-- tests/module.cat -- the `module` global reflects the current unit. -- -- `module` is a global table: `name` is the basename of the running -- file, `path` its path and `dir` its directory. Importing another -- file (use/dofile) swaps `module` for the duration of that file and -- restores the caller's afterwards. print("name:", module.name) print("dir:", module.dir) -- a user may mutate it like any table module.extra = "tagged" print("extra:", module.extra) use("tests/module_lib.cat") print("back:", module.name) print("extra kept:", module.extra)