Skip to main content
Version: 9.0.2

gre.env

gre.env(
string_key
)
--or
gre.env(
table
)

Return information about the Storyboard runtime environment. The input can be either a single string containing the key to look up or a table of keys for variables to match. The following table describes the available keys:

version The version of this engine as a string value. The format of the string is four version numbers separated by dots: major.minor.service.build.

target_os The target operating system

target_cpu The target processor

renderer The name of the graphics rendering technology being used.

screen_width The dimensions of the screen width

screen_height The dimensions of the screen height

active_screen The name of the currently active screen

render_caps The rendering capabilities. Currently the only defined capability is "3d" if 3D rendering is supported

mem_stats Platform memory statistics for the engine. The results are returned in a table with string keys, indicating the type of memory value being reported, and number values in bytes. Not all platforms support querying all statistics so this field may be nil or the individual field values may be set to 0 indicating that the platform can not provide the requested level of detail.

The key process_used returns the number of bytes of memory that is being used by the Storyboard Engine process.

The key heap_used returns the number of bytes of memory that is specifically being used by the heap. This number is usually smaller than the process memory and does not typically include large memory allocations for display framebuffers or memory mapped files.

greio_channel The current application's IO channel name.

Parameters

ParameterTypeDescription
key#string or #tableA string or a table of strings to look up.

Returns

If a single #string is provided as an input argument, just a single data value for that argument is returned.

If a #table is provided as an input argument, then a #table with key/value pairs corresponding to the keys of the input argument and the results they provide.

Example

-- Get the target OS for dynamic module loading
local os = gre.env("target_os")
print("Running on target OS: " .. tostring(os))

-- Report on the Storyboard version and rendering technology
local info = gre.env({"version", "renderer"})
local msg = string.format("Storyboard version %s (%s renderer)",\
info.version, info.renderer)
print(msg)