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

Extending Existing API's

Started by Dlcruz129, 10 February 2013 - 06:37 AM
Dlcruz129 #1
Posted 10 February 2013 - 07:37 AM
So, I'm gonna extend some already existing API's, and add neat features such as rednet.openAll() I can't do:

function rednet.openAll()
  ...
end

and I can't do:


rednet = {}
rednet.openAll()
  ...
end

The first one attempts to write to a global API, which is not allowed, and the second one, of course, would wipe out rednet. Does anyone know if it is possible to extend APIs? Thanks.
Orwell #2
Posted 10 February 2013 - 07:39 AM
This should work:

rednet.openAll = function()
  -- body
end
Eric #3
Posted 10 February 2013 - 07:53 AM
Your first method should work just fine.
Dlcruz129 #4
Posted 10 February 2013 - 08:09 AM
bios:267: Attempt to write to global

Btw I'm doing this on tekkit.
KaoS #5
Posted 10 February 2013 - 08:12 AM
ok then


rawset(rednet,"openAll",function()
--
end)
ChunLing #6
Posted 12 February 2013 - 11:33 AM
Orwell's method should work fine.