The Namespace Folly [Renamed]
Posted: Wed Nov 05, 2014 4:35 pm
Hello, before I started the Grimrock II. editor up a spent a few days perusing the LoG1 modding forums to get a handle on how things were, generally, done in that one. There wasn't much information, yet, on these forums so while learning I misinterpreted the keyword global. I thought, coming into LoG2 modding, it meant it was truly global so I decided I would like all my functions within it's own namespace (not that there's true namespace functionality with LUA but that's besides the point) so I wouldn't have name-collision problems with other modders.
Cut to the chase, a few days later I discover variables are only global to that script entity (which is, around, a couple weeks ago now) and I really don't need to bother with a namespace anymore but now I have all my functions wrapped up in a table, like so:
Is it bad to have these functions assigned to a global table? So far I've had no problems with saves *directly related to having functions in my GFX namespace" but are there risks down the road to doing it like this?
((Yes I had crashes due to saving returned entities to globally available variables but have squashed this problem.))
Cut to the chase, a few days later I discover variables are only global to that script entity (which is, around, a couple weeks ago now) and I really don't need to bother with a namespace anymore but now I have all my functions wrapped up in a table, like so:
Code: Select all
GFX = {}
GFX.functionA = function() end
GFX.functionB = function() end
-- so on
((Yes I had crashes due to saving returned entities to globally available variables but have squashed this problem.))