Lua run (console command)

From GMod Wiki

Revision as of 18:57, 2 November 2009 by Crazy Quebecer (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
For other uses, see Lua run (disambiguation).
Console.png Go to:
Console
Command
Syntax lua_run String code
Available On: NewerServer.pngState Console.png
Part Of: Garry's Mod
Description:
A console command that allows you to run lua code on the server.

Examples

DescriptionYou can run any valid lua code with this.
Used onNewerServer.png
Code
lua_run Entity(1):SetHealth(300)
OutputSet's the first player's health to 300.



DescriptionYou can also chain multiple lines in a single command.
Used onNewerServer.png
Code
lua_run zombie = ents.Create("npc_zombie") zombie:Spawn()
OutputCreates a zombie and spawns it (at the origin by default).



DescriptionVariables defined in the code or in previous lua_run commands can be used.
Used onNewerServer.png
Code
lua_run zombie:Ignite()
OutputSets our previously spawned zombie on fire.


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox