Closed Memorix101 closed 8 years ago
Are you running test.lua before register a function?
void print_text(const char* msg)
{
//printf("%s", msg.c_str());
std::cout << "kaguya rocks ! " << msg << std::endl;
}
kaguya::State state;
state["print_text"] = &print_text;
state.dofile("test.lua");
Ahhh, that's it.
Sure, then it can't work.
Thank you ^-^
Your welcome.
Hey :)
I can't call the C++ function in Lua I just registered :(
I always get "test.lua:7: attempt to call a nil value (global 'print_text')"
but calling
state["print_text"]("meep");
works :PIn my lua script it's just
print_text("hello world\n)