Tritium (Fusion Addons & Utilities)

Tritium

A collection of Fusion addons and utilities made to supercharge your experience with Fusion.

Some utility functions were pulled from boatbomber’s PluginEssentials.

You can view the GitHub here.

:warning: THIS CURRENTLY USES A VERSION OF FUSION THAT IS NOT PRODUCTION READY!

Install with Wally:

fusion = "scytheric/fusion@0.2.6"

No documentation :frowning:

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

State Objects

TableValue

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

-- Assume Fusion 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" }
3 Likes

UPDATE - Tritium has been converted into a fork of Fusion. ArrayValue has been removed and the insert and remove methods were moved to TableValue. TableValue can be found under Fusion’s state folder and TableUtil can be found under Fusion’s utility folder.

1 Like