I'm doing an agent based framework with C++ and Lua. I want to use Lua to code the Agent behaviour having an AgentClass
class that have the name and source code and an AgentInstance
class that have the lua_State. I want to have a few AgentClass
instances during execution but hundreds or thousands of AgentInstance
objects.
Is there any way to share the same lua script with different lua_State
? Or Is there a better way to get hundreds of agents without too much performance penalty?
¿Options?:
- Having compiled Lua code in
AgentClass
. - Having
lua_State
only onAgentClass
, setting a self variable in everyAgentInstance
update. - Other.