Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Graal V4 Main Forum (https://forums.graalonline.com/forums/forumdisplay.php?f=143)
-   -   Function Argument Defaults (https://forums.graalonline.com/forums/showthread.php?t=63340)

Tom 01-10-2006 07:47 PM

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;



ApothiX 01-10-2006 07:56 PM

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.

Tom 01-10-2006 07:58 PM

It still should be have defaults set... Let's say if we WANT "" to be a possibility!

ApothiX 01-10-2006 08:03 PM

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.

Tom 01-10-2006 08:05 PM

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!

ApothiX 01-10-2006 08:08 PM

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? :confused:

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.

Yen 01-10-2006 10:06 PM

>_>
<_<
Graal != C++

Rick 01-10-2006 10:26 PM

HTML Code:

function somefunc(/*arg1, arg2*/)
{
  temp.arg1 = params.size() > 0 ? params[0] : "default";
  temp.arg2 = params.size() > 1 ? params[1] : "default";
}

I win.

CheeToS2 01-10-2006 11:34 PM

Moved to the main forum :)


All times are GMT +2. The time now is 08:40 PM.

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