Wikia

WoWWiki

Changes: Sea.IO

Edit

Back to page

m (moved Sea.IO.printfc to Sea.IO)
(mrrr)
Line 1: Line 1:
  +
{{tocright}}
 
{{funclib|Sea}}
 
{{funclib|Sea}}
== Usage: ==
+
A child of [[Sea]], Sea.IO is a collection of functions for printing output in [[World of Warcraft]].
  +
  +
The Sea.IO library is organized in a simple format, there a three basic output types: <tt>print</tt>, <tt>banner</tt> and <tt>error</tt>.
  +
  +
== Modifiers ==
  +
:<tt>d</tt> - the first parameter of the function is a debug key that will be checked before printing. (e.g. <tt>dprint("MY_KEY", "Hi!");</tt> will only print the message if <tt>getglobal("MY_KEY")</tt> is true. )
  +
  +
:<tt>f</tt> - will make the next parameter the frame you want to contain the print message. (e.g. <tt>printf (ChatFrame2, "Hi!");</tt> will print "Hi!" in the combat window. )
  +
  +
:<tt>c</tt> - the next parameter is a table with 'r', 'g' and 'b' values to specify the color of the printed text.
  +
  +
:All of these can be used together:
  +
<tt>dprintfc ("MY_KEY", ChatFrame3, {r=1.0,g=.5,b=.2}, "Hello", " ", "Welcome to my colorful world!" ); </tt>
  +
  +
== Functions ==
  +
=== Banner ===
  +
Prints a message to a large banner. Banners do not have a frame option.
  +
  +
Usage
  +
Sea.IO.banner("Message", " ", "Some Message");
  +
<pre> -- banner ( ... )
  +
--
  +
-- Arguments
  +
-- () arg
  +
-- arg - the values to be printed
  +
--
  +
-- Returns
  +
-- (nil)</pre>
  +
  +
==== Bannerc ====
  +
Banners in the specified color.
  +
  +
Usage
  +
MyColor = { r = 1.0, g=0.2, b=0.0 };
  +
Sea.IO.bannerc(MyColor, "Message", " ", "Some Message");
  +
  +
==== Dbanner ====
  +
Banners if the debug key is true.
  +
  +
Usage
  +
MY_DEBUG_KEY = true;
  +
MyKey = "MY_DEBUG_KEY";
  +
Sea.IO.dbannerc(MyKey, "Message", " ", "Some Message");
  +
  +
==== Dbannerc ====
  +
Banners with the specified color if the debug key is true.
  +
  +
Usage
  +
MY_DEBUG_KEY = true;
  +
MyKey = "MY_DEBUG_KEY";
  +
MyColor = { r = 1.0, g=0.2, b=0.0 };
  +
Sea.IO.dbannerc(MyKey, MyColor, "Message", " ", "Some Message");
  +
  +
Produces:
  +
"Message Some Message" in red-orange.
  +
  +
=== Error ===
  +
Prints to the default error pipe.
  +
  +
Usage
  +
Sea.IO.error("Error:", " ", "Some Error Message");
  +
<pre> -- error (...)
  +
--
  +
-- prints just like Sea.IO.print, except as an error
  +
--
  +
-- Arguments:
  +
-- () arg
  +
-- arg - contains all error output</pre>
  +
  +
==== Errorc ====
  +
Prints an error message in the specified color.
  +
  +
Usage
  +
MyColor = { r = 1.0, g=0.2, b=0.0 };
  +
Sea.IO.derrorfc(MyColor, "Message", " ", "Some Message");
  +
  +
==== Errorf ====
  +
Prints an error message to the specified frame.
  +
  +
Usage
  +
Sea.IO.errorf( ChatFrame1, "Message", " ", "Some Message");
  +
  +
==== Errorfc ====
  +
Prints an error message to the specified frame in the specified color.
  +
  +
Usage
  +
MyColor = { r = 1.0, g=0.2, b=0.0 };
  +
Sea.IO.errorfc(ChatFrame1, MyColor, "Message", " ", "Some Message");
  +
  +
==== Derror ====
  +
Errors if the debug key is true.
  +
  +
Usage
  +
MY_DEBUG_KEY = true;
  +
MyKey = "MY_DEBUG_KEY";
  +
Sea.IO.derror(MyKey, "Message", " ", "Some Message");
  +
  +
==== Derrorc ====
  +
Errors if the debug key is true in the specified color.
  +
  +
Usage
  +
MY_DEBUG_KEY = true;
  +
MyKey = "MY_DEBUG_KEY";
  +
MyColor = { r = 1.0, g=0.2, b=0.0 };
  +
Sea.IO.derrorc(MyKey, MyColor, "Message", " ", "Some Message");
  +
  +
==== Derrorf ====
  +
Errors if the debug key is true in the specified frame.
  +
  +
Usage
  +
MY_DEBUG_KEY = true;
  +
MyKey = "MY_DEBUG_KEY";
  +
Sea.IO.derrorfc(MyKey, ChatFrame1, "Message", " ", "Some Message");
  +
  +
==== Derrorfc ====
  +
Errors if the debug key is true in the specified frame in the specified color.
  +
  +
Usage
  +
MY_DEBUG_KEY = true;
  +
MyKey = "MY_DEBUG_KEY";
  +
MyColor = { r = 1.0, g=0.2, b=0.0 };
  +
Sea.IO.derrorfc(MyKey, ChatFrame1, MyColor, "Message", " ", "Some Message");
  +
  +
=== Print ===
  +
Prints to the default chat box.
  +
<pre> -- print ( ... )
  +
--
  +
-- Arguments
  +
-- () arg
  +
-- arg - the values to be printed
  +
--
  +
-- Returns
  +
-- (nil)</pre>
  +
  +
==== Printc ====
  +
Prints a message in the specified color.
  +
  +
Usage
  +
MyColor = { r = 1.0, g=0.2, b=0.0 };
  +
Sea.IO.printc(MyColor, "Message", " ", "Some Message");
  +
  +
==== Printf ====
  +
Prints to the specified frame.
  +
  +
Usage
  +
Sea.IO.printf(ChatFrame1, "Message", " ", "Some Message");
  +
  +
==== Printfc ====
  +
Prints a message to the specified frame in the specified color.
  +
  +
Usage
 
MyColor = { r = 1.0, g=0.2, b=0.0 };
 
MyColor = { r = 1.0, g=0.2, b=0.0 };
 
Sea.IO.printfc(ChatFrame1, MyColor, "Message", " ", "Some Message");
 
Sea.IO.printfc(ChatFrame1, MyColor, "Message", " ", "Some Message");
  +
  +
==== Dprint ====
  +
Prints if the debug key is true.
  +
  +
Usage
  +
MY_DEBUG_KEY = true;
  +
MyKey = "MY_DEBUG_KEY";
  +
Sea.IO.dprintfc(MyKey, "Message", " ", "Some Message");
  +
  +
==== Dprintc ====
  +
Prints if the debug key is true in the color specified.
  +
  +
Usage
  +
MY_DEBUG_KEY = true;
  +
MyKey = "MY_DEBUG_KEY";
  +
MyColor = { r = 1.0, g=0.2, b=0.0 };
  +
Sea.IO.dprintc(MyKey, MyColor, "Message", " ", "Some Message");
  +
  +
==== Dprintf ====
  +
Prints to the specified frame if the debug key is true.
  +
  +
Usage
  +
MY_DEBUG_KEY = true;
  +
MyKey = "MY_DEBUG_KEY";
  +
Sea.IO.dprintf(MyKey, ChatFrame1, "Message", ": ", "Some Message");
  +
  +
==== Dprintfc ====
  +
Prints to the specified frame in the specified color if the debug key is true.
  +
  +
Usage
  +
MY_DEBUG_KEY = true;
  +
MyKey = "MY_DEBUG_KEY";
  +
MyColor = { r = 1.0, g=0.2, b=0.0 };
  +
Sea.IO.dprintfc(MyKey, ChatFrame1, MyColor, "Message", " ", "Some Message");
  +
  +
==== printComma ====
  +
Prints the arguments separated by commas.
  +
  +
Usage
  +
Sea.IO.printComma ("A", "B", "C");
  +
  +
A,B,C
  +
  +
==== printTable ====
  +
Prints the contents of an entire table, marking function pointers and nils. Beware that the pre-release version (as of Dec 1, 2004) seems to have some issues with tables that self-refer. For instance, Sea.IO.printTable(Sea) causes WoW to hang.
  +
  +
Example
  +
MyTable = {
  +
a = function () return 1+1 end;
  +
[1] = 3;
  +
[2] = 5;
  +
["A"] = "Hello";
  +
["B"] = nil;
  +
[4] = { 1,2,4,5, n=4};
  +
};
  +
Sea.IO.printTable(MyTable);
  +
  +
Root := {
  +
a = { { FunctionPtr* } },
  +
[1] = 3,
  +
[2] = 4,
  +
[4] = {
  +
n = 4,
  +
[1] = 1,
  +
[2] = 2,
  +
[3] = 4,
  +
[4] = 5
  +
}
  +
["A"] = "Hello",
  +
["B"] = nil
  +
}

Revision as of 05:16, July 3, 2010

This article is a part of the documentation of the Sea (AddOn) function library

A child of Sea, Sea.IO is a collection of functions for printing output in World of Warcraft.

The Sea.IO library is organized in a simple format, there a three basic output types: print, banner and error.

Modifiers

d - the first parameter of the function is a debug key that will be checked before printing. (e.g. dprint("MY_KEY", "Hi!"); will only print the message if getglobal("MY_KEY") is true. )
f - will make the next parameter the frame you want to contain the print message. (e.g. printf (ChatFrame2, "Hi!"); will print "Hi!" in the combat window. )
c - the next parameter is a table with 'r', 'g' and 'b' values to specify the color of the printed text.
All of these can be used together:
dprintfc ("MY_KEY", ChatFrame3, {r=1.0,g=.5,b=.2}, "Hello", " ", "Welcome to my colorful world!" ); 

Functions

Prints a message to a large banner. Banners do not have a frame option.

Usage

Sea.IO.banner("Message", " ", "Some Message");
 -- banner ( ... )
 --
 -- Arguments
 --      () arg
 --      arg - the values to be printed
 --
 -- Returns
 --      (nil)

Bannerc

Banners in the specified color.

Usage

MyColor = { r = 1.0, g=0.2, b=0.0 };
Sea.IO.bannerc(MyColor, "Message", " ", "Some Message");

Dbanner

Banners if the debug key is true.

Usage

MY_DEBUG_KEY = true;
MyKey = "MY_DEBUG_KEY";
Sea.IO.dbannerc(MyKey, "Message", " ", "Some Message");

Dbannerc

Banners with the specified color if the debug key is true.

Usage

MY_DEBUG_KEY = true;
MyKey = "MY_DEBUG_KEY";
MyColor = { r = 1.0, g=0.2, b=0.0 };
Sea.IO.dbannerc(MyKey, MyColor, "Message", " ", "Some Message");

Produces:

"Message Some Message" in red-orange.

Error

Prints to the default error pipe.

Usage

Sea.IO.error("Error:", " ", "Some Error Message");
 -- error (...)
 --
 --      prints just like Sea.IO.print, except as an error
 --
 -- Arguments:
 --      ()  arg
 --      arg - contains all error output

Errorc

Prints an error message in the specified color.

Usage

MyColor = { r = 1.0, g=0.2, b=0.0 };
Sea.IO.derrorfc(MyColor, "Message", " ", "Some Message");

Errorf

Prints an error message to the specified frame.

Usage

Sea.IO.errorf( ChatFrame1, "Message", " ", "Some Message");

Errorfc

Prints an error message to the specified frame in the specified color.

Usage

MyColor = { r = 1.0, g=0.2, b=0.0 };
Sea.IO.errorfc(ChatFrame1, MyColor, "Message", " ", "Some Message");

Derror

Errors if the debug key is true.

Usage

MY_DEBUG_KEY = true;
MyKey = "MY_DEBUG_KEY";
Sea.IO.derror(MyKey, "Message", " ", "Some Message");

Derrorc

Errors if the debug key is true in the specified color.

Usage

MY_DEBUG_KEY = true;
MyKey = "MY_DEBUG_KEY";
MyColor = { r = 1.0, g=0.2, b=0.0 };
Sea.IO.derrorc(MyKey, MyColor, "Message", " ", "Some Message");

Derrorf

Errors if the debug key is true in the specified frame.

Usage

MY_DEBUG_KEY = true;
MyKey = "MY_DEBUG_KEY";
Sea.IO.derrorfc(MyKey, ChatFrame1, "Message", " ", "Some Message");

Derrorfc

Errors if the debug key is true in the specified frame in the specified color.

Usage

MY_DEBUG_KEY = true;
MyKey = "MY_DEBUG_KEY";
MyColor = { r = 1.0, g=0.2, b=0.0 };
Sea.IO.derrorfc(MyKey, ChatFrame1, MyColor, "Message", " ", "Some Message");

Print

Prints to the default chat box.

 -- print ( ... )
 --
 -- Arguments
 --      () arg
 --      arg - the values to be printed
 --
 -- Returns
 --      (nil)

Printc

Prints a message in the specified color.

Usage

MyColor = { r = 1.0, g=0.2, b=0.0 };
Sea.IO.printc(MyColor, "Message", " ", "Some Message");

Printf

Prints to the specified frame.

Usage

Sea.IO.printf(ChatFrame1, "Message", " ", "Some Message");

Printfc

Prints a message to the specified frame in the specified color.

Usage

MyColor = { r = 1.0, g=0.2, b=0.0 };
Sea.IO.printfc(ChatFrame1, MyColor, "Message", " ", "Some Message");

Dprint

Prints if the debug key is true.

Usage

MY_DEBUG_KEY = true;
MyKey = "MY_DEBUG_KEY";
Sea.IO.dprintfc(MyKey, "Message", " ", "Some Message");

Dprintc

Prints if the debug key is true in the color specified.

Usage

MY_DEBUG_KEY = true;
MyKey = "MY_DEBUG_KEY";
MyColor = { r = 1.0, g=0.2, b=0.0 };
Sea.IO.dprintc(MyKey, MyColor, "Message", " ", "Some Message");

Dprintf

Prints to the specified frame if the debug key is true.

Usage

MY_DEBUG_KEY = true;
MyKey = "MY_DEBUG_KEY";
Sea.IO.dprintf(MyKey, ChatFrame1, "Message", ": ", "Some Message");

Dprintfc

Prints to the specified frame in the specified color if the debug key is true.

Usage

MY_DEBUG_KEY = true;
MyKey = "MY_DEBUG_KEY";
MyColor = { r = 1.0, g=0.2, b=0.0 };
Sea.IO.dprintfc(MyKey, ChatFrame1, MyColor, "Message", " ", "Some Message");

printComma

Prints the arguments separated by commas.

Usage

Sea.IO.printComma ("A", "B", "C");
A,B,C

printTable

Prints the contents of an entire table, marking function pointers and nils. Beware that the pre-release version (as of Dec 1, 2004) seems to have some issues with tables that self-refer. For instance, Sea.IO.printTable(Sea) causes WoW to hang.

Example

MyTable = {
    a = function () return 1+1 end;
    [1] = 3;
    [2] = 5;
    ["A"] = "Hello";
    ["B"] = nil;
    [4] = { 1,2,4,5, n=4};
};
Sea.IO.printTable(MyTable);
Root := { 
   a = { { FunctionPtr* } },
   [1] = 3,
   [2] = 4,
   [4] = {
       n = 4,
       [1] = 1,
       [2] = 2,
       [3] = 4,
       [4] = 5
    }
   ["A"] = "Hello",
   ["B"] = nil
}

Around Wikia's network

Random Wiki