Posted 05 July 2014 - 09:38 AM
Making it simple: Im making a os and i want to implement config. when i get number out of config and try it as a background. it just errors.
Code:
The os.conf file just has a 8.
When i try to print bg it just says 8. Works fine
Code:
menu = 0
w, h = term.getSize()
rootdir = "AdmiOS/"
--API LOAD
os.loadAPI(rootdir .. "apis/gui")
os.loadAPI(rootdir .. "apis/osinfo")
--os.loadAPI(rootdir .. "apis/cfg")
--print("CONFIG API LOADED")
--API LOAD END
--GETCFG
local config = fs.open(rootdir .. "os.conf", "r")
bg = config.readLine()
config.close()
function desktop()
term.setBackgroundColor(bg)
term.clear()
term.setBackgroundColor(colors.lightBlue)
term.setCursorPos(1,1)
term.clearLine()
term.setTextColor(colors.white)
term.setBackgroundColor(colors.green)
term.setCursorPos(1,1)
print("Start")
end
function start()
term.setBackgroundColor(colors.blue)
term.setTextColor(colors.white)
term.setCursorPos(1,2)
print(" ")
sleep(0.1)
term.setCursorPos(1,3)
print("Shut Down ")
end
desktop()
while true do
local event, button, X, Y = os.pullEvent("mouse_click")
if X>=1 and X<=5 and Y==1 and button==1 then
menu = 1
start()
else
desktop()
end
end
The os.conf file just has a 8.
When i try to print bg it just says 8. Works fine