For example:
number x
= x 100
string s
= s (varname x)
print "%\n" s ; prints "x"
= `(tovar s) 777 ; x is now 777
For example:
number x
= x 100
string s
= s (varname x)
print "%\n" s ; prints "x"
= `(tovar s) 777 ; x is now 777
Some internal things like vector locations will return “-booboo-” and will be an error trying to set them, though.
By the way everything like labels, functions, and variables are all “variables” which would work with this.
There is also the case of the variables being out of scope, like if you call a function and pass it a variable name in a string and that var doesn’t exist in the function, tovar should set the pointer to nullptr and I’ll probably leave it to crash…
I think it makes sense to leave varname out, but tovar could be useful. You could have a json/text/ini file that scripts your game.
Leave a Reply