Lua functions

SetAccessToEntityCommand

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

Historical signature: SetAccessToEntityCommand(Spawn, Player, CommandString, Allowed)

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

Function: SetAccessToEntityCommand(Player, Spawn, CommandString, Allowed)

Description: Sets a Player's permission entry on a spawn's primary entity command. Primary commands are matched by their command text, as supplied to AddPrimaryEntityCommand. The entry is used when listing that spawn's right-click commands for the Player.

Parameters:

  • Player (Spawn) - Player whose character ID receives the permission entry.
  • Spawn (Spawn) - Spawn owning the primary command.
  • CommandString (string) - Exact primary command text to match.
  • Allowed (uint8) - 1 allows the command; other values store a denial.

Returns: true when the primary command was found and updated; false when it was absent. Invalid actors or a non-Player first argument produce no result.

Command lifetime: Lookup and permission publication are one mutation operation. A removed command cannot receive a detached descriptor write. Existing packet readers retain their immutable command version; later readers see the updated permission entry. See Lua actor lifetime.

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.

SetAccessToEntityCommand(Spawn,NPC,"smash", 0)

Evidence: server/SpawnScripts/Caves/acuriousrock.lua:15; binding EQ2Emu_lua_SetAccessToEntityCommand.

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