MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / pushstr

Function pushstr

lib/lua/src/lobject.c:414–422  ·  view source on GitHub ↗

** Push given string to the stack, as part of the result, and ** join it to previous partial result if there is one. ** It may call 'luaV_concat' while using one slot from EXTRA_STACK. ** This call cannot invoke metamethods, as both operands must be ** strings. It can, however, raise an error if the result is too ** long. In that case, 'luaV_concat' frees the extra slot before ** raising the error

Source from the content-addressed store, hash-verified

412** raising the error.
413*/
414static void pushstr (BuffFS *buff, const char *str, size_t lstr) {
415 lua_State *L = buff->L;
416 setsvalue2s(L, L->top.p, luaS_newlstr(L, str, lstr));
417 L->top.p++; /* may use one slot from EXTRA_STACK */
418 if (!buff->pushed) /* no previous string on the stack? */
419 buff->pushed = 1; /* now there is one */
420 else /* join previous string with new one */
421 luaV_concat(L, 2);
422}
423
424
425/*

Callers 2

clearbuffFunction · 0.85
addstr2buffFunction · 0.85

Calls 2

luaS_newlstrFunction · 0.85
luaV_concatFunction · 0.85

Tested by

no test coverage detected