gre.SCRIPT ROOT

gre.SCRIPT_ROOT
                    

This is a variable that is filled in by the Storyboard Engine to contain the path to the application project's scripts directory.

The gre.SCRIPT_ROOT variable provides a convenient way to reference the Lua script related resources in a location independent, project relative, manner. This variable is only applicable for filesystem based configurations.

When used in conjunction with the gre.env() function, the gre.SCRIPT_ROOT can provide an effective way to configure the search path for extra Lua modules.

Example:

-- Add the scripts/<os>-<cpu> to the Lua file resolver for require statements
-- ie ..../scripts/linux-x86
local target = gre.env({"target_os", "target_cpu"})
local extra_path = string.format("%s/%s-%s/?.lua;", gre.SCRIPT_ROOT,
target.target_os, target.target_cpu)
package.path = extra_path .. package.path 
                    
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Article is closed for comments.