Function: GetEquippedItemBySlot(spawn, slot)
Returns the original item currently equipped in a slot, as item userdata.
Parameters: spawn must be an entity (Player, NPC or Bot). slot is the
equipment slot number, from 0 through 24.
Returns: One item userdata value when present. Invalid entities, slots or
empty slots return no value (nil in a Lua expression), with an error log.
local item = GetEquippedItemBySlot(Player, 0)
if item ~= nil then print(GetItemID(item)) end
Original item lifetime: The collection selects and acquires the original item loan while holding its lock. Marshalling admits that loan into the protected Lua invocation. The userdata itself remembers a weak original allocation control; saved Lua values cannot extend publication or follow address reuse. An admitted invocation keeps its original item through retirement/expiration until the callback ends. Later invocations reject retired originals. See Lua actor lifetime.