lia.chat
Chat manipulation and helper functions.
Chat messages are a core part of the framework - it's takes up a good chunk of the gameplay, and is also used to interact with
the framework. Chat messages can have types or "classes" that describe how the message should be interpreted. All chat messages
will have some type of class: ic
for regular in-character speech, me
for actions, ooc
for out-of-character, etc. These
chat classes can affect how the message is displayed in each player's chatbox. See lia.chat.register
.
to create your own chat classes.
Functions
parse(client, message, noSend)
This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.
Identifies which chat mode should be used.
Parameters
-
client
Player
Player who is speaking
-
message
String
Message to parse
-
noSend
Boolean
default: false
Whether or not to send the chat message after parsing
Returns
send(speaker, chatType, text, anonymous, receivers)
Sends a chat message from a speaker to specified receivers, based on the provided chat type and text. The message is processed according to the properties and functions defined for the chat class.
Parameters
-
speaker
Entity
sending the message
-
chatType
String
Type of the chat message
-
text
String
The message content
-
anonymous
Boolean
default: false
Whether the message should be sent anonymously
-
receivers
table
optional
List of entities to receive the message (if specified)
timestamp(ooc)
Generates a timestamp string for chat messages.
Parameters
-
ooc
Boolean
Whether the message is Out of Character (OOC).
Returns
-
any
string The formatted timestamp string, including date and time if configured to show.
Tables
classes
List of all chat classes that have been registered by the framework, where each key is the name of the chat class, and value
is the chat class data. Accessing a chat class's data is useful for when you want to copy some functionality or properties
to use in your own. Note that if you're accessing this table, you should do so inside of the InitializedChatClasses
hook.
Example Usage
print(lia.chat.classes.ic.format)
> "%s says \"%s\""