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

Function isarray

Plugins/UnLuaExtensions/LuaRapidjson/Source/src/values.hpp:48–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 }
47
48 inline bool isarray(lua_State* L, int idx, bool empty_table_as_array = false) {
49 bool arr = false;
50 if (hasJsonType(L, idx, arr)) // any table with a meta field __jsontype set to 'array' are arrays
51 return arr;
52
53 idx = luax::absindex(L, idx);
54 lua_pushnil(L);
55 if (lua_next(L, idx) != 0) {
56 lua_pop(L, 2);
57
58 return luax::rawlen(L, idx) > 0; // any non empty table has length > 0 are treat as array.
59 }
60
61 // Now it comes empty table
62 return empty_table_as_array;
63 }
64
65
66

Callers 2

TableValueFunction · 0.85
encodeTableMethod · 0.85

Calls 5

hasJsonTypeFunction · 0.85
absindexFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
rawlenFunction · 0.85

Tested by

no test coverage detected