Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-06-2009, 04:04 AM
Programmer Programmer is offline
Coder
Programmer's Avatar
Join Date: Jan 2008
Location: -78.464422, 106.837328
Posts: 449
Programmer has a spectacular aura aboutProgrammer has a spectacular aura about
Send a message via AIM to Programmer Send a message via MSN to Programmer Send a message via Yahoo to Programmer
Quote:
Originally Posted by Loriel View Post
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.
Try:

PHP Code:
function Foo(barbaz)
{
    echo({ 
barbaz });
    echo(
params);
}

Foo(12true999); 
Will echo:
HTML Code:
1, 2
-- Comment: 'true' is represented as 1.
1, 2, 1, 999
Quote:
Originally Posted by Loriel View Post
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?
0 in Graal is literally translated as 'null', and will print absolutely nothing to the RC. An empty string literal will obviously print nothing as well.

Quote:
Originally Posted by Loriel View Post
I think it is indeed dissimilar, because I could call that function with a single array instead of a list of parameters.
In C#, it's similar in this manner:
PHP Code:
// C#
private void Foo(params object[] parameters)
{
     var 
bar parameters[0];
     var 
baz parameters[1];
     
     
Console.WriteLine("Result: " bar ", " baz);
}

Foo(12);

// OUTPUT:
// Result: 1, 2 
__________________
- Iᴀɴ Zɪᴍᴍᴇʀᴍᴀɴ
Reply With Quote
Reply


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 09:07 PM.


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