1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
local upgradeList = { 	[300] = { -- itemid 		{1, 2}, --requirement item id = 1 , amount 2 		{2, 5}, --requirement item id = 2 , amount 5 	}, 	[301] = { 		{1, 3}, 		{2, 6}, 	}, }
If we want to craft itemid 300 we must have the items below:
1
2
2
{1, 2}, --requirement item id = 1 , amount 2 		{2, 5}, --requirement item id = 2 , amount 5
{1, 2}, --requirement item id = 1 , amount 2this is working but;
1
{2, 5}, --requirement item id = 2 , amount 5
this line is not working.
Sorry for stealing your time, thank you for reading.
Full Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
dofile("sys/lua/unimenu.lua") local upgradeList = { 	[300] = { 		{1, 2}, 		{2, 5}, 	}, 	[301] = { 		{1, 3}, 		{2, 6}, 	}, } function constructMenu(id) 	local m = { 		title = "Craft Menu", 		items = {}, 	} 	 	local totalUpgradable = 0 	for k, v in pairs(upgradeList) do 		local available = false 		local reqCount = #v 		local reqString = "" 		local a = "" 		local b = "" 		for _, req in pairs(v) do 			local amount, itm = itemcount(id, req[1]) 			if amount >= req[2] then 				available = true 			end 			reqString = reqString .. ITEMS[req[1]].name .. "x" .. req[2] .. " " 		end 		 		if not available then 			a = "(" 			b = ")" 		end 		 		local item = { 			a .. ITEMS[k].name, reqString .. b,function(id) 				local done = true 				for _, t in pairs(upgradeList) do 					for _, tt in pairs(t) do 						done = removeitem(id, tt[1], tt[2], true) 					end 				end 				if done then 					additem(id, k, 1, true) 				else 					msg2(id, "You don't have enough items.") 				end 			end 		} 		table.insert(m.items, item) 	end 	 	unimenu(id, true, m, 1) end addhook("say", "b_say") function b_say(id, txt) 	if txt == "!craft" then 		constructMenu(id) 	end end