MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / lua_objlen

Function lua_objlen

lua/lapi.c:368–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 9

luaL_getnFunction · 0.85
luaL_refFunction · 0.85
create_temp_tableFunction · 0.85
luabb_carray_bind_realFunction · 0.85
luabb_carray_bind_stringFunction · 0.85
luabb_carray_bind_blobFunction · 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