Posted 28 December 2012 - 11:43 AM
In attachment minimalized version of my multitasking OS
to boot it, you have to place it in computer root directory(or change path in boot file)
I found few bugs with environment:
1st: When you boot my OS(run boot), after few seconds everything runs and you can see error "task 'tty1' has errored": ttyManager:37: attempt to call nil" line 37 of bin/ttyManager is:
2nd bug is workaround the 1st bug:
And to avoid some interpretations, _G isn't global for every function in lua 5.2 there is _ENV which is only one and global environment. If _G would be global, then it would mess up all multitasking code in bin/netOS
But please first fix 1st bug and then 2nd ;)/>
[attachment=827:netOS.zip]
to boot it, you have to place it in computer root directory(or change path in boot file)
I found few bugs with environment:
1st: When you boot my OS(run boot), after few seconds everything runs and you can see error "task 'tty1' has errored": ttyManager:37: attempt to call nil" line 37 of bin/ttyManager is:
local function TTY(n, _f, PID) --line 31
local fnFile, err = loadfile( fs.combine(os.getPath(), "/bin/lua" ))
if fnFile then
-- _G = getfenv() ------------BUG, also workaround another bug
term._write("test not global")
getfenv().term._write("test getfenv") ------BUG getfenv isn't equal to _G
_G["term"]._write("test global") -----------BUG getfenv isn't equal to _G
local _api = _G
local tEnv = {}
setmetatable( tEnv, { __index = _api } )
setfenv( fnFile, tEnv )
end
login(os.version().."\n TTY "..tostring(n), fnFile, PID)
end --line 44
I don't know how it happen to happen, as far as I know in lua it is impossible that getfenv() isn't equal to _G variable2nd bug is workaround the 1st bug:
_G = getfenv()
According to lua documentation: http://www.lua.org/m...ual.html#pdf-_gSo, this workaround shouldn't work.Lua itself does not use this variable [_G] ; changing its [_G] value does not affect any environment
And to avoid some interpretations, _G isn't global for every function in lua 5.2 there is _ENV which is only one and global environment. If _G would be global, then it would mess up all multitasking code in bin/netOS
But please first fix 1st bug and then 2nd ;)/>
[attachment=827:netOS.zip]