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 » Scripting Helpers
Home Search
 

Re: what does nil do?

Previous Thread :: Next Thread 
sidekick601 is not online. sidekick601
Joined: 27 Feb 2012
Total Posts: 8734
12 Jun 2013 04:23 PM
I'm new to scripting and I want to try know all the commands.
Report Abuse
robox44 is not online. robox44
Joined: 16 Sep 2008
Total Posts: 737
12 Jun 2013 04:29 PM
nil = no/nothing

So, if I say
collide=nil

it means that what ever is colliding, well, won't collide.

or say if character=nil

means, the characters not there
Report Abuse
T3XT is not online. T3XT
Joined: 25 Jul 2011
Total Posts: 9233
12 Jun 2013 05:26 PM
"nil" is essentially the phrase for nothing.

If something is equal to nil, it's not there. If something is not equal to nil, it is there. If you set something equal to nil,it will disappear. It's a similar usage to the keyword "void" in standard C++.
Report Abuse
T3XT is not online. T3XT
Joined: 25 Jul 2011
Total Posts: 9233
12 Jun 2013 05:27 PM
For more information:

http://wiki.roblox.com/index.php/Nil
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
12 Jun 2013 05:31 PM
Object = nil
Is /essentailly/ the same as
Object:Destroy()
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
12 Jun 2013 05:37 PM
That's incorrect. Setting a *variable* to nil does not affect the actual instance within RBX.Lua, it simply won't associate the variable with it's previous value when called. Using the destroy method on an instance change's it's parent to nil and fully locks the metatable so it can't be accessed from scripts with a normal security level, as well as with all it's descendants.
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
12 Jun 2013 05:39 PM
/essentailly/ <<<<----

There's a reason I put emphasis on that word.
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
12 Jun 2013 05:43 PM
Essentially you're wrong.
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
12 Jun 2013 05:46 PM
I knew I wasn't entirely correct, so that's why I said essentially.
I'm simple trying to make it easier to understand. Do you think someone who doesn't know what 'nil' is will understand this?:

"Setting a *variable* to nil does not affect the actual instance within RBX.Lua, it simply won't associate the variable with it's previous value when called. Using the destroy method on an instance change's it's parent to nil and fully locks the metatable so it can't be accessed from scripts with a normal security level, as well as with all it's descendants."
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
12 Jun 2013 05:48 PM
If you don't know what nil is, why are you telling him what nil is?
nil is nothing.
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
12 Jun 2013 05:52 PM
I do know what nil is, would you like me to explain my logic?

nil = nothing
Destroying something makes it nothing.
Hence, destroying something is virtually the same as setting it to nil, which is nothing.
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
12 Jun 2013 06:06 PM
local part=Instance.new('Part',workspace)
part.Name='lolpart'
print(part)
--> lolpart
part=nil
print(part)
--> nil
print(workspace.lolpart)
--> lolpart

Setting a variable to nil does NOT do the same thing. Setting it's parent to nil is /close/ to the /remove/ method. pls goway
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
12 Jun 2013 06:18 PM
I'm not talking about variables, I'm talking about objects!
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
12 Jun 2013 06:20 PM
You can not set an instance to nil in RBX.Lua. Please learn more about your argument before fighting for it.
Report Abuse
dog456pop248 is not online. dog456pop248
Joined: 24 Aug 2008
Total Posts: 3977
12 Jun 2013 06:21 PM
Oh.
In that case, I'm wrong. Carry on.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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