Interface to access global application functionality.
Note that since the application is a singleton (there is only one application), you don't need to pass any Application object to any of the Application functions. All the functions operate on the application singleton.
Related sample code
Other related reference items
Related help topics
argv ( ) : string*Returns the command-line arguments that were supplied to the engine when it was executed, if any.
|
This function does not accept any parameters. |
string* |
Each of the command line arguments is returned as a separate string. The * notation indicates that there may be zero or more instances of the specified type. |
back_buffer_size ( window ) : number, numberReturns the back buffer resolution.
|
window : | Optional; used only when rendering to multiple swap chains on PC. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
number |
The back buffer resolution width, in pixels. |
number |
The back buffer resolution height, in pixels. |
Do not call the deprecated version of this named "resolution".
Related sample code
Other related reference items
begin_scoped_autoload ( ) : integerWhen autoloading is enabled and this function is called, then all the resources that are autoloaded will be unloaded when end_scoped_autoloaded is called.
|
This function does not accept any parameters. |
integer |
The offset from which to unload the autoloaded resources. |
build ( ) : stringIdentifies the build mode of the engine.
|
This function does not accept any parameters. |
string |
One of the following strings: debug, dev or release. |
build_identifier ( ) : stringIdentifies the build version number of the engine.
|
This function does not accept any parameters. |
string |
A string that identifies the build version number of the engine. |
For example: 2437 branch:release2.
If you rebuild the engine on your own, you can set this build identifier in a post-processing step after you have built the engine executable. The built executable will contain the string a4e915264ceaa4424b3ed6d3d2fe5e1a, followed by 128 zero characters. You can replace the zero characters with whatever string you want this build_identifier() function to return.
can_get ( type, name ) : booleanIndicates whether or not the specified resource is available.
|
type : | string | The type of the resource to find. |
name : | string | The name of the resource to find. |
boolean |
true if the specified resource is available, or false otherwise. |
Related sample code
clear_resource_override ( type, name )Clears a resource override set by set_resource_override().
|
type : | string | The type of the resource being overridden. |
name : | string | The name of the resource being overridden. |
This function does not return any values. |
Other related reference items
clear_resource_override_flag ( name )Clears a resource override flag set by set_resource_override_flag()
|
name : | string | The flag that should be removed. |
This function does not return any values. |
Other related reference items
console_command ( command, parameters )Simulates sending a command from the console directly to the game.
|
command : | string | The command to send to the console. |
parameters : | string* | Zero or more additional command-line parameters to pass along with the command. The * notation indicates that there may be zero or more instances of the specified type. |
This function does not return any values. |
console_port ( ) : integerIndicates the number of the port that the console is listening on.
|
This function does not accept any parameters. |
integer |
The port number of the console. |
console_send ( command, data, length )Sends the specified command to the Stingray console, the same as if it had been sent from an external editor.
|
command : | The information that you want to send to the console, expressed in a string-keyed table. | |
data : | string? | Optional pointer to binary data to send. If this is supplied then length must also be given. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
length : | number? | Length of binary data, if any. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
This function does not return any values. |
You can use this function to print messages, warnings and errors to the console, or send arbitrary messages to other clients of the engine's console server.
Other related reference items
create_viewport ( world, viewport_template ) : stingray.ViewportCreates a viewport that will be used when rendering the specified world using the named viewport template, which must be set up in the render config file.
|
world : | The world that will be rendered in the new viewport. | |
viewport_template : | string | The name of the viewport template that determines the characteristics of the viewport. |
The newly created Viewport. |
When you are finished with this viewport, you should destroy it by calling destroy_viewport().
Other related reference items
destroy_viewport ( world, viewport )Destroys a viewport that was previously created by a call to create_viewport().
|
world : | The world being rendered in the viewport you want to destroy. | |
viewport : | The viewport you want to destroy. |
This function does not return any values. |
Other related reference items
end_scoped_autoload ( offset )Will unload all resources that were autoloaded between the calls of begin_scoped_autoload and end_scoped_autoload.
|
offset : | integer | The offset from which to unload the autoloaded resources. |
This function does not return any values. |
flow_callback_context_entity ( ) : stingray.EntityReturns the Entity which owns the currently executing flow node, or nil if this node is not owned by an Entity.
|
This function does not accept any parameters. |
The Entity which owns the executing flow node. |
flow_callback_context_level ( ) : stingray.LevelReturns the Level which owns the currently executing flow node, or nil if this node is not owned by a Level.
|
This function does not accept any parameters. |
The Level which owns the executing flow node. |
flow_callback_context_unit ( ) : stingray.UnitReturns the Unit which owns the currently executing flow node, or nil if this node is not owned by a Unit.
|
This function does not accept any parameters. |
The Unit which owns the executing flow node. |
flow_callback_context_world ( ) : stingray.WorldReturns the World which owns the currently executing flow node, or nil if this node is not owned by a World.
|
This function does not accept any parameters. |
The World which owns the executing flow node. |
get_data ( indices ) : anyRetrieves the data set at the specified indices within the global script data object.
|
indices : | any(integer, string)+ | One or more indices for the data, which may be integers or strings. The + notation indicates that there may be one or more instances of the specified type. The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
any |
The data value stored at the specified sequence of indices, if any. |
Other related reference items
has_data ( indices )Indicates whether or not any data has been saved at the specified indices in the global script data object.
|
indices : | any(integer, string)+ | One or more indices for the data, which may be integers or strings. The + notation indicates that there may be one or more instances of the specified type. The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
This function does not return any values. |
main_world ( ) : stingray.WorldDebug helper function that returns the "most important" game world.
|
This function does not accept any parameters. |
The World that is determined to be the most important. |
This is usually the world where stuff is happening, and in which you want to test particle effects, sounds, etc.
The "most important" world is defined as the world that was rendered last frame that contains the most units.
Related sample code
make_hash ( values ) : stringCreates a combined hash out of the arguments.
|
values : | any+ | The values to use when creating the hash. This list must contain at least one value. Accepts numbers, nil, strings, and hex numbers expressed as strings. The + notation indicates that there may be one or more instances of the specified type. |
string |
A 64-bit hexadecimal hash. |
flags : | integer* | Any number of New World Flags that set up properties for the new world. The * notation indicates that there may be zero or more instances of the specified type. |
The newly created World. |
You can have as many game worlds as you like. Multiple game worlds may be useful for things like loading screens or inventory rooms.
NOTE: Always remember to free every world you create by calling release_world() when you are done with it.
Other related reference items
open_url_in_browser ( url )Opens the specified URL in the default browser.
|
url : | string | The URL to open. |
This function does not return any values. |
platform ( ) : stringIdentifies the platform the application is currently running on.
|
quit ( exit_code )Quits the application.
|
exit_code : | integer? | If supplied, specifies the exit code of the application. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
This function does not return any values. |
This function does not exist on the PlayStation 3, since it is forbidden to exit without a termination request from the SDK.
Related sample code
release_resource_package ( package )Frees a resource package that was previously created by a call to resource_package().
|
package : | The package to be destroyed. |
This function does not return any values. |
Other related reference items
release_world ( world )Destroys the specified World.
|
world : | The World you want to destroy. |
This function does not return any values. |
You should call this when you are completely done with a particular world.
Other related reference items
render_caps ( caps ) : boolean+Returns the status of the specified render caps.
|
caps : | string+ | One or more render caps whose status will be retrieved. The + notation indicates that there may be one or more instances of the specified type. |
boolean+ |
Returns a separate boolean value for each argument. The + notation indicates that there may be one or more instances of the specified type. |
render_world ( world, camera, viewport, shading_environment, window )Renders the specified world, with the specified shading environment, using the specified camera, in the specified viewport.
|
world : | The World that you want to render. | |
camera : | The Camera that defines the point of view for the rendering. | |
viewport : | The Viewport that will contain the rendering. | |
shading_environment : | The ShadingEnvironment that determines the characteristics of the rendering. NOTE: If a shading environment entity exists in any of the levels loaded into the world, this parameter is not used. The settings are read from the entity instead. | |
window : | Optional; used only when rendering to multiple swap chains on PC. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
This function does not return any values. |
Other related reference items
resource_package ( name ) : stingray.ResourcePackageCreates a resource package from the .package file with the specified name.
|
name : | string | The file name of the .package file to use when creating the new resource package. |
The new resource package. |
NOTE: Always remember to free every resource package you create by calling release_resource_package() when you are done with it.
Other related reference items
resource_package_from_url ( name ) : stingray.ResourcePackageCreates a resource package from a bundle located on a web server.
|
name : | string | The URL of the bundle file to use when creating the new resource package. |
The new resource package. |
NOTE: Always remember to free every resource package you create by calling release_resource_package() when you are done with it.
restart_file_log ( local_filename, remote_filename )Closes the current file log, copies the remote log, and then restarts logging.
|
local_filename : | string? | Optional. If specified, the new log will use this path. If not specified, the last log will be overwritten. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
remote_filename : | string? | Optional. If specified, the new remote log will use this path. If not specified, the last remote log will be overwritten. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
This function does not return any values. |
The paths and file names that you pass to this function can contain the following variables, which will be expanded automatically:
This function does not accept any parameters. |
This function does not return any values. |
The path and file name are determined by the key win32.user_settings or macosx.user_settings in the settings.ini file. The string %%APPDATA%% in the file name will be expanded to the user's AppData or Application Support folder. For example:
win32 = { user_settings = "%%APPDATA%%\\CompanyName\\GameTitle\\user_settings.config" } macosx = { user_settings = "%%APPDATA%%/CompanyName/GameTitle/user_settings.config" }
Other related reference items
settings ( ) : tableReturns an object that contains the script settings specified in the settings.ini file: i.e. whatever is found in the settings.ini file under the script_data setting.
|
This function does not accept any parameters. |
table |
A table that contains data read from the script_data setting in the settings.ini file. |
Related sample code
set_autoload_enabled ( isEnabled )Determines whether or not the auto-loading mechanism is enabled.
|
isEnabled : | boolean | true to enable auto-loading, or false otherwise. |
This function does not return any values. |
If enabled, the package system will be disabled, and all resources will be automatically loaded as they are accessed.
Other related reference items
set_data ( indices, indices, indices, value ) set_data ( indices, indices, value ) set_data ( indices, value )Stores the specified value in a global script data object, at a location determined by the specified indices.
|
indices : | any(integer, string) | One or more indices for the data, which may be integers or strings. The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
value : | any | The value to store. |
This function does not return any values. |
You can retrieve the data later by passing the same indices in a call to get_data().
set_resource_override ( type, name, override )Specifies that the resource override should override the resource name.
|
type : | string | The type of the resource to override. |
name : | string | The name of the resource to override. |
override : | string | The resource it should be replaced with. |
This function does not return any values. |
I.e. whenever any engine system requests the resource name, the resource override will be returned instead. To remove an override, use clear_resource_override().
Other related reference items
set_resource_override_flag ( flag, priority )Sets the value of a resource override flag.
|
flag : | string | The flag whose priority we should set. |
priority : | integer | The priority of the flag. |
This function does not return any values. |
These values are used when resource overrides have been compiled with runtime flags. When a resource is requested, the override that corresponds to the flag with the highest priority will be used. The base resource (with no flags) is considered to have a priority of 0. To remove an override flag, use clear_resource_override_flag()
Other related reference items
set_tablet_pen_service_properties ( properties )Sets windows tablet pen and service properties
|
properties : | number | Can be any combination of the defined Pen Service Properties values. (e.g., stingray.Input.TabletPenServiceProperty.DISABLE_PRESSANDHOLD + Input.TabletPenServiceProperty.DISABLE_SMOOTHSCROLLING). |
This function does not return any values. |
set_time_step_policy ( params )Controls how the application's time step is advanced.
|
params : | any+ | A list of configuration parameters and their corresponding values. The + notation indicates that there may be one or more instances of the specified type. |
This function does not return any values. |
This function accepts the following parameters:
sysinfo ( ) : stringIndicates the hardware that the game runs on.
|
This function does not accept any parameters. |
string |
A string that describes the hardware the game runs on. |
This is typically used in error messages in order to append some extra detail about the hardware on which the error occurred, in case that information would be helpful in diagnosing and correcting the error.
time_since_launch ( ) : numberReturns the elapsed time, in seconds, since the application was launched.
|
This function does not accept any parameters. |
number |
The elapsed time, in seconds. |
user_settings_load_error ( ) : booleanIndicates whether or not an error occurred when loading the user settings data file.
|
This function does not accept any parameters. |
boolean |
true if the user settings file exists but could not be loaded, or false otherwise. |
If this function returns true, the file may be corrupt. In this case, default strings will be used. Note that a missing data file is not considered a load error.
worlds ( ) : stingray.World[]Returns all the game worlds you have created.
|
This function does not accept any parameters. |
A table of World objects. The [] notation indicates that this type is an array: a table in which the keys of the members are sequential integers, and the value of each element is an instance of the type shown. |
The elements in this group are only available in development builds.
Do not use them in your final builds.
autoload_resource_package ( name )When autoload is enabled, automatically loads all the resources from the specified resource package.
|
name : | string | The package to load. |
This function does not return any values. |
See also set_autoload_enabled().
guid ( ) : stringReturns a globally unique identifier, which can be useful for identifying particular objects.
|
This function does not accept any parameters. |
string |
A new globally unique identifier. |
Only available on Windows platforms and in development builds or on Xbox One.
sleep ( milliseconds )Sleeps for the specified amount of time.
|
milliseconds : | number | The time to sleep, in milliseconds. |
This function does not return any values. |
toggle_dev_only_warnings ( enabled )Enables warnings to be printed out every time a function that is only available in development builds is called from Lua.
|
enabled : | boolean | True if development only warnings should be enabled |
This function does not return any values. |
The constants listed in this group can be passed as arguments in calls to Application.new_world().
APEX_LOD_RESOURCE_BUDGET : integerSets the apex_lod_resource_budget to a specified value.
|
If you pass this flag to Application.new_world(), you must also pass an additional argument that indicates the desired value for the resource budget.
DISABLE_APEX_CLOTH : integerDisables Apex cloth simulation in a world.
|
DISABLE_PHYSICS : integerDisables physics in a world.
|
DISABLE_RENDERING : integerDisables rendering in a world.
|
DISABLE_SOUND : integerDisables sound playback in a world.
|
ENABLE_REPLAY : integerEnables Replay for a world.
|
ANDROID = "android" : stringThe string used internally to represent Android platforms.
|
Other related reference items
IOS = "ios" : stringThe string used internally to represent iOS platforms.
|
LINUX = "linux" : stringThe string used internally to represent the Linux platform.
|
MACOSX = "macosx" : stringThe string used internally to represent Mac OS platforms.
|
PS4 = "ps4" : stringThe string used internally to represent the PlayStation 4 platform.
|
UWP = "uwp" : stringThe string used internally to represent UWP platforms.
|
WEB = "web" : stringThe string used internally to represent the Web platform.
|
WIN32 = "win32" : stringThe string used internally to represent Windows platforms.
|
Other related reference items
XB1 = "xb1" : stringThe string used internally to represent the Xbox One platform.
|
The functions in this group are only available on Windows and Mac OS X platforms.
This function does not accept any parameters. |
This function does not return any values. |
enum_display_modes ( ) : tableReturns detailed information about all available display modes on all screens.
|
This function does not accept any parameters. |
table |
A table of Vector3 objects, each of which describes a single display mode. Each Vector3 stores the information as follows: (width, height, screen_index). |
NOTE: This function is considered deprecated, and exists only to preserve backward compatibility. For all new development, use the DisplayAdapter interface instead.
Other related reference items
process_id ( ) : integerReturns the process ID assigned to the application by the operating system.
|
This function does not accept any parameters. |
integer |
The process ID. |
This function does not accept any parameters. |
This function does not return any values. |
New PS4 controllers connected to the PC are not automatically detected after startup. Use this function to detect and setup the connected controllers and remove references to disconnected controllers.
When calling this function the order of the controllers can change, so the different PS4Pad1 interfaces can represent different physical devices.
After calling this function the first found PS4 controller will be available as PS4Pad1, the second as PS4Pad2, etc. If you call this function multiple times, there is no guarantee that the order of controllers is preserved. I.e., a controller previously detected as PS4Pad3 may now be PS4Pad1.
This function only exists on Windows.
Other related reference items
set_max_frame_stacking ( frames )Sets the maximum number of frames that are permitted to be stacked in the driver and the GPU.
|
frames : | number | The maximum number of frames, or -1 to disable frame stacking. |
This function does not return any values. |
This is implemented by issuing a D3D11_QUERY_EVENT once per frame in a round-robin fashion, and every frame waits for the oldest event in the queue.
This feature is intended to reduce "mouse lag" on slow machines. Available for Windows platforms only.
NOTE: It is highly recommended that you avoid using this function unless absolutely necessary. It should only be considered as a last resort.
set_user_setting ( indices, indices, indices, value ) set_user_setting ( indices, indices, value ) set_user_setting ( indices, value )Stores the specified value in the user settings data object, at a location determined by the specified indices.
|
indices : | any(integer, string) | One or more indices for the data, which may be integers or strings. The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
value : | any | The value to store. |
This function does not return any values. |
You can retrieve the data later by passing the same indices in a call to user_setting(). See also save_user_settings() to persist the change to disk.
user_setting ( indices )Retrieves the data set at the specified indices within the user settings data object.
|
indices : | any(integer, string)+ | One or more indices for the data, which may be integers or strings. The + notation indicates that there may be one or more instances of the specified type. The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses. |
This function does not return any values. |
Other related reference items