FrameworkZ API Documentation - FrameworkZ.Characters

FrameworkZ.Characters

module

Characters module for FrameworkZ. Defines and interacts with CHARACTER object.

1
Functions
14
Methods
4
Fields

Fields

4
FrameworkZ.Characters 📋 table
Characters module for FrameworkZ. Defines and interacts with CHARACTER object.
Initial value: {}
FrameworkZ.Characters.Cache 📋 table
Unique IDs list for characters by UID.
Initial value: {}
FrameworkZ.Characters.List 📋 table
List of all active character instances by username.
Initial value: {}
FrameworkZ.Characters.MetaObject ❓ unknown
Reference to the CHARACTER metatable for external access.
Initial value: CHARACTER

Methods

14

FrameworkZ.Characters:AddToCache(uid, character)

method
Add a character to the UID cache.

Parameters

uid 📝 string
The character's unique ID.
character 📋 table
The character object to add.

Returns

📋 table
\boolean The added character object or false if failed.

FrameworkZ.Characters:AddToList(username, character)

method
Add a character to the active character list.

Parameters

username 📝 string
The player's username.
character 📋 table
The character object to add.

Returns

📋 table
\boolean The added character object or false if failed.

FrameworkZ.Characters:GetCharacterByID(username)

method
Gets the user's loaded character by their ID.

Parameters

username 📝 string
The player's username to get their character object with.

Returns

📋 table
The character object from the list of characters.

FrameworkZ.Characters:GetCharacterByUID(uid)

method
Gets a character by their unique ID.

Parameters

uid 📝 string
The character's unique ID.

Returns

📋 table
The character object from the cache or nil if not found.

FrameworkZ.Characters:GetCharacterInventoryByID(username)

method
Gets a character's inventory by their username.

Parameters

username 📝 string
The player's username.

Returns

📋 table
The character's inventory object or nil if not found.

FrameworkZ.Characters:Initialize(isoPlayer, id)

method
Initialize a character and add it to the system.

Parameters

isoPlayer 📋 table
The IsoPlayer object associated with this character.
id 🔢 integer
The character's ID from the player stored data.

Returns

📋 table
\string The initialized character object or false and an error message.

FrameworkZ.Characters:New(isoPlayer, id)

method
Create a new character object.

Parameters

isoPlayer 📋 table
The IsoPlayer object associated with this character.
id 🔢 integer
The character's ID from the player stored data.

Returns

📦 object | ✅ boolean
The new character object or false if the process failed to create a new character object.
📝 string
An error message if the process failed.

FrameworkZ.Characters:OnInitGlobalModData()

method
Initialize global mod data for the Characters module.

FrameworkZ.Characters:OnPostLoad(isoPlayer, characterData)

method
Initializes a player's character after loading.

Parameters

isoPlayer 📋 table
The IsoPlayer object.
characterData 📋 table
The character's stored data.

Returns

📋 table
The initialized character object.

FrameworkZ.Characters:OnStorageSet(isoPlayer, command, namespace, keys, value)

method
Storage set event handler for character data.

Parameters

isoPlayer 📋 table
The IsoPlayer object.
command 📝 string
The command type.
namespace 📝 string
The data namespace.
keys 📝 string
The data keys.
value 📋 table
The data value.

FrameworkZ.Characters:PlayerTick(player)

method
Player tick function for handling character auto-save on client.

Parameters

player 📋 table
The player object to process.

FrameworkZ.Characters:RemoveFromCache(uid)

method
Remove a character from the UID cache.

Parameters

uid 📝 string
The character's unique ID.

Returns

✅ boolean
Whether the character was successfully removed.

FrameworkZ.Characters:RemoveFromList(username)

method
Remove a character from the active character list.

Parameters

username 📝 string
The player's username.

Returns

✅ boolean
Whether the character was successfully removed.

FrameworkZ.Characters:Save(username)

method
Saves the user's currently loaded character.

Parameters

username 📝 string
The player's username to get their loaded character from.

Returns

✅ boolean
Whether or not the character was successfully saved.

Functions

1

FrameworkZ.Characters.PostLoad(data, characterData)

function
Post-load callback function for character initialization.

Parameters

data 📋 table
The data containing the IsoPlayer object.
characterData 📋 table
The character's stored data.

Returns

📋 table
The initialized character object.