Lua functions

GetSpellCaster

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

Historical signature: GetSpellCaster(spell)

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

Function: GetSpellCaster(spell)

Description: Returns the caster of the supplied spell, or the current spell when the optional argument is omitted. The result retains the original actor allocation through the active callback; address reuse, runtime-ID reuse or reconnect does not replace a known caster.

Parameters:

  • spell (Spell, optional) - Spell to inspect; defaults to the current spell.

Returns: A Spawn reference, or no value (evaluates as nil) when the spell or caster is unavailable.

Spell caster lifetime: When this function reads a spell's caster, it retains that allocation for the native operation. Retirement or callback reentry cannot replace its caster with a different allocation at the same address or runtime ID. A known expired or cleared caster is not rediscovered through a replacement connection. An actor already owned by the active callback remains usable through that callback. See Lua actor lifetime.

Checked example

Active call in a local runtime Lua script. Falls back to the current spell context. This is a contextual call pattern, not a tested standalone script.

local initial_caster = GetSpellCaster()

Evidence: server/Spells/Priest/Cleric/Inquisitor/ContriteGrace.lua:25; binding EQ2Emu_lua_GetSpellCaster.

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