Hi,
I have this error:
OpenAura -> the craftitem command has failed to run.[@gamemodes\openaura\gamemode\openaura\sh_coms.lua:21] bad argument #1 to ‘pairs’ (table expected, got nil)
The command ive scripted is:
– Called when the command has been run.
function COMMAND:OnRun(player, arguments)
local craftingTable = openAura.crafting:Get( arguments[1] );
local gotitems = “true”;
local count = 0;
for k, v in pairs(craftingTable.items) do
required = openAura.inventory:HasItem(player, v, "inventory");
if (!required or required == "") then
openAura.player:Notify(player, "You need"..v.."!");
gotitems = "false";
end;
count = count + 1;
end;
if (gotitems == "true") then
for k, v in pairs(craftingTable.items) do
openAura.inventory:Update(player, v, -1);
end;
make = craftingtable.makes;
openAura.inventory:Update(player, make, 1);
end;
end;
openAura.command:Register(COMMAND, “craftitem”);
(I know it isnt logically coded, Its a proof of concept atm)
However i cant work out where this error is coming from. It gets craftingTable fine, The input i have made for craftingTable.items is:
CRAFT.items = {“Bottled Water”,“Coffee Powder”,“Mug”};
(Its in a crafting file which is similar to how the item files are)
Any help? I can post more of my code if needed