|
| 14 Feb 2014 06:09 PM |
I invoke a remote function, and it calculates two values that I need. Example:
local shoot = workspace.Shoot local pistolDamage = 14.999999 local rifleDamage = 3
function shoot.OnServerInvoke(player, arg1, arg2)
local calculatedA = arg1%arg2 local calculatedB = arg2%arg1
print(calculatedA) print(calculatedB)
return calculatedA,calculatedB end
That is just an example of how my code is set up. I am not using the server to calculate remainders. However, calculatedA and calculatedB are both printed, so I know that they're not nil. Back in my local script though:
local calcA, calcB = workspace.rFunction:InvokeServer(5,8) print(calcA) print(calcB)
> 5 > nil
Are remote functions unable to return multiple values? |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2014 06:10 PM |
| No, they can't, neither can ModuleScripts, it's very annoying. |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2014 06:13 PM |
They seem broken atm.
02:13:03.542 - OnServerInvoke is not a valid member of RemoteFunction
however they should, as the parameter is a tuple(multiple arguments)
OnServerInvoke Parameters: Player player, Tuple arguments |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2014 06:14 PM |
But you can simply use a table as an argument to go past this issue :)
However I recommend using RemoteEvents as they're superior. |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2014 06:30 PM |
| Off Topic: Does anyone know if ROBLOX patched freezing your health with Cheat Engine? |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 14 Feb 2014 06:36 PM |
No
OP, it should work.
t = function(a, b) return (a..b), (b..a) end
ab, ba = t("T", "b") print(ab..ba) |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2014 06:44 PM |
| FML. RemoteFunctions return the second value, but crash when the ray is pointing to the void. RemoteEvents won't return tables. |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 14 Feb 2014 06:49 PM |
Modulescripts.
I know for a fact they can return multiple values |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2014 06:52 PM |
| @lol: No they can't(a table is a single value, which is what I just used in both events/functions). Both of your posts are in contradiction with already-posted answers that are correct. If you don't know what you're talking about, then don't post. |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
| |
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
| |
|
|
| 14 Feb 2014 06:59 PM |
Are you a complete idiot? Did you not even read the title? The issue is with REMOTE FUNCTIONS not being able to return multiple values.
Man -- clannies are so FREAKING STUPID these days. |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 14 Feb 2014 07:01 PM |
| Oh my bad, you are right regarding modulescripts. Why not a _G table? |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 14 Feb 2014 07:03 PM |
| What's the point of Remote Functions anyway? They seem useless anyhow. |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2014 07:03 PM |
| Please, just go away. If I want to return multiple values with a ModuleScript, I can just use a table -- you obviously don't know what you're talking about. Just leave. |
|
|
| Report Abuse |
|
|
nramsey
|
  |
| Joined: 20 Dec 2013 |
| Total Posts: 1298 |
|
|
| 15 Feb 2014 01:16 AM |
| EchoReaper: Please politely express your frustrations. |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2014 01:19 AM |
"Please, just go away."
I did. |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2014 03:51 AM |
Also,
"If you don't know what you're talking about, then don't post."
Keyboard not found. Press F1 to continue. |
|
|
| Report Abuse |
|
|
Usering
|
  |
| Joined: 18 Aug 2012 |
| Total Posts: 10281 |
|
|
| 16 Feb 2014 03:54 AM |
| This worked for me, but not functions. I sent a string through them as the first argument and it worked, then a function to be called on the receiving end and that didn't work. |
|
|
| Report Abuse |
|
|