Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-26-2007, 06:03 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
makevar with array?

This won't work:
PHP Code:
makevar("this.something[0]") = "just testing";
echo(
this.something[0]); 
I could do:
PHP Code:
makevar("this.something")[0
but what I really want to do is this:

PHP Code:
makevar("this.something[0].whatever") = "just testing"
Is there any way to get makevar to work with arrays like this?

Thanks.
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #2  
Old 06-26-2007, 06:04 PM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Quote:
Originally Posted by JkWhoSaysNi View Post
This won't work:
PHP Code:
makevar("this.something[0]") = "just testing";
echo(
this.something[0]); 
I could do:
PHP Code:
makevar("this.something")[0
but what I really want to do is this:

PHP Code:
makevar("this.something[0].whatever") = "just testing"
Is there any way to get makevar to work with arrays like this?

Thanks.
Why not use (@"this.something")[0].(@"whatever"); ?
Reply With Quote
  #3  
Old 06-26-2007, 06:15 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
hmm actually that doesnt seem to work either

PHP Code:
temp.test "something";
this.(@temp.test)[0] = 5;
echo(
this.something[0]); 
echos null.
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #4  
Old 06-26-2007, 07:42 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Well I see the problem.

"something[0]" becomes a variable name listed in getVarNames() it doesn't treat it as an array at all
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #5  
Old 06-26-2007, 08:11 PM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Quote:
Originally Posted by JkWhoSaysNi View Post
hmm actually that doesnt seem to work either

PHP Code:
temp.test "something";
this.(@temp.test).add(5);
echo(
this.something[0]); 
echos null.

PHP Code:
temp.test "something";
this.(@temp.test) = new[1];
this.(@temp.test)[0] = 5;
echo(
this.something[0]); 

I'd try that. As a blank string, I don't think [0] is even created... The variable type isn't set yet. By doing the
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 08:40 PM.


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