Results 1 to 3 of 3

Thread: [Lua] ~= nil

  1. #1
    1010010011010101101001
    Austin .'s Avatar
    Join Date
    May 2011
    Location
    Where the Green Grass Grows. <3
    Posts
    4,830
    Points
    2,134
         User Info     Contact     Gamer ID
    Join Date
    May 2011
    Location
    Where the Green Grass Grows. <3
    Posts
    4,830
    Points
    2,134
    Gamer IDs

    PSN ID: x-CrimsoN-x21

    Contact info:

    Youtube Channel: http://www.youtube.com/user/xCrimmYx?feature=mhee

    Default [Lua] ~= nil

    if obj ~= nil and obj.type ~= nil

    So.... nil represents wut.

    Edit: From what I've been seeing, the output of nil is like an error - a value that just doesn't exist... kind of. But I still don't understand why the statement in one of these scripts I'm looking at would check to see if the object and obj.type were nil. Would it be checking to see if the object doesn't exist?

    0 Not allowed! Not allowed!
    Last edited by Austin .; 10-27-2013 at 04:17 PM.

    1v1 (as of June) :
    Wins: 2 Losses: 0
    We accept the love we think we deserve.

  2. #2
    Member

    Badge

    Join Date
    Feb 2013
    Posts
    283
    Points
    576
         User Info     Contact     Gamer ID
    Join Date
    Feb 2013
    Posts
    283
    Points
    576
    Gamer IDs

    PSN ID: xWesleyCL

    Contact info:

    Youtube Channel: http://www.youtube.com/user/TechyL33T Kik Username: WesleyAUSMC

    Default

    nil basically represents none. you can send messages to nil, and use it just about anywhere you can as null.

    0 Not allowed! Not allowed!
    August 13th, 2011. Coming on two years of a long history with CL. <3

  3. #3

    Retired Prophet
    ToxicJew.'s Avatar
    Join Date
    Mar 2011
    Location
    S̢͎̳̞̲͈̪̳̻ͮͩt̟̳̏ͬ̔&#
    Posts
    7,809
    Points
    7,616
         User Info     Contact     Gamer ID
    Join Date
    Mar 2011
    Location
    S̢͎̳̞̲͈̪̳̻ͮͩt̟̳̏ͬ̔&#
    Posts
    7,809
    Points
    7,616

    Contact info:

    Youtube Channel: http://www.youtube.com/kennethbgoodin

    Default

    Nil and null essentially mean the value doesn't exist. So, by checking if something equals nil, you're checking if any value exists for it or not. It's not checking whether the object exists, because clearly it does or you couldn't use it in a statement like that. It's checking the value of that object.

    Some context for whatever code you're talking about would be nice; may be able to tell you exactly why.

    0 Not allowed! Not allowed!
    ส็็็็็็็็็็็็็็็็็็็็็็็็็༼ ຈل͜ຈ༽ส้้้้้้้้้้้้้้้้้้้้้้้ส็็็็็็็็็็็็็็็็็็็็ ็็็็็༼ ຈل͜ຈ༽ส้้้้้้้้้้้้้้้้้้้้้้้

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -10. The time now is 09:40 AM.
Powered by vBulletin®
Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.