Hey Guys,
I have been really enhancing my game engine, and the one thing I have been working on the most, is my script component.
After getting advice from Rez, and also using the Unity Engine I understand more how actor behaviours are defined. I have a question regarding the context of a script though, and as I am now switched over to LuaPlus it may be easier for you to answer Rez.
When I parse a script file, say Object.lua, if that script file has a function called say, OnUpdate, the OnUpdate function will be in the global namespace in Lua. Now, if I have 200 actors all with there own OnUpdate functions, will they not get overwritten? If this is the case, what is the best solution for me to have these functions be local to the script file, and how would they be individually accessed?
At the moment I have a script component, which has the option to parse a file before anything else, and then sets an Init, ShutDown, and Update function which are all called accordingly. Also, if I am able to make these functions local to the script file, I imagine I can make a local 'this' variable which would reference to the specific actor, which kind of answers my second question.
I have been really enhancing my game engine, and the one thing I have been working on the most, is my script component.
After getting advice from Rez, and also using the Unity Engine I understand more how actor behaviours are defined. I have a question regarding the context of a script though, and as I am now switched over to LuaPlus it may be easier for you to answer Rez.
When I parse a script file, say Object.lua, if that script file has a function called say, OnUpdate, the OnUpdate function will be in the global namespace in Lua. Now, if I have 200 actors all with there own OnUpdate functions, will they not get overwritten? If this is the case, what is the best solution for me to have these functions be local to the script file, and how would they be individually accessed?
At the moment I have a script component, which has the option to parse a file before anything else, and then sets an Init, ShutDown, and Update function which are all called accordingly. Also, if I am able to make these functions local to the script file, I imagine I can make a local 'this' variable which would reference to the specific actor, which kind of answers my second question.
PC - Custom Built
CPU: 3rd Gen. Intel i7 3770 3.4Ghz
GPU: ATI Radeon HD 7959 3GB
RAM: 16GB
Laptop - Alienware M17x
CPU: 3rd Gen. Intel i7 - Ivy Bridge
GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
RAM: 8GB Dual Channel DDR3 @ 1600mhz
CPU: 3rd Gen. Intel i7 3770 3.4Ghz
GPU: ATI Radeon HD 7959 3GB
RAM: 16GB
Laptop - Alienware M17x
CPU: 3rd Gen. Intel i7 - Ivy Bridge
GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
RAM: 8GB Dual Channel DDR3 @ 1600mhz