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_entity.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_entity.cpp')
-rw-r--r-- | src/script/cpp_api/s_entity.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/script/cpp_api/s_entity.cpp b/src/script/cpp_api/s_entity.cpp index ab8c6ee95..b52bde18a 100644 --- a/src/script/cpp_api/s_entity.cpp +++ b/src/script/cpp_api/s_entity.cpp @@ -56,7 +56,7 @@ bool ScriptApiEntity::luaentity_Add(u16 id, const char *name) // Add object reference // This should be userdata with metatable ObjectRef - objectrefGet(id); + objectrefGet(L, id); luaL_checktype(L, -1, LUA_TUSERDATA); if (!luaL_checkudata(L, -1, "ObjectRef")) luaL_typerror(L, -1, "ObjectRef"); @@ -236,8 +236,8 @@ void ScriptApiEntity::luaentity_Punch(u16 id, return; } luaL_checktype(L, -1, LUA_TFUNCTION); - lua_pushvalue(L, object); // self - objectrefGetOrCreate(puncher); // Clicker reference + lua_pushvalue(L, object); // self + objectrefGetOrCreate(L, puncher); // Clicker reference lua_pushnumber(L, time_from_last_punch); push_tool_capabilities(L, *toolcap); push_v3f(L, dir); @@ -267,7 +267,7 @@ void ScriptApiEntity::luaentity_Rightclick(u16 id, } luaL_checktype(L, -1, LUA_TFUNCTION); lua_pushvalue(L, object); // self - objectrefGetOrCreate(clicker); // Clicker reference + objectrefGetOrCreate(L, clicker); // Clicker reference // Call with 2 arguments, 0 results if (lua_pcall(L, 2, 0, m_errorhandler)) scriptError(); |