Skip to content

Instantly share code, notes, and snippets.

View lucasmz-dev's full-sized avatar

Lucas lucasmz-dev

View GitHub Profile
@lucasmz-dev
lucasmz-dev / RecycledDefer.lua
Last active September 12, 2021 02:50
RecycledDefer
-- RecycledDefer is a *PROOF OF CONCEPT*.
-- It should not be used if you wanna spawn threads quickly, AFAIK that's what recycling thread with task.spawn is usually about,
-- this takes a lot longer because of table look ups, and other things.
-- So please, don't use it in an actual production.
--[[
RecycledDefer:
Library which recycles threads but with .defer, instead of using .spawn, like it usually is done.
@lucasmz-dev
lucasmz-dev / ParallelSpawn.lua
Last active September 14, 2021 23:54
ParallelSpawn
local Bindable: BindableEvent = Instance.new("BindableEvent")
type Event = typeof(Bindable.Event)
local Event: Event = Bindable.Event
return function(_function: (...any) -> (), ...)
if typeof(_function) ~= "function" then
error("Must be a function", 2)
end
@lucasmz-dev
lucasmz-dev / MusicHandler.client.lua
Created September 5, 2021 14:43
Simple Music Handler
local SoundService = game:GetService("SoundService")
local Sound do
Sound = Instance.new("Sound")
Sound.Name = "Music"
Sound.Parent = SoundService
end
local SongIndex = 1
local Songs = {
@lucasmz-dev
lucasmz-dev / Enum.lua
Last active August 30, 2021 19:17
Enum
local Enum = {}
function Enum:__index(enumObjectName)
error(enumObjectName.. " is not a valid EnumItem from".. self._name, 2)
end
function Enum:__newindex()
error("You cannot add new members to an Enum. -".. self._name, 2)
end