Lua functions

GetOwner

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

Historical signature: GetOwner(spawn)

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

Function: GetOwner(spawn)

Description: Returns the original owner of an NPC, including a pet or charmed NPC, using its weak allocation reference. The native lookup retains that actor in the current Lua invocation; a replacement allocation with the same runtime ID or address cannot become the owner. An admitted actor remains readable through retirement within that invocation. Stored userdata remains weak between calls.

Parameters:

  • spawn (Spawn) - NPC whose owner is requested. Other spawn types are invalid.

Returns: Owner Spawn userdata, or no value (nil when assigned) for invalid input, no owner, retirement or a detached/different-zone relationship.

Checked example

No checked example is published for this function yet. No active script call with the current C++ argument count was found.

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