repo stringclasses 341
values | file_path stringlengths 29 173 | language stringclasses 2
values | file_type stringclasses 4
values | code stringlengths 2 1.66M | tokens int64 2 598k |
|---|---|---|---|---|---|
imezx/MultiRaycast | imezx-MultiRaycast-c45dd4d/src/init.luau | luau | .luau | --@EternityDev
--!strict
--!native
--!optimize 2
local Raycast = {}
Raycast.__index = Raycast
local RunService = game:GetService("RunService")
local Signal = require(script.Signal)
local PreSimulation = RunService.PreSimulation
local sampleActor = script:WaitForChild("Actor")
function Raycast.new(header: string, dir... | 710 |
imezx/Surround | imezx-Surround-dde33fc/src/init.luau | luau | .luau | --!optimize 2
--!native
local Surround = {}
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local scheduler = require(ReplicatedStorage:WaitForChild("scheduler"))
local begin_profiler, end_profiler = scheduler.profiler.Begin, scheduler.profiler.End
loca... | 729 |
imezx/TaskChain | imezx-TaskChain-83b1c84/src/Types.luau | luau | .luau | --!strict
--!optimize 2
local promise = require(script.Parent.Parent.promise)
local janitor = require(script.Parent.Parent.janitor)
export type Promise<T...> = promise.TypedPromise<T...>
export type Janitor = janitor.Janitor
export type task = {
type: "call" | "wait" | "promise" | "andThen" | "catch" | "finally" | "... | 374 |
imezx/TaskChain | imezx-TaskChain-83b1c84/src/init.luau | luau | .luau | --!optimize 2
local TaskChain = {}
TaskChain.__index = TaskChain
local types = require(script.Types)
--]
local function _processNextTask(self: types.TaskChain)
if self._status == "Destroyed" or not self._isProcessing then
return
end
if #self._tasks == 0 then
self._isProcessing = false
return
end
local ta... | 1,143 |
imezx/InfiniteMath | imezx-InfiniteMath-9e375b0/src/InfiniteMath/Int.luau | luau | .luau | --!native
local Int = {}
Int.__index = Int
export type Int = typeof(setmetatable({
sign = 0 :: number, -- -1, 0, +1
limbs = {} :: { number }, -- little-endian uint32 limbs (base 2^32)
}, Int))
local function trimLimbs(limbs: { number })
while #limbs > 0 and limbs[#limbs] == 0 do
table.remove(limbs)
end
end
loc... | 2,047 |
imezx/InfiniteMath | imezx-InfiniteMath-9e375b0/src/InfiniteMath/Values/FullNames.luau | luau | .luau | return {'Thousand','Million','Billion','Trillion','Quadrillion','Quintillion','Sextillion','Septillion','Octillion','Nonillion','Decillion','Undecillion','Duodecillion','Tredecillion','Quattuordecillion','Quindecillion','Sedecillion','Septendecillion','Octodecillion','Novendecillion','Vigintillion','Unvigintillion','Du... | 40,396 |
imezx/InfiniteMath | imezx-InfiniteMath-9e375b0/src/InfiniteMath/Values/Suffixes.luau | luau | .luau | return {'K','M','B','T','Q','QN','S','SP','O','N','D','UD','DD','TD','QD','QND','SD','SPD','OD','ND','V','UV','DV','TV','QV','QNV','SV','SPV','OV','NV','TG','UTG','DTG','TTG','QTG','QNTG','STG','SPTG','OTG','NTG','QG','UQG','DQG','TQG','QQG','QNQG','SQG','SPQG','OQG','NQG','QQ','UQQ','DQQ','TQQ','QQQ','QNQQ','SQQ','SPQ... | 14,331 |
imezx/InfiniteMath | imezx-InfiniteMath-9e375b0/src/InfiniteMath/init.luau | luau | .luau | --!native
-- forked by @EternityDev
-- originally created by @KdudeDev
--[=[
@class InfiniteMath
InfiniteMath is module that allows you to surpass the limit of -10^308 to 10^308, with a new limit of -10^^308 to 10^^308 (1 with 10^308 zeros)
InfiniteMath has many of the functions from the math library, as well as ... | 8,303 |
imezx/Scheduler | imezx-Scheduler-43e0719/dev/init.luau | luau | .luau | --!optimize 2
return require(script.Parent.Packages.scheduler)
| 14 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/client/init.luau | luau | .luau | --!optimize 2
local client = {}
local ContextActionService = game:GetService("ContextActionService")
local CollectionService = game:GetService("CollectionService")
local localPlayer = game:GetService("Players").LocalPlayer
local vide = require("../vide")
local Profiler = require("./profiler")
local client_performance... | 784 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/client/performance.luau | luau | .luau | --!optimize 2
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Stats = game:GetService("Stats")
local vide = require("../../vide")
local remotes = require("./remotes/Remotes")
local get_performance_socket = remotes.fromFunction("scheduler.get_performance_socket")
local... | 1,609 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/client/remotes/Function.luau | luau | .luau | --!optimize 2
--!strict
--@EternityDev
local Function = {}
Function.__index = Function
local RunService = game:GetService("RunService")
function Function.new(remote: RemoteFunction)
local meta = setmetatable({
remote = remote,
}, Function)
remote.Destroying:Once(function()
if not meta then return end
Functio... | 254 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/client/remotes/Remotes.luau | luau | .luau | --!optimize 2
--!strict
--@EternityDev
--Client
local Remotes = {}
if not script.Parent.Parent.Parent:FindFirstChild("Remotes") then
Instance.new("Folder", script.Parent.Parent.Parent).Name = "Remotes"
end
local RemotesDir = script.Parent.Parent.Parent:WaitForChild("Remotes")
local Function = require("./Function")
... | 237 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/init.luau | luau | .luau | --!optimize 2
--!strict
local scheduler = {}
local profiler = require("@self/profiler")
local client = nil
scheduler.profiler = profiler
scheduler.server = function()
local server = require("@self/server")
return server
end
scheduler.client = function()
if client then
return client
end
client = require("@sel... | 96 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/profiler/init.luau | luau | .luau | --!optimize 2
--!native
local Profiler = {}
Profiler.isRunning = false
local IsServer: boolean = game:GetService("RunService"):IsServer()
local vide = require("../vide")
local convert_scale = require("./util/convert_scale")
local Signal = require("./util/limesignal")
local socket_changed_signal = Signal.Signal.new()
... | 1,987 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/server/init.luau | luau | .luau | --!optimize 2
local server = {}
local HttpService = game:GetService("HttpService")
local RunService = game:GetService("RunService")
local Stats = game:GetService("Stats")
local CollectionService = game:GetService("CollectionService")
local convert_units = require("./util/convert_units")
local remotes = require("@self/... | 1,141 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/server/remotes/Remotes.luau | luau | .luau | --!optimize 2
--!strict
--@EternityDev
--Server
local Remotes = {}
if not script.Parent.Parent.Parent:FindFirstChild("Remotes") then
Instance.new("Folder", script.Parent.Parent.Parent).Name = "Remotes"
end
local RemotesDir = script.Parent.Parent.Parent:WaitForChild("Remotes")
local Function = require("./Function")
... | 227 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/ui/home.luau | luau | .luau | --!optimize 2
local pebble = require("../../pebble")
local vide = require("../../vide")
local spawn_app = require("./spawn_app")
local scheduler_app = require("./scheduler")
local performance_app = require("./performance")
type HomeProps = {
env: string,
Profiler: any,
profiler_state: RemoteEvent,
version: string... | 1,244 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/ui/performance.luau | luau | .luau | --!optimize 2
local vide = require("../../vide")
local pebble = require("../../pebble")
local Profiler = require("../profiler")
local create = vide.create
local source = vide.source
local values = vide.values
local cleanup = vide.cleanup
local function parse(data)
local columnDefinitions = {
{ key = "host", displa... | 516 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/ui/scheduler.luau | luau | .luau | --!optimize 2
local vide = require("../../vide")
local pebble = require("../../pebble")
local stack_bar = require("./stack_bar")
local convert_scale = require("../util/convert_scale")
type SchedulerProps = {
env: string,
Position: UDim2,
ProfilerState: () -> { any },
Runtime: string?,
Pause: () -> (),
Resume: (... | 1,742 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/ui/spawn_app.luau | luau | .luau | -- by jabby
--!strict
--!optimize 2
local Players = game:GetService("Players")
local vide = require("../../vide")
local destroy_fn: { [() -> ()]: boolean } = {}
local function unmount_all()
for destroy in destroy_fn do
destroy()
end
table.clear(destroy_fn)
end
local function spawn_app<T>(app, props: T): () -> ... | 179 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/ui/stack_bar.luau | luau | .luau | --!optimize 2
local vide = require("../../vide")
local create = vide.create
local indexes = vide.indexes
local derive = vide.derive
type stack_bar = {
values: () -> { { Name: string, Color: Color3, Size: UDim2, Duration: number } },
selected: (index: number) -> (),
}
return function(props: stack_bar)
local total:... | 299 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/Enums.luau | luau | .luau | --!optimize 2
--[[
## made by anexpia •…• ##
assigns values to specific bytes so that they can be encoded
this is mainly for sending values that cannot be encoded from server to client
like newproxy() objects, or other unique values like tables that you want to be the same everytime
they're sent in a remote.
y... | 1,131 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/Miscellaneous/floatencoder.luau | luau | .luau | --!native
--!optimize 2
--!strict
-- read float16 number from buffer
local function readf16(buff: buffer, cursor: number): number
local n: number = buffer.readu16(buff, cursor)
local mantissa: number, exponent: number, sign: number = bit32.extract(n, 0, 10),
bit32.extract(n, 10, 5),
... | 503 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/Miscellaneous/init.luau | luau | .luau | --!native
--!optimize 2
-- quaternion stuff from https://devforum.roblox.com/t/introducing-luau-buffer-type-beta/2724894/105?u=anexpia
-- modified a bit to be more performant when encoding
local Types = require(script.Parent.Types)
local floatencoder = require(script.floatencoder)
local FP_EPSILON = 1e-6
local I16_... | 1,298 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/RbxEnumEncoder.luau | luau | .luau | --!optimize 2
--[[
## made by anexpia •…• ##
]]
local RS = game:GetService("RunService")
local Settings = require(script.Parent.Settings)
local SyncingEnabled = Settings.serverclientsyncing
local enumitem_to_type = {}
local enumitem_to_value = {}
local exposed = {
enumitem_to_type = enumitem_to_type;
enumitem... | 1,388 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/Read.luau | luau | .luau | --!native
--!optimize 2
--!nolint LocalShadow
--[[ ## made by anexpia •…• ## ]]
local Encoder = script.Parent
local Datatypes = require(Encoder.ReadDatatypes)
local RbxEnumEncoder = require(Encoder.RbxEnumEncoder)
local Settings = require(Encoder.Settings)
local Types = require(Encoder.Types)
type ReadSettings = Ty... | 1,240 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/BrickColor.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local brickcolorbyte = 30
return {
[brickcolorbyte] = @native function(buff: buffer... | 127 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/CFrame.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
local Miscellaneous = require(Module.Miscellaneous)
type datatypedecodinginfo = Types.datatypedecodinginfo
local cframebyte = 17
return {
... | 97 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/Color3.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
local Miscellaneous = require(Module.Miscellaneous)
local color3always6bytes = Settings.color3always6bytes
local readf16 = Miscellaneous.readf16... | 290 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/ColorSequence.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local colorbyte = 25
local uI16_max = (2 ^ 16) - 1
return {
[colorbyte... | 266 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/ContentAndFont.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local contentbyte = 33
local fontbyte = 34
local writebytesign
local FromValue = (Enum.... | 494 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/DateTime.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local datetimebyte = 35
return {
[datetimebyte] = @native function(buff: buffer, byte: number, cursor: number): (DateTime, num... | 129 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/NumberRange.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local numberbyte = 21
local writebytesign
return {
[numberbyte] = @native function(... | 152 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/NumberSequence.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
local Miscellaneous = require(Module.Miscellaneous)
type datatypedecodinginfo = Types.datatypedecodinginfo
local readf16 = Miscellaneous.readf16... | 271 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/PhysicalProperties.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local physpropsbyte = 29
local writebytesign
return {
[physpropsbyte] = @native fun... | 220 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/Ray.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local raybyte = 18
local writebytesign
return {
[raybyte] = @native function(buff: buf... | 357 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/Rect.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local rectbyte = 28
local writebytesign
return {
[rectbyte] = @native function(buff... | 185 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/UDim.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local udimbyte = 26
local writebytesign
return {
[udimbyte] = @native function(buff... | 154 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/UDim2.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local udim2byte = 27
local writebytesign
return {
[udim2byte] = @native function(bu... | 201 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/Vector2.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local vectorbyte = 16
local vectorint16byte = 32
local writebytesign
return {
[vec... | 291 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/Vector3.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local vectorbyte = 15
local vectorint16byte = 31
local writebytesign
return {
[vec... | 402 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/buffer.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local bufferu8byte = 12
local bufferu16byte = 13
local bufferu32byte = 14
@native
local... | 262 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/init.luau | luau | .luau | --[[
## made by anexpia •…• ##
originally this also had write functions for each datatype
but i found that it was slower than having if conditions
so now it only contains read functions and thats it
]]
local bytetofunction = {}
local bytetodatatype = {}
for _, t in script:GetChildren() do
local name = t.Name... | 389 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/number.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
local Enums = require(Module.Enums)
type datatypedecodinginfo = Types.datatypedecodinginfo
local u8numbyte = 5
local n_u8numbyte = 8
local u16... | 476 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/string.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local stringu8byte = 54
local stringu16byte = 55
local stringu32byte = 56
local writeby... | 296 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/table_and_deduplicate.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local ByteToValue = require(Module.Enums).bytetovalue
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local tblu8byte = 51
local tblu16byte = 52
local tblu32byte = 53
local dedupu... | 792 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/ReadDatatypes/template.luau | luau | .luau | --!nolint LocalUnused
--!nolint ImportUnused
--!optimize 2
local Module = script.Parent.Parent
local Settings = require(Module.Settings)
local Types = require(Module.Types)
type datatypedecodinginfo = Types.datatypedecodinginfo
local templatebyte = -1
local writebytesign
return {
[templatebyte] = @native funct... | 128 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/Settings.luau | luau | .luau | local Encoder = script.Parent
-- explanation for each of the settings exists in the main module
local t = {
color3always6bytes = false;
rbxenum_behavior = "full" :: "full" | "compact";
serverclientsyncing = false;
sanitize_nanandinf = false;
}
for att, value in Encoder:GetAttributes() do
if t[at... | 141 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/Types.luau | luau | .luau | type anyTable = { [any]: any }
export type encodeinfo = {
valuepositionlookup: anyTable;
settings: WriteSettings,
scanlist: { anyTable },
referencelist: { any },
allocatedsize: number;
}
export type decodeinfo = {
sanitize_nanandinf: boolean?,
references: { any }?;
deduplicationtable: { any };
tables: {... | 239 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/Write.luau | luau | .luau | --!native
--!optimize 2
--!nolint LocalShadow
--[[ ## made by anexpia •…• ## ]]
-- [[ byte tags, if negative then its a dict key ]]
-- 0 -> at end: terminate, at start: deduplication table
-- 1 -> stop and start new table
-- 2 -> boolean: true
-- 3 -> boolean: false
-- 4 -> nil
-- 5 to 11 -> number
-- 12 to 14 -> bu... | 7,360 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/bufferencoder/init.luau | luau | .luau | --[[
## made by anexpia •…• ##
v---v---v---v---v---v currently supported types v---v---v---v---v---v
[x] -> datatype has deduplication
deduplication means that if the value exists in more than one table, it will be encoded only once
this reduces buffer size and time it takes to encode the value
luau types
> str... | 681 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/convert_scale.luau | luau | .luau | --!optimize 2
-- jabby_util
local function convert_scale(unit: string, value: number): string
local s = math.sign(value)
value = math.abs(value)
local prefixes = {
[4] = "T",
[3] = "G",
[2] = "M",
[1] = "k",
[0] = "",
[-1] = "m",
[-2] = "μ",
[-3] = "n",
[-4] = "p",
}
local order = 0
while valu... | 305 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/convert_units.luau | luau | .luau | --!optimize 2
-- jabby_util
local function convert_units(unit: string, value: number): string
local s = math.sign(value)
value = math.abs(value)
local prefixes = {
[4] = "T",
[3] = "G",
[2] = "M",
[1] = "k",
[0] = " ",
[-1] = "m",
[-2] = "u",
[-3] = "n",
[-4] = "p",
}
local order = 0
while val... | 264 |
imezx/Scheduler | imezx-Scheduler-43e0719/src/util/limesignal/init.luau | luau | .luau | --!optimize 2
--!strict
--!native
--$Packages
local ThreadPool = require("@self/threadpool")
--$Types
export type Connection<T...> = {
disconnect: (self: Connection<T...>) -> (),
reconnect: (self: Connection<T...>) -> (),
connected: boolean,
}
export type Event<T...> = {
connect: (self: Event<T...>, fn: (T...) -... | 1,490 |
imezx/JPSPlus | imezx-JPSPlus-127f489/benchmark.luau | luau | .luau | --!native
--!optimize 2
local RunService = game:GetService("RunService")
local JPSPlus = require("./JPSPlus")
local WIDTH, HEIGHT = 384, 384
local OBSTACLE_DENSITY = 0.25
local SEED = 12345
local NUM_QUERIES = 5000
local WARMUP = 200
local DIAG_POLICY = JPSPlus.grid.DiagonalPolicy.NoSqueeze
local YIELD_EVERY = 100... | 1,686 |
imezx/JPSPlus | imezx-JPSPlus-127f489/playground/WorldGrid.luau | luau | .luau | local WorldGrid = {}
WorldGrid.__index = WorldGrid
function WorldGrid.new(origin: Vector3, cellSize: number, width: number, height: number)
return setmetatable({
Origin = origin,
CellSize = cellSize,
Width = width,
Height = height,
}, WorldGrid)
end
function WorldGrid:worldToCell(pos: Vector3)
local p = po... | 218 |
imezx/JPSPlus | imezx-JPSPlus-127f489/playground/test.server.luau | luau | .luau | --!optimize 2
--!native
local PhysicsService = game:GetService("PhysicsService")
local CollectionService = game:GetService("CollectionService")
local Players = game:GetService("Players")
local JPSPlus = require("./JPSPlus")
local WorldGrid = require("./WorldGrid")
local npcModel1 = workspace:WaitForChild("Agent 1")
l... | 1,832 |
imezx/JPSPlus | imezx-JPSPlus-127f489/src/dirs.luau | luau | .luau | --!optimize 2
local Dirs = {}
@native
local function bit(d) return bit32.lshift(1, d-1) end
Dirs.E = 1
Dirs.W = 2
Dirs.N = 3
Dirs.S = 4
Dirs.NE = 5
Dirs.NW = 6
Dirs.SE = 7
Dirs.SW = 8
Dirs.dx = { [1]= 1, [2]=-1, [3]= 0, [4]= 0, [5]= 1, [6]=-1, [7]= 1, [8]=-1 }
Dirs.dy = { [1]= 0, [2]= 0, [3]=-1, [4]= 1, [5]=-1, [6]=... | 648 |
imezx/JPSPlus | imezx-JPSPlus-127f489/src/grid.luau | luau | .luau | --!optimize 2
local Grid = {}
Grid.__index = Grid
Grid.DiagonalPolicy = {
Always = "Always", -- diagonal allowed if destination is free
NoSqueeze = "NoSqueeze", -- (default) diagonal allowed if dest free AND (at least one orthogonal adjacent is free)
NoCorner = "NoCorner", -- diagonal allowed if dest free AND (both... | 485 |
imezx/JPSPlus | imezx-JPSPlus-127f489/src/init.luau | luau | .luau | --@EternityDev
-- Jump Point Search Plus (JPS+)
local JPSPlus = {}
JPSPlus.dirs = require("@self/dirs")
JPSPlus.grid = require("@self/grid")
JPSPlus.preprocess = require("@self/preprocess")
JPSPlus.planner = require("@self/planner")
JPSPlus.smoothing = require("@self/smoothing")
return JPSPlus
| 86 |
imezx/JPSPlus | imezx-JPSPlus-127f489/src/planner.luau | luau | .luau | --!native
--!optimize 2
local Dirs = require("./dirs")
local PQ = require("./priorityqueue")
local Planner = {}
Planner.__index = Planner
local function octile(ix, iy, gx, gy, D, D2)
local dx = math.abs(ix - gx)
local dy = math.abs(iy - gy)
local mn = (dx < dy) and dx or dy
local mx = (dx > dy) and dx or dy
retu... | 2,695 |
imezx/JPSPlus | imezx-JPSPlus-127f489/src/preprocess.luau | luau | .luau | --!native
--!optimize 2
local Dirs = require("./dirs")
local Grid = require("./grid")
local Preprocess = {}
local function makeOffsets(total)
local off = table.create(8)
local offB = table.create(8)
for d = 1, 8 do
local o = (d - 1) * total
off[d] = o
offB[d] = o * 2 -- bytes for u16
end
return off, offB
e... | 2,556 |
imezx/JPSPlus | imezx-JPSPlus-127f489/src/priorityqueue.luau | luau | .luau | --!native
--!optimize 2
local PQ = {}
PQ.__index = PQ
function PQ.new(capacity)
capacity = capacity or 256
return setmetatable({
n = 0,
id = table.create(capacity),
f = table.create(capacity),
g = table.create(capacity),
}, PQ)
end
function PQ:push(nodeId, fScore, gScore)
local n = self.n + 1
self.n = ... | 557 |
imezx/JPSPlus | imezx-JPSPlus-127f489/src/smoothing.luau | luau | .luau | --!native
--!optimize 2
local Smoothing = {}
local function hasLOS(blocked, stride, x0, y0, x1, y1)
local dx = x1 - x0
local dy = y1 - y0
local adx = math.abs(dx)
local ady = math.abs(dy)
local sx = (dx > 0 and 1) or (dx < 0 and -1) or 0
local sy = (dy > 0 and 1) or (dy < 0 and -1) or 0
local ix, iy = x0 + 1,... | 573 |
imezx/Warp | imezx-Warp-a27067c/runTests.server.luau | luau | .luau | require(script.Parent.TestEZ).TestBootstrap:run({
game:GetService("ServerScriptService").Test
}) | 22 |
imezx/Warp | imezx-Warp-a27067c/src/Client/init.luau | luau | .luau | --!optimize 2
--!strict
--@EternityDev
local Client = {}
local Thread = require("./Util/Thread")
local Buffer = require("./Util/Buffer")
local Replication = require("./Replication")
local Xor = require("./Util/Xor")
local RunService = game:GetService("RunService")
local Event: RemoteEvent = script.Parent:WaitForChild... | 1,895 |
imezx/Warp | imezx-Warp-a27067c/src/Replication/init.luau | luau | .luau | --!optimize 2
--!strict
local Replication = {}
local RunService = game:GetService("RunService")
local _repl: RemoteEvent = script.Parent:WaitForChild("_repl")
local Buffer = require("./Util/Buffer")
local Identifier = require("./Util/Identifier")
local identifiers_schema = Buffer.Schema.string
local warp_identifier_... | 931 |
imezx/Warp | imezx-Warp-a27067c/src/Util/Identifier.luau | luau | .luau | --!optimize 2
--!strict
--@EternityDev
const BITS: number = 8
const MAX_VALUE: number = bit32.lshift(1, BITS) - 1
local hook_fn: (string, number) -> ()
if not shared.__warp_identifier_registry then
shared.__warp_identifier_registry = {
cache = {} :: { [string]: number },
name = {} :: { [number]: string },
count... | 355 |
imezx/Warp | imezx-Warp-a27067c/src/Util/Thread.luau | luau | .luau | --!strict
--!optimize 2
--@EternityDev
local thread: thread?
local function passer<T...>(func: (T...) -> (), ...: T...): ()
local HoldThread: thread = thread :: thread
thread = nil
func(...)
thread = HoldThread
end
local function newThread(): ()
thread = coroutine.running()
while true do passer(coroutine.yield(... | 128 |
imezx/Warp | imezx-Warp-a27067c/src/Util/Xor.luau | luau | .luau | --!strict
--!native
--!optimize 2
local Xor = {}
type XorEntry = { buf: buffer, len: number }
local serverPrev: { [Player]: XorEntry } = {}
local clientPrev: { [Player]: XorEntry } = {}
local clientOutPrev: XorEntry? = nil
local clientInPrev: XorEntry? = nil
const MAX_BUFFER_SIZE: number = 1024
local function xorAp... | 799 |
imezx/Warp | imezx-Warp-a27067c/src/init.luau | luau | .luau | --!strict
--@EternityDev
local Remote = {}
if game.RunService:IsServer() then
if not script:FindFirstChild("_repl") then
Instance.new("RemoteEvent", script).Name = "_repl"
end
if not script:FindFirstChild("Event") then
Instance.new("RemoteEvent", script).Name = "Event"
end
if not script:FindFirstChild("Unreli... | 228 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Debug.luau | luau | .luau | --!optimize 2
local Types = require("./Types")
local GradClip = require("./GradClip")
local Anomaly = require("./Util/Anomaly")
type Tensor = Types.Tensor
local Debug = {}
function Debug.checkTensor(t: Tensor, name: string?): boolean
if Anomaly.hasBadValues(t) then
warn(`Gradien.Debug: tensor '{name or "?"}' has ... | 449 |
imezx/Gradien | imezx-Gradien-362b9bc/src/GradClip.luau | luau | .luau | --!native
--!optimize 2
local GC = {}
function GC.clipValue(params, clip)
task.desynchronize()
for _, p in params do
if p._grad then
for i = 1, #p._grad._storage do
p._grad._storage[i] = math.clamp(p._grad._storage[i], -clip, clip)
end
end
end
task.synchronize()
end
function GC.clipNorm(params, maxNor... | 253 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Initializer.luau | luau | .luau | --!native
--!optimize 2
local Types = require("./Types")
local Initializer = {}
local function _randn(): number
local u1 = math.random()
local u2 = math.random()
if u1 <= 1e-7 then
u1 = 1e-7
end
return math.sqrt(-2 * math.log(u1)) * math.cos(2 * math.pi * u2)
end
-- U(-sqrt(6 / (fanIn + fanOut)), sqrt(6 / (fan... | 1,223 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Metrics.luau | luau | .luau | --!native
--!optimize 2
local Types = require("./Types")
local M = {}
function M.accuracy(logits: Types.Tensor, targets: Types.Tensor): number
task.desynchronize()
local C, B = logits._shape[1], logits._shape[2]
local correct = 0
for j = 1, B do
local best = -1 / 0
local arg = 1
for i = 1, C do
local v = ... | 1,276 |
imezx/Gradien | imezx-Gradien-362b9bc/src/State.luau | luau | .luau | --!native
--!optimize 2
local Types = require("./Types")
local Util = require("./Util")
local State = {}
local assert = Util.Assert
local function mapParamsToIndices(params: { Types.Tensor }): { [Types.Tensor]: string }
local map = {}
for i, p in params do
map[p] = `{i}`
end
return map
end
--@param params { Ty... | 1,195 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Tensor.luau | luau | .luau | --!native
--!optimize 2
local Tensor = {}
local Util = require("./Util")
local Types = require("./Types")
local Tape -- lazy-load
export type Tensor = Types.Tensor
local sizeFromShape = Util.sizeFromShape
local assert = Util.Assert
local sqrt = math.sqrt
local log = math.log
local cos = math.cos
local sin = math.si... | 3,662 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Trainer.luau | luau | .luau | --!native
--!optimize 2
local Tape = require("./autograd/Tape")
local Types = require("./Types")
local Losses = require("./nn/Losses")
local Metrics = require("./Metrics")
local Util = require("./Util")
local Trainer = {}
Trainer.__index = Trainer
local assert = Util.Assert
local function asArrayCallbacks(raw: Types... | 1,961 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Types.luau | luau | .luau | --!strict
export type Shape = { number }
export type Storage = { number }
export type Tensor = {
_storage: Storage,
_shape: Shape,
_requiresGrad: boolean,
_size: number,
_strides: { number }?,
_parents: { Tensor }?,
_backprop: ((grad: Tensor) -> ())?,
_grad: Tensor?,
}
export type Module<TIn = Tensor, TOut = ... | 926 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Util/Anomaly.luau | luau | .luau | --!native
--!optimize 2
local Types = require("../Types")
local Anomaly = {}
function Anomaly.hasBadValues(t: Types.Tensor)
for i = 1, #t._storage do
local v = t._storage[i]
if v ~= v or v == math.huge or v == -math.huge then
return true
end
end
return false
end
function Anomaly.hasNaN(t: Types.Tensor)
for... | 205 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Util/Assert.luau | luau | .luau | --!optimize 2
--@Eternity_Devs
return function<T>(condition: T, errorMessage: string, level: number?): T
if not (condition :: any) then
error(errorMessage, level or 2)
end
return condition
end
| 58 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Util/Buffer/Dedicated.luau | luau | .luau | --!native
--!native
--!optimize 2
--@Eternity_Devs
--from Warp lib
local DedicatedBuffer = {}
local default: { [string]: number } = {
point = 0,
next = 0,
size = 128,
bufferSize = 128,
}
local function copyMethod(self: any, offset: number, b: buffer?, src: buffer?, srcOffset: number?, count: number?)
if not b th... | 2,081 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Util/Buffer/init.luau | luau | .luau | --!native
--!native
--!optimize 2
--@Eternity_Devs
--from Warp lib & extended
local Buffer = {}
Buffer.__index = Buffer
local Dedicated = require("@self/Dedicated")
local function readValue(b: buffer, position: number, ref: { any }?): (any, number)
local typeByte = buffer.readi8(b, position)
position += 1
if typeB... | 1,568 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Util/GradStats.luau | luau | .luau | --!native
--!optimize 2
local Types = require("../Types")
local GradStats = {}
local function stats(t: Types.Tensor): (number, number, number, number)
local n = #t._storage
if n == 0 then
return 0, 0, 0, 0
end
task.desynchronize()
local minv, maxv = math.huge, -math.huge
local sum, sumsq = 0, 0
for i = 1, n d... | 350 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Util/Hooks.luau | luau | .luau | --!optimize 2
local Hooks = {}
function Hooks.addForwardHook(module, fn)
local orig = module.forward
module.___fwd = orig
module.forward = function(self, ...)
local out = orig(self, ...)
fn(self, out)
return out
end
end
function Hooks.removeForwardHook(module)
if module.___fwd then
module.forward = modul... | 103 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Util/ModelStats.luau | luau | .luau | --!native
--!optimize 2
local function count(model): (number, number)
local ps = model:parameters()
local total, bytes = 0, 0
task.desynchronize()
for i = 1, #ps do
local t = ps[i]
local n = #t._storage
total += n
bytes += n * 8 -- 8 bytes
end
task.synchronize()
return total, bytes
end
local function fm... | 252 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Util/Parallel.luau | luau | .luau | --!native
--!optimize 2
local Parallel = {}
function Parallel.with(fn: () -> ...any): ...any
task.desynchronize()
local res = { fn() }
task.synchronize()
return table.unpack(res)
end
function Parallel.withSafe(fn: () -> ...any): (boolean, ...any)
task.desynchronize()
local res = { pcall(fn) }
task.synchronize()
... | 93 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Util/Profiler.luau | luau | .luau | --!native
--!optimize 2
local Types = require("../Types")
local assert = require("./Assert")
local Profiler = {}
local fmt = string.format
local stats: { [string]: Types.Stat } = {}
local stack: { Types.Marker } = {}
local enabled: boolean = true
local function ensureStat(name: string): Types.Stat
local stat = stat... | 2,081 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Util/RNG.luau | luau | .luau | --!native
--!optimize 2
local RNG = {}
local _rng = Random.new()
function RNG.seed(s: number)
_rng = Random.new(math.floor(s))
return s
end
function RNG.uniform(a: number?, b: number?, rng: Random?)
a = a or 0
b = b or 1
return (rng or _rng):NextNumber(a, b)
end
function RNG.randint(lo: number, hi: number, rng:... | 241 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Util/RunningNorm.luau | luau | .luau | --!native
--!optimize 2
local function update(self, x: number)
self.n += 1
local d = x - self.mean
self.mean += d / self.n
self.m2 += d * (x - self.mean)
end
local function var(self): number
if self.n < 2 then
return 1.0
end
return self.m2 / (self.n - 1)
end
local function std(self): number
return math.sqrt... | 210 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Util/Visual3D.luau | luau | .luau | --!native
--!optimize 2
local Visual3D = {}
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local HttpService = game:GetService("HttpService")
local Types = require("../Types")
type Tensor = Types.Tensor
type Module = Types.Module
export type RenderOptions = {
layerS... | 4,295 |
imezx/Gradien | imezx-Gradien-362b9bc/src/Util/init.luau | luau | .luau | --!native
--!optimize 2
local Util = {}
local Types = require("./Types")
local function isModule(m: any): boolean
return type(m) == "table" and type(m.forward) == "function" and type(m.parameters) == "function"
end
local function applyRecursive(m: any, fn: (any) -> ())
if isModule(m) then
fn(m)
end
if type(m) =... | 485 |
imezx/Gradien | imezx-Gradien-362b9bc/src/autograd/Tape.luau | luau | .luau | --!native
--!optimize 2
local Tensor = require("../Tensor")
local BLAS = require("../ops/BLAS")
local Types = require("../Types")
local Tape = {}
local gradEnabled = true
local function withTape(t: Types.Tensor, parents: { Types.Tensor }, back: (grad: Types.Tensor) -> ()): Types.Tensor
if not gradEnabled then
t._pa... | 1,370 |
imezx/Gradien | imezx-Gradien-362b9bc/src/classic/ElasticNet.luau | luau | .luau | --!native
--!optimize 2
local Tensor = require("../Tensor")
local Tape = require("../autograd/Tape")
local Losses = require("../nn/Losses")
local Linear = require("../nn/Linear")
local Adam = require("../optim/Adam")
-- ElasticNet: MSE + lambda1 * ||W||_1 + lambda2 * ||W||_2^2
-- lambda1 controls L1 sparsity (Lasso), ... | 739 |
imezx/Gradien | imezx-Gradien-362b9bc/src/classic/GaussianNB.luau | luau | .luau | --!native
--!optimize 2
local Util = require("../Util")
local assert = Util.Assert
return function(C: number)
local mu = {}
local var = {}
local prior = table.create(C, 0)
local fitted = false
local self
self = {
fit = function(_, X, y: { number })
local D, N = X._shape[1], X._shape[2]
task.desynchronize... | 678 |
imezx/Gradien | imezx-Gradien-362b9bc/src/classic/KMeans.luau | luau | .luau | --!native
--!optimize 2
local Tensor = require("../Tensor")
local Util = require("../Util")
local assert = Util.Assert
return function(K: number, iters: number)
iters = iters or 20
local centers: any = nil
local function initPlusPlus(X)
local D, N = X._shape[1], X._shape[2]
local C = Tensor.zeros({ D, K })
lo... | 1,035 |
imezx/Gradien | imezx-Gradien-362b9bc/src/classic/KNN.luau | luau | .luau | --!native
--!optimize 2
local Types = require("../Types")
local Util = require("../Util")
local assert = Util.Assert
--@class KNN
--@field X any
--@field y {number}
--@field k integer
local function predict(self, Q: Types.Tensor): { number }
task.desynchronize()
local D, N = self.X._shape[1], self.X._shape[2]
loca... | 442 |
imezx/Gradien | imezx-Gradien-362b9bc/src/classic/LinearRegression.luau | luau | .luau | --!native
--!optimize 2
local Tape = require("../autograd/Tape")
local Losses = require("../nn/Losses")
local Linear = require("../nn/Linear")
local SGD = require("../optim/SGD")
return function(inF: number)
local model = Linear(inF, 1)
local self
self = {
fit = function(_, X, Y, epochs: number, lr: number)
lo... | 207 |
imezx/Gradien | imezx-Gradien-362b9bc/src/classic/LogisticRegression.luau | luau | .luau | --!native
--!optimize 2
local Tensor = require("../Tensor")
local Tape = require("../autograd/Tape")
local Losses = require("../nn/Losses")
local Linear = require("../nn/Linear")
local Adam = require("../optim/Adam")
return function(inF: number)
local model = Linear(inF, 1)
local self
self = {
fit = function(_, X... | 388 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.