1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix object reference pushing functions when called from coroutines

This commit is contained in:
ShadowNinja 2014-10-02 15:58:13 -04:00
parent 28438bba27
commit 741df993ff
10 changed files with 42 additions and 45 deletions

View file

@ -53,7 +53,7 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowMove(v3s16 p,
lua_pushstring(L, to_list.c_str()); // to_list
lua_pushinteger(L, to_index + 1); // to_index
lua_pushinteger(L, count); // count
objectrefGetOrCreate(player); // player
objectrefGetOrCreate(L, player); // player
if (lua_pcall(L, 7, 1, m_errorhandler))
scriptError();
if (!lua_isnumber(L, -1))
@ -88,7 +88,7 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowPut(v3s16 p,
lua_pushstring(L, listname.c_str()); // listname
lua_pushinteger(L, index + 1); // index
LuaItemStack::create(L, stack); // stack
objectrefGetOrCreate(player); // player
objectrefGetOrCreate(L, player); // player
if (lua_pcall(L, 5, 1, m_errorhandler))
scriptError();
if(!lua_isnumber(L, -1))
@ -123,7 +123,7 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowTake(v3s16 p,
lua_pushstring(L, listname.c_str()); // listname
lua_pushinteger(L, index + 1); // index
LuaItemStack::create(L, stack); // stack
objectrefGetOrCreate(player); // player
objectrefGetOrCreate(L, player); // player
if (lua_pcall(L, 5, 1, m_errorhandler))
scriptError();
if (!lua_isnumber(L, -1))
@ -161,7 +161,7 @@ void ScriptApiNodemeta::nodemeta_inventory_OnMove(v3s16 p,
lua_pushstring(L, to_list.c_str()); // to_list
lua_pushinteger(L, to_index + 1); // to_index
lua_pushinteger(L, count); // count
objectrefGetOrCreate(player); // player
objectrefGetOrCreate(L, player); // player
if (lua_pcall(L, 7, 0, m_errorhandler))
scriptError();
}
@ -190,7 +190,7 @@ void ScriptApiNodemeta::nodemeta_inventory_OnPut(v3s16 p,
lua_pushstring(L, listname.c_str()); // listname
lua_pushinteger(L, index + 1); // index
LuaItemStack::create(L, stack); // stack
objectrefGetOrCreate(player); // player
objectrefGetOrCreate(L, player); // player
if (lua_pcall(L, 5, 0, m_errorhandler))
scriptError();
}
@ -219,7 +219,7 @@ void ScriptApiNodemeta::nodemeta_inventory_OnTake(v3s16 p,
lua_pushstring(L, listname.c_str()); // listname
lua_pushinteger(L, index + 1); // index
LuaItemStack::create(L, stack); // stack
objectrefGetOrCreate(player); // player
objectrefGetOrCreate(L, player); // player
if (lua_pcall(L, 5, 0, m_errorhandler))
scriptError();
}