MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / lua_objlen

Function lua_objlen

other_src/lua/src/lapi.cpp:383–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381
382
383LUA_API size_t lua_objlen (lua_State *L, int idx) {
384 StkId o = index2adr(L, idx);
385 switch (ttype(o)) {
386 case LUA_TSTRING: return tsvalue(o)->len;
387 case LUA_TUSERDATA: return uvalue(o)->len;
388 case LUA_TTABLE: return luaH_getn(hvalue(o));
389 case LUA_TNUMBER: {
390 size_t l;
391 lua_lock(L); /* `luaV_tostring' may create a new string */
392 l = (luaV_tostring(L, o) ? tsvalue(o)->len : 0);
393 lua_unlock(L);
394 return l;
395 }
396 default: return 0;
397 }
398}
399
400
401LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {

Callers 7

ktablelenFunction · 0.70
read_lineFunction · 0.70
read_charsFunction · 0.70
luaL_getnFunction · 0.70
luaL_refFunction · 0.70
GetLengthMethod · 0.50
AddCallInErrorFunction · 0.50

Calls 3

index2adrFunction · 0.70
luaH_getnFunction · 0.70
luaV_tostringFunction · 0.70

Tested by

no test coverage detected