hi. i'm having some troubles with this and i can't find anything on the internet. i tried moving stuff around, but apparantly i'm attempting to index a function value, which isn't good? i've found a whole lot of examples of people using gsub and gmatch and stuff in for loops, so i don't really understand the problem. any help?
here's the input:
- a postal letter, a sparkling potion (three), an iron-bound crested chest, a
leather herb pouch, an ebony pipe (three), a dull grey potion (two), a lightweight leather backpack,
a luminous potion (two), a blue potion (three), a white potion (two), a bug-shaped rune, a perfect
crystal glass, empty of liquid, a glowing torch
and the function:
function parseItems(list)
inventory = {}
local numbers = {
["(one)"] = 1,["(two)"] = 2,["(three)"] = 3,["(four)"] = 4,["(five)"] = 5,
["(six)"] = 6,["(seven)"] = 7,["(eight)"] = 8,["(nine)"] = 9,["(ten)"] = 10
}
for _,item in ipairs(string.gmatch(list,"%+,"):gsub(",","")) do
function nest()
for str,int in pairs(numbers) do
if item:find(str) then
inventory[item:gsub(" "..str,"")] = int
return
end
end
inventory[item:gsub(" "..str,"")] = 1
end
end
end