68 posts
Location
Land of the Pharos
Posted 25 February 2020 - 10:46 AM
that is the error I'm getting from this;
function index()
if index ~= nil then
index = nil
index = inventory.list()
else inventory.list()
end
end
why is that?
as the name implies this is just a function used to update the index table of all items inside a chest.
Edited on 25 February 2020 - 02:32 PM
2427 posts
Location
UK
Posted 25 February 2020 - 11:12 AM
You have a variable name collision, using local variables will help.
Side note, what is the goal of that function?
Also, are all these ask a pro posts you are making the same program?
62 posts
Location
Sweden
Posted 25 February 2020 - 11:16 AM
You are overwriting your function and turning it into a table, when you try calling the function again it fails because its not a function anymore.
function index()
index = {}
end
print("index is a " .. type(index))
index() -- ok
print("index is a " .. type(index))
index() -- fails, index is a table, not a function anymore
Edited on 25 February 2020 - 10:21 AM
68 posts
Location
Land of the Pharos
Posted 25 February 2020 - 12:44 PM
You have a variable name collision, using local variables will help.
k, thanks. I'm realy inexperienced with tables
Side note, what is the goal of that function?
it is to index an inventory i.e. chests or storage crates -is for a storage management program-
Also, are all these ask a pro posts you are making the same program?
maybe… maybe not.
You are overwriting your function and turning it into a table, when you try calling the function again it fails because its not a function anymore.
thanks, I really needed you to point that out…
that's exactly my issuewith kind regards-qwerty
Edited on 25 February 2020 - 11:45 AM