• 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 Tables

darkmu

Well-Known Member
Joined
Aug 26, 2007
Messages
274
Solutions
1
Reaction score
50
Location
Paraná,Brazil
Hi, Can someone help me?

local config = {
system = {
[1] = {name = "Citizen",
IdsexMale = 128,
IdsexFemale = 136,
reqItems = {
[1] = {item = 2455, count = 1}, -- Crossbow
[2] = {item = 5904, count = 30}, -- Magic Sulphur
[3] = {item = 18427, count = 20}, -- Pulverized Ore
[4] = {item = 22396, count = 50}, -- Cluster of Solace
},
},
}
}


function Player:ModalAddon1(config, lastChoice)
local function buttonCallback(button, choice)
if button.text == "Sim" then

for i = 1, #config.system[lastChoice].reqItems[choice.id] do
print("HERE")
end

end
end


how do I access the table? of items .. to demonstrate
 
Lua:
local addon_item = [B]config.system[lastChoice].reqItems[choice.id]
print(addon_item.item, addon_item.count)
 
local item = config.system[lastChoice].reqItems[choice.id]
print(item.item, item.count)

ERROR
6sgojq.png



USING MY FOR

for i = 1, #config.system[lastChoice].reqItems[choice.id] do
print("a")
end

ERRO:

34hc4jt.png
 
hard to help you when you just send a snippet of code, send all of it
your error is that lastChoice is most likely wrong
 
Back
Top