lua-users home
lua-l archive

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



This would be a welcome feature, if possible and fast.

It could be used i.e. with servers, where currently Lua states need either to be recreated from scratch for each query, or carefully restored to known "clean" state after finishing a query. This sounds like a simpler way to me.

Maybe code from Lanes can be used to copy the entries of the template state. I should do some speed tests on that (or do the code and let _you_ run the speed tests). ;)

-asko


Pavel Shevaev kirjoitti 5.9.2009 kello 20:01:

Folks, is there a way to clone a Lua state? I tried to google around
but found nothing really meaningful(correct me if I'm wrong, please).

In my game application the initialization procedure of the Lua virtual
machine is pretty heavy(about 1 sec, since many scripts are loaded at
once). I have a separate Lua vm for each autonomous agent and once the
agent is created its Lua initialization affects FPS pretty badly.

I'm thinking about the following schema: what about keeping
"preforked" Lua state which is then simply cloned for each agent? Is
it possible?

Thanks in advance

--
Best regards, Pavel