86 posts
Posted 16 June 2012 - 01:42 AM
Are global variables created in one CC program accessible from another?
1604 posts
Posted 16 June 2012 - 01:47 AM
Yes, they are stored in the global table, so you can access them from another program. It's not good practice though.
Edit: just checked the shell program, and each shell creates an environment to run the programs, so the variables will be global to the shell that's running the program.
351 posts
Posted 16 June 2012 - 01:54 AM
The os loaded APIs have namespaces, so if you set a global in one of those, it just becomes one of the local attributes of the API's table.
Also note, the global scope applies to functions as well.
86 posts
Posted 16 June 2012 - 06:49 PM
OK, fortunately I just read programming in lua, so I actually remember what that means. Anyway, thanks.
Also, is it possible to create truly global variables?
I was intending to create variables for functions that are super-annoying to type the names of.