From Riftui Wiki
A variable is a user created piece of data that can be changed or remain static. Variables in Rift must follow proper naming convention, or risk throwing errors. They can be all small letters, or start with a small letter and have capitalization later, and can include numbers and the underscore _. They cannot start with the underscore or a number.
It is also recommended to give your variables descriptive names, unless they are used in simple loops. You can still give descriptive names to your loop variables if you wish.
For variables with more than one value at the same time, see table.
x foo thisIsCorrect soIsthis right_again me2 1thisIsWrong Wrong_Again DEFINITELY_WRONG _whyDoesThis_not_work?
Variables should also be local to the addon, or risk polluting the global name space and getting overwritten. Any variable in a loop is local to the loop, and not to the entire addon.
local x = 17 -- x is not very descriptive, but it is still a variable. for i = 1, x do -- i is local to the for/end loop print(i) end local myString = "Looping" for index = 1, 100 do print(myString) end myString = "Finished!" print(myString)
This would print Looping to chat 100 times, then, because we changed the value of myString, it would print Finished!