Sharsnik
September 6th, 2008, 09:02 PM
I'm setting up a LUA interpreter for my game. I get the basic concepts of registering events to call LUA functions.
What I'm having trouble with is making sure that different LUA scripts don't overlap. For example, if I have two skill scripts - skill1.lua and skill2.lua, and they both have an onCast function that is called when skills are cast. I want to be able to distinguish between these scripts.
I was thinking that it could be dun by denoting different name spaces to each script, but I'm not sure how to do that.
Edit: Another question. Is it viable to spawn new lua virtual machines for each instance of a script? Or would that be way too much overhead?
What I'm having trouble with is making sure that different LUA scripts don't overlap. For example, if I have two skill scripts - skill1.lua and skill2.lua, and they both have an onCast function that is called when skills are cast. I want to be able to distinguish between these scripts.
I was thinking that it could be dun by denoting different name spaces to each script, but I'm not sure how to do that.
Edit: Another question. Is it viable to spawn new lua virtual machines for each instance of a script? Or would that be way too much overhead?