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 by OneTech, 05 March 2019 - 08:22 AM.