lua-users home
lua-l archive

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


Hi,	

If I run main.lua from the command line init is executed without
complaints. Running the (compiled and linked) c file generates the error:
lua error: call expression not a function
Error in lua_callfunction. Error is 1.

This is my C code:
main()
{
lua_open();
if ((err = lua_dofile("main.lua")) != 0) then
{
  printf("Failed to execute lua_dofile. Err = %d\n",err);
  exit(-1);
}
if ((err = lua_callfunction(lua_getglobal("init"))) != 0)
{
  printf("Failed to call init. Err = %d\n",err);
  exit(-1);
}
}

main.lua contains the following:
function init()
  writeto("temp")
  write("init was executed.")
  writeto()
end

If I run main.lua from the command line init is executed without complaints.

Running the (compiled and linked) c file generates the error:
lua error: call expression not a function
Error in lua_callfunction. Error is 1.

Any ideas?

TIA,

Elan