Skip to content

Instantly share code, notes, and snippets.

View Accoast's full-sized avatar

Accoast

View GitHub Profile
@Accoast
Accoast / SafePropSet.luau
Created September 15, 2024 01:25
runtime safe object/instance properties set specified to use with --!strict
--!optimize 2
export type props = {[string]: any}
-- return runtime safe pcall wrapper
local function generate_safewrap(func: (any...) -> (any...))
return function(...: any...)
local success: boolean, result: string? = pcall(func, ...)
if success then
return result
@Accoast
Accoast / fastTween.lua
Created January 7, 2024 20:36
FastTween
function FastTween(objects: {Instance}, properties: {[string]: any}, easing: {number? | Enum.EasingStyle? | Enum.EasingDirection?}, delay: number?): Tween
-- Check if the first parameter is a table, if not, convert it to a table
if type(objects) ~= "table" then
objects = {objects}
end
-- Create an empty array to store Tween objects
local tweens: {Tween} = {}
-- Loop through each object in the input table
@Accoast
Accoast / luau-oop-typecheck
Created August 19, 2023 16:46
Luau --!strict Typechecking OOP Example
--!strict
local Tool = {}
Tool.__index = Tool
export type ToolSettings = {
debounce : number?,
activatedFunction : (...any) -> ()
}