Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

JContainers Lua Documentation — API Version 4

Examples and reference material for the Lua API provided by JContainers.

Try It Offline

The JContainers Lua Playground is a small offline sandbox for experimenting with the Lua API without launching Skyrim. It provides an interactive command loop, module reloading, a minimal example mod, and launchers for Windows and Wine.

Example Index

API Reference and Editor Support

The complete Lua API reference is included with every JContainers release that implements API version 4:

Data/SKSE/Plugins/JC4Data/lua/jc/jcdefs.lua

jcdefs.lua is the canonical declaration of the globals, types, and functions provided by JContainers. It also declares the LuaJIT globals needed by its type annotations, but it does not attempt to redeclare the complete Lua and LuaJIT environment. The copy shipped with the installed release is authoritative because it necessarily matches that runtime version.

For convenient browsing and downloading, this repository also includes the current jcdefs.lua. It is updated with the documentation but does not supersede the version included in an installed release.

The declarations and examples use EmmyLua annotations, which have no runtime cost. VS Code users can install the EmmyLua extension and make the release's JC4Data/lua directory available to their workspace for completion, type information, and signature help.

Module Layout

Keep a mod's modules under its own top-level namespace directory. Within a namespace such as MyMod/, a module may be stored either as a single file such as MyMod/Feature.lua or as a directory entry module at MyMod/Feature/init.lua. require('MyMod.Feature') supports both layouts.

An expression evaluated through JLua_evalLua* may refer to MyMod.function() directly when the namespace entry point is MyMod/init.lua. This is a convenient entry-point syntax, not a requirement that every module inside the namespace be named init.lua. The examples use both layouts according to what they demonstrate.

Lua Environment

User modules and JLua_evalLua* expressions run with a curated global environment. The following Lua and LuaJIT facilities are available alongside the JContainers globals declared by jcdefs.lua:

  • library tables: math, io, string, table, bit, os, debug, coroutine, ffi, and jit;
  • base functions: pairs, ipairs, next, select, error, assert, tonumber, tostring, type, print, pcall, xpcall, collectgarbage, loadfile, load, setfenv, getfenv, setmetatable, and getmetatable;
  • the JContainers module loaders require and weak_require.

jit_zone is also exposed when the corresponding LuaJIT module is available. require is the JContainers loader for modules below JC4Data/lua, not direct access to Lua's package loader. This is a curated environment rather than the complete default Lua global table; globals not listed here, such as package, should not be assumed to be available to user modules.

Useful Links

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages