-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Description
Currently ScreenManager doesn't check:
- If the screens are tables when calling
ScreenManager.init. So it will error when trying to indexscreen.new() - If the returned value from
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 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.directorydroppedwas a stringScreenManager.directorydroppedwould 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.initif thenscreenswasn'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