MCPcopy Create free account
hub / github.com/crownengine/crown / lua_tolstring

Function lua_tolstring

3rdparty/luajit/src/lj_api.c:504–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

502}
503
504LUA_API const char *lua_tolstring(lua_State *L, int idx, size_t *len)
505{
506 TValue *o = index2adr(L, idx);
507 GCstr *s;
508 if (LJ_LIKELY(tvisstr(o))) {
509 s = strV(o);
510 } else if (tvisnumber(o)) {
511 lj_gc_check(L);
512 o = index2adr(L, idx); /* GC may move the stack. */
513 s = lj_strfmt_number(L, o);
514 setstrV(L, o, s);
515 } else {
516 if (len != NULL) *len = 0;
517 return NULL;
518 }
519 if (len != NULL) *len = s->len;
520 return strdata(s);
521}
522
523LUALIB_API const char *luaL_checklstring(lua_State *L, int idx, size_t *len)
524{

Callers 6

add_sFunction · 0.70
reader_funcFunction · 0.70
lib_base.cFile · 0.70
luaL_checkoptionFunction · 0.70
incompleteFunction · 0.70
luaL_addvalueFunction · 0.70

Calls 1

index2adrFunction · 0.70

Tested by

no test coverage detected