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: nil = 0?

Previous Thread :: Next Thread 
Flash77 is not online. Flash77
Joined: 14 Jun 2008
Total Posts: 550
31 May 2012 05:40 PM
how come Vector3.new(nil,nil,nil) = Vector3.new(0,0,0) but nil doesnt equal 0?
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
31 May 2012 05:45 PM
> print(tonumber(nil))
nil

~Read Between The Squiggles~
Report Abuse
Flash77 is not online. Flash77
Joined: 14 Jun 2008
Total Posts: 550
31 May 2012 05:47 PM
> print(Vector3.new(nil,nil,nil) == Vector3.new(0,0,0))
true
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
31 May 2012 05:47 PM
Odd...

~Read Between The Squiggles~
Report Abuse
nickmaster24 is not online. nickmaster24
Joined: 04 Oct 2008
Total Posts: 8906
31 May 2012 05:50 PM
> print( nil + 1 )
18:47:55 - print( nil + 1 ):1: attempt to perform arithmetic on a nil value
18:47:55 - Script "print( nil + 1 )", Line 1
18:47:55 - stack end

~Read Between The Squiggles~
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
31 May 2012 05:54 PM
nil = none
0 = none
Report Abuse
Flash77 is not online. Flash77
Joined: 14 Jun 2008
Total Posts: 550
31 May 2012 05:57 PM
but
> print(0==nill)
false
Report Abuse
Halted is not online. Halted
Joined: 20 May 2012
Total Posts: 11
31 May 2012 05:58 PM
@Flash,

you spelled 'nil' wrong.



- Halted
Report Abuse
Flash77 is not online. Flash77
Joined: 14 Jun 2008
Total Posts: 550
31 May 2012 05:59 PM
print(nil == 0)
> false
Report Abuse
agent767 is not online. agent767
Joined: 03 Nov 2008
Total Posts: 4181
31 May 2012 06:23 PM
Trying to create a Vector3.new(nil,nil,nil) will automaticly set it to 0,0,0.
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
31 May 2012 09:11 PM
If a value in the vector isn't a number, it resets the value to 0.
Ex.:
> print(tostring(Vector3.new("Lol",nil,25)))
0, 0, 25
Report Abuse
BlueTaslem is not online. BlueTaslem
Joined: 11 May 2008
Total Posts: 11060
31 May 2012 09:12 PM
function dat(n)
if n == nil then return 0 else return n end
end

print(dat(nil))
--> 0
print(dat(0))
--> 0

It doesn't prove anything. It's just an escape statement.

The reason they do that is so that you can do

Vector3.new()

to refer to the additive identity vector.
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
31 May 2012 09:13 PM
Because Vector3.new(nil, nil, nil) is equivilent to Vector3.new(); calling the default new on Vector3 creates the same thing as Vector3.new(0, 0, 0)
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
31 May 2012 09:14 PM
I win c:
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
31 May 2012 09:15 PM
You can prove it by doing

print(nil == false)
> false
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
31 May 2012 09:17 PM
* nil == 0
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
31 May 2012 09:18 PM
A GIANT CHICKEN! :O
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