How do I procedurally iterate through similar variables in Lua?
snippet in lua

How do I procedurally iterate through similar variables in Lua?

user2114

local Banks = 2
local Rows = 3
local Columns = 5

function Objectstatus(bank,row,column)

    Id = bank .. row .. column
    worldx = "-" .. column+3
    worldy = row+2
    if bank == 1 then worldz = -4; end
    if bank == 2 then worldz = 1; end
    Object = {}
    Object[Id] = s.getTargetDetails(worldx..","..worldy..","..worldz)
    xcursor = (column*7)+3
    if bank == 1 then 
        ycursor = (row*4)+8
    end
    if bank == 2 then 
        ycursor = (row*4)+24
    end

    mon.setCursorPos(xcursor,ycursor)
    powertext(Object[Id].StoredPercentage) -- A function that sets Texts settings based on result
    mon.write(Object[Id].StoredPercentage) -- Actually writes the result
end

    for BankTemp = 1, Banks do
        for ColumnTemp = 1, Columns do
            for RowTemp = 1, Rows do
            Objectstatus(BankTemp,RowTemp,ColumnTemp)
            end
        end
    end