Map Lua
Maps can run Lua scripts via the lua_run
entity.
Here's an example on gm_construct
:

During the execution of the script, the following global variables are available:
The code can be ran on entity spawn via a spawnflag, or via its RunCode
input.
There's also the RunPassedCode
input, which will run any code passed as the input value. Never use double-quotation marks in any Hammer Output, it will corrupt the map file. Try using Double Square brackets instead.