Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   Editing params (https://forums.graalonline.com/forums/showthread.php?t=73358)

Chandler 04-08-2007 10:14 AM

Editing params
 
Would it be possible for this feature to be added:

PHP Code:

this.doActionTest(5.66"heya!");
function 
onActionTest(int(moneyValue), string.substring(2))
  echo(
temp.moneyValue SPC temp.string); 

Would return

PHP Code:

6 ya

I think it'd be usefull although it could cause problems... :[

killerogue 04-08-2007 10:35 AM

Would be nice. And useful in some cases.

Twinny 04-08-2007 01:14 PM

You could produce those outputs in the function itself...

Chandler 04-08-2007 02:56 PM

Quote:

Originally Posted by Twinny (Post 1297973)
You could produce those outputs in the function itself...

What is your point? :p

Novo 04-08-2007 03:50 PM

PHP Code:

this.doActionTest(5.66"heya!");
function 
onActionTest(moneyValuestring)
  echo (
inttemp.moneyValue SPC temp.string.substring(2) ); 

You can't put functions inside the parameters: They are more like a declaration of variables than anything else. Making functions act within the parameters is completely non-conformist and actually goes further to impair the concept of general coding in higher-level languages.

Put it this way: You can't act on the variables themselves because they do not have a name (yet). If anything, the result of that would be the variable name being the outcome of the function itself.

Chandler 04-08-2007 03:54 PM

Quote:

Originally Posted by Novo (Post 1298016)
PHP Code:

this.doActionTest(5.66"heya!");
function 
onActionTest(moneyValuestring)
  echo (
inttemp.moneyValue SPC temp.string.substring(2) ); 

You can't put functions inside the parameters: They are more like a declaration of variables than anything else. Making functions act within the parameters is completely non-conformist and actually goes further to impair the concept of general coding in higher-level languages.

Put it this way: You can't act on the variables themselves because they do not have a name (yet). If anything, the result of that would be the variable name being the outcome of the function itself.

You're right. Thanks

Admins 04-12-2007 01:50 AM

Sometimes it is better to use more script lines when it improves the readibility of the script. So it would be better to write moneyValue = int(moneyValue); in the next line instead of adding some hacky way of manipulating it directly in the function header. In some programming languages you can define conditions for the input variables, although it is probably more easy to write those checks at the beginnig of the function.


All times are GMT +2. The time now is 09:52 PM.

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