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

Function lua_tolstring

deps/lua/src/lapi.c:343–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341
342
343LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {
344 StkId o = index2adr(L, idx);
345 if (!ttisstring(o)) {
346 lua_lock(L); /* `luaV_tostring' may create a new string */
347 if (!luaV_tostring(L, o)) { /* conversion failed? */
348 if (len != NULL) *len = 0;
349 lua_unlock(L);
350 return NULL;
351 }
352 luaC_checkGC(L);
353 o = index2adr(L, idx); /* previous call may reallocate the stack */
354 lua_unlock(L);
355 }
356 if (len != NULL) *len = tsvalue(o)->len;
357 return svalue(o);
358}
359
360
361LUA_API size_t lua_objlen (lua_State *L, int idx) {

Callers 12

luaRedisGenericCommandFunction · 0.85
luaRedisSha1hexCommandFunction · 0.85
luaLogCommandFunction · 0.85
ldbCatStackValueRecFunction · 0.85
incompleteFunction · 0.85
generic_readerFunction · 0.85
gmatch_auxFunction · 0.85
add_sFunction · 0.85
luaL_checklstringFunction · 0.85
luaL_addvalueFunction · 0.85
json_append_stringFunction · 0.85
mp_encode_lua_stringFunction · 0.85

Calls 2

index2adrFunction · 0.85
luaV_tostringFunction · 0.85

Tested by

no test coverage detected