lua-users home
lua-l archive

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


Not "good", but I think with iterated print and string functions the
Lua user generally should be very careful... .

Have a look how print is programmed... print is easy to use, but it
somehow has to create a larger buffer for this, and iterating this too
much can for sure get critical.

(I use Lua on a controller system with VERY restricted Heap (only
40kByte), and for Lua applications with much string handling, this
worked only, after I introduced a special "static StringBuffer"
library, written by myself (this in fact does NOT allow buffer
overflow, as it limits the maximal string buffer size to some
predefined "senseful value" (in my case 150 Bytes, as I assume strings
will be needed only for "normal text files" in any user Lua app
wriitten for my controller application) (print I anyway had to
re-write for my special communication interfaces, and I also use this
"home-written" static StringBuffer lib for the print-buffer ... so
then the print buffer also is "automatically limited" to 150 Bytes and
does NOT use stack...) (but with this then, until now all working
EXTREMLY nice, I am completely fascinated by the power Lua for such
small systems).


On Fri, May 20, 2022 at 7:48 PM Jinwei Dong <jwdong2000@qq.com> wrote:
>
> Jinwei Dong wrote:
>

> Does anyone have any good ideas on how to fix issues like this? In fact I'm curious how the developers would treat these weird little bugs.