Posted 31 May 2013 - 06:42 PM
I have looked for over an hour for an answer to this, so if the answer is oviosu, i tried finding it first, just FYI.
I have a table within a table which looks like this:
Inside my first table i have regular indexes and values which define
I call this table into action using:
which returns my afore-mentioned error. my question is; do i get this fault because my table has strings and numbers in it and therefore this will never work, or is there a way around this fault?
I am able to get the code to work when i split the sub table into its' own table, but i would rather have one table than multiple, if this is possible.
I have a table within a table which looks like this:
Spoiler
local desktopGrid = {
[1] = {
GridBeginX = 2,
GridBeginY = 2,
GridEndX = 10,
GridEndY = 6,
desktopGoTo = 1,
[1] = {
GridBeginX = 2,
GridBeginY = 2,
GridEndX = 10,
GridEndY = 2,
onClick = 1
},
[2] = {
GridBeginX = 2,
GridBeginY = 3,
GridEndX = 10,
GridEndY = 3,
onClick = 2
}
},
[2] = {
GridBeginX = 13,
GridBeginY = 1,
GridEndX = 50,
GridEndY = 18,
desktopGoTo = 2
}
}
Inside my first table i have regular indexes and values which define
desktopGrid[i]
then after those first values i have indexes which create more tables.I call this table into action using:
Spoiler
for a,v in pairs(desktopGrid) do
if (arg2 >= (desktopGrid[a].GridBeginX)) and (arg2 <= (desktopGrid[a].GridEndX)) then
if (arg3 >= desktopGrid[a].GridBeginY) and (arg3 <= desktopGrid[a].GridEndY) then
if desktopGrid[a].desktopGoTo == 1 then
for b,v in pairs(desktopGrid[a]) do
if (arg2 >= desktopGrid[a][b].GridBeginX) and (arg2 <= desktopGrid[a][b].GridEndX) then
if (arg3 >= desktopGrid[a][b].GridBeginY) and (arg3 <= desktopGrid[a][b].GridEndY) then
if (menuItemSelect == 5) and (desktopGrid[a][b].onClick == 5) then
escape = true
end
menuItemSelect = desktopGrid[a][b].onClick
end
end
end
elseif desktopGrid[a].desktopGoTo == 2 then
elseif desktopGrid[a].desktopGoTo == 3 then
menuItemSelect = 0
end
end
end
end
which returns my afore-mentioned error. my question is; do i get this fault because my table has strings and numbers in it and therefore this will never work, or is there a way around this fault?
I am able to get the code to work when i split the sub table into its' own table, but i would rather have one table than multiple, if this is possible.
Edited on 31 May 2013 - 09:25 PM