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

Function luaS_newlstr

extlibs/lua/src/lstring.c:233–244  ·  view source on GitHub ↗

** new string (with explicit length) */

Source from the content-addressed store, hash-verified

231** new string (with explicit length)
232*/
233TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
234 if (l <= LUAI_MAXSHORTLEN) /* short string? */
235 return internshrstr(L, str, l);
236 else {
237 TString *ts;
238 if (unlikely(l >= (MAX_SIZE - sizeof(TString))/sizeof(char)))
239 luaM_toobig(L);
240 ts = luaS_createlngstrobj(L, l);
241 memcpy(getstr(ts), str, l * sizeof(char));
242 return ts;
243 }
244}
245
246
247/*

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