Garry's Mod Wiki

Garry's Mod Wiki

  function CompileFile( string path )

Description

Attempts to compile the given file. If successful, returns a function that can be called to perform the actual execution of the script.

Arguments

1 string path
Path to the file, relative to the garrysmod/lua/ directory.

Returns

1 function
The function which executes the script.

Example

Assuming our file is named example.lua and located in the garrysmod/lua/ directory, the following code would execute the script.

local example = CompileFile("example.lua") example()
Output: Hello!

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...