Thread Tools Display Modes
04-14-14, 09:44 PM   #1
TULOA
A Wyrmkin Dreamwalker
 
TULOA's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2009
Posts: 50
Interesting Error...

I am using UnitId to get the ID for UnitFullName for the realm.

Everything is correct but im getting this error:
Message: [string "print(UnitId("player"))"]:1: attempt to call global 'UnitId' (a nil value)
Time: 04/14/14 22:33:41
Count: 1
Stack: [string "print(UnitId("player"))"]:1: in main chunk
[C]: in function `RunScript'
Interface\FrameXML\ChatFrame.lua:2036: in function `?'
Interface\FrameXML\ChatFrame.lua:4315: in function `ChatEdit_ParseText'
Interface\FrameXML\ChatFrame.lua:3969: in function `ChatEdit_SendText'
Interface\FrameXML\ChatFrame.lua:4008: in function `ChatEdit_OnEnterPressed'
[string "*:OnEnterPressed"]:1: in function <[string "*:OnEnterPressed"]:1>

Locals: (*temporary) = <function> defined @Interface\FrameXML\RestrictedInfrastructure.lua:116
(*temporary) = nil
(*temporary) = "player"
(*temporary) = "attempt to call global 'UnitId' (a nil value)"
I am running /run print(UnitId("player")) ingame to try to test it in my addon but its still giving that error.

Anyone know offhand why its doing that?
  Reply With Quote
04-14-14, 09:47 PM   #2
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
UnitId isn't a function that you can call...

What is the ID for UnitFullName for a realm? Do you mean a GUID?
  Reply With Quote
04-14-14, 09:57 PM   #3
TULOA
A Wyrmkin Dreamwalker
 
TULOA's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2009
Posts: 50
Originally Posted by Clamsoda View Post
UnitId isn't a function that you can call...

What is the ID for UnitFullName for a realm? Do you mean a GUID?
Wasnt aware of that as I thought if you didnt have one this function was used to retrieve it.

If its not when did this change? I know a few sites saying this is a valid function is why I used it.
  Reply With Quote
04-14-14, 10:14 PM   #4
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
A UnitID is used to define who you want to specify for a function or an action. There isn't any "not knowing" a UnitID; you know it -- they are just relative to the situation.

"player" IS the UnitID; you use that inside of UnitFullName.

Lua Code:
  1. /run print(UnitFullName("player"))

http://www.wowwiki.com/UnitId
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Interesting Error...


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off