Forest Logo
search
package_2

tritium

By @scytheric

Roblox

Mirrored

Tritium

A collection of Fusion addons and utilities made by Scythe (dz_Scy). Some utility functions were pulled from boatbomber's PluginEssentials.

DISCLAIMER - If you probe thru the source code, this is for you:

I completely forgot that Fusion 0.2 was published to Wally so please excuse my weird way of locating the Fusion library. This will be fixed shortly soon. :)

Install with Wally:

tritium = "scytheric/tritium@0.1.3"

No documentation :(

Documentation WIP! Please refer to the code examples below to get an idea of how to use the addons/utility.

State Objects

ArrayValue

-- Assume Tritium is required here.

local array = ArrayValue { "Apple", "Orange", "Cherry" }

print(array:get())
-- { "Apple", "Orange", "Cherry" }

-- Arg #1 `value`: `any`
array:insert("Pear")

print(array:get())
-- { "Apple", "Orange", "Cherry", "Pear" }

array:remove(3)

print(array:get())
-- { "Apple", "Orange", "Pear" }

-- Helper method, removes element by its value.
array:removeByValue("Apple")

print(array:get())
-- { "Orange", "Pear" }

TableValue

Note: For all dictionary/mixed tables/"arrays" containing spaces, use TableValue.

-- Assume Tritium is required here.

local tbl = TableValue {
	Currency = {
		Cash = 100
	},

	Name = "John"
}

print(tbl:get())
-- { Currency = { Cash = 100 }, Name = "John" }

-- Arg #1 `Key`: `any`
-- Arg #2 `Value`: `any`
-- Arg #3 `deepAssignment`: `boolean?`
-- Arg #4 `delimiter`: `string?`
-- Arg #5 `ignoreNumericIndices`: `boolean?`
tbl:assign("Name", "John Doe")

print(tbl:get())
-- { Currency = { Cash = 100 }, Name = "John Doe" }

-- To deep-assign values, you must pass true for the third argument.
-- Arg #4 `delimiter` is optional, "/" by default.
-- Arg #5 `ignoreNumericIndices` will ignore numeric indices when parsing the table with the path string, false by default.
--         ^-- If true, all indices are treated as strings (no type conversion will occur where possible.)
tbl:assign("Currency/Cash", 5000, true)

print(tbl:get())
-- { Currency = { Cash = 5000 }, Name = "John Doe" }

Package Details

Install command (Click to copy)


Version

0.1.9

License

MIT

check_circle

Safe for commercial use

Automated license review — not legal advice.