generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How can I work with tables in java script?

Previous Thread :: Next Thread 
j00NotAScripter is not online. j00NotAScripter
Joined: 17 Aug 2011
Total Posts: 60
31 Aug 2011 05:37 PM
I dont know if there are tables, but I want it like in Lua it would be.

OriginalName = {
"Sorcus",
"ArecusInator",
"Tenal",
"61352151511",
}

NewNames = {
"A Troll",
"Arecus",
"Emess",
"Mitch",
}

And then blah blah, change the text to NewName. But how would I do this?

~ Mitch
Report Abuse
Piedude777 is not online. Piedude777
Joined: 01 Oct 2008
Total Posts: 10017
31 Aug 2011 05:39 PM
It's called an array.

public string[] table = new string[4]
Report Abuse
Piedude777 is not online. Piedude777
Joined: 01 Oct 2008
Total Posts: 10017
31 Aug 2011 05:40 PM
Oops! I thought you were asking Java, not JavaScript...
Report Abuse
j00NotAScripter is not online. j00NotAScripter
Joined: 17 Aug 2011
Total Posts: 60
31 Aug 2011 05:42 PM
stupid name similarities

~ Mitch
Report Abuse
t6e is not online. t6e
Joined: 25 Dec 2010
Total Posts: 587
31 Aug 2011 05:43 PM
var types = new Array("Troll","Lord");
var people = new Array("Dap300","Myrkos");
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
31 Aug 2011 05:45 PM
var whyDon'tIEverUseThingsMySchoolTeachesMe = new Array("fruit");
Report Abuse
Tenal is not online. Tenal
Joined: 15 May 2011
Total Posts: 18684
31 Aug 2011 05:48 PM
[ Content Deleted ]
Report Abuse
j00NotAScripter is not online. j00NotAScripter
Joined: 17 Aug 2011
Total Posts: 60
31 Aug 2011 05:49 PM
okay, and a for loop. How would I use the # operator? Is it the same?

for(1, #OldNames)

or something.

~ Mitch
Report Abuse
Piedude777 is not online. Piedude777
Joined: 01 Oct 2008
Total Posts: 10017
31 Aug 2011 05:50 PM
foreach (String str in OldNames)
{

}

???
Report Abuse
Tenal is not online. Tenal
Joined: 15 May 2011
Total Posts: 18684
31 Aug 2011 05:50 PM
[ Content Deleted ]
Report Abuse
booing is not online. booing
Joined: 04 May 2009
Total Posts: 6594
31 Aug 2011 05:52 PM
array.length
var b = new Array();
b = {"a","b","c"}
for (var i in b) {
document.write(b[i])
}
Report Abuse
j00NotAScripter is not online. j00NotAScripter
Joined: 17 Aug 2011
Total Posts: 60
31 Aug 2011 05:54 PM
ok lets just say

for A = 1, 3 do

What would that be?

for (Item in 3)

That probably fails

~ Mitch
Report Abuse
Aaaboy97 is not online. Aaaboy97
Joined: 05 Apr 2009
Total Posts: 6612
31 Aug 2011 05:56 PM
I believe it is:

for (var A = 1; A < 3; A++) {
// stuff
}
Report Abuse
booing is not online. booing
Joined: 04 May 2009
Total Posts: 6594
31 Aug 2011 05:56 PM
for (i=1;i<4;i++) {
document.write(i);
}
1
2
3
Report Abuse
j00NotAScripter is not online. j00NotAScripter
Joined: 17 Aug 2011
Total Posts: 60
31 Aug 2011 05:57 PM
I have this so far

var OldNames=new Array();
OldNames[1] = "Sorcus";
OldNames[2] = "61352151511";
OldNames[3] = "Tenal";
var NewNames=newArray();
NewNames[1] = "A Troll";
NewNames[2] = "Mitch";
NewNames[3] = "Emess";

function FIX() {
var x=document.getElementsByTagName("A");
for (Item in x) {
for (var i in OldNames){
if (x[Item].innerText==OldNames[i]) {
x[Item].alt = x[Item].innerText;
x[Item].innerText = NewNames[i];
}
}
}

FIX();

The console says Unexpected end of input

On the last line
Report Abuse
booing is not online. booing
Joined: 04 May 2009
Total Posts: 6594
31 Aug 2011 06:00 PM
new type
not newtype
Report Abuse
j00NotAScripter is not online. j00NotAScripter
Joined: 17 Aug 2011
Total Posts: 60
31 Aug 2011 06:04 PM
Ahh thanks, but I still get the same error

~ Mitch
Report Abuse
j00NotAScripter is not online. j00NotAScripter
Joined: 17 Aug 2011
Total Posts: 60
31 Aug 2011 06:06 PM
*facepalm* Forgot to add the new tabbing in and forgot a }

it works now, thanks

~ Mitch
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image