WoW:API CanGrantLevel: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (stub for more context)
No edit summary
Line 4: Line 4:
<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
  status = CanGrantLevel()
  status = CanGrantLevel("unit")




== Arguments ==
== Arguments ==
<!-- List each argument, together with its type -->
<!-- List each argument, together with its type -->
No arguments
:("unit")
 
:;unit : [[UnitId]] or a name, returns true if you can grant a level to the target or nil if not




Line 15: Line 17:
<!-- List each return value, together with its type -->
<!-- List each return value, together with its type -->


:;arg1 : nil if false, true if you have levels to grant
:;status : nil if false, true if you have levels to grant




== Example ==
== Example ==
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
  local status = CanGrantLevel()
  local status = CanGrantLevel("target")
  if status then
  if status then
   ChatFrame1:AddMessage("I can grant "..status.." levels to my friend!")
   ChatFrame1:AddMessage("I can grant levels to my friend!")
  else
  else
   ChatFrame1:AddMessage("I am out of free levels for now.")
   ChatFrame1:AddMessage("I am out of free levels for now.")
Line 30: Line 32:
<!-- If it helps, include example results here, though they are not required. You're allowed to cheat liberally since WoW isn't a command line language. -->
<!-- If it helps, include example results here, though they are not required. You're allowed to cheat liberally since WoW isn't a command line language. -->


Outputs in the chat frame either if you can or if you can't grant levels right now.
Outputs in the chat frame either if you can or if you can't grant levels to your target right now.

Revision as of 21:57, 13 September 2008

WoW API < CanGrantLevel

status = CanGrantLevel("unit")


Arguments

("unit")
unit
UnitId or a name, returns true if you can grant a level to the target or nil if not


Returns

status
nil if false, true if you have levels to grant


Example

local status = CanGrantLevel("target")
if status then
 ChatFrame1:AddMessage("I can grant levels to my friend!")
else
 ChatFrame1:AddMessage("I am out of free levels for now.")
end

Result

Outputs in the chat frame either if you can or if you can't grant levels to your target right now.