At the moment, I am currently creating a library loading system to streamline my development. I did write it myself however I referenced quite a bit from Nevermore so it looks pretty much the same, just with the lack of any OSS components. The second part of this paragraph is irrelevant, just wanted to give background.
Currently, I am trying to make a method that is intended to load a library. However, even though it’s not quite OSS, I ended up writing a way to catch if the method is indexed either from dot or colon syntax, which means I can call it either way.
LibraryLoader.LoadLibrary = function(self, libraryName)
local libraryName = self and libraryName or self
warn(libraryName)
end
LibraryLoader.LoadLibrary("ABTest") --> ABTest
LibraryLoader:LoadLibrary("ABTest") --> ABTest
Is there anything inherently bad about doing this? I was just playing around with some code and found that this works. Almost certain I won’t keep this in, though for the sake of knowledge I’d like to know what the pros or cons of doing this are, either from a technical or usage standpoint (public or private usage).