MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / lua_objlen

Function lua_objlen

deps/lua/src/lapi.c:361–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359
360
361LUA_API size_t lua_objlen (lua_State *L, int idx) {
362 StkId o = index2adr(L, idx);
363 switch (ttype(o)) {
364 case LUA_TSTRING: return tsvalue(o)->len;
365 case LUA_TUSERDATA: return uvalue(o)->len;
366 case LUA_TTABLE: return luaH_getn(hvalue(o));
367 case LUA_TNUMBER: {
368 size_t l;
369 lua_lock(L); /* `luaV_tostring' may create a new string */
370 l = (luaV_tostring(L, o) ? tsvalue(o)->len : 0);
371 lua_unlock(L);
372 return l;
373 }
374 default: return 0;
375 }
376}
377
378
379LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {

Callers 5

luaL_getnFunction · 0.85
luaL_refFunction · 0.85
read_lineFunction · 0.85
read_charsFunction · 0.85

Calls 3

index2adrFunction · 0.85
luaH_getnFunction · 0.85
luaV_tostringFunction · 0.85

Tested by

no test coverage detected