I don't know if this is very simple or not but like how do u change a variable in a script
for example
lets say x is 30
x = 30
and i want to change it to 20
x = 20
how would i do that
I don't know if this is very simple or not but like how do u change a variable in a script
for example
lets say x is 30
x = 30
and i want to change it to 20
x = 20
how would i do that
Well, you just did. Once you define a variable, you can change it via var = value.
local variable = "20" -- the two " are making it into a string. We will call it text to simplify it!
variable = 20 -- we then turn it into a NUMBER, and not TEXT.
when making a variable via local, you can easily change the value right after! Make sure to mark this answer if it helps you
NOTE: in lua you must use locals for variables like 85% of the time, so if you are used to python you might want to change the way you think.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
You just changed the variable.