How to create a global variable

Followed recommended code and it didn’t work, what do I need to do to get a global variable to work?

Lua is case-sensitive, so A and a are different variables.

And if you need a better way to handle global variables, try Lua modules: Lua modules in Defold

1 Like

It works if you start it with a lowercase variable name. I created “camera_position” and was able to access the value from another script.

Still, I would recommend using Lua modules to contain global variables as suggested by @Halfstar

1 Like