• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Call table data

beenii

Well-Known Member
Joined
Jul 26, 2010
Messages
580
Solutions
1
Reaction score
57
Hi, I'm trying to read the information in this table, I don't know if the structure of my table is wrong, or my way of wanting to receive the data

Table:
Lua:
towerTileConf = {
 
     [37101] = {
       minLevel = 100,
       centerArena = Position(31957, 32335, 7), -- Centro de la arena
       rangoX = 6, -- rango en X del centro
       rangoY = 6, -- rango en Y del centro
       playerPos = Position(31957, 32337, 7), -- Enter player position

       WAVES = {
           [1] = {
                  [1] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)},
                  [2] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)},
                  [3] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)},
                  [4] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)},
                  [5] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)}
                  },
           [2] = {
                  [1] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)},
                  [2] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)},
                  [3] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)},
                  [4] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)},
                  [5] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)}
                  },
           [3] = {
                  [1] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)},
                  [2] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)},
                  [3] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)},
                  [4] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)},
                  [5] = {monsterName = "Minotaur", level = 50, spawnPos = Position(31957, 32335, 7)}
                  }
                  
       }
       }


Call data:
Code:
local towerConfig = item.actionid
local tileReqTower = towerTileConf[towerConfig]

for i = 1, #tileReqTower.WAVES[1].[i] do
tileReqTower.WAVES[1].[i].monsterName
end


I want to read the information of the first wave, and then call the 2, so on
 
Solution
Lua:
local towerConfig = item.actionid
local tileReqTower = towerTileConf[towerConfig]

for i = 1, #tileReqTower.WAVES do
    for x = 1, #tileReqTower.WAVES[i] do
        tileReqTower.WAVES[i][x].monsterName
    end
end
Lua:
local towerConfig = item.actionid
local tileReqTower = towerTileConf[towerConfig]

for i = 1, #tileReqTower.WAVES do
    for x = 1, #tileReqTower.WAVES[i] do
        tileReqTower.WAVES[i][x].monsterName
    end
end
 
Solution
Lua:
local towerConfig = item.actionid
local tileReqTower = towerTileConf[towerConfig]

for i = 1, #tileReqTower.WAVES do
    for x = 1, #tileReqTower.WAVES[i] do
        tileReqTower.WAVES[i][x].monsterName
    end
end

It works, call all the monsters

But how can I call each wave individually?

SOLVED:
for x = 1, #tileReqTower.WAVES[1] do
tileReqTower.WAVES[1][x].monsterName
 
It works, call all the monsters

But how can I call each wave individually?

SOLVED:
for x = 1, #tileReqTower.WAVES[1] do
tileReqTower.WAVES[1][x].monsterName
Lua:
for x = 1, #tileReqTower.WAVES[1] do
        tileReqTower.WAVES[1][x].monsterName
end

Nvm, you just solved it yourself, good job!
 
Back
Top