lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Thanks for responding. The example provided by you works. But the
function in the Lua bytecode cannot be found by LuaVM.  So, somehow
the function in the bytecode cannot be invoked ....

In the lua script, there is a chunk of code as

function lua_onInit

// scripting language


The bytecode was generated using luac.  I will be working more on
Monday and will write to you with additional details.

On 1/7/10, Graham Wakefield <> wrote:
> 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