This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
kjdgnib4u94oidfnjksnadn893's profile picture

Need help with an error!

Started by kjdgnib4u94oidfnjksnadn893, 29 December 2014 - 11:18 PM
kjdgnib4u94oidfnjksnadn893 #1
Posted 30 December 2014 - 12:18 AM
I am trying to make an OS and i cant get the load feature to work (to load from another file) im using this function:

function getTable(path)
  if fs.exists(path) then
	local file = io.open(path, "r")
	local lines = {}
	local i = 1
	local line = file:read("*1")
	while line ~= nil do
	  lines[i] = line
	  line = file:read("*1")
	  i = i + 1
	end
	file:close()
	return lines
  end
  return {}
end

but i keep getting an error that says "io :86: Unsupported format" and there is nothing wrong with line 86, because there isnt a line 86 =/ my program only goes up to 62 lines. the chunk of code i use to call the function is

local config = getTable("AluminOS/config")
The config file is in a folder called AluminOS as you can see.
Please help me asap i will keep checking on the website every 10 or 20 mins. Thank you!
Lyqyd #2
Posted 30 December 2014 - 12:54 AM
The problem is the "*1" you're using as the format. Acceptable formats are "*a" for all or "*l" for line.
kjdgnib4u94oidfnjksnadn893 #3
Posted 30 December 2014 - 11:44 PM
The problem is the "*1" you're using as the format. Acceptable formats are "*a" for all or "*l" for line.
Lol apparently i cant tell the difference between an L an a 1. Thanks a lot for the help! =)
Edited on 31 December 2014 - 06:57 PM