EnvUtils2

Date: December 30, 2008

Introduction

EnvUtils2 started as a recreation of the setenv and getenv commands from StepMania 3.9 in SM4.0 CVS.

Installation

Make sure that EnvUtils2.lua is in your theme's Scripts directory. On sm-ssc, this is not necessary, since EnvUtils2 is included in the fallback theme, meaning every theme* should have access to it.

*Themes that fall back on a theme that isn't _fallback will have to provide EnvUtils2 in either their fallback theme or the theme itself.

Usage

When the file is in place, you can then use setenv and getenv:

Examples

Getting an env value

local toasty = getenv("Toasty");
LoadActor(toasty)..{
(...)

Setting an env value

setenv("Toasty","nima");

You can even use different types:

setenv("TrickyDisco",false);
setenv("TowelPixels",320);

Even tables, if that interests you:

setenv("PlayerScore",{ Name = "DDR", Score = 8000000 });

and the matching code to get such values:

local PlayerScore = getenv("PlayerScore");
local psName = PlayerScore['Name'];
local psScore = PlayerScore['Score'];

Download

[Right click, Save as]