+ Reply to Thread
Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By Naifu

  Click here to go to the first Rift Team post in this thread.   Thread: Inspect.Unit.Detail("player") => nil on /reloadui

  1. #1
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    130

    Default Inspect.Unit.Detail("player") => nil on /reloadui

    I'm storing the player's name for future reference
    Code:
    local player_name = Inspect.Unit.Detail("player")["name"]
    This line of code is at the "root" of my main lua file (ie, not within a function).

    It runs just fine, until I execute a "/reloadui"

    which would cause the following error.

    lua:trying to index a nil value
    I've commented the whole line and did a "/reloadui", it didn't fail. So the way I see it, is that the player's information is not available immediately upon reloading the UI.

  2. #2
    Champion
    Join Date
    Jun 2011
    Posts
    561

    Default

    You need to wait for the unit loaded event. Here's how I do it in nkWardrobe:

    Code:
    table.insert(Event.Unit.Available, {nkWardrobe.startup, "nkWardrobe", "systemLoaded"})
    
    function nkWardrobe.startup()
    
    	if privateVars.calling == nil then
    		local userDetails = Inspect.Unit.Detail ('player')
    		privateVars.calling = userDetails.calling
    	end
    
    end
    Cheers
    N.

  3. #3
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    130

    Default

    I didn't knew about this.

    Thanks !

  4.   This is the last Rift Team post in this thread.   #4
    Rift Team
    Join Date
    Oct 2010
    Posts
    927

    Default

    For what it's worth, this is a bug, and should be fixed in 1.8

  5. #5
    Ascendant Credo's Avatar
    Join Date
    Jan 2011
    Posts
    4,172

    Default

    Quote Originally Posted by ZorbaTHut View Post
    For what it's worth, this is a bug, and should be fixed in 1.8
    Huzzah and hooray!
    Even free cost too much now

  6. #6
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    130

    Default

    Thanks !

    meanwhile I did followed the suggestion above.

+ Reply to Thread

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