MCPcopy Create free account
hub / github.com/Tencent/UnLua / ObjectValue

Function ObjectValue

Plugins/UnLuaExtensions/LuaRapidjson/Source/src/values.cpp:68–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66 }
67
68 Value ObjectValue(lua_State* L, int idx, int depth, Allocator& allocator)
69 {
70 Value object(rapidjson::kObjectType);
71 idx = luax::absindex(L, idx);
72 lua_pushnil(L); // [nil]
73 while (lua_next(L, idx))
74 {
75 // [key, value]
76 if (lua_type(L, -2) == LUA_TSTRING)
77 {
78 object.AddMember(StringValue(L, -2, allocator), toValue(L, -1, depth, allocator), allocator);
79 }
80
81 // pop value, leaving original key
82 lua_pop(L, 1);
83 // [key]
84 }
85 // []
86
87 return object;
88 }
89
90 Value ArrayValue(lua_State* L, int idx, int depth, Allocator& allocator)
91 {

Callers 1

TableValueFunction · 0.85

Calls 7

absindexFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
lua_typeFunction · 0.85
StringValueFunction · 0.85
AddMemberMethod · 0.80
toValueFunction · 0.70

Tested by

no test coverage detected