Posted 29 February 2012 - 02:50 PM
ComputerCraft Version Information: 1.3 Client / 1.3 Server
Description of Bug:
unloadAPI doesn't unload the API properly.
Steps to Reproduce Bug:
In unloadAPI's code in the 'bios.lua' there's a typo.
Original code:
In the 4th line sName should be _sName, so that it looks like this:
Suggestion:
It might also be useful to return a boolean value to be able to determine if the unloading was successful or not.
Because even with the fix above if someone tries to unload the API using e.g. a string as an argument, there won't be any error message at the moment.
Description of Bug:
unloadAPI doesn't unload the API properly.
Steps to Reproduce Bug:
- Load any API with os.loadAPI("someApi")
- Try to unload it with os.unloadAPI(someApi)
- Expected: _G.someApi should be nil, because the API should've been unloaded.
- Observed: _G.someApi still holds a table while this error message occurs on trying to unload the API: bios:313: table index expected, got nil
In unloadAPI's code in the 'bios.lua' there's a typo.
Original code:
function os.unloadAPI( _sName )
if _sName ~= "_G" and type(_G[_sName] == "table") then
bProtected = false
_G[sName] = nil
bProtected = true
end
end
In the 4th line sName should be _sName, so that it looks like this:
function os.unloadAPI( _sName )
if _sName ~= "_G" and type(_G[_sName] == "table") then
bProtected = false
_G[_sName] = nil
bProtected = true
end
end
Suggestion:
It might also be useful to return a boolean value to be able to determine if the unloading was successful or not.
Because even with the fix above if someone tries to unload the API using e.g. a string as an argument, there won't be any error message at the moment.
Edited on 29 February 2012 - 02:19 PM