[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: calling a lua function from c
- From: Mike Atamas <aelfgar@...>
- Date: Fri, 12 Sep 2003 23:00:03 -0400
Hello,
I have been struggling with the following problem. I ran a file with lua_dofile. Inside that file there is a function,
function start()
print("test");
end
I attempt to call it from C++ with the following code, which I got straight from the reference.
lua_pushstring( lstate , "start" );
lua_gettable( lstate , LUA_GLOBALSINDEX );
lua_call( lstate , 0, 0 );
Whenever I run the program it crashes when it gets to this point. I tried running it through gdb and it told me
Program received signal SIGSEGV, Segmentation fault.
0x0805355e in newlstr ()
I am curious what the problem could be.
Thanks in advance
Mike Atamas
hazuzu@aelfgar.com