Posted 13 May 2014 - 11:13 PM
When defining a function, how do I pass it's parameters to be parameters of a function it calls? I.e.
and a person would then call monWrap(left). Or, for another example, if I want to pass program arguments to be parameters of a shell command,
I feel like there's a lot wrong with that second one. How do I do this properly? I know this is elementary programming but I can't figure it out.
function monWrap(location)
mon = peripheral.wrap("location")
end
and a person would then call monWrap(left). Or, for another example, if I want to pass program arguments to be parameters of a shell command,
local arg = { ... }
function reload(filename,code)
fs.delete(filename)
shell.run("pastebin get "code" "filename)
end
if #args ~= 2
reload(arg[1],arg[2])
end
I feel like there's a lot wrong with that second one. How do I do this properly? I know this is elementary programming but I can't figure it out.