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

Way To Get Arguments For An Api Function

Started by johnnic, 09 August 2013 - 07:10 PM
johnnic #1
Posted 09 August 2013 - 09:10 PM
I was writing a program of mine, an editor, and I have it so I can automatically insert an API function. I was wondering if there is a way to get the arguments that it may or may not need and add them, like this:

rs.setOutput(sSide, sBool)
Instead of:

rs.setOutput()
Thanks in advance.
Kingdaro #2
Posted 09 August 2013 - 09:34 PM
Not automatically. You'll just need to make a database of functions with the arguments needed stored as well.
johnnic #3
Posted 09 August 2013 - 10:02 PM
Not automatically. You'll just need to make a database of functions with the arguments needed stored as well.
Thanks. Well this is now 1000 times harder.
mz2212 #4
Posted 10 August 2013 - 05:16 AM
what you can do is

RSide = "right"
local function setOutput(sSide, sBool)
  if sSide == nil then
	rs.setOutput(RSide, 0)
  else
	rs.setOutput(sSide, sBool)
  end
end

Thats really the best I know how to do…
immibis #5
Posted 11 August 2013 - 08:24 AM
what you can do is

RSide = "right"
local function setOutput(sSide, sBool)
  if sSide == nil then
	rs.setOutput(RSide, 0)
  else
	rs.setOutput(sSide, sBool)
  end
end

Thats really the best I know how to do…
That's not what he asked for.