From d577a98980b81d843b8600b79bb833db6ab8e08f Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Sun, 17 Mar 2024 01:52:02 +1100 Subject: Lua: allow jarray and jobject to convert existing tables [skip ci] --- source/core/StarLua.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source/core/StarLua.hpp') diff --git a/source/core/StarLua.hpp b/source/core/StarLua.hpp index 84fc256..2fe275d 100644 --- a/source/core/StarLua.hpp +++ b/source/core/StarLua.hpp @@ -1467,6 +1467,8 @@ namespace LuaDetail { // index. void shallowCopy(lua_State* state, int sourceIndex, int targetIndex); + LuaTable insertJsonMetatable(LuaEngine& engine, LuaTable const& table, Json::Type type); + // Creates a custom lua table from a JsonArray or JsonObject that has // slightly different behavior than a standard lua table. The table // remembers nil entries, as well as whether it was initially constructed @@ -1489,10 +1491,14 @@ namespace LuaDetail { // Create a JsonList container table Json jarrayCreate(); - // Create a JsonMap container table Json jobjectCreate(); + // Adds the Json array metatable to a Lua table or creates one. + LuaTable jarray(LuaEngine& engine, Maybe table); + // Adds the Json object metatable to a Lua table or creates one. + LuaTable jobject(LuaEngine& engine, Maybe table); + // *Really* remove an entry from a JsonList or JsonMap container table, // including removing it from the __nils table. If the given table is not a // special container table, is equivalent to setting the key entry to nil. -- cgit v1.2.3