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

Function lua_tolstring

lua/lapi.c:344–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 7

incompleteFunction · 0.85
generic_readerFunction · 0.85
gmatch_auxFunction · 0.85
add_sFunction · 0.85
luaL_checklstringFunction · 0.85
luaL_addvalueFunction · 0.85
sp_column_ptrFunction · 0.85

Calls 4

index2adrFunction · 0.85
luabb_iscstringFunction · 0.85
luabb_tocstringFunction · 0.85
luaV_tostringFunction · 0.85

Tested by

no test coverage detected