MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / luaS_newlstr

Function luaS_newlstr

Dependencies/lua/src/lstring.c:222–233  ·  view source on GitHub ↗

** new string (with explicit length) */

Source from the content-addressed store, hash-verified

220** new string (with explicit length)
221*/
222TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
223 if (l <= LUAI_MAXSHORTLEN) /* short string? */
224 return internshrstr(L, str, l);
225 else {
226 TString *ts;
227 if (l_unlikely(l * sizeof(char) >= (MAX_SIZE - sizeof(TString))))
228 luaM_toobig(L);
229 ts = luaS_createlngstrobj(L, l);
230 memcpy(getlngstr(ts), str, l * sizeof(char));
231 return ts;
232 }
233}
234
235
236/*

Callers 8

luaV_concatFunction · 0.85
luaX_newstringFunction · 0.85
luaO_tostringFunction · 0.85
pushstrFunction · 0.85
loadStringNFunction · 0.85
lua_pushlstringFunction · 0.85
lua_concatFunction · 0.85
luaS_newFunction · 0.85

Calls 3

internshrstrFunction · 0.85
luaM_toobigFunction · 0.85
luaS_createlngstrobjFunction · 0.85

Tested by

no test coverage detected