Lua functions

GetSpellDataIndex

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

Historical signature: GetSpellDataIndex(spell, idx, secondfield)

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

Function: GetSpellDataIndex(spell, idx, secondfield)

Description: Reads an owned snapshot of one Lua-data record from the spell. Integer/float/string records have two values; boolean records have one.

Parameters:

  • spell (Spell) - Lua spell object whose backing template supplies the record.
  • idx (int32) - Zero-based index. Negative or out-of-range indexes are rejected; indexes above 255 are not truncated.
  • secondfield (bool, optional) - Read the second integer/float/string value when true; default false. Boolean records ignore this flag.

Returns: Integer, number, boolean or string according to the record type. Missing records or unsupported types return no values (nil in a single-result Lua call).

Record ownership: The backing template owns child values directly; readers receive copies and setters publish prepared edits. The instance must be admitted as described below; child-value ownership and VM execution are separate contracts. See Lua actor lifetime.

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.