Skip to main content

require

Function require 

Source
pub fn require(modname: string) -> any
Expand description

Loads the given module. Starts by looking into the package.loaded table to determine whether modname is already loaded; if so, returns the stored value. Otherwise, finds a loader for the module by consulting the searchers in package.searchers, runs it, and caches its result in package.loaded[modname].

§Examples

local socket = require("socket")
print(require("socket") == socket)    --> true  (cached in package.loaded)