Superloading
Posted: Mon Mar 19, 2012 5:41 pm
There are very few discussion threads in this forum, so I hope that I'm posting this in the right place.
What is the proper way to use superload when making an addon? So far I've prefaced the file that I've wanted to modify with 'local _M = loadPrevious(...)', put in the function that I want to change, and end the file with 'return _M'. That worked well enough for me in beta 37, but in beta 38 that only seems to work some of the time. And the time that I need it most is the time it doesn't work -- superloading the 'data' directory.
I've seen 'data' overloaded just fine, and even the separate 'data' folder definition work in various modules. But the former is absolute and should be avoided for compatibility purposes, and the latter I've only seen used when the module maker wanted to add new files.
So my big point of confusion is, how can I modify existing data folder files when I don't want to append to them, overwrite them, or add new files to the directory?
What is the proper way to use superload when making an addon? So far I've prefaced the file that I've wanted to modify with 'local _M = loadPrevious(...)', put in the function that I want to change, and end the file with 'return _M'. That worked well enough for me in beta 37, but in beta 38 that only seems to work some of the time. And the time that I need it most is the time it doesn't work -- superloading the 'data' directory.
I've seen 'data' overloaded just fine, and even the separate 'data' folder definition work in various modules. But the former is absolute and should be avoided for compatibility purposes, and the latter I've only seen used when the module maker wanted to add new files.
So my big point of confusion is, how can I modify existing data folder files when I don't want to append to them, overwrite them, or add new files to the directory?