Files
zoitechat/docs/script_lua.rst

27 KiB

<?xml version="1.0" encoding="utf-8" ?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <style type="text/css"> /* :Author: David Goodger (goodger@python.org) :Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. */ /* used to remove borders from tables and images */ .borderless, table.borderless td, table.borderless th { border: 0 } table.borderless td, table.borderless th { /* Override padding for "table.docutils td" with "! important". The right padding separates the table cells. */ padding: 0 0.5em 0 0 ! important } .first { /* Override more specific margin styles with "! important". */ margin-top: 0 ! important } .last, .with-subtitle { margin-bottom: 0 ! important } .hidden { display: none } .subscript { vertical-align: sub; font-size: smaller } .superscript { vertical-align: super; font-size: smaller } a.toc-backref { text-decoration: none ; color: black } blockquote.epigraph { margin: 2em 5em ; } dl.docutils dd { margin-bottom: 0.5em } object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] { overflow: hidden; } /* Uncomment (and remove this text!) to get bold-faced definition list terms dl.docutils dt { font-weight: bold } */ div.abstract { margin: 2em 5em } div.abstract p.topic-title { font-weight: bold ; text-align: center } div.admonition, div.attention, div.caution, div.danger, div.error, div.hint, div.important, div.note, div.tip, div.warning { margin: 2em ; border: medium outset ; padding: 1em } div.admonition p.admonition-title, div.hint p.admonition-title, div.important p.admonition-title, div.note p.admonition-title, div.tip p.admonition-title { font-weight: bold ; font-family: sans-serif } div.attention p.admonition-title, div.caution p.admonition-title, div.danger p.admonition-title, div.error p.admonition-title, div.warning p.admonition-title, .code .error { color: red ; font-weight: bold ; font-family: sans-serif } /* Uncomment (and remove this text!) to get reduced vertical space in compound paragraphs. div.compound .compound-first, div.compound .compound-middle { margin-bottom: 0.5em } div.compound .compound-last, div.compound .compound-middle { margin-top: 0.5em } */ div.dedication { margin: 2em 5em ; text-align: center ; font-style: italic } div.dedication p.topic-title { font-weight: bold ; font-style: normal } div.figure { margin-left: 2em ; margin-right: 2em } div.footer, div.header { clear: both; font-size: smaller } div.line-block { display: block ; margin-top: 1em ; margin-bottom: 1em } div.line-block div.line-block { margin-top: 0 ; margin-bottom: 0 ; margin-left: 1.5em } div.sidebar { margin: 0 0 0.5em 1em ; border: medium outset ; padding: 1em ; background-color: #ffffee ; width: 40% ; float: right ; clear: right } div.sidebar p.rubric { font-family: sans-serif ; font-size: medium } div.system-messages { margin: 5em } div.system-messages h1 { color: red } div.system-message { border: medium outset ; padding: 1em } div.system-message p.system-message-title { color: red ; font-weight: bold } div.topic { margin: 2em } h1.section-subtitle, h2.section-subtitle, h3.section-subtitle, h4.section-subtitle, h5.section-subtitle, h6.section-subtitle { margin-top: 0.4em } h1.title { text-align: center } h2.subtitle { text-align: center } hr.docutils { width: 75% } img.align-left, .figure.align-left, object.align-left, table.align-left { clear: left ; float: left ; margin-right: 1em } img.align-right, .figure.align-right, object.align-right, table.align-right { clear: right ; float: right ; margin-left: 1em } img.align-center, .figure.align-center, object.align-center { display: block; margin-left: auto; margin-right: auto; } table.align-center { margin-left: auto; margin-right: auto; } .align-left { text-align: left } .align-center { clear: both ; text-align: center } .align-right { text-align: right } /* reset inner alignment in figures */ div.align-right { text-align: inherit } /* div.align-center * { */ /* text-align: left } */ .align-top { vertical-align: top } .align-middle { vertical-align: middle } .align-bottom { vertical-align: bottom } ol.simple, ul.simple { margin-bottom: 1em } ol.arabic { list-style: decimal } ol.loweralpha { list-style: lower-alpha } ol.upperalpha { list-style: upper-alpha } ol.lowerroman { list-style: lower-roman } ol.upperroman { list-style: upper-roman } p.attribution { text-align: right ; margin-left: 50% } p.caption { font-style: italic } p.credits { font-style: italic ; font-size: smaller } p.label { white-space: nowrap } p.rubric { font-weight: bold ; font-size: larger ; color: maroon ; text-align: center } p.sidebar-title { font-family: sans-serif ; font-weight: bold ; font-size: larger } p.sidebar-subtitle { font-family: sans-serif ; font-weight: bold } p.topic-title { font-weight: bold } pre.address { margin-bottom: 0 ; margin-top: 0 ; font: inherit } pre.literal-block, pre.doctest-block, pre.math, pre.code { margin-left: 2em ; margin-right: 2em } pre.code .ln { color: grey; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } pre.code .literal.string, code .literal.string { color: #0C5404 } pre.code .name.builtin, code .name.builtin { color: #352B84 } pre.code .deleted, code .deleted { background-color: #DEB0A1} pre.code .inserted, code .inserted { background-color: #A3D289} span.classifier { font-family: sans-serif ; font-style: oblique } span.classifier-delimiter { font-family: sans-serif ; font-weight: bold } span.interpreted { font-family: sans-serif } span.option { white-space: nowrap } span.pre { white-space: pre } span.problematic { color: red } span.section-subtitle { /* font-size relative to parent (h1..h6 element) */ font-size: 80% } table.citation { border-left: solid 1px gray; margin-left: 1px } table.docinfo { margin: 2em 4em } table.docutils { margin-top: 0.5em ; margin-bottom: 0.5em } table.footnote { border-left: solid 1px black; margin-left: 1px } table.docutils td, table.docutils th, table.docinfo td, table.docinfo th { padding-left: 0.5em ; padding-right: 0.5em ; vertical-align: top } table.docutils th.field-name, table.docinfo th.docinfo-name { font-weight: bold ; text-align: left ; white-space: nowrap ; padding-left: 0 } /* "booktabs" style (no vertical lines) */ table.docutils.booktabs { border: 0px; border-top: 2px solid; border-bottom: 2px solid; border-collapse: collapse; } table.docutils.booktabs * { border: 0px; } table.docutils.booktabs th { border-bottom: thin solid; text-align: left; } h1 tt.docutils, h2 tt.docutils, h3 tt.docutils, h4 tt.docutils, h5 tt.docutils, h6 tt.docutils { font-size: 100% } ul.auto-toc { list-style-type: none } </style> </head>

ZoiteChat Lua Interface

System Message: WARNING/2 (<stdin>, line 2)

Title underline too short.

ZoiteChat Lua Interface
=====================

Scripts

Just like many other language plugins, the Lua plugin provides the commands /load, /unload, and /reload which operate on Lua scripts. You can forcibly load a Lua script with any extension by using /lua load, /lua unload or /lua reload instead. All files ending in .lua and .luac in the addons directory will be automatically loaded on startup.

Every script gets its own isolated state. The state is initialized with the Lua standard library, and has a global table called zoitechat providing the API, which is described below.

Commands

System Message: ERROR/3 (<stdin>, line 21)

Unknown directive type "program".

.. program:: lua

System Message: ERROR/3 (<stdin>, line 23)

Unknown directive type "option".

.. option:: /lua load <filename>

System Message: ERROR/3 (<stdin>, line 24)

Unknown directive type "option".

.. option:: /load <filename>

Loads a script with the given filename. /load will only load files ending in .lua and .luac.

System Message: ERROR/3 (<stdin>, line 29)

Unknown directive type "option".

.. option:: /lua unload <filename>

System Message: ERROR/3 (<stdin>, line 30)

Unknown directive type "option".

.. option:: /unload <filename>

Unloads a script with the given filename.

System Message: ERROR/3 (<stdin>, line 34)

Unknown directive type "option".

.. option:: /reload <filename>`

System Message: ERROR/3 (<stdin>, line 35)

Unknown directive type "option".

.. option:: /lua reload <filename>`

Reloads a script with the given filename.

System Message: ERROR/3 (<stdin>, line 39)

Unknown directive type "option".

.. option:: /lua list

Lists loaded Lua scripts.

System Message: ERROR/3 (<stdin>, line 43)

Unknown directive type "option".

.. option:: /lua exec <code>

Executes given code in the interpreter.

System Message: ERROR/3 (<stdin>, line 47)

Unknown directive type "option".

.. option:: /lua console

Opens an interactive console. Messages to that tab are intercepted and interpreted as code.

System Message: ERROR/3 (<stdin>, line 52)

Unknown directive type "option".

.. option:: /lua inject <filename> <code>

Executes given code in the context of a given script (which has to be loaded).

System Message: ERROR/3 (<stdin>, line 57)

Unknown directive type "option".

.. option:: /lua reset

Reloads the interpreter (but not the scripts).

Environment

Note

This only directly applies to Windows since other platforms rely on the Lua version and libraries installed on your system. It is most likely still of use, however.

The embedded Lua implementation is LuaJIT . LuaJIT by itself provides a few extensions, such as the the bit and ffi modules. It generally follows Lua 5.1 and has a few backwards compatible additions from Lua 5.2, which are explained on the extensions page.

Hexchat then provides the global zoitechat table, which is described in detail in the :ref:`lua-API` section below.

System Message: ERROR/3 (<stdin>, line 78); backlink

Unknown interpreted text role "ref".

Additionally, the lgi module is available, which provides GObject-introspection, since it is used by Hexchat internally. For looking up mappings, the Python GObject Introspection API reference can be used, as it is very similar.

API

The ZoiteChat API is accessible through the zoitechat table.

General functions

zoitechat.register(name, version, description)

System Message: WARNING/2 (<stdin>, line 117)

Title underline too short.

zoitechat.register(name, version, description)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Upon initialization every script should introduce itself by calling this function. Failure to do so will result in the script being unloaded immediately.

zoitechat.command(cmd)

System Message: WARNING/2 (<stdin>, line 124)

Title underline too short.

zoitechat.command(cmd)
^^^^^^^^^^^^^^^^^^^^

Executes the command cmd in the current context, as if /cmd was typed by the user.

See /help for valid commands and their documentation.

zoitechat.print(...)

System Message: WARNING/2 (<stdin>, line 132)

Title underline too short.

zoitechat.print(...)
^^^^^^^^^^^^^^^^^^

Prints zero or more values to the current tab. This function also replaces the global print function.

zoitechat.emit_print(event, ...)

System Message: WARNING/2 (<stdin>, line 138)

Title underline too short.

zoitechat.emit_print(event, ...)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Emits a text event (can be found in Settings->Text Events) into the current tab. ... are the strings that are passed as arguments to the event. At the moment due to internal limitations, only 5 arguments are passed as there aren't any text events with more arguments.

zoitechat.send_modes(targets, mode[, max])

System Message: WARNING/2 (<stdin>, line 146)

Title underline too short.

zoitechat.send_modes(targets, mode[, max])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sets multiple modes in the current context, possibly grouping them together up to the server limit. targets needs to be an array of strings, mode needs to be a string of 2 characters: + or - followed by the mode letter. max is the number of modes on one line, if omitted the serverside limit is used.

zoitechat.nickcmp(a, b)

System Message: WARNING/2 (<stdin>, line 155)

Title underline too short.

zoitechat.nickcmp(a, b)
^^^^^^^^^^^^^^^^^^^^^

Compares 2 strings case-insensitively, in accordance with current server's casemapping. Returns a negative number if a is less than b, zero if they are equal, and a positive number if a is more than b.

zoitechat.strip(string[, keep_colors[, keep_attrs]])

System Message: WARNING/2 (<stdin>, line 163)

Title underline too short.

zoitechat.strip(string[, keep_colors[, keep_attrs]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Removes color codes from the given string. If keep_colors is a truthy value, colors are not removed. If keep_attrs is a truthy value, attributes such as bold or underline are not removed. Returns the resulting string.

zoitechat.get_info(id)

System Message: WARNING/2 (<stdin>, line 171)

Title underline too short.

zoitechat.get_info(id)
^^^^^^^^^^^^^^^^^^^^

Returns information about the current context. id is a string determining the information you want. It can be one of the following (case sensitive):

ID Return value
away Away reason or nil if you are not away
channel Current context's name
charset Character set used in the current context
configdir ZoiteChat config directory, e.g. /home/user/.config/zoitechat
event_text <name> Text event format string for <name>
host Real hostname of the server you connected to
inputbox The input box contents, what the user has typed
libdirfs Library directory. e.g. /usr/lib/zoitechat. The same directory is used for autoloading plugins
modes Channel modes, or nil if not known
network Current network name, or nil if not known
nick Your current nickname
password Password for this network or nil
server Current server name (what the server claims to be) or nil if you are not connected
topic Current channel topic
version ZoiteChat version number
win_status Window status: active, hidden or normal
win_ptr A light userdata pointer to the native window. GtkWindow on unix, HWND on windows
gtkwin_ptr A light userdata pointer to a GtkWindow. (Usable within lgi)

zoitechat.iterate(list)

System Message: WARNING/2 (<stdin>, line 201)

Title underline too short.

zoitechat.iterate(list)
^^^^^^^^^^^^^^^^^^^^^

Iterate through the list list. To be used with generic for-loops in the following fashion:

System Message: WARNING/2 (<stdin>, line 206)

Cannot analyze code. Pygments package not found.

.. code-block:: lua

    for chan in zoitechat.iterate("channels") do
        print(chan.server .. ": " .. chan.channel)
    end

List of possible values of list, along with respective keys:

channels List of channels, queries and their servers
Name Description
channel Tab name
channelkey Channel's key or nil
chanmodes Channel modes, e.g. beI,k,l (2.12.2+)
chantypes Channel types, e.g. #!&
context Tab's context object
flags
  • 2^0 = Connected
  • 2^1 = Connecting
  • 2^2 = Marked away
  • 2^3 = End of MOTD
  • 2^4 = Has WHOX
  • 2^5 = Has IDMSG
  • 2^6 = Hide Join/Parts
  • 2^7 = Hide Join/Parts unset
  • 2^8 = Beep on Message
  • 2^9 = Beep on Message unset
  • 2^10 = <unused>
  • 2^11 = Logging
  • 2^12 = Logging unset
  • 2^13 = Scrollback
  • 2^14 = Scrollback unset
  • 2^15 = Strip colors
  • 2^16 = Strip colors unset
  • 2^17 = Flash tray
  • 2^18 = Flash tray unset
  • 2^19 = Flash taskbar
  • 2^20 = Flash taskbar unset
id Unique server ID
lag Lag in milliseconds
maxmodes Maximum modes per line
network Network name
nickprefixes Nickname prefixes, e.g. @+
nickmodes Nickname mode chars, e.g. ov
queue Number of bytes in the send-queue
server Server name to which this channel belongs
type
  • 1 = Server
  • 2 = Channel
  • 3 = Dialog
  • 4 = Notice
  • 5 = SNotice
users Number of users in this channel
users Current contexts users
Name Description
account Account name or nil
away Away message or nil
host Host name in form of user@host or nil
lasttalk Time stamp of last time they spoke
nick Nick name
prefix Prefix character such as @
realname Real name
selected If they are selected in the userlist
dcc List of DCC file transfers
Name Description
address32 Address of the remote user (ipv4 address)
cps Bytes per second (speed)
destfile Destination full pathname
file File name
nick Nickname of person who the file is from/to
port TCP port number
pos Bytes sent/received
poshigh Bytes sent/received, high order 32 bits
resume Point at which this file was resumed (or zero if it was not resumed)
resumehigh Point at which this file was resumed, high order 32 bits
size File size in bytes, low order 32 bits (cast it to unsigned)
sizehigh File size in bytes, high order 32 bits
status
  • 0 = Queued
  • 1 = Active
  • 2 = Failed
  • 3 = Done
  • 4 = Connecting
  • 5 = Aborted
type
  • 0 = Send
  • 1 = Recieve
  • 1 = ChatRecv
  • 1 = ChatSend
ignore Current ignore list
Name Description
mask Ignore mask, .e.g. \*\!\*\@\*.aol.com
flags
  • 2^0 = Private
  • 2^1 = Notice
  • 2^2 = Channel
  • 2^3 = CTCP
  • 2^4 = Invite
  • 2^5 = Unignore
  • 2^6 = NoSave
  • 2^7 = DCC
notify List of people on notify
Name Description
networks Networks to which this nick applies. Comma separated. May be nil
nick Nickname
flags Bit field of flags. 0=Is online.
on Unix timestamp of when user came online.
off Unix timestamp of when user went offline.
seen Unix timestamp of when user the user was last verified still online.

zoitechat.props

System Message: WARNING/2 (<stdin>, line 379)

Title underline too short.

zoitechat.props
^^^^^^^^^^^^^

A table containing the values of a "channels" list for the current context.

Preferences

zoitechat.prefs

System Message: WARNING/2 (<stdin>, line 388)

Title underline too short.

zoitechat.prefs
^^^^^^^^^^^^^

You can access ZoiteChat's settings via this pseudo-table, see /set for a list of keys. Note that you cannot modify the table. Instead, you should use zoitechat.command("set -quiet <key> <value>")

There are also these special preferences:

  • id - Unique server id
  • state_cursor - Location of cursor in input box

Hooks

Some hooks are executed in a priority order, and hooks executed earlier can prevent later hooks from being invoked. The following constants determine priorities of such hooks and are passed to the hooking function:

  • zoitechat.PRI_HIGHEST - The highest priority.
  • zoitechat.PRI_HIGH
  • zoitechat.PRI_NORM - The default priority.
  • zoitechat.PRI_LOW
  • zoitechat.PRI_LOWEST - The lowest priority.

The following constants determine whether to pass the event on after the hook has finished. One of these has to be returned from the callback:

  • zoitechat.EAT_NONE - Let other hooks see the event.
  • zoitechat.EAT_ZOITECHAT - Let other hooks see the event, but prevent ZoiteChat itself from seeing it.
  • zoitechat.EAT_PLUGIN - Don't let remaining hooks see the event, but let ZoiteChat know about it.
  • zoitechat.EAT_ALL - Consume this event completely, don't let anyone else know about it.

All hooking functions return an object which can be later used to remove the hook, but the hooks are also removed automatically when the script is unloaded or reloaded.

Unlike the C and Python APIs, there isn't a userdata value passed to the hooks. Instead you should use upvalues, closures, and/or anonymous functions.

zoitechat.hook_command(command, callback[, help[, priority]])

System Message: WARNING/2 (<stdin>, line 433)

Title underline too short.

zoitechat.hook_command(command, callback[, help[, priority]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Hooks the function callback to be executed whenever /command is entered. help is the helptext for the /help command. Returns a hook object. The callback receives an array of words, and an array of word_eols as arguments.

If command is nil, then all non-command text is hooked instead, including /say.

zoitechat.hook_print(event, callback[, priority])

System Message: WARNING/2 (<stdin>, line 444)

Title underline too short.

zoitechat.hook_print(event, callback[, priority])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Hooks the function callback to be executed whenever the text event event is to be printed. Returns a hook object. The callback receives the array of event's arguments as its only argument.

There are also a few extra events you can hook using this function:

  • Open Context - Emitted when a new context is created.
  • Close Context - Emitted when a context is closed.
  • Focus Tab - Emitted when a tab is brought to the front.
  • Focus Window - Emitted when a toplevel window is focused, or the main tab-window is focused by the window manager.
  • DCC Chat Text - Emitted when some text from a DCC Chat arrives. It provides these elements in the word list:
    • Address
    • Port
    • Nick
    • Message
  • Key Press - Emitted when some keys are pressed in the input box. It provides these elements in the word list:
    • Key Value
    • Modifier bitfield (Shift, CapsLock, Alt, etc)
    • String version of the key
    • Length of the string (may be 0 for unprintable keys)

zoitechat.hook_server(command, callback[, priority])

System Message: WARNING/2 (<stdin>, line 468)

Title underline too short.

zoitechat.hook_server(command, callback[, priority])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Hooks the function callback to be executed whenever command is received from the server. Returns a hook object. The callback receives an array of words, and an array of word_eols as arguments.

If command is nil, then the callback is called for every received line.

zoitechat.hook_timer(interval, callback)

System Message: WARNING/2 (<stdin>, line 478)

Title underline too short.

zoitechat.hook_timer(interval, callback)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Hooks the function callback to be executed after inverval milliseconds. Returns a hook object. As long as the callback returns a truthy value, it is scheduled to happen after the same preiod of time.

zoitechat.hook_unload(callback)

System Message: WARNING/2 (<stdin>, line 485)

Title underline too short.

zoitechat.hook_unload(callback)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Hooks the function callback to be executed when the current script is unloaded. Returns a hook object.

hook:unhook() and zoitechat.unhook(hook)

System Message: WARNING/2 (<stdin>, line 491)

Title underline too short.

hook:unhook() and zoitechat.unhook(hook)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Removes the given hook. A hook can only be removed once.

Contexts

A context corresponds to a ZoiteChat window or tab. Some of the functions in zoitechat.* will do something in the current tab. Using contexts you can perform such actions in other tabs instead. Two context objects can be tested for equality using the == operator, which will return true if the contexts refer to the same tab. All methods of a context object will error if the object is invalidated and points to a tab that is closed.

zoitechat.get_context()

System Message: WARNING/2 (<stdin>, line 507)

Title underline too short.

zoitechat.get_context()
^^^^^^^^^^^^^^^^^^^^^

Returns a context object for the current context.

zoitechat.find_context(server_name, channel_name)

System Message: WARNING/2 (<stdin>, line 512)

Title underline too short.

zoitechat.find_context(server_name, channel_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Finds a context object for a tab on the given channel of the given channel. If server_name is nil, it searches for the given channel or query across all servers. If channel_name is nil, finds the frontmost tab of the given server. If both are nil, returns current context. In any case, if the specified tab was not found, the function returns nil.

ctx:set() and zoitechat.set_context(ctx)

System Message: WARNING/2 (<stdin>, line 522)

Title underline too short.

ctx:set() and zoitechat.set_context(ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Makes ctx the "current" context. All zoitechat.* functions will be using this context. This setting only persists within one event. Next time any of the callbacks is called, the current context will be set to the actual one.

Returns a boolean indicating whether the context was successfully set. Failure will only occur if the context has been closed.

ctx:find_context(server_name, channel_name)

Identical to zoitechat.find_context, except the defaults are based on the current context.

ctx:print(...)

Prints zero or more values in the given context.

ctx:emit_print(event, ...)

Emits a text event into the given context. See zoitechat.emit_print.

Returns a boolean indicating success.

ctx:command(cmd)

Executes the command /cmd in the given context. See zoitechat.command.

ctx:nickcmp(a, b)

Compares 2 strings using casemapping from the given context. See zoitechat.nickcmp.

ctx:get_info(id)

Returns information about the given context. See zoitechat.get_info.

ctx:iterate(list)

Iterate through a list within the given context. See zoitechat.iterate.

Plugin preferences

zoitechat.pluginprefs

System Message: WARNING/2 (<stdin>, line 577)

Title underline too short.

zoitechat.pluginprefs
^^^^^^^^^^^^^^^^^^^

To persistently store your script's settings, you can use this pseudo-table. The values inside will persist across script reloads, ZoiteChat restarts, and reboots. Currently, you can only store and read strings and numbers associated to string keys, and iterate through the table with pairs().

Attributes

Attributes correspond to extra metadata for messages, such as server-time (currently the only supported attribute). Some functions have attributes-enhanced versions.

zoitechat.attrs()

System Message: WARNING/2 (<stdin>, line 592)

Title underline too short.

zoitechat.attrs()
^^^^^^^^^^^^^^^

Returns a new attributes object. It has only one field: server_time_utc.

zoitechat.emit_print_attrs(attrs, event, ...) and ctx:emit_print_attrs(attrs, event, ...)

System Message: WARNING/2 (<stdin>, line 598)

Title underline too short.

zoitechat.emit_print_attrs(attrs, event, ...) and ctx:emit_print_attrs(attrs, event, ...)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Analogous to zoitechat.emit_print and ctx:emit_print respectively, but passes an extra attributes argument.

zoitechat.hook_print_attrs(event, callback[, priority])

System Message: WARNING/2 (<stdin>, line 604)

Title underline too short.

zoitechat.hook_print_attrs(event, callback[, priority])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Identical to zoitechat.hook_print, except that the callback receives an additional second argument with an attributes object and that the aforementioned extra events cannot be hooked.

zoitechat.hook_server_attrs(command, callback[, priority])

System Message: WARNING/2 (<stdin>, line 611)

Title underline too short.

zoitechat.hook_server_attrs(command, callback[, priority])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Identical to zoitechat.hook_server, except that the callback receives an additional third argument with an attributes object.

</html>