/* In-place coercion of a number to a string. */ static LJ_AINLINE int tostring(lua_State *L, TValue *o) { if (tvisstr(o)) { return 1; } else if (tvisnumber(o)) { setstrV(L, o, lj_str_fromnumber(L, o)); return 1; } else { return 0; } }
GCstr *lj_lib_checkstr(lua_State *L, int narg) { TValue *o = L->base + narg-1; if (o < L->top) { if (LJ_LIKELY(tvisstr(o))) { return strV(o); } else if (tvisnumber(o)) { GCstr *s = lj_str_fromnumber(L, o); setstrV(L, o, s); return s; } } lj_err_argt(L, narg, LUA_TSTRING); return NULL; /* unreachable */ }