For..in
How to iterate through the list items using the "for..in" loop, then when I want to change the value of a given list item, I can't do it.
Array = class
constructor = function( size )
list = []
for loop = 1 to size
list.push( 100 + loop )
end
end
div_a = function( value )
for item in list
item /= value
end
end
div_b = function( value )
for item in list
item = item / value
end
end
div_c = function( value )
for loop = 0 to list.length - 1
list[ loop ] /= value
end
end
printList = function()
local string = ''
for item in list
string += ' , ' + item
end
print( string )
end
end
init = function()
array = new Array( 10 )
array.printList()
array.div_a(2)
array.printList()
array.div_b(2)
array.printList()
array.div_c(2)
array.printList()
end
update = function()
end
draw = function()
end
I'm doing something wrong ??