summaryrefslogtreecommitdiff
path: root/src/script/common/c_content.cpp
diff options
context:
space:
mode:
authorred-001 <red-001@outlook.ie>2017-05-20 15:45:49 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-05-20 16:45:49 +0200
commit772944daf69ab463568fbbf35a9011e4c8e6c44a (patch)
tree9cac5a5ed6523a07f11980b497642fd78b26453c /src/script/common/c_content.cpp
parent7e185068c4f9fb3253006a8d8a2aceea3f8000a1 (diff)
downloadminetest-772944daf69ab463568fbbf35a9011e4c8e6c44a.tar.gz
minetest-772944daf69ab463568fbbf35a9011e4c8e6c44a.tar.bz2
minetest-772944daf69ab463568fbbf35a9011e4c8e6c44a.zip
Fix CSM crash (#5779)
Caused by dc5bc6c and them made worse by 5ebf8f9
Diffstat (limited to 'src/script/common/c_content.cpp')
-rw-r--r--src/script/common/c_content.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index 8696ad7cb..7eb1d094b 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -1441,7 +1441,7 @@ void read_json_value(lua_State *L, Json::Value &root, int index, u8 recursion)
lua_pop(L, 1); // Pop value
}
-void push_pointed_thing(lua_State *L, const PointedThing &pointed)
+void push_pointed_thing(lua_State *L, const PointedThing &pointed, bool csm)
{
lua_newtable(L);
if (pointed.type == POINTEDTHING_NODE) {
@@ -1454,8 +1454,14 @@ void push_pointed_thing(lua_State *L, const PointedThing &pointed)
} else if (pointed.type == POINTEDTHING_OBJECT) {
lua_pushstring(L, "object");
lua_setfield(L, -2, "type");
- push_objectRef(L, pointed.object_id);
- lua_setfield(L, -2, "ref");
+
+ if (csm) {
+ lua_pushinteger(L, pointed.object_id);
+ lua_setfield(L, -2, "id");
+ } else {
+ push_objectRef(L, pointed.object_id);
+ lua_setfield(L, -2, "ref");
+ }
} else {
lua_pushstring(L, "nothing");
lua_setfield(L, -2, "type");