Yes. Have a table of functions like:
local t_func = {
receivefile = function(flnm)
local cntnt
flnm,cntnt = flnm:match("(%S+)%s*(.*)")
local hndl = fs.open(flnm,"w") hndl.write(cntnt) hndl.close()
rednet.send(controllerID,flnm.." Updated")
end,
servefile = function(flnm)
flnm = flnm:match("%S+")
local hndl = fs.open(flnm,"r")
rednet.send(controllerID,hndl.readAll()) hndl.close()
executefile = function(prms)
local tprm = {prms:gmatch("%w+")}
shell.run(unpack(tprm))
rednet.send(controllerID,tprm[1].." executed")
end,
}
Then have a part of your rednet receive logic loop that looks like:
repeat senderID,rdntmessage = rednet.receive() until senderID == controllerID
funcname, parameterstring = rdntmessage:match("^(%a+)%s*(.*)")
if t_func[funcname] then t_func[funcname](parameterstring) end
What this does is take a rednet messages until it finds one that comes from the controllerID. Then it tries to parse that into an initial alphanumeric sequence and whatever comes after a space (example, "receivefile somefilename Something to put in the file." should produce a funcname = "receivefile" and a parameterstring = "somefilename Something to put in the file.").
Then it checks if there is a function in t_func matching funcname, and if there is, it calls that function with parameterstring as an argument. The functions are all designed to further parse the parameterstring into something useful to them. The function t_func.receivefile takes its string and strips off the first part to use as a filename, then uses the rest as the file contents.
You can also set this up using textutils.unserialize() to unpack a table of information, but this only works if you're going to have a setup on the controller that uses textutils.serialize() to pack the information, which is certainly possible and probably a better way to present a clean user interface on the controller.
Ugh, posted the wrong version of receive file. And what happened to the indentation there?