Graal Forums  

Go Back   Graal Forums > Private forums > Graal4 Forums > Graal V4 Main Forum
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 01-10-2006, 07:47 PM
Tom Tom is offline
Grraaaaaw
Tom's Avatar
Join Date: May 2005
Posts: 2,037
Tom is on a distinguished road
Function Argument Defaults

Other problems encountered is function argument defaults aren't set.

PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
player.chat test(); // Returns "Error: No text"
}

function 
testtexx "Pete" )
{
  if (
texx == "")
    return 
"Error: No text";

  return 
texx;

  #2  
Old 01-10-2006, 07:56 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
I don't think there was intent for default arguments to be set o_O

PHP Code:
function Foo(bar) {
  if(
bar == ""bar "Default Text";

You could just use that to set default arguments.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
  #3  
Old 01-10-2006, 07:58 PM
Tom Tom is offline
Grraaaaaw
Tom's Avatar
Join Date: May 2005
Posts: 2,037
Tom is on a distinguished road
It still should be have defaults set... Let's say if we WANT "" to be a possibility!
  #4  
Old 01-10-2006, 08:03 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Tom
It still should be have defaults set... Let's say if we WANT "" to be a possibility!
Then you should make it in the form of a suggestion, not a bug.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
  #5  
Old 01-10-2006, 08:05 PM
Tom Tom is offline
Grraaaaaw
Tom's Avatar
Join Date: May 2005
Posts: 2,037
Tom is on a distinguished road
I do believe it was possible, however, in the former versions. Likewise, it does not generate any errors when I do put defaults in the function, thereby, it would be characterized as a bug because it does not report it as the feature isn't there. It just doesn't work!
  #6  
Old 01-10-2006, 08:08 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Tom
I do believe it was possible, however, in the former versions.
I don't remember there being any mention of default parameters?

Quote:
Originally Posted by Tom
Likewise, it does not generate any errors when I do put defaults in the function, thereby, it would be characterized as a bug because it does not report it as the feature isn't there. It just doesn't work!
Just because it's legitimate syntax-wise does not mean it's an implemented feature.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
  #7  
Old 01-10-2006, 10:06 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
>_>
<_<
Graal != C++
  #8  
Old 01-10-2006, 10:26 PM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
HTML Code:
function somefunc(/*arg1, arg2*/)
{
  temp.arg1 = params.size() > 0 ? params[0] : "default";
  temp.arg2 = params.size() > 1 ? params[1] : "default";
}
I win.

Last edited by Rick; 01-10-2006 at 11:35 PM..
  #9  
Old 01-10-2006, 11:34 PM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Moved to the main forum
__________________

 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:32 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.