How is the extra space associated with the given Lua state used for under actual user applications?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How is the extra space associated with the given Lua state used for under actual user applications?

孙世龙 sunshilong
Hi, list

As per the manual document of Lua(lua-5.4.0/doc/manual.html),
 which says that[empasise mine]:
The application can use this area**(
The  the extra space associated with the given Lua state.) **
for any purpose; Lua does not use it for anything.

How is the extra space used for under actual user applications?
I would be grateful if you could give me some examples, especially the
occasions that could not be replaced.

Best regards
Sunshilong
v
Reply | Threaded
Open this post in threaded view
|

Re: How is the extra space associated with the given Lua state used for under actual user applications?

v
On Sun, 2020-09-27 at 11:10 +0800, 孙世龙 sunshilong wrote:
> Hi, list
> How is the extra space used for under actual user applications?
> I would be grateful if you could give me some examples, especially
> the
> occasions that could not be replaced.

In my C++ wrapper for Lua I use it to store pointer to C++ object that
wraps given Lua VM. It could possibly be replaced by lightuserdata
somewhere like Lua registry, but extra space is easier and probably
faster to both read and write.
--
v <[hidden email]>