lua-users home
lua-l archive

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

sorry from another nerving "memory peeking" questions from the world
of Lua32 with only 64kB alloc-RAM available:

Such IoT devices typically have quite man IO ports. I would like to
allow the Lua Users to give every one of them a nice name, if they

Therefore I would like to handle them similar like FileIO objects in
liolib.c with meta functions read/write/open... (but per IO only a
very small userdata necessary, typically only 1-2 int's or so...).

In a file IO Lua program, you typically would expect 2-10 file
objects, but in my Lua32 program for IoT, I would more expect 20-100
of such IOport objects, so really quite many. Therefore the memory
need of each IOport will be quite crucial (having only 64kB
alloc-memory available).

If I give meta support to such userdata IOports (opened the standard
way with lua_newuserdatauv), then how much bytes will be consumed by
this "meta addition" to each object?

I expect this is only ONE additional table entry of the form "userdata
= meta-name-string" in the registry - is this correct? (so esentially
1 TValue userdata and 1 TValue string - give 2 TValues or 16 Bytes in
Lua32).  Or do they need more memory?