MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaS_newlstr

Function luaS_newlstr

third-party/lua-5.3.5/src/lstring.c:199–210  ·  view source on GitHub ↗

** new string (with explicit length) */

Source from the content-addressed store, hash-verified

197** new string (with explicit length)
198*/
199TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
200 if (l <= LUAI_MAXSHORTLEN) /* short string? */
201 return internshrstr(L, str, l);
202 else {
203 TString *ts;
204 if (l >= (MAX_SIZE - sizeof(TString))/sizeof(char))
205 luaM_toobig(L);
206 ts = luaS_createlngstrobj(L, l);
207 memcpy(getstr(ts), str, l * sizeof(char));
208 return ts;
209 }
210}
211
212
213/*

Callers 8

luaV_concatFunction · 0.70
luaX_newstringFunction · 0.70
luaO_tostringFunction · 0.70
pushstrFunction · 0.70
LoadStringFunction · 0.70
lua_pushlstringFunction · 0.70
lua_concatFunction · 0.70
luaS_newFunction · 0.70

Calls 3

internshrstrFunction · 0.70
luaM_toobigFunction · 0.70
luaS_createlngstrobjFunction · 0.70

Tested by

no test coverage detected