diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-03-17 01:52:02 +1100 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-03-17 01:52:02 +1100 |
commit | d577a98980b81d843b8600b79bb833db6ab8e08f (patch) | |
tree | 71e10cf6639a940acc8bf83a770a731bbbba2cb6 /source/core/StarLua.hpp | |
parent | 8f8741bcb2f164f5d947cc4557806a6b72e50835 (diff) |
Lua: allow jarray and jobject to convert existing tables
[skip ci]
Diffstat (limited to 'source/core/StarLua.hpp')
-rw-r--r-- | source/core/StarLua.hpp | 8 |
1 files changed, 7 insertions, 1 deletions
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<LuaTable> table); + // Adds the Json object metatable to a Lua table or creates one. + LuaTable jobject(LuaEngine& engine, Maybe<LuaTable> 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. |