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: Title too long

Previous Thread :: Next Thread 
myrkos is not online. myrkos
Joined: 06 Sep 2010
Total Posts: 8072
27 Jul 2012 10:16 AM
x = {1,2,3}
print(x[0])

>1

me gusta. and it was surprisingly easy, too. just edit 2 lines (one of which is to make unpack() still work)
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
27 Jul 2012 10:17 AM
:D now hack it into Roblox D: D:
Report Abuse
agent767 is not online. agent767
Joined: 03 Nov 2008
Total Posts: 4181
27 Jul 2012 11:43 AM
Meh I would still prefer tableindexes starting at 1...
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
27 Jul 2012 12:00 PM
Quick, make it a compile-time switch!

Also, you might want to edit other utilities such as select() which also have indexing behavior.
Report Abuse
NecroBumpist is not online. NecroBumpist
Joined: 12 Sep 2010
Total Posts: 4198
27 Jul 2012 01:52 PM
>people still complaining of Lua's array indexing

find another language and go away pls

Report Abuse
sncplay42 is not online. sncplay42
Joined: 27 Nov 2008
Total Posts: 11891
27 Jul 2012 01:54 PM
"you might want to edit other utilities such as select() which also have indexing behavior."

And the entire API
Report Abuse
BlueTaslem is not online. BlueTaslem
Joined: 11 May 2008
Total Posts: 11060
27 Jul 2012 02:57 PM
How does it affect ipairs and the # operator?
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
27 Jul 2012 03:16 PM
If you do that to me, half my scripts break!

xD

But I do agree it's confusing when working with Java or C++, since Lua is my technically 'Home' programming language.
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
27 Jul 2012 03:17 PM
ipairs isn't in Lua 5.2, which is probably the distribution that he got. And the # operator will behave exactly the same. What indexing style you use does not change lengths, only indices.
Report Abuse
myrkos is not online. myrkos
Joined: 06 Sep 2010
Total Posts: 8072
27 Jul 2012 06:23 PM
Hmm, the # operator seems to be having some trouble:

x = {1,2,3}
print(#x)

> 2

It appears the sizearray of the table is 2, also, even though it has 3 elements. Gaah. I'll look further into it later.

But yes, this is in Lua 5.2.
Report Abuse
NecroBumpist is not online. NecroBumpist
Joined: 12 Sep 2010
Total Posts: 4198
27 Jul 2012 10:15 PM
way to go, maestro.

What does `print(#{}, #{1})` output?
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
27 Jul 2012 10:18 PM
This would be excellent for things using the modulus operator. you could go from using (x-1)%y+1 to x%y c:
Report Abuse
myrkos is not online. myrkos
Joined: 06 Sep 2010
Total Posts: 8072
28 Jul 2012 01:56 AM
@necrobumpist

print(#{},#{1})

> 0 0
Report Abuse
oxcool1 is not online. oxcool1
Joined: 05 Nov 2009
Total Posts: 15444
28 Jul 2012 01:58 AM
[ Content Deleted ]
Report Abuse
myrkos is not online. myrkos
Joined: 06 Sep 2010
Total Posts: 8072
28 Jul 2012 02:05 AM
@oxcool1,

when?
Report Abuse
oxcool1 is not online. oxcool1
Joined: 05 Nov 2009
Total Posts: 15444
28 Jul 2012 02:10 AM
[ Content Deleted ]
Report Abuse
nightname is not online. nightname
Joined: 10 Jun 2008
Total Posts: 8960
28 Jul 2012 10:51 AM
Am I the only one here who cannot find a legitimate reason for why this would be useful?
Report Abuse
Solotaire is not online. Solotaire
Joined: 30 Jul 2009
Total Posts: 30356
28 Jul 2012 10:56 AM
I actually like indexes starting at one.
Report Abuse
myrkos is not online. myrkos
Joined: 06 Sep 2010
Total Posts: 8072
28 Jul 2012 12:03 PM
>Am I the only one here who cannot find a legitimate reason for why this would be useful?

Because I like indexes starting at 0. There's a reason.
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
28 Jul 2012 12:13 PM
I like Lua because the indexes start at 1 :) It makes sense when you haven't used other languages before learning it.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
28 Jul 2012 12:20 PM
[ Content Deleted ]
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
28 Jul 2012 12:23 PM
^
I haven't notice that before.
Report Abuse
Strieken is not online. Strieken
Joined: 17 Jun 2011
Total Posts: 3058
28 Jul 2012 12:31 PM
Even though Lua was my first language, I still prefer tables to index at 0 first.

Otherwise, it gets confusing if I work with multiple languages in the same time frame.
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
28 Jul 2012 12:44 PM
I usually use the pairs function, so I don't subtract to much.
Report Abuse
Flurite is not online. Flurite
Joined: 03 Apr 2011
Total Posts: 5386
28 Jul 2012 02:58 PM
Was there an x - 1 and you took out the - 1?
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