MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / arrayLen

Function arrayLen

pj_scripting/src/luau_engine.cpp:128–139  ·  view source on GitHub ↗

Length of the array part of the table at `idx` (counts 1..n until the first nil). Avoids depending on lua_objlen's exact spelling across Luau versions.

Source from the content-addressed store, hash-verified

126// Length of the array part of the table at `idx` (counts 1..n until the first
127// nil). Avoids depending on lua_objlen's exact spelling across Luau versions.
128int arrayLen(lua_State* L, int idx) {
129 int n = 0;
130 while (true) {
131 lua_rawgeti(L, idx, n + 1);
132 const bool is_nil = lua_isnil(L, -1);
133 lua_pop(L, 1);
134 if (is_nil) {
135 return n;
136 }
137 ++n;
138 }
139}
140
141std::string stringField(lua_State* L, int table_idx, const char* key, const std::string& fallback = "") {
142 lua_rawgetfield(L, table_idx, key);

Callers 4

readEnumValuesFunction · 0.85
readParametersFunction · 0.85
inspectModuleMethod · 0.85
createInstanceMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected