If I had code like this in Lua, how would I call 'this'?
array = { this = { pic="hi.png", health=4 } , pos=20 }
Edit:
Say for example I have a table of enemies like:
enemy = {}
enemy[1] = {pic="Ships/enem-01.png", hp=2}
enemy[2] = {pic="Ships/enem-02.png", hp=4}
enemy[3] = {pic="Ships/enem-03.png", hp=3}
enemy[4] = {pic="Ships/enem-04.png", hp=5}
enemy[5] = {pic="Ships/enem-05.png", hp=7}
enemy[6] = {pic="Ships/enem-06.png", hp=9}
enemy[7] = {pic="Ships/enem-07.png", hp=15}
I then want to be able to create a table of there positions.
level1 = {}
level1[1] = { ent = enemy[2], xpos= 20, ypos=20}
how would I call pic, using level1, or wouldn't I?
would I change level1 to be like
level1[1] = {ent = 2, xpos=20, ypos=20}
then use
screen:draw(level[1].xpos, level[1].ypos, enemy[level[1].ent].pic)