MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / luaS_newlstr

Function luaS_newlstr

libraries/AP_Scripting/lua/src/lstring.c:204–215  ·  view source on GitHub ↗

** new string (with explicit length) */

Source from the content-addressed store, hash-verified

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

Callers 8

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

Calls 4

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

Tested by

no test coverage detected