Hi I am trying to push variables from Lua to a C function, how would I do that? I have generated a C++ object on Lua side but want to send a number to that the objects function. But I get: Error when loading script with following string:
player.lua:2: attempt to index a function value (local 'myPlayer')
player.lua
local myPlayer = Player.new(69)
myPlayer.testing(myPlayer, 24069)
player.cpp
int player_test_pos(lua_State* L)
{
player* myPlayer = l_CheckPlayer(L, 1);
myPlayer->setPos({ 10, 0, 30 });
int ok = lua_istable(L, 1);
std::cout << ok << std::endl;
ok = lua_isnumber(L, 2);
std::cout << ok << std::endl;
return 0;
}