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 as a table of key value pairs with two current keys defined. The key 'process_used' indicates the memory used by the sbengine process. The key 'heap_used' indicates only the heap (malloc) memory used by the sbengine process. Not all rendering engine platforms support all metrics, in which case the value will be set to 0 indicating no information.


Parameters:

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)