in here, i ask you is local variables are important?
The different lexical scopes in Lua are described here: https://defold.com/manuals/lua/#locals-globals-and-lexical-scoping
I will always make variables local unless I have a good reason to otherwise, such as making some functions globally available (even this we tend to keep them in a globals.lua which we require as needed). Sometimes storing information in self is useful, other times it is more useful to share data via a shared Lua module.
3 Likes