I have strange problem, with calling Lua function from C++. I have in Lua:
Player =
{
Number = 0.43,
Text = "SomeText",
}
function Player:Func(a, b)
return (a * b);
end
Before lua_pcall my stack looks:
table
function
3
4
I call this function with:
lua_pcall(L, 2, 1, 0)
我从Lua那里得到错误:
尝试对当地b(无价值)进行算术
当我改变卢阿的脚本
return (a * b);
至
return a;
There is no error, but from lua_至number(L, -1); I get value 4 (my second argument in C:/), so it looks that my second argument in C is first in Lua.
Do you know what I made wrong in my code ?
How I construct stack:
lua_getglobal (L, "Player");
lua_pushstring(L, "Func");
lua_gettable(L, -2);
lua_pushnumber(L, 3.0);
lua_pushnumber(L, 4.0);