From 741df993ff33832d773536ed571c1a67ed93b5cb Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Thu, 2 Oct 2014 15:58:13 -0400 Subject: Fix object reference pushing functions when called from coroutines --- src/script/cpp_api/s_item.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/script/cpp_api/s_item.cpp') diff --git a/src/script/cpp_api/s_item.cpp b/src/script/cpp_api/s_item.cpp index ab82b6b47..e3a9ac7aa 100644 --- a/src/script/cpp_api/s_item.cpp +++ b/src/script/cpp_api/s_item.cpp @@ -40,7 +40,7 @@ bool ScriptApiItem::item_OnDrop(ItemStack &item, // Call function LuaItemStack::create(L, item); - objectrefGetOrCreate(dropper); + objectrefGetOrCreate(L, dropper); pushFloatPos(L, pos); if (lua_pcall(L, 3, 1, m_errorhandler)) scriptError(); @@ -66,7 +66,7 @@ bool ScriptApiItem::item_OnPlace(ItemStack &item, // Call function LuaItemStack::create(L, item); - objectrefGetOrCreate(placer); + objectrefGetOrCreate(L, placer); pushPointedThing(pointed); if (lua_pcall(L, 3, 1, m_errorhandler)) scriptError(); @@ -92,7 +92,7 @@ bool ScriptApiItem::item_OnUse(ItemStack &item, // Call function LuaItemStack::create(L, item); - objectrefGetOrCreate(user); + objectrefGetOrCreate(L, user); pushPointedThing(pointed); if (lua_pcall(L, 3, 1, m_errorhandler)) scriptError(); @@ -115,7 +115,7 @@ bool ScriptApiItem::item_OnCraft(ItemStack &item, ServerActiveObject *user, lua_getglobal(L, "core"); lua_getfield(L, -1, "on_craft"); LuaItemStack::create(L, item); - objectrefGetOrCreate(user); + objectrefGetOrCreate(L, user); // Push inventory list std::vector items; @@ -146,7 +146,7 @@ bool ScriptApiItem::item_CraftPredict(ItemStack &item, ServerActiveObject *user, lua_getglobal(L, "core"); lua_getfield(L, -1, "craft_predict"); LuaItemStack::create(L, item); - objectrefGetOrCreate(user); + objectrefGetOrCreate(L, user); //Push inventory list std::vector items; @@ -229,7 +229,7 @@ void ScriptApiItem::pushPointedThing(const PointedThing& pointed) { lua_pushstring(L, "object"); lua_setfield(L, -2, "type"); - objectrefGet(pointed.object_id); + objectrefGet(L, pointed.object_id); lua_setfield(L, -2, "ref"); } else -- cgit v1.2.3