lua-users home
lua-l archive

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


I’m using lua in a game where we have a considerable amount (30+) of lua controlled objects running around. In order to free up memory I’m trying to get each object running off of a thread that was spawned off of a master state. This allows me to load all of the standard libs and a fair amount of my own into the state so that I can have a lot of objects running around using the global copy of the libraries and not have to load their own.

 

Now my problem is this: Since there is only one global table, how can I add a unique ‘this’ pointer ( as well as some other game object specific data ) to each thread as I was able to do when they each had their own state so I can then pass this data to our functions? Is there anyway to add them to the execution state so they look like any other variable declared during normal execution? Ideally I’d like to be able to use this data as if it were in the global table or had been declared in script, but cannot find a way to do this.

 

There are a lot of less than nice solutions to this problem that I’d like to avoid.

 

Thanks!

Joel