attempt to index a function value

Post Reply
Posts: 1
Joined: Wed Mar 09, 2016 12:17 am

attempt to index a function value

Post by tyrannopath » Wed Mar 09, 2016 12:23 am

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:
Code: [show] | [select all] lua
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

			inventory[item:gsub(" "..str,"")] = 1

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests