Lua functions

AddItem

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

Historical signature: AddItem(Spawn, ItemID, Quantity)

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

Function: AddItem(Spawn, ItemID, Quantity)

Description: Grant a fresh item to a connected Player, using the defined item ID and quantity. A non-player recipient returns false.

Parameters:

  • Spawn: Player - The original recipient.
  • ItemID: UInt32 - Item id to assign to Spawn.
  • Quantity: UInt16 - Quantity of item to assign to Spawn (default 1).

Returns: On normal return, a boolean: true after native placement or stacking commits; false when input or admission is rejected. True does not promise synchronous durable database commit.

Connection lifetime: The selected original Player's connection is retained through the native call. A disconnect or reconnect during a callback cannot destroy that retained connection or switch the ongoing call to a replacement. A later Lua call resolves the current connection. This does not extend the lifetime of unrelated spawn or item userdata.

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.

AddItem(Spawn, 12866, 1)

Evidence: server/Quests/BigBend/rat_barsh.lua:31; binding EQ2Emu_lua_AddItem.

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