Dear all,
Can anyone see something wrong with this line of code...
if (sub(m[n],f,f)="1") then rect(f*5,n*5,(f*5)+5,(n*5)+5) |
...as it's giving me this syntax error...
')' EXPECTED NEAR '=' |
It sits in this nested loop:
for n=1,10 do for f=1,15 do if (sub(m[n],f,f)="1") then rect(f*5,n*5,(f*5)+5,(n*5)+5) end end |
Any help much appreciated as my eyes have dried out looking at it!
tobo
P#33081 2016-12-05 14:57 ( Edited 2016-12-05 21:44)
If it helps, I'm trying to draw a map based on an array of strings.
_init() m={} m[1]="111111111111111" m[2]="100000000000001" m[3]="100000000001001" m[4]="100000000000001" m[5]="100011111110001" m[6]="100000000010001" m[7]="100000000010001" m[8]="100011111110001" m[9]="100000000000001" m[10]="111111111111111" _update() for n=1,10 do for f=1,15 do if (sub(m[n],f,f)="1") then rect(f*5,n*5,(f*5)+5,(n*5)+5) end end |
P#33082 2016-12-05 15:04 ( Edited 2016-12-05 20:04)
Hi Tobobobo,
It looks like you have "=" instead of logical "==".
if (sub(m[n],f,f)=="1") then rect(f*5,n*5,(f*5)+5,(n*5)+5) end
P#33083 2016-12-05 15:10 ( Edited 2016-12-05 20:10)
[Please log in to post a comment]