The Storyboard Engine Lua plugin provides a slightly different execution environment when compared to normal Lua script execution.
Normally a single Lua script serves as the starting point of script execution and all other scripts would be included using the Lua require() declaration. The Storyboard Lua plugin provides a slightly different loading behaviour in that it will pre-load all of the Lua scripts contained in the scripts directory at engine initialization time. This initialization will include executing any script elements that are not contained within function blocks. Since the load order of multiple files is not specified, scripts that require order dependant initialization should add a Lua callback action to the Application Start event (gre.init).
In addition to loading all of the script files in the scripts directory, the Lua plugin modifies the package.path variable and ;; default search path to automatically search the scripts directory.
A convenience variable, gre.SCRIPT_ROOT is pushed into the execution environment that contains the path from the current working directory to the scripts directory. This variable can be used to locate additional resource files or to include extra script directories in a manner that is relative to the overall deployment bundle.
print("Script base directory: " .. tostring(gre.SCRIPT_ROOT)) -- Look for additional module files in the scripts/modules directory package.path = package.path .. ";" .. gre.SCRIPT_ROOT .. "/modules/?.lua"