Require

Require is directive in lua script that force execution of another lua file before execute current one. The only argument is path to lua file without extension. It can be either relative to current file:

require "WellWindow" require "../../common/base"

or absolute path (from root folder of game):

require "scripts/gui/BuildingWindows/WellWindow" require "scripts/common/base"

All files in scripts directory are already required at the moment of mod's files execution. There are no need to require them second time.

The main reason to use require directive is inheritance or access classes or functions from another mod's files in script body:

require "Bird" require "Nest" Crow = Class( "Crow", Bird) -- inherit Bird class (require is needed) function Crow: init self .feather = Feather -- access Feather class in function (require is NOT needed) end theCrow = Crow theCrow.nest = Nest -- access Nest class in script body (require is needed)