Can someone explain how arrays work?
It's very much bugging me out :(
P#10849 2015-05-21 23:54 ( Edited 2015-05-22 21:38)
What specifically are you having trouble with? This would probably be a good start: http://www.lua.org/pil/11.1.html
P#10865 2015-05-22 13:27 ( Edited 2015-05-22 17:27)
Oh, so you don't mean "array" as a data structure, but some other definition of "array"? I'm not sure what you are asking :D
P#10867 2015-05-22 16:41 ( Edited 2015-05-22 20:41)
You can use tables as arrays:
local a = {} a[1]="hello" a[2]="world" for i=1,2,1 do print(a[i]) end |
They're 1 based and don't have a length, as far as I know at least...
You can also use tables as JSON styled objects, just imagine = instead of :
{ x=0, y=0, xv=0, yv=0, guns={ {t=0,bullets=30}, {t=1,bullets=2} } } |
P#10871 2015-05-22 17:12 ( Edited 2015-05-22 21:17)
[Please log in to post a comment]