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: Are these the same thing?

Previous Thread :: Next Thread 
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
24 Mar 2017 11:58 AM

would be doing this:
local entity = {__index=entity}

be the same as:
local entity = {}
entity.__index=entity



mm mm mm, you gotta love that cornflakes's tastelessness
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
24 Mar 2017 11:59 AM
If you're trying to get the value to reference the table it's in, the first one won't work at all.

You could do this though:

local entity
entity = {__index = entity}
Report Abuse
badfitz67 is not online. badfitz67
Joined: 03 Jun 2010
Total Posts: 13165
24 Mar 2017 12:00 PM
kk


mm mm mm, you gotta love that cornflakes's tastelessness
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
24 Mar 2017 12:20 PM
"local entity
entity = {__index = entity}"

If you want the __index field to be nil.
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
24 Mar 2017 12:26 PM
Oops, I can't believe I just did that. I was thinking of something else
Report Abuse
JoshRBX is not online. JoshRBX
Joined: 19 May 2012
Total Posts: 8778
24 Mar 2017 12:39 PM
All methods will either set entity.___index to nil or just error.


Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
24 Mar 2017 12:44 PM
> All methods will either set entity.___index to nil or just error.

No, the OP's second one would work
Report Abuse
JoshRBX is not online. JoshRBX
Joined: 19 May 2012
Total Posts: 8778
24 Mar 2017 01:16 PM
Oh yeah, I was just thinking that it will return nil because the table is empty. It actually returned this upon testing...

> table: 0x80635c90


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