summaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_base.cpp
diff options
context:
space:
mode:
authorVincent Glize <vincentglize@hotmail.fr>2017-04-29 12:08:16 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-04-29 12:08:16 +0200
commitdc5bc6cac7b81ab27e0064bc25b5fd1d8d617340 (patch)
tree5b7be08157b8c377dfd10152c04d44687e9b1c81 /src/script/cpp_api/s_base.cpp
parentecf08255b0b6b9d15b86f614942ac8f53f41302a (diff)
downloadminetest-dc5bc6cac7b81ab27e0064bc25b5fd1d8d617340.tar.gz
minetest-dc5bc6cac7b81ab27e0064bc25b5fd1d8d617340.tar.bz2
minetest-dc5bc6cac7b81ab27e0064bc25b5fd1d8d617340.zip
[CSM] Add event on_place_node API lua (#5548)
* [CSM] Add event on_place_node API lua
Diffstat (limited to 'src/script/cpp_api/s_base.cpp')
-rw-r--r--src/script/cpp_api/s_base.cpp15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/script/cpp_api/s_base.cpp b/src/script/cpp_api/s_base.cpp
index 6a843810f..e72af22c6 100644
--- a/src/script/cpp_api/s_base.cpp
+++ b/src/script/cpp_api/s_base.cpp
@@ -42,6 +42,7 @@ extern "C" {
#include <stdio.h>
#include <cstdarg>
+#include "script/common/c_content.h"
#include <sstream>
@@ -320,22 +321,10 @@ void ScriptApiBase::objectrefGetOrCreate(lua_State *L,
if (cobj == NULL || cobj->getId() == 0) {
ObjectRef::create(L, cobj);
} else {
- objectrefGet(L, cobj->getId());
+ push_objectRef(L, cobj->getId());
}
}
-void ScriptApiBase::objectrefGet(lua_State *L, u16 id)
-{
- // Get core.object_refs[i]
- lua_getglobal(L, "core");
- lua_getfield(L, -1, "object_refs");
- luaL_checktype(L, -1, LUA_TTABLE);
- lua_pushnumber(L, id);
- lua_gettable(L, -2);
- lua_remove(L, -2); // object_refs
- lua_remove(L, -2); // core
-}
-
Server* ScriptApiBase::getServer()
{
return dynamic_cast<Server *>(m_gamedef);