Disclaimer: It's getting a bit late so maybe I'm missing something obvious
I've been trying to figure out the Interpreter class and how to create custom lua functions, and it's going well quite apart from not being able to identify a register function on the interpreter class - so I cheated a bit there.
static int addTwo(lua_State *L){
int argc=Interpreter::GetStackSize(); // equiv to lua_gettop(Interpreter::L) ?
int i,t;
for (i = 1; i <= argc; i++){
t=Interpreter::ToNumber(i);
std::cout << "[C++]addTwo(" << t << ")=" << (t+2) << std::endl;
Interpreter::PushFloat(t+2);
}
return i-1;
}
and in App::Start()
lua_register(Interpreter::L,"addTwo",addTwo);
In the fps player controller i added this
a,b,c=addTwo(1,2,3)
System:Print(a)
System:Print(B)
System:Print(c)
to the pickup code rigth after "mass = pickInfo.entity:GetMass()" to make sure I can trigger it when ever I want.
Now the strange bit is this works perfectly in Code::blocks - but by when I run it in the LE editor it instantly crashed when I try to pick something up.
I've tried toggling sandbox to no avail