Currently ScreenManager doesn't check:
- If the screens are tables when calling
ScreenManager.init. So it will error when trying to index screen.new()
- If the returned value from
screen.new() is a table. So new() could return a string (for example) and later on when trying to index it in search for the callbacks you would get an error trying to index a string
- If the callback is defined. So it will error when trying to index a callback which wasn't defined in the screen
- If the callback is actually a function. So if for example
screen.directorydropped was a string ScreenManager.directorydropped would try to call a string resulting in an error
I know that most of this issues can be fixed by using the suggested Screen.lua as a base class, but it would be great if ScreenManager errored when it found one of this akward cases (which are of course not the libraries fault but the users fault)
I consider that the following would be the best way to handle each case:
- In the case of
new() not returning a table it should probably error
- In
ScreenManager.init if the nscreens wasn't a table containing tables that have a .new() function then it should error
- If the callback is not defined it should be ignored
- If the callback is defined but not a function then it should be ignored
Currently ScreenManager doesn't check:
ScreenManager.init. So it will error when trying to indexscreen.new()screen.new()is a table. Sonew()could return a string (for example) and later on when trying to index it in search for the callbacks you would get an errortrying to index a stringscreen.directorydroppedwas a stringScreenManager.directorydroppedwould try to call a string resulting in an errorI know that most of this issues can be fixed by using the suggested
Screen.luaas a base class, but it would be great if ScreenManager errored when it found one of this akward cases (which are of course not the libraries fault but the users fault)I consider that the following would be the best way to handle each case:
new()not returning a table it should probably errorScreenManager.initif thenscreenswasn't a table containing tables that have a.new()function then it should error