@carloscosta, very true regarding the double check for “o”.
This is my “working code” so it’s not optimized and has a lot of artifacts and stand-ins from cobbling together various methods, structures and ideas - some more refined that others. As for the extra “o” check, sometimes I add a property to the second “o” to add an on-the-fly filter for the objects I’m asking to “die” see below
[lua]
- if (o and o ~= nil) then
- – o~= nil is a stand in for testing other properties. While in development I sometimes find in useful to drop in a test another property on the fly like:
- if (o and o.x ~= nil) then – sometimes I need to sort objects that way so only some “die”
[/lua]
Also, very true about the double checking for valid arguments. In an earlier version of the “death” function, all of the instructions were contained in the initial “if” statements. At some point, I extracted the instruction sets into their own functions (with their own checks) and added a reference without deleting the initial if/then check for valid arguments - so yes, very unnecessary redundancies for now. This will definitely be refined in a future code revision. Although now it’s bugging me so I think I’ll do it tonight
Carlos, it looks like you are using a database. What is your preferred method for database integration. Have you tried / do you use Coronium Core? It’s worked really well for me.