I started a simple colour matching game to help me learn corona, but as my game has developed i’ve had to do some research into modular classes. using all the tutorials i could find I have created three files, main, gameScreen and gameFunctions.
my gameScreen file holds a function that when called displays all my UI display objects and the functionality of these objects is controlled by functions in the gameFunctions file.
but when I run the game in the simulator I always get an error for the display objects that are created in the other class file.
the error is:
Attempt to index global ‘hintBtn’ (a nil value)
stack traceback:
[C]: ?
/Users/user/Desktop/ReTrispect/gameFunctions.lua:148: in main chunk
[C]: in function ‘require’
?: in function <?:982>
(tail call): ?
/Users/user/Desktop/ReTrispect/main.lua:48: in main chunk
if I add local to the object mentioned it then gives me a new error:
Error loading module ‘gameFunctions’ from file ‘/Users/user/Desktop/ReTrispect/gameFunctions.lua’:
/Users/user/Desktop/ReTrispect/gameFunctions.lua:148: ‘(’ expected near ‘:’
I didn’t just want to post all the code on here so I hope I’m explaining myself well.

