Documentation
¶
Overview ¶
openlib shows how to write your own library that installs like a built-in one. The standard libraries register via methods on the state (L.OpenString, L.OpenMath, …); from an embedding package you write the exact same pattern as a free function taking *LState — build a module table, fill it with Go functions and constants, and install it as a global. (For `require("x")` integration instead, see the customlib example's Requiref/Preload.)
The payoff: a custom library is how you expose Go's standard library — here a few strings helpers Lua's string library does not have.
Click to show internal directories.
Click to hide internal directories.