Posted 13 July 2014 - 12:58 AM
Hehe
Is looking at some old code from my start into programming. We are back in late 80's and i used a Apple II running Integer Basic.
I want to test some old code and need to make a rough translation into LUA, and then later rewrite the code in proper LUA. (I just started into LUA some month ago)
My question is:
To 'simulate' a multi DIM like this:
Is this the right way to do it? or is there a simpler way…?
Then i can access the array like this
Flashback to look at old old code :)/>
/sEi
Is looking at some old code from my start into programming. We are back in late 80's and i used a Apple II running Integer Basic.
I want to test some old code and need to make a rough translation into LUA, and then later rewrite the code in proper LUA. (I just started into LUA some month ago)
My question is:
To 'simulate' a multi DIM like this:
DIM A(X1,X2,X3)
Is this the right way to do it? or is there a simpler way…?
local X1=10
local X2=10
local X3=10
local A={}
for i=0,X1 do
A[i]={}
for ii=0,X2 do
A[i][ii]={}
for iii=0,X3 do
A[i][ii][iii]=""
end
end
end
Then i can access the array like this
A[2][4][3]="some data"
Flashback to look at old old code :)/>
/sEi
Edited on 12 July 2014 - 11:07 PM