diff --git a/docs/generate.py b/docs/generate.py index b1a76883a..2adbe3098 100644 --- a/docs/generate.py +++ b/docs/generate.py @@ -162,6 +162,11 @@ def print_af(lf, af): for lib in lualibs: print('### `'+lib+'`') +print('## Modules') +print("""You can load modules with `require "mymod"` or `require "mydir.mymod"`, just put `mymod.lua` in the same directory the script is, or in `mydir/` to keep things organized. + +Check the [Lua tutorial](http://lua-users.org/wiki/ModulesTutorial) or examples how to actually make modules.""") + print('## Global variables') print("""These variables are always there to use.""") for lf in funcs: diff --git a/docs/script-api.md b/docs/script-api.md index 0fa395398..c4e1f3169 100644 --- a/docs/script-api.md +++ b/docs/script-api.md @@ -12,6 +12,10 @@ The following Lua libraries and their functions are available. You can read more ### `string` ### `table` ### `package` +## Modules +You can load modules with `require "mymod"` or `require "mydir.mymod"`, just put `mymod.lua` in the same directory the script is, or in `mydir/` to keep things organized. + +Check the [Lua tutorial](http://lua-users.org/wiki/ModulesTutorial) or examples how to actually make modules. ## Global variables These variables are always there to use. ### [`meta`](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=meta)