Lua functions

SetCharacterTitlePrefix

Registered in this checkout as EQ2Emu_lua_SetCharacterTitlePrefix; implementation found at WorldServer/Lua/LuaFunctions.cpp:14040.

Historical signature: SetCharacterTitlePrefix(spawn, titleName)

Parameter and behavior details in the historical explanation are under review against the current implementation.

Function: SetCharacterTitlePrefix(Spawn, TitleName)

Description: Selects an owned prefix title by name for the original Player.

Parameters:

  • Spawn: Spawn - The Player whose title is being selected.
  • TitleName: string - Owned prefix title name, matched without case sensitivity.

Returns: None. The native function does not push a Lua result.

Behavior and ownership: An invalid Player, missing title or title of the wrong type leaves the selection unchanged and logs an error. The function copies the owned title entry and saves its zero-based character index. Row lookup does not expose a title pointer after releasing the list lock.

The original Player and connection are captured before persistence callbacks. UI generation uses copied title snapshots, and delivery stops if that connection's Player relationship or session generation changes. A later Lua call observes the current connection. The selected title's metadata stays owned throughout this operation.

Checked example

Active call in a local runtime Lua script. Argument count matches current fixed C++ readers. This is a contextual call pattern, not a tested standalone script.

SetCharacterTitlePrefix(Spawn, "Lord")

Evidence: server/SpawnScripts/IsleRefuge1/TitleBot.lua:17; binding EQ2Emu_lua_SetCharacterTitlePrefix.

Current registration: WorldServer/Lua/LuaInterface.cpp. Historical explanation: EQ2Emu Lua documentation.