diff options
author | ShadowNinja <shadowninja@minetest.net> | 2014-10-02 15:58:13 -0400 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2014-10-07 16:37:45 -0400 |
commit | 741df993ff33832d773536ed571c1a67ed93b5cb (patch) | |
tree | 1e6e3379873ce00df92a1c53d1e403e767b21a32 /src/script/cpp_api/s_item.cpp | |
parent | 28438bba27168289be59a26d3ae55e3f3658d8d3 (diff) | |
download | minetest-741df993ff33832d773536ed571c1a67ed93b5cb.tar.gz minetest-741df993ff33832d773536ed571c1a67ed93b5cb.tar.bz2 minetest-741df993ff33832d773536ed571c1a67ed93b5cb.zip |
Fix object reference pushing functions when called from coroutines
Diffstat (limited to 'src/script/cpp_api/s_item.cpp')
-rw-r--r-- | src/script/cpp_api/s_item.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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<ItemStack> 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<ItemStack> 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 |