MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaL_addvalue

Function luaL_addvalue

third-party/lua-5.4.6/src/lauxlib.c:622–630  ·  view source on GitHub ↗

** 'luaL_addvalue' is the only function in the Buffer system where the ** box (if existent) is not on the top of the stack. So, instead of ** calling 'luaL_addlstring', it replicates the code using -2 as the ** last argument to 'prepbuffsize', signaling that the box is (or will ** be) below the string being added to the buffer. (Box creation can ** trigger an emergency GC, so we should not remove

Source from the content-addressed store, hash-verified

620** stack before we have the space guaranteed.)
621*/
622LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
623 lua_State *L = B->L;
624 size_t len;
625 const char *s = lua_tolstring(L, -1, &len);
626 char *b = prepbuffsize(B, len, -2);
627 memcpy(b, s, len * sizeof(char));
628 luaL_addsize(B, len);
629 lua_pop(L, 1); /* pop string */
630}
631
632
633LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {

Callers 8

add_sFunction · 0.70
add_valueFunction · 0.70
addliteralFunction · 0.70
str_formatFunction · 0.70
luaL_tracebackFunction · 0.70
utfcharFunction · 0.70
addfieldFunction · 0.70
findloaderFunction · 0.70

Calls 2

lua_tolstringFunction · 0.70
prepbuffsizeFunction · 0.70

Tested by

no test coverage detected