Navigation menu

WoW:API print: Difference between revisions

Jump to navigation Jump to search
32 bytes removed ,  26 March 2010
framexmlfunc
(examples and new introduction line)
(framexmlfunc)
Line 1: Line 1:
{{wowapi}}
{{framexmlfunc|RestrictedEnvironment.lua}}
Takes any number of arguments and prints their values to the default chat frame using the [[API tostring|tostring()]] function
Passes its arguments to the current print output handler. By default, this will output them all to the default chat frame.
  print("Hello, WoW!")
  print(...)
 
== Parameters ==
 
=== Arguments ===
:("arg1"[, "argN"])


:;arg1 : object to print
== Arguments ==
:;argN : object to print, separated by a space from the previous object.
; ... : Any - any number of any type of values.
 
=== Returns ===
:;nil


== Example ==
== Example ==
Line 28: Line 20:
  print("Hello", "this is a", {}, "value")
  print("Hello", "this is a", {}, "value")
prints <code>Hello this is a table: ###### value</code>
prints <code>Hello this is a table: ###### value</code>


== Details ==
== Details ==
This function serves as a cleaner replacement from DEFAULT_CHAT_FRAME:AddMessage().
* This function is a securecall/forceinsecure wrapper around the current print output handler function. Instead of attempting to replace it, you can set your own output handler function using {{api|setprinthandler}}(func).
 
* This function serves as a cleaner replacement from DEFAULT_CHAT_FRAME:AddMessage(); unlike which, it can safely be used to output nil values.
Each argument given is printed separated by a space from the previous one.
 
Unlike DEFAULT_CHAT_FRAME:AddMessage(), '''print()''' will allow the output nil values to the chat frame without causing an error message.


'''print()''' was added in 3.0.2 (8926)
== History ==
* Added in 3.0.2 (8926)