[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Cannot call Lua function from C code
- From: Graham Wakefield <wakefield@...>
- Date: Wed, 6 Jan 2010 19:03:43 -0800
Er, please send additional code?
Kind of hard to know what FAILING means, what func is, what global
functions are defined in the script, etc.
what happens for you with this, for example:
lua_getglobal(luaState, "print");
if (lua_isfunction(L, -1)) {
printf("found print\n");
}
On Jan 6, 2010, at 7:33 AM, Sudhindra Murthy wrote:
I have a chunk of C code that is loading the Lua bytecode (generated
using luac). The C code invokes a Lua function. But the Lua VM is
not able to find the function.
Used the luac to generate the listing to check if the symbol
(function) is present in the bytecode and it sure was.
Anyone has an idea? Call flow in C code as below
lua_open()
// Open Lua standard libraries - basic, table, string , etc
// Load App SDK - push C functions
luaL_loadbuffer -- to load bytecode
lua_pcall
All the above calls are successful.
lua_getglobal(luaState, func);
lua_isfunction(luaState,-1) ---> THIS IS FAILING
Please let me know for additional info.
Thanks,
Sudhi