πŸ’¬

Community answer

Collected from the ACE community Discord archive around 2023-07-04. It may be informal or outdated β€” anyone can edit this page to improve it.

Local vs global variables in Lua

πŸŒ™ LuaUpdated 2 days agoβ€’0 views
By default in Lua all variables are global, so a variable defined in a function without 'local' is accessible anywhere in the chip. Best practice is to keep var…

What is the difference between a local variable and a normal one in Lua/Starfall?

By default in Lua all variables are global, so a variable defined in a function without 'local' is accessible anywhere in the chip. Best practice is to keep variables local unless you explicitly need them global. More info: https://www.l ua.org/pil/4.2.html

Was this article helpful?

See More

Discussion(0)

No comments yet. Be the first to ask a question!

Have a question? Sign in to join the discussion.