WoW:USERAPI printMSG: Difference between revisions

m (→‎Returns: There is no "null" in Lua.)
m (Move page script moved page USERAPI printMSG to USERAPI printMSG without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{userfunc}} <!-- Leave this line in! -->
{{userfunc}}
<center>'''printMSG''' ''- by [[user:Bull3t|Bull3t]] -''</center>


Displays a custom message to the default chat frame, for the user to see. A prefix and suffix can also be added, with ease, in the function. This is just to save you from typing out, ''DEFAULT_CHAT_FRAME:AddMessage("Prefix " .. "Hello world!" .. " Suffix", 1, 1, 1);'' everytime you want to tell the user something.
Displays a custom message to the default chat frame, for the user to see. A prefix and suffix can also be added, with ease, in the function. This is just to save you from typing out, ''DEFAULT_CHAT_FRAME:AddMessage("Prefix " .. "Hello world!" .. " Suffix", 1, 1, 1);'' everytime you want to tell the user something.
Line 31: Line 30:


__NOTOC__
__NOTOC__
[[Category:User Defined Functions]]
[[Category:User defined functions]]

Latest revision as of 04:49, 15 August 2023

This page documents a <i>user-defined function</i> that you can copy and paste into your addon. Replace PREFIX with your addon or lib prefix to avoid conflicts between different versions of these functions.

User defined functions

Displays a custom message to the default chat frame, for the user to see. A prefix and suffix can also be added, with ease, in the function. This is just to save you from typing out, DEFAULT_CHAT_FRAME:AddMessage("Prefix " .. "Hello world!" .. " Suffix", 1, 1, 1); everytime you want to tell the user something.

<PREFIX>_printMSG("Hello world!");


Function Parameters

Arguments

msg
String - This is the message you wish to display.

Returns

nil

Example

<PREFIX>_printMSG("Hello world!");

Result

Displays the words Prefix Hello world! Suffix, in the default chat frame.


Code

 function <PREFIX>_printMSG(msg)
    DEFAULT_CHAT_FRAME:AddMessage("Prefix " .. msg .. " Suffix", 1, 1, 1);
 end