algernon
algernon copied to clipboard
One LuaState for one User?
LuaState is very expensive for creating. And if we treat user as a game player and a webpage as a NPC, we can offer only one lua-state for one logined user. So we can use a coroutine for one user:webpage pair, the context of talking is auto-saved in the coroutine's context. Every lua-state can save to a key-value store, when it timeouted. What about it ?
By the way, we can use the concurrent-map
for managing lua-states.
This is a good idea! Thanks for reporting.