Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 02-06-2009, 02:45 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by Programmer View Post
params[] is set to the total sum of the variables passed into a function. Consider the following:

PHP Code:
function Foo(barbaz)
{ ... }

Foo(12true999); 
I cannot quite get this to work. I inserted echoo({bar, baz}); into the function body for testing. Indeed it outputs 1,2 as I expected.

Quote:
And thus, the above function can literally be transcribed into:

PHP Code:
function Foo()
{
    
bar params[0];
    
baz params[1];

Now when I do this, the output is "",0. If I say echo(params), I do not get any output at all. Am I missing something here?

Quote:
This is not dissimilar to C#'s implementation of parameters, if you're into that:
PHP Code:
// C#
private void Foo(params object[] parameters)
{
     var 
bar parameters[0];
     var 
baz parameters[1];

I think it is indeed dissimilar, because I could call that function with a single array instead of a list of parameters.
Reply With Quote
 


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 02:19 PM.


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