Exception with LuaFunction

Added by Miklos Nyers over 1 year ago

Hi there!

I'm using VS2008 Express with LuaPlus_1100.dll and trying to execute some Lua functions from C++:

LuaStateOwner state(true);
state->DoString( "function Add(x, y) return x + y end" );

LuaCall call = state->GetGlobal("Add");
LuaObject retObj = call << 2 << 7 << LuaRun();
cout << "Add(2, 7): " << retObj.GetInteger() << endl;

LuaFunction<float> Add = state->GetGlobal("Add");
cout << Add(2, 7) << endl;

The second method gives me an unhandled exception, any help would be appreciated, thanks!