Ux | Separates your functions via 'gateways'

Hello there. I made a quick community resource for my project within the timespan of ~5-10 minutes. It’s super self explanatory code but also helps keep your functions, modular code, and client code organized.

Here is a code showing how Ux works (Very simple)

local Replicated = game:GetService("ReplicatedStorage")
local Ux = require(Replicated:WaitForChild("Ux"))

--// Function Categories
local Functions = {
	Printing = {};
	Loops = {};
	Task = {};
};

--// Interior Functions
function Functions.Printing.Print(String: string)
	print(String)
end

function Functions.Printing.Warn(String: string)
	warn(String)
end

function Functions.Printing.Err(String: string)
	local success, response = pcall(function()
		error(String)
	end)
end

function Functions.Loops.StartMainLoop(Threshold: number)
	task.spawn(function()
		while task.wait(Threshold) do
			Functions.Printing.Print(`This loop prints every {Threshold} seconds!`)
		end
	end)
end

function Functions.Task.Sleep(Duration: number)
	task.wait(Duration)
end

--// Function Registery
Ux.Gateways.New("Printing", Functions.Printing)
Ux.Gateways.New("Loops", Functions.Loops)
Ux.Gateways.New("Task", Functions.Task)

--// Function Calling
Ux.Gateways.Get("Printing").Print("A loop will begin shortly.")

Ux.Gateways.Get("Task").Sleep(2);
Ux.Gateways.Get("Loops").StartMainLoop(2)

--[[
. Register functions
. Output "A loop will begin shortly."
. Wait two seconds
. Trigger "StartMainLoop" function with threshold of two
. Output "This loop prints every {Threshold} seconds"
]]

All you have to do is put Ux in ReplicatedStorage and boom. You have Ux installed.

Install Ux here

Have you considered modulescripts before?

What is this lil bro :sob:

a whole function for print? why.. doesn’t even use coroutines or something like that do distinguish it from a literally function.. this is just filler. not worth

3 Likes

Why did you make this? What is this for?

This has no purpose, you can use pass the print and warn functions. And the Err function here does absolutely nothing by the way.

We really just out here making anything :broken_heart:
Guys be looking for an excuse to post
:sob: :sob:

5 Likes

My men be posting anything nowadays :sob:
gonna end up doomscrolling the devforum by 2027

This is an example code, not the module usage or what its used for :sob:

so then what IS it used for? I still dont see a purpose in this

1 Like