Posted: Mon Nov 10, 2008 5:20 am
I'm having a bit of trouble with this. So far I have this:
Obviously I'm ending up doing arithmetic on layer objects here (which makes the variables 'uplayer' & 'downlayer' nil). I have the feeling I'm making this harder than it needs to be.
I'm trying to increment the table index [i+1]. This would probably work, but I'm also trying to assign the layer object as the value of this index. I'm I just trying to abreviate the code too much?
Code: Select all
for i = 0, layerid do
layerobj = moho.layer:Parent():Layer(i)
local layertable = {}
layertable[i] = layerobj
--print(i .. " equals " .. tostring(layertable[i]))
if (tostring(layertable[i]) == tostring(moho.layer)) then
print(tostring(layertable[i]) .. tostring(moho.layer))
--if (i ~= layerid) and (i ~= 0)then
uplayer = layertable[i+1]
print(tostring(uplayer))
downlayer = layertable[i-1]
print(tostring(downlayer))
--end
end
end
I'm trying to increment the table index [i+1]. This would probably work, but I'm also trying to assign the layer object as the value of this index. I'm I just trying to abreviate the code too much?