Posted 15 November 2018 - 04:12 PM
Spoiler
So, I'm trying to make a command handler, when I run the file, it fails with a nil value, which the weird thing is, it's a copy paste of a previous value, only the file, and variable name changed….Main File
local lvl = loginutils.levelCheck()
if fs.exists("/system/settings/system/cmdlevels.lua") then print("Found") end --returns 'Found'
print(lvl) - returns nil
-- ^broken
local settings = loginutils.loadUserConf(cuser)
local perms = settings["Perms"]
print(perms) - returns correct value
--^works
loginutils
function levelCheck()
local file = fs.open("/system/settings/system/cmdlevels.lua", "r")
local lvl = textutils.unserialize(file.readAll())
file.close()
return lvl
end
function loadUserConf(cuser)
local file = fs.open("/system/settings/users/"..cuser..".lua", "r")
local settings = textutils.unserialize(file.readAll())
file.close()
return settings
end
cmdlevels
{
['shutdown']='1',
['reboot']='1'
['help']='1',
['Dummy']='',
['returntoshell']='3',
['update']='3',
['adduser']='4',
['removeuser']='4',
['reset']='5',
}
Any ideas?
Edited on 15 November 2018 - 03:35 PM