libraries/ManiaLib/ManiaScript/Tools.php
static function array2maniascript(array $array, $preserveKeys = false)
    {
        if (!$array) {
            // hack because "[]" is not supported and "Text[]" doesnt work yet
            return $preserveKeys ? '[""=>""]' : '[""]';
        }
        foreach ($array as $k => $v) {
            if (is_array($v)) {
                if ($preserveKeys) {
                    $array[$k] = sprintf('"%s"=>%s', self::escapeString($k), self::array2maniascript($v, $preserveKeys));
                } else {
                    $array[$k] = self::array2maniascript($v, $preserveKeys);
                }
            } elseif ($preserveKeys) {
                $array[$k] = sprintf('"%s"=>"%s"', self::escapeString($k), self::escapeString($v));
            } else {
                $array[$k] = sprintf('"%s"', self::escapeString($v));
            }
        }
        return '[' . implode(', ', $array) . ']';
    }
static function array2maniascript(array $array, $preserveKeys = false)
    {
        if (!$array) {
            // hack because "[]" is not supported and "Text[]" doesnt work yet
            return $preserveKeys ? '[""=>""]' : '[""]';
        }
        foreach ($array as $k => $v) {
            if (is_array($v)) {
                if ($preserveKeys) {
                    $array[$k] = sprintf('"%s"=>%s', self::escapeString($k), self::array2maniascript($v, $preserveKeys));
                } else {
                    $array[$k] = self::array2maniascript($v, $preserveKeys);
                }
            } elseif ($preserveKeys) {
                $array[$k] = sprintf('"%s"=>"%s"', self::escapeString($k), self::escapeString($v));
            } else {
                $array[$k] = sprintf('"%s"', self::escapeString($v));
            }
        }
        return '[' . implode(', ', $array) . ']';
    }
Converts a PHP array to a Text[] ManiaScript array (note the type!).
Usefull when used with "ManiaScript Framework Actions"