How to run a Lua file in GMod
Type lua_openscript test/hello.lua in the server console to run that file from garrysmod/lua once, without restarting the server.
lua_openscript
Runs a server-side Lua file from the lua folder.
lua_openscript <path> Examples
lua_openscript test/hello.lua Run garrysmod/lua/test/hello.lua.
Arguments
pathRequired- File path relative to garrysmod/lua, with the .lua extension.
What it does
Loads and runs the file once, relative to garrysmod/lua. Use it to test a script without restarting the server.
The game's own description: Open a Lua script
Run it on your server
On a SLASHPLAY server, type it in the Console tab of the server page; the reply shows right under it. A value set there lasts until the server restarts. To keep it, add the line to garrysmod/cfg/server.cfg. New to this? Start a GMod server first.
Your own
GMod server.
From $0.03 an hour, only while it runs. New accounts get 6 free tokens.