So, the RTFM entry for reflect states that it cannot be used to create variables, and that cell-less access requires set "arr_n " = 0 for n => capacity. I'm pretty sure I just did what that said was impossible, but I'd like to share for a second opinion and maybe to have the manual entry changed if this proves it possible. Here's the code, it sets up variables "reg_0" => "reg_9" using Reflect:
set registerNameHeader "reg_"
set initialValue 0
set i 48
set m 57
string push t "" i 0
string add rd registerNameHeader t 0
reflect set rd initialValue
op add i i 1
jump 4 lessThanEq i m
print reg_0
print "\n"
print reg_9
printflush message1
It's a bit hacky, and will only go from 0 to 9 without an extra loop for the other digit, but does in fact set all the variables properly (checked by an attached message block)
here you are creating variables, so reflect set has something to work with. (for those 2 only)
if you try to get them with reflect get val "reg_0" you'll get null back.
So, the RTFM entry for reflect states that it cannot be used to create variables, and that cell-less access requires
set "arr_n " = 0
for n => capacity. I'm pretty sure I just did what that said was impossible, but I'd like to share for a second opinion and maybe to have the manual entry changed if this proves it possible. Here's the code, it sets up variables "reg_0" => "reg_9" using Reflect:It's a bit hacky, and will only go from 0 to 9 without an extra loop for the other digit, but does in fact set all the variables properly (checked by an attached message block)
What are your thoughts on this?