Posted 13 May 2015 - 10:47 AM
So I had a homescreen function and I wish to return some data from the page as to which program I wanted to run…
So I wish to run the home screen, and it should return what to run next, this then will pick up the function and the arguments and then pass them to the function. I then also need to pass the arguments back.
So my question how do you grab the first argument and then the rest after in a table? and then unpack them? to the function?
I also have a feeling this is like coroutines, where you pass arguments back and forth to coroutines?
is like:
or is it that? or different? also can someone even maybe explain how this would work with a coroutine? xD
Moderator: Please do not move this topic, it's completely separate and I added the bit on the bottom as the other post wasn't getting replies anymore.
function home(page)
-- do something
if page then
print("worked")
else
print("nope")
end
return runtest, "hello"
end
function runtest(text)
print(text)
return true
end
So I wish to run the home screen, and it should return what to run next, this then will pick up the function and the arguments and then pass them to the function. I then also need to pass the arguments back.
So my question how do you grab the first argument and then the rest after in a table? and then unpack them? to the function?
I also have a feeling this is like coroutines, where you pass arguments back and forth to coroutines?
is like:
local foo, args = home()
and args will be a table of the rest of the args?local foo, {args} = home()
or is it this?local foo, ... = home()
or is it that? or different? also can someone even maybe explain how this would work with a coroutine? xD
Moderator: Please do not move this topic, it's completely separate and I added the bit on the bottom as the other post wasn't getting replies anymore.