G.include
From GMod Wiki
Function | |
Syntax |
include( String Filename ) Where is this used? |
Description: | |
Runs a lua file | |
Returns: | nil |
Part of Library: | Global Functions |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=G.include]G.include [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Includes "hello.lua". |
---|---|
Used on | |
Code | include("hello.lua") |
Output | N/A |
The files will continue to include each other, untill infinity and beyond. Garry's Mod will throw a rather strange error at you as well, mainly saying:
file.lua:linenumber: chunk has too many syntax levels -- Error PARSING CLIENTSIDE file ------------------------- - File: file.lua ----------------------------------------------------------
The number is usually irrelevant as to the real root of the problem, so begin searching in this file, as well as included files for cross-including.
Additional notes
- The file name must not include ".." - this is the special folder name to go up a folder.
- The filename is relative to the current directory.
- An error saying "Couldn't include file" will be thrown if the file is empty.