mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
parent
7e185068c4
commit
772944daf6
4 changed files with 13 additions and 7 deletions
|
@ -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");
|
||||
|
|
|
@ -164,7 +164,7 @@ bool push_json_value (lua_State *L,
|
|||
void read_json_value (lua_State *L, Json::Value &root,
|
||||
int index, u8 recursion = 0);
|
||||
|
||||
void push_pointed_thing (lua_State *L, const PointedThing &pointed);
|
||||
void push_pointed_thing (lua_State *L, const PointedThing &pointed, bool csm = false);
|
||||
|
||||
void push_objectRef (lua_State *L, const u16 id);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue