So I tried to use LuaBind for my project, I’ve read the tutorial on using it, and I kinda got it, so I made a .cpp file for my project, the code:
[code]#include “GDCpp/RuntimeScene.h”
#include “TextObject/TextObject.h”
#include
#include
extern “C” {
#include “lua.h”
#include “lualib.h”
#include "lauxlib.h
}
#include <luabind/luabind/luabind.hpp>
void test(RuntimeScene & scene, float r, float g, float b)
{
scene.SetBackgroundColor(r, g, b);
}
int initialize_lua()
{
lua_State *LS = lua_newstate();
luabind::open(LS);
luabind::module(LS) [
luabind::def("test", test)
];
luaL_dofile(LS, "testfunc.lua")
lua_close(LS)
}
initialize_lua()[/code]
But it doesn’t work, there’s no errors that happened, it simply doesn’t work it was supposed to connect the C++ function “test” to Lua and then call the Lua file called testfunc.lua and in the testfunc.lua contains:
test(scene, 250, 1, 1)
I’ve picked Lua as the scripting language for my project as it’s an interpreted language, so I don’t need to compile/re-compile a Lua code everytime. But I don’t get it on why it doesn’t work. Help please…
//////EDIT\\
I didn’t save the .cpp file correctly, maybe that’s why it won’t work, but now I’ve made a .cpp and a .h file and now I’m getting a few errors, I forgot to download Boost C++ Library, gonna download it first then see what happens…