lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Ok right. I have to do the whole dump mechanism Lua 5.4- style. Thanks for your help.

Le jeu. 8 juil. 2021 à 11:51, Xmilia Hermit <> a écrit :

> when prepbuffsize is called, because my stack contains the function
> being dumped at the top (since that's what lua_dump needs), and
> prepbufsize does:

So you are violating:
You can use the stack between successive calls to buffer operations as
long as that use is balanced
from since you
push the function after a buffer operation without removing it before
the next buffer operation in the write function.

You could argue that the design of either buffer or dump should be
changed. Buffers could include the stack slot they occupy since now they
allway occuply exactly one or dump could get a index to the function
instead of requireing in on the top.

It is also interesting so see how lua solved this issue for string.dump