Change saveSettings() to be more mod friendly
Posted: Wed Feb 20, 2013 4:22 am
I just managed to make a template for new graphical widgets in minimalist.lua, and check to notice that DarkGod's apparently just had a look in there, so I've got two comments:
1) saveSettings isn't mod (or maintenance) friendly, because it looks for specific fields ("player", "toolbar", "resources", etc) rather than writing all fields. That means that mods that want to introduce graphical widgets need to alter this function, right in the middle of the function, and so it's really tough to make them all play well together. I don't know how to fix it myself, but given the apparent power of Lua, I'd wager it's fixable.
2) Very very minor point, but desc_fct is a misleading choice of name, since anything you do on mouse-over (scaling or moving, for instance) has to occur in that function. mouseover_fct would be a better choice. Not a big deal, because mod authors can pick any name they want for that function when they use it, but for figuring out the code, better naming would be nice.
It's given me a real headache to trace this stuff out, but that's just because I'm new to it. I have to express my admiration to all of the coders (not just DarkGod?) for what is very readable, very clear code. Other than saveSettings, everything to make another widget can be easily superloaded.
1) saveSettings isn't mod (or maintenance) friendly, because it looks for specific fields ("player", "toolbar", "resources", etc) rather than writing all fields. That means that mods that want to introduce graphical widgets need to alter this function, right in the middle of the function, and so it's really tough to make them all play well together. I don't know how to fix it myself, but given the apparent power of Lua, I'd wager it's fixable.
2) Very very minor point, but desc_fct is a misleading choice of name, since anything you do on mouse-over (scaling or moving, for instance) has to occur in that function. mouseover_fct would be a better choice. Not a big deal, because mod authors can pick any name they want for that function when they use it, but for figuring out the code, better naming would be nice.
It's given me a real headache to trace this stuff out, but that's just because I'm new to it. I have to express my admiration to all of the coders (not just DarkGod?) for what is very readable, very clear code. Other than saveSettings, everything to make another widget can be easily superloaded.