How do I use them?
I want to use variables in that way, or define them
You can achieve the effect you want using a Table, but there is no way, that I know of, to use them as variable names directly:
local vars = {} vars["1!#%W!~!#^"] = -11 vars["Bloo #11"] = true
Also, those aren't "alphanumeric symbols". They're just symbols. Alphanumeric symbols are just the numbers 0 to 9, and the letters A-Z and a-z. Nothing more.
Edit: I don't know why you think you need to use extraneous symbols for defining variables, but whatever you do, be careful with the '\' character. It is used for "escaping" special characters in Strings, and will cause errors if used improperly. To get around this, you have to use the string-literal constructor (as opposed to the quotation marks):
local vars = {} vars[ [[ A fancy string!!! ///////////\\\\\\\\\\\\\\ All of the whitespace in this string is preserved, except for the first character if it is a newline, which it is here. \' \" \[ \] Escape sequences are ignored. -- You can't make Lua comments! The tail newline is *not* ignored,though... ]] ]
There is a way, but the only way to access them is to index them through their function environment (getfenv()
)
getfenv()["!@#"] = "this is a global variable" print( getfenv()["!@#"] ) --> this is a global variable" print ( !@# ) --> error