MCPcopy Create free account
hub / github.com/defold/defold / arrayindex

Function arrayindex

engine/lua/src/lua/ltable.c:120–129  ·  view source on GitHub ↗

** returns the index for `key' if `key' is an appropriate key to live in ** the array part of the table, -1 otherwise. */

Source from the content-addressed store, hash-verified

118** the array part of the table, -1 otherwise.
119*/
120static int arrayindex (const TValue *key) {
121 if (ttisnumber(key)) {
122 lua_Number n = nvalue(key);
123 int k;
124 lua_number2int(k, n);
125 if (luai_numeq(cast_num(k), n))
126 return k;
127 }
128 return -1; /* `key' did not match some condition */
129}
130
131
132/*

Callers 2

findindexFunction · 0.85
countintFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected