I need a little help with how to sort and compress code…
For the following code, is there any way to write the shortest code, iterating or something like that, to avoid repeating so much?
if ( value == 0 ) then
add_point_1 = true add_point_2 = true add_point_3 = true add_point_4 = true add_point_5 = true add_point_6 = true add_point_7 = true add_point_8 = true add_point_9 = true add_point_10 = true
add_point_11 = true add_point_12 = true add_point_13 = true add_point_14 = true add_point_15 = true add_point_16 = true add_point_17 = true add_point_18 = true add_point_19 = true add_point_20 = true
add_point_21 = true add_point_22 = true add_point_23 = true add_point_24 = true add_point_25 = true add_point_26 = true add_point_27 = true add_point_28 = true add_point_29 = true add_point_30 = true
add_point_31 = true add_point_32 = true
end
if ( value == 1 ) then
add_point_1 = false add_point_2 = true add_point_3 = true add_point_4 = true add_point_5 = true add_point_6 = true add_point_7 = true add_point_8 = true add_point_9 = true add_point_10 = true
add_point_11 = true add_point_12 = true add_point_13 = true add_point_14 = true add_point_15 = true add_point_16 = true add_point_17 = true add_point_18 = true add_point_19 = true add_point_20 = true
add_point_21 = true add_point_22 = true add_point_23 = true add_point_24 = true add_point_25 = true add_point_26 = true add_point_27 = true add_point_28 = true add_point_29 = true add_point_30 = true
add_point_31 = true add_point_32 = true
end
--etc etc etc
if ( value == 32 ) then
add_point_1 = false add_point_2 = false add_point_3 = false add_point_4 = false add_point_5 = false add_point_6 = false add_point_7 = false add_point_8 = false add_point_9 = false add_point_10 = false
add_point_11 = false add_point_12 = false add_point_13 = false add_point_14 = false add_point_15 = false add_point_16 = false add_point_17 = false add_point_18 = false add_point_19 = false add_point_20 = false
add_point_21 = false add_point_22 = false add_point_23 = false add_point_24 = false add_point_25 = false add_point_26 = false add_point_27 = false add_point_28 = false add_point_29 = false add_point_30 = false
add_point_31 = false add_point_32 = false
end
Any way to do this with tables?
Thanks!