Project OutFox Wiki
Project OutFox home View the OutFox Wiki source on GitHub Toggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto mode Back to homepage


Introduced in StepMania 3.95, Scripts are Lua files that are loaded globally to the engine. These are always available to use, from anywhere in the theme. However, it is advised to use these sparingly to avoid unnecesary carry over of data, overlapping variable names with other existing Lua naming scopes, and others.

It is recommended practice to ensure script data is kept to a minimum to avoid collision with objects like song data, scores, player data, mods, profile information, song rates, and others.

An example of a script file can be the following:

MyGlobalObject = {}

-- Add some objets to this variable.
MyGlobalObject.CustomFunction = function( val )
	SCREENMAN:SystemMessage( "I've just recieved ".. val )

Usage example:

return Def.Actor{
		-- Notice how this object is called, but there's no presence of MyGlobalObject on this actor or even
		-- the file at all; given it's loaded into memory.
		MyGlobalObject.CustomFunction( "a custom string!" )

Clearing an object

As mentioned on the introduction, it is advised to keep this at a minimum, and also to clean these objects when not in use anymore.

-- Let's say MyGlobalObject is filled to the brim with number objects.
MyGlobalObject = {

-- to clean the object, just reasign the value back to an empty table.
MyGlobalObject = {}