Advertisement

LUABind: Calling Lua Functions

Started by July 23, 2004 06:48 AM
-1 comments, last by luridcortex 20 years, 4 months ago
I dont quite understand how to do this, and havent been able to get it to work even with the simplest of functions. Ive read the tiny section of the manual that goes over it several times too, so maybe one of you guys can help! I define a simple function in lua function printString ( ) print ( "string" ) end Then in c++ using luabind i try to call it like so: call_function< void >( mState, "printString" ) The program crashed when i try and call the function. Now a few more questions as well, in the template brackets you supply the return value, in this case void? Second, if the function took parameters how would i pass them, just after "printString"? And lastly, you would have to load the script before you can call the function.. im thinking this is obvious, but just want to make sure. thanks, -gf

This topic is closed to new replies.

Advertisement