require

From Inspired-Lua Wiki
Revision as of 12:22, 7 June 2012 by Adriweb (talk | contribs) (Created page with "Require is the function used to import some modules. There are three modules that you can 'require': physics, color, and strict. The physics module is the chipmunk [[Physics E...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Require is the function used to import some modules.

There are three modules that you can 'require': physics, color, and strict.


The physics module is the chipmunk Physics Engine.

color is just a table containing colors. (color.red (or color["red"]) will return the color code for red.)

'strict' is a module (not tested) which, apparently, makes it so Lua checks uses of undeclared global variables. All global variables must be 'declared' through a regular assignment (even assigning nil will do) in a main chunk before being used anywhere or assigned to inside a function.

Usage: require 'modulename'

This has been introduced in TI-Nspire OS 3.2 (Changes).