Modules

Jul 1, 2023  │  m. Jul 2, 2023 by Gleb Buzin

A Module is like a library full of functions and variables.

info.lua:

local M = {}

function M.valueOf(x)
    io.write("Value: ", x)
end

return M

main.lua:

local info = require("info")

info.valueOf("John")

$ lua main.lua
Value: John


Next: Coroutines