Posted 03 March 2019 - 06:54 PM
Hello, dear Community,
I am working on a project and I need to compare two tables. The error I get is: attempt to call table
On line 44 and here is my code:
The components Table is working as it should.
I tried
and Test is the name of a file in the directory the code is looking at. Also I loaded the Config API. That is just not the full code because just that part has to do with the table.
Any help would be appreciated :)/> Have a nice day!
I am working on a project and I need to compare two tables. The error I get is: attempt to call table
On line 44 and here is my code:
function printComponents()
local components = {}
local curComponent = {}
local dir = Config.CurrentProject
local CurrentDir = dir
term.setCursorPos(1,2)
term.setTextColor(colors.black)
term.setBackgroundColor(colors.lightGray)
for _, file in ipairs(fs.list(dir)) do
components[file] = {
name = file,
position = term.getCursorPos()
}
print("X "..file)
end
for _, fname in ipairs(components()) do
for _, fl in ipairs(fs.list(dir)) do
if file == fl then
print("Test")
end
end
end
end
The components Table is working as it should.
I tried
print(components["Test"].name)
and Test is the name of a file in the directory the code is looking at. Also I loaded the Config API. That is just not the full code because just that part has to do with the table.
Any help would be appreciated :)/> Have a nice day!
Edited on 05 March 2019 - 07:22 AM