Is it possible to have a function return more than one result consisting of different variables? and if so, how?
E.g. Have a function return both a boolean and an integer
Is it possible to have a function return more than one result consisting of different variables? and if so, how?
E.g. Have a function return both a boolean and an integer
sure, just with it in the header
it will return a boolean as the resultSimba Code:function something(var i: Integer): Boolean;
and it will return a integer in i
~shut
All my scripts are held on Googlecode git, so if you ever see a problem, fork it and send me a pull request
If a script is grey, it doesn't work, if it's colour then it does!
My Tutorials:-
Everything you need to know about setting up Simba, SRL and Reflection!, How to sort out the MSVCR71.dll error
How to set up players for autoing with Simba, SRL/Simba Standards (with examples), Defines
Auto Updater and Git, Using a testing branch for git, Adding SRL Stats to your script
Creating your own font set for Simba, Guide to Cups, How to make 1.45M (RSGP) a day (not really my tut)
Download a image and set it as your Desktop Wallpaper in C#, How to make your first PHP file uploader
<Coh3n> Shuttleu, fuck I love you right now
Yes in create a type and make it return that,
Type
boolInt = record
bool = Boolean;
Number = Integer;
and then do Func Name:boolInt;
and use it by
Function Derp():boolInt;
Her := Derp();
then Her.bool = true/false
and Her.Number will be a interger
E: Look at shut who ninja'd me it is so much simpler i forgot about itmine is long winded
Originally Posted by DD on IRC
ah, I slightly get it but I've got a few more questions, if you don't mind
Once the function runs how would the results be set e.g.:
Simba Code:function something(var i: Integer): Boolean;
begin
if something then
result := true //boolean
result := 44
end;
would that set both variables or am i doing it wrong?
Edit: @Troll: i'm gonna try it now, brb
Last edited by HT BaaFly; 01-03-2012 at 08:23 PM.
All my scripts are held on Googlecode git, so if you ever see a problem, fork it and send me a pull request
If a script is grey, it doesn't work, if it's colour then it does!
My Tutorials:-
Everything you need to know about setting up Simba, SRL and Reflection!, How to sort out the MSVCR71.dll error
How to set up players for autoing with Simba, SRL/Simba Standards (with examples), Defines
Auto Updater and Git, Using a testing branch for git, Adding SRL Stats to your script
Creating your own font set for Simba, Guide to Cups, How to make 1.45M (RSGP) a day (not really my tut)
Download a image and set it as your Desktop Wallpaper in C#, How to make your first PHP file uploader
<Coh3n> Shuttleu, fuck I love you right now
it it has var before it then it is a input and a output
but if it does not then it is just a input
~shut
All my scripts are held on Googlecode git, so if you ever see a problem, fork it and send me a pull request
If a script is grey, it doesn't work, if it's colour then it does!
My Tutorials:-
Everything you need to know about setting up Simba, SRL and Reflection!, How to sort out the MSVCR71.dll error
How to set up players for autoing with Simba, SRL/Simba Standards (with examples), Defines
Auto Updater and Git, Using a testing branch for git, Adding SRL Stats to your script
Creating your own font set for Simba, Guide to Cups, How to make 1.45M (RSGP) a day (not really my tut)
Download a image and set it as your Desktop Wallpaper in C#, How to make your first PHP file uploader
<Coh3n> Shuttleu, fuck I love you right now
ok thanks a lot man I love you
+ripped everyone that helped
Don't rep me.. only stating what troll posted.
Simba Code:program new;
type
return = record
Int: Integer;
bool: Boolean;
end;
Function Returnstwo(I: integer): return;
begin
Result.bool:= true;
Result.Int:= 3;
end;
I am Ggzz..
Hackintosher
thanks a lot for making it clearerjust one question about troll's method: outside of the function, how would you set the result
e.g.:
boolean := Returnstwo;
int := Returnstwo;
simple as that or what?
Simba Code:Var
I : Integer;
B : Boolean;
I := Returnstwo.Int
B := Returnstwo.bool
much much clearer now thanks to everyone![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)