Are global variables created in one CC program accessible from another?
Are global variables actually global?
Started by Graypup, Jun 16 2012 12:42 AM
3 replies to this topic
#1
Posted 16 June 2012 - 12:42 AM
#2
Posted 16 June 2012 - 12: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.
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.
#3
Posted 16 June 2012 - 12: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.
Also note, the global scope applies to functions as well.
#4
Posted 16 June 2012 - 05: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.
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.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











