lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Wed, Jun 22, 2022 at 4:22 AM Egor Skriptunoff <> wrote:
A question about Lua coding style.
Is it a good or bad idea to distinguish global from local variables by its uppercase / lowercase initial letter?
Var=0 -- global
var=0 -- local or upvalue

Neither I'd wager. Seems like personal preference, and from that I'll sprout a case that an alternative naming style for globals appears ideal. Of course, you could also vouch for no naming changes and explicitly use _G to look up the global. Some may call this ugly, but it's about as explicit as you'll get haha.