benilla-re systems structs docs

luaL_addlstring

function · lua · boundary

Address
0x6f51f0 · 58 bytes, up to 0x6f5229
Meaning
Adds a block of bytes to a buffer, a byte at a time
Confidence
verified, proof one
Finding
lua/auxlib#string-buffers

Finding: String buffers in lua: the auxiliary library

A luaL_Buffer is p at +0, the number of stack pieces at +4, the state at +8 and 512 bytes at +0xc. luaL_buffinit sets it up. Adding bytes fills the area; when it is full emptybuffer pushes its contents as a string and adjuststack merges the pushed pieces from the top by lua_concat while the pieces taken so far are longer than the next one, or ten are pushed. luaL_pushresult pushes the rest and joins them, and luaL_addvalue adds the string on the stack top.

functionnamedecided by
0x6f5120luaL_prepbufferemptybuffer (0x6f5123), adjuststack when it pushed (0x6f512e), returns buf+0xc
0x6f5140emptybufferlength p-buf-0xc (0x6f5147), lua_pushlstring (0x6f515a), level count +4 raised (0x6f5164)
0x6f5170adjuststacklua_strlen pairs (0x6f5190, 0x6f51a5), limit 10 (0x6f51b2), lua_concat (0x6f51cf)
0x6f51f0luaL_addlstringcalls luaL_prepbuffer when the area is full (0x6f520f)
0x6f5230luaL_addstringlength by repne scasb, then luaL_addlstring (0x6f5243)
0x6f5250luaL_pushresultemptybuffer (0x6f5253), lua_concat (0x6f525e), level reset to 1
0x6f5270luaL_addvaluelua_strlen, lua_tostring (0x6f52a3), copy when it fits, else lua_insert and adjuststack (0x6f52e7, 0x6f52f5)
0x6f5300luaL_buffinitstores L at +8, p = buf+0xc, level 0 (0x6f5303, 0x6f5306, 0x6f5308)

The derivation is in the doc.

Callers 7

Callees 1

Calls and jumps by a bare address, from tables/calls.tsv.