|
| 11 Jul 2015 10:47 AM |
say I used a pre-made function to get something in my newer function, and the pre-made function would return multiple values, and then I just do return func(stuff) would that return ALL the values that where returned by the pre-made function? cos it doesn't work like that for me :/
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 10:52 AM |
You mean this?
function numbers() return 1, 2, 3 end
local one, two, three = numbers() print(one, two, three)
> 1 2 3 |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 10:54 AM |
function test() return 1, 2, 3 end
function do() return test() end
print(do())
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 10:57 AM |
| What happens when you run the above..? |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 11:02 AM |
well this, haven't tried yet, but other code, bugs the hell out... I even printed all 3 values and it printed numbers, then when I returned thatFunc(stuff) from the other function it returned 1 number, the 1st one... I even printed before returning that number print(thatFunc(stuff)) and it only printed the 1st number :/
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 11 Jul 2015 11:13 AM |
That's how returns work. You can only pass one tuple, or else it will only give you the first value from the set.
function X() return 1,2,3 end
print(X(), 1)
>1 1 |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 11:15 AM |
weird... I tried just now
h, m, s = myFunc(stufff) return h, m, s
and it still only printed the first one :/
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 11 Jul 2015 11:16 AM |
| that's obviously not you're entire code. Show what you are doing. There is neither a print call nor a definition of myFunc in those two lines |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 11:22 AM |
sry it's just that I want to keep it secret for at least some time, since I know a few dudes that are pretty competative and can take my idea and stuff :/ all I can say right now is
['funciton'] = function(stuff) num1 = stuff num2 = stuff / lala num3 = num2 / otherLala --I did print after all these and everything was fine return num1, num2, num3 end
then in the other function I call this one and well get only the first :/
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 11:23 AM |
Kap, without code, we cannot help.
Chances are whatever you're doing I can find in a free model anyway. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 11:27 AM |
war, u felt with ur butt that ur one of those competative c*nts! XDDD man, u always crack me up! XDDD anyways, I wouldn't say so, and even if it can be found, am doing this mostly for myself :P
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 11:28 AM |
If you're doing it for yourself then don't ask for help, figure it out.
Honestly I couldn't care less what you're making. I'm trying to help lol. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 11:33 AM |
I know u from the start war :/ ya grab the idea, shove the person's head up their arse and start crackin' on the stolen idea, and u showcase it XDDD anyways... I have to solve like 99% of my problems so I guess I'll fix this idiotic problem pretty soon...
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 11:35 AM |
What's with the bad words. :C
This isn't what this sub-forum is about.
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 11:37 AM |
not bad, it's like a joke, but true XD
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 11:39 AM |
Kap, I also know you.
You'll come here with a CFrame problem (or what you think is a CFrame solution) Then MrNicNac will come along and either A) Solve your problem, or B) Tell you what's wrong with your solution so that you can start whining about how it should work.
And I don't steal ideas, I help people here all the time, I haven't stolen a single idea.
This is the current situation, read it and tell me if it sounds like you'll get help:
Guy comes to Scripters Asks for help but gives no code Gets asked for code Gives code that isn't his real code, this code works, but he claims it does not in his "real code" Gets asked for code again Won't code because he's afraid of copiers.
You come asking for help with your code, but won't give your code? Do you expect us to be mind-readers or what? |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 11:44 AM |
war, I had forgotten that ALL BaseParts have their faces individually, meaning different rotations, it's now that I could fix the problem of urs (that u had before) but back then I didn't think properly, I just went head first into the problem instead of the opposite...
well I dunno... ya might want to compete as always XD
em, these examples are fairly accurate, to what my real code looks like... but now I think the problem is with __add
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 11:50 AM |
@warspyking Code or not, the problem at hand is, to my understanding, obvious.
function foo() return 1,2,3; end print(foo(), 1); > 1 1
I think @Kap wants it to print [1 2 3 1] as opposed to what it does. This is something with Lua's tuples, not his code. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 11:59 AM |
| Cynical, that does happen? Interesting. I never knew that. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 12:03 PM |
same
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 12:08 PM |
The same happens with tables too, interestingly. I'm going to assume this is a language-level thing and not ROBLOX.
function foo() return 1,2,3; end print(table.concat({foo()}, " "); > 1 2 3 print(table.concat({foo(),1}, " "); > 1 1
You might have better luck asking this on StackOverflow or similar, as this is more of a Lua thing than ROBLOX can help.
I'm equally as curious to know a solution now. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 12:12 PM |
:/ seems so weird though :/ I wonder if strings would work with this kinda thing :/
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 11 Jul 2015 12:50 PM |
You may also find it productive to know that if you do (...) where ... is a tuple, it strips it to the first value.
If you need to combine tuples consider merging them in tables. Also no code = no help. Your example code is obviously not what you're doing. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 01:13 PM |
em, well I guess then Tables will be better, but then sadly more organizing and stuff to do :'(
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 01:13 PM |
This is really basic, I've known this for a long time lol.
function ReturnDatTuple() return 1, 2, 3 end
funtion PrintDatTupleWith(n) local Results = {ReturnDatTuple()} Results[#Results+1] = n print(unpack(Results)) return Results end
Pretty simple example. You can combine tuples and such if you join tables together, you can do this easily with my table module:
local table = require(ID)
function Tuple1() return 1, 2, 3 end
funtion Tuple2() return 4, 5, 6 end
function JoinTuplesAndValues(...) return unpack(table.join(Tuple1(), Tuple2(), ...)) end
Should return 1, 2, 3, 4, 5, 6, and any values you passed to JoinTuplesAndValues |
|
|
| Report Abuse |
|
|