MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / luaS_newlstr

Function luaS_newlstr

xrepo/packages/l/lua/port/lua/src/lstring.c:221–232  ·  view source on GitHub ↗

** new string (with explicit length) */

Source from the content-addressed store, hash-verified

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

Callers 8

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

Calls 4

internshrstrFunction · 0.85
luaS_createlngstrobjFunction · 0.85
memcpyFunction · 0.85
luaM_toobigFunction · 0.70

Tested by

no test coverage detected