repo stringclasses 350
values | file_path stringlengths 29 200 | language stringclasses 2
values | file_type stringclasses 4
values | code stringlengths 2 1.01M | tokens int64 2 598k |
|---|---|---|---|---|---|
brightluau/bright | brightluau-bright-76da13c/src/bin/argparse.luau | luau | .luau | --
-- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
-- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
--
-- whilst argparse has been patched to expose its types, pesde refuses to regenerate the linker script to expose ... | 155 |
brightluau/bright | brightluau-bright-76da13c/src/bin/cli/init.luau | luau | .luau | --
-- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
-- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
--
local argparse = require("@cli/argparse")
return {
require("./cmd_init"),
--require("./run"),
require("./upda... | 93 |
brightluau/bright | brightluau-bright-76da13c/src/bin/cli/run.luau | luau | .luau | --
-- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
-- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
--
local fs = require("@lune/fs")
local argparse = require("@cli/argparse")
local config = require("@cli/config")
l... | 514 |
brightluau/bright | brightluau-bright-76da13c/src/bin/cli/update.luau | luau | .luau | --
-- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
-- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
--
local fs = require("@lune/fs")
local serde = require("@lune/serde")
local argparse = require("@cli/argparse")
lo... | 354 |
brightluau/bright | brightluau-bright-76da13c/src/bin/config.luau | luau | .luau | --
-- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
-- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
--
local fs = require("@lune/fs")
local serde = require("@lune/serde")
local constants = require("./constants")
ty... | 258 |
brightluau/bright | brightluau-bright-76da13c/src/bin/main.luau | luau | .luau | --
-- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
-- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
--
local process = require("@lune/process")
local argparse = require("./argparse")
local cli = require("./cli")
loc... | 181 |
brightluau/bright | brightluau-bright-76da13c/src/lib/init.luau | luau | .luau | --
-- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
-- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
--
return {
std = require("./std"),
}
| 64 |
brightluau/bright | brightluau-bright-76da13c/src/lib/poke.luau | luau | .luau | --
-- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
-- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
--
-- we use the "pokemore" version of the library, which means it uses a CST to preserve things like comments via t... | 114 |
brightluau/bright | brightluau-bright-76da13c/src/lib/std.luau | luau | .luau | --
-- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
-- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
--
local types = require("./types")
-- re-export all of the types that would be most used
export type Config<C> = t... | 222 |
brightluau/bright | brightluau-bright-76da13c/src/lib/types.luau | luau | .luau | --
-- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
-- distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
--
--- Converts a configuration definition to a K/V pair of configuration options.
export type function Config(userC... | 677 |
brightluau/bright | brightluau-bright-76da13c/tests/cases/blank.luau | luau | .luau | -- nothing should happen!
| 5 |
brightluau/bright | brightluau-bright-76da13c/vendor/colorful/init.luau | luau | .luau | local ESCAPE = string.char(27)
local ANSI_16 = `{ESCAPE}[%dm`
export type Styler = (text: string) -> string
local function createStylerFunction(opener: number, closer: number): Styler
local open = string.format(ANSI_16, opener)
local close = string.format(ANSI_16, closer)
return function(text: string)
return `{... | 591 |
mayari-org/mayari | mayari-org-mayari-d4abc88/.lune/dev.luau | luau | .luau | local process = require("@lune/process")
local alias = require("../src/utils/Alias")
local newCAlias = process.cwd .. "tests/web/"
alias.set("c", newCAlias)
process.exec("lune", { "run", "src/main", "dev" }, { stdio = "inherit", cwd = "tests/web" }) | 72 |
mayari-org/mayari | mayari-org-mayari-d4abc88/.lune/start.luau | luau | .luau | local process = require("@lune/process")
local alias = require("../src/utils/Alias")
local newCAlias = process.cwd .. "tests/web/"
alias.set("c", newCAlias)
process.exec("lune", { "run", "src/main" }, { stdio = "inherit", cwd = "tests/web" }) | 69 |
mayari-org/mayari | mayari-org-mayari-d4abc88/.lune/test.luau | luau | .luau | local process = require("@lune/process")
local child = process.exec("lune", { "run", "tests" }, { stdio = "inherit" })
if not child.ok then
process.exit(child.code)
end
| 48 |
mayari-org/mayari | mayari-org-mayari-d4abc88/.lute/dev.luau | luau | .luau | local process = require("@lute/process")
local alias = require("../src/utils/Alias")
local newCAlias = process.cwd() .. "/tests/web/"
alias.set("c", newCAlias)
process.run({ "lute", "run", "src/main", "dev" }, { stdio = "inherit", cwd = "tests/web" }) | 73 |
mayari-org/mayari | mayari-org-mayari-d4abc88/.lute/start.luau | luau | .luau | local process = require("@lute/process")
local alias = require("../src/utils/Alias")
local newCAlias = process.cwd() .. "/tests/web/"
alias.set("c", newCAlias)
process.run({ "lute", "run", "src/main" }, { stdio = "inherit", cwd = "tests/web" }) | 70 |
mayari-org/mayari | mayari-org-mayari-d4abc88/.lute/test.luau | luau | .luau | local process = require("@lute/process")
local child = process.run({ "lute", "run", "tests" }, { stdio = "inherit" })
if not child.ok then
process.exit(child.exitcode)
end
| 49 |
mayari-org/mayari | mayari-org-mayari-d4abc88/.zune/dev.luau | luau | .luau | local adpt = require("@mayari.adpt")
local process = zune.process
local json = adpt.json
local fs = adpt.fs
local luaurcPath = process.cwd() .. "/.luaurc"
local luaurcjson = fs.readFile(luaurcPath)
local decode = json.decode(luaurcjson)
if not decode.aliases then
decode.aliases = {}
end
local newCAlias = process... | 181 |
mayari-org/mayari | mayari-org-mayari-d4abc88/.zune/start.luau | luau | .luau | local adpt = require("@mayari.adpt")
local process = zune.process
local json = adpt.json
local fs = adpt.fs
local luaurcPath = process.cwd() .. "/.luaurc"
local luaurcjson = fs.readFile(luaurcPath)
local decode = json.decode(luaurcjson)
if not decode.aliases then
decode.aliases = {}
end
local newCAlias = process... | 178 |
mayari-org/mayari | mayari-org-mayari-d4abc88/.zune/test.luau | luau | .luau | local process = zune.process
local child = process.run("zune", { "run", "tests" }, { stdout = "inherit", stderr = "inherit" })
if not child.ok then
process.exit(child.code)
end
| 50 |
mayari-org/mayari | mayari-org-mayari-d4abc88/src/core/Attribute/Guard.luau | luau | .luau | local registry = require("./RegistryGenerator").registry
local common = require("@mayari.common")
local Exception = common.exception
local function Guard(args: { string })
return function(req: common.Request, next: common.Next)
local attribute = registry["Guard"]
if not attribute then
... | 133 |
mayari-org/mayari | mayari-org-mayari-d4abc88/src/core/Attribute/Interceptor.luau | luau | .luau | local registry = require("./RegistryGenerator").registry
local common = require("@mayari.common")
local function Interceptor(args: { string })
return function(req: common.Request, next: common.Next)
local attribute = registry["Interceptor"]
if not attribute then
return next()
e... | 184 |
mayari-org/mayari | mayari-org-mayari-d4abc88/src/core/Attribute/Resolver.luau | luau | .luau | local MAX_ATTRIBUTES = 10
--// PARSER // --
local function parseArgs(raw: string): { string }
local args = {}
for arg in raw:gmatch("([^,]+)") do
local trimmed = arg:match("^%s*(.-)%s*$")
if trimmed and trimmed ~= "" then
table.insert(args, trimmed)
end
end
retur... | 883 |
mayari-org/mayari | mayari-org-mayari-d4abc88/src/core/BodyParser.luau | luau | .luau | local adpt = require("@mayari.adpt")
local json = adpt.json
type BodyParsers = { [string]: (raw: string) -> string | { any } }
local BodyParser: BodyParsers = {}
BodyParser["text/plain"] = function(raw: string)
return raw
end
BodyParser["application/json"] = function(raw: string)
local ok, result = pcall(js... | 328 |
mayari-org/mayari | mayari-org-mayari-d4abc88/src/core/Routing/CreateTestRouter.luau | luau | .luau | local RouteHelper = require("./Helpers")
local RouteMatcher = require("./Matcher")
local splitPath = RouteHelper.splitPath
local createNode = RouteHelper.createNode
local matchRouteFrom = RouteMatcher.matchRouteFrom
local function createTestRouter()
local staticRoute: { [string]: any } = {}
local root: RouteH... | 486 |
mayari-org/mayari | mayari-org-mayari-d4abc88/src/core/Routing/Dispatcher.luau | luau | .luau | local common = require("@mayari.common")
local RouteHelper = require("./Helpers")
local BodyParser = require("../BodyParser")
local RouteMatcher = require("./Matcher")
local Exception = common.exception
local METHOD_MAP = RouteHelper.METHOD_MAP
local staticRoutes = RouteHelper.staticRoutes
local routeTreeRoot = Route... | 425 |
mayari-org/mayari | mayari-org-mayari-d4abc88/src/core/Routing/Generator.luau | luau | .luau | local adpt = require("@mayari.adpt")
local registerRoute = require("./RegisterRoute")
local AttributeResolver = require("../Attribute/Resolver")
local Attributes = require("../Attribute")
local Chain = require("../../utils/Chain")
local RouteHelper = require("./Helpers")
local RouteLogger = require("../../utils/Logger"... | 744 |
mayari-org/mayari | mayari-org-mayari-d4abc88/src/core/Routing/Helpers.luau | luau | .luau | export type RouteNode = {
children: { [string]: RouteNode },
dynamicChild: RouteNode?,
dynamicName: string?,
wildcardChild: RouteNode?,
wildcardName: string?,
module: any?,
}
type METHOD_MAP = {
[string]: string,
}
local staticRoutes: { [string]: any } = {}
local routeTreeRoot: RouteNode ... | 253 |
mayari-org/mayari | mayari-org-mayari-d4abc88/src/core/Routing/Matcher.luau | luau | .luau | local RouteHelper = require("./Helpers")
local function matchRouteFrom(
node: RouteHelper.RouteNode,
segments: { string },
index: number,
params: { [string]: any }
): RouteHelper.RouteNode?
while index <= #segments do
local segment = segments[index]
if node.children[segment] then
... | 504 |
mayari-org/mayari | mayari-org-mayari-d4abc88/src/core/Routing/RegisterRoute.luau | luau | .luau | local RouteHelper = require("./Helpers")
local staticRoutes = RouteHelper.staticRoutes
local routeTreeRoot = RouteHelper.routeTreeRoot
local splitPath = RouteHelper.splitPath
local createNode = RouteHelper.createNode
local function registerRoute(path: string, module: any)
if not string.find(path, "%[") then
... | 324 |
mayari-org/mayari | mayari-org-mayari-d4abc88/src/utils/Alias.luau | luau | .luau | local adpt = require("@mayari.adpt")
local fs = adpt.fs
local process = adpt.process
local Alias = {}
--[[
Links a package alias to the given value in the `.luaurc` file.
If the alias already exists, its value is overwritten with the new one.
If it doesn't exist, a new entry is added.
@param name The... | 750 |
mayari-org/mayari | mayari-org-mayari-d4abc88/src/utils/LoadEnv.luau | luau | .luau | local adpt = require("@mayari.adpt")
local process = adpt.process
local fs = adpt.fs
local function loadEnv()
local envVars: { [string]: string } = {}
local content: string?
for _, filename in { ".env", ".env.local", ".env.development" } do
local success, result = pcall(fs.readFile, filename)
... | 233 |
mayari-org/mayari | mayari-org-mayari-d4abc88/src/utils/Logger.luau | luau | .luau | --[[
This will be the template for what the logger supposed to output:
(Startup Message)
Middleware: Logger · cors · rateLimiter
Routes:
GET / Guard(AuthRule, AdminRule) · Interceptor(TransformRule)
POST / Guard(AuthRule)
GET /users ... | 841 |
mayari-org/mayari | mayari-org-mayari-d4abc88/src/utils/MainDir.luau | luau | .luau | return ".mayari/src/app"
| 7 |
mayari-org/mayari | mayari-org-mayari-d4abc88/tests/adapters/fs/fs.test.luau | luau | .luau | local runner = require("@test-runner")
local adpt = require("@mayari.adpt")
local fs = adpt.fs
local FIXTURES = "./tests/fixtures/fs"
local describe, test, expect = runner.describe, runner.test, runner.expect
local function Test()
describe("isFile", function()
test("returns true for an existing file", function()... | 502 |
mayari-org/mayari | mayari-org-mayari-d4abc88/tests/init.luau | luau | .luau | local adpt = require("@mayari.adpt")
local runner = require("@self/runner")
local fs = adpt.fs
local function findTestFiles(dir: string): { string }
local results = {}
for _, entry in fs.readDir(dir) do
local fullPath = dir .. "/" .. entry
if fs.isDir(fullPath) then
for _, nested in findTestFiles(fullPath)... | 209 |
mayari-org/mayari | mayari-org-mayari-d4abc88/tests/runner.luau | luau | .luau | local adpt = require("@mayari.adpt")
local process = adpt.process
export type Expected = {
toBe: (expected: any) -> (),
toEqual: (expected: any) -> (),
toBeNil: (expected: any) -> (),
never: (expected: any) -> (),
}
export type TestRunner = {
describe: (name: string, fn: () -> ()) -> (),
test: (name: string, f... | 758 |
mayari-org/mayari | mayari-org-mayari-d4abc88/tests/unit/router.test.luau | luau | .luau | local runner = require("@test-runner")
local describe, test, expect = runner.describe, runner.test, runner.expect
local createRouter = require("@core/Routing/CreateTestRouter")
local function Test()
describe("static routes", function()
test("matches an exact path", function()
local router = createRouter()
lo... | 771 |
mayari-org/mayari | mayari-org-mayari-d4abc88/tests/web/src/app/users/users.service.luau | luau | .luau | local UserService = {}
function UserService.getUser(userId: number)
return {
msg = "Hello, user " .. userId,
}
end
return UserService
| 31 |
mayari-org/mayari | mayari-org-mayari-d4abc88/tests/web/src/guards/Admin.luau | luau | .luau | local common = require("@mayari.common")
local function Admin(_req: common.Request)
print("Admin Check")
return true
end
return Admin
| 32 |
mayari-org/mayari | mayari-org-mayari-d4abc88/tests/web/src/guards/Auth.luau | luau | .luau | local common = require("@mayari.common")
local function Auth(_req: common.Request)
print("Auth Check")
return true
end
return Auth
| 32 |
mayari-org/mayari | mayari-org-mayari-d4abc88/tests/web/src/interceptors/Transform.luau | luau | .luau | local common = require("@mayari.common")
local function Transform(_req: common.Request, next: common.Next)
next()
end
return Transform
| 31 |
mayari-org/mayari | mayari-org-mayari-d4abc88/tests/web/src/main.luau | luau | .luau | local mayari = require("@mayari")
local adpt = require("@mayari.adpt")
local process = adpt.process
local function myMiddleware(_req: mayari.Request, next: mayari.Next)
print("lorem")
next()
end
local PORT = tonumber(process.env.PORT) or 8080
local app = mayari.new(PORT, {
myMiddleware,
function(_req... | 121 |
mayari-org/mayari | mayari-org-mayari-d4abc88/tests/web/src/validators/createUser.luau | luau | .luau | local common = require("@mayari.common")
local schema: common.ValidatorSchema = {
body = {
username = { type = "string", required = true, min = 3, max = 20 },
age = { type = "number", required = true, min = 18 },
email = { type = "string", required = true, pattern = "^[^@%s]+@[^@%s]+%.[^@%s... | 105 |
vantoanvh/LuauPorts | vantoanvh-LuauPorts-15cd630/Compression/Zlib.luau | luau | .luau | --!optimize 2
--!native
--!strict
--[[
Deflate.luau
Public API:
- Deflate(Input: buffer, Level: number?) returns a raw RFC1951 DEFLATE stream.
- Inflate(Input: buffer) accepts a raw RFC1951 DEFLATE stream and returns the decompressed buffer.
- Compress(Input: buffer, Level: number?) returns an RFC1950 zlib strea... | 13,570 |
vantoanvh/LuauPorts | vantoanvh-LuauPorts-15cd630/Compression/rANS.luau | luau | .luau | --!optimize 2
--!native
local PROB_BITS = 12
local PROB_SCALE = 4096
local function compress(src: buffer): buffer
local n = buffer.len(src)
if n == 0 then
return buffer.create(4)
end
local freqs = table.create(256, 0)
for i = 0, n - 1 do
local s = buffer.readu8(src, i) + 1
freqs[s] += 1
end
local n... | 1,346 |
vantoanvh/LuauPorts | vantoanvh-LuauPorts-15cd630/Conversion/Base85.luau | luau | .luau | --!optimize 2
--!native
--!strict
local POW1, POW2, POW3, POW4 = 85, 7225, 614125, 52200625
local ENC_LUT_HI = buffer.create(14000)
local ENC_LUT_LO = buffer.create(30000)
local DECODE_A = buffer.create(262144)
local DECODE_B = buffer.create(262144)
for i = 0, 6995 do
buffer.writeu16(ENC_LUT_HI, i * 2, (i // 85 +... | 2,348 |
vantoanvh/LuauPorts | vantoanvh-LuauPorts-15cd630/Conversion/Base94.luau | luau | .luau | --!optimize 2
--!native
--!strict
local DIRECT_LOOKUP = {}
local BIT_MASK = {}
local ENCODE_MAP = {}
local DECODE_MAP = {}
local j = 0
for i = 32, 127 do
if i ~= 34 and i ~= 92 then
ENCODE_MAP[j] = i
DECODE_MAP[i] = j
j += 1
end
end
for entry = 0, 8835 do
DIRECT_LOOKUP[entry] = bit32.bor(
bit32.lshift(EN... | 836 |
vantoanvh/LuauPorts | vantoanvh-LuauPorts-15cd630/Decoder/DecodeGIF.luau | luau | .luau | --!optimize 2
--!native
--!strict
--[[
GIFDecoder.luau
Public API:
- Module returns DecodeGif(GifData: buffer).
- DecodeGif returns a mutable animation state:
{
Animated = boolean,
Size = Vector2.new(Width, Height),
RGBA8 = CurrentCanvas,
Frame = CurrentCanvas,
AdvanceFrame = AdvanceFrame,
Res... | 8,670 |
vantoanvh/LuauPorts | vantoanvh-LuauPorts-15cd630/Decoder/DecodeJPEG.luau | luau | .luau | --!optimize 2
--!native
--!strict
--[[
JPEGDecoder.luau
Public API:
- Module returns DecodeJpeg(JpegData: buffer).
- DecodeJpeg returns { Size = Vector2.new(Width, Height), RGBA8 = OutputBuffer }.
- OutputBuffer is packed row-major RGBA8 using buffer.writeu32-compatible byte order.
Supported JPEG image coding:... | 27,109 |
vantoanvh/LuauPorts | vantoanvh-LuauPorts-15cd630/Decoder/DecodePNG.luau | luau | .luau | --!optimize 2
--!native
--!strict
--[[
PNGDecoder.luau
Public API:
- Module returns DecodePng(PngData: buffer).
- DecodePng always returns:
{
Animated: boolean,
Size: Vector2,
RGBA8: buffer,
Frame: buffer,
AdvanceFrame: () -> (),
Reset: () -> (),
Finished: boolean,
Delay: number,
}
- ... | 31,135 |
Roblox/zen-observable-lua | Roblox-zen-observable-lua-7c7dab8/bin/spec.lua | luau | .lua | local ProcessService = game:GetService("ProcessService")
local Root = script.Parent.ZenObservableTestModel
local Packages = Root.Packages
-- Load JestGlobals source into Packages folder so it's next to Roact as expected
local JestGlobals = require(Root.Packages.Dev.JestGlobals)
local TestEZ = JestGlobals.TestEZ
-- Ru... | 150 |
Roblox/zen-observable-lua | Roblox-zen-observable-lua-7c7dab8/src/init.lua | luau | .lua | --!strict
local exports = {}
local ObservableModule = require(script.Observable)
local Observable = ObservableModule.Observable
exports.Observable = Observable
export type SubscriptionObserver<T> = ObservableModule.SubscriptionObserver<T>
export type Observer<T> = ObservableModule.Observer<T>
export type Subscriber<T>... | 91 |
SovereignSatellite/Fin | SovereignSatellite-Fin-7ff8432/Fin51/Source.luau | luau | .luau | --!strict
--!native
--!optimize 2
type Prototype = {
upvalueCount: number,
parameterCount: number,
varargFlags: number,
maximumStackSize: number,
code: { number },
constants: { [number]: any },
children: { Prototype },
}
local deserialize: (bytecode: buffer) -> Prototype
do
type ByteReader = {
source: buff... | 24,308 |
SovereignSatellite/Fin | SovereignSatellite-Fin-7ff8432/Fin52/Source.luau | luau | .luau | --!strict
--!native
--!optimize 2
type Prototype = {
parameterCount: number,
varargFlags: number,
maximumStackSize: number,
code: { number },
constants: { [number]: any },
children: { Prototype },
captureSources: { number },
}
local deserialize: (bytecode: buffer) -> Prototype
do
type ByteReader = {
source... | 25,176 |
SovereignSatellite/Fin | SovereignSatellite-Fin-7ff8432/Fin53/Source.luau | luau | .luau | --!strict
--!native
--!optimize 2
type Prototype = {
parameterCount: number,
varargFlags: number,
maximumStackSize: number,
code: { number },
constants: { [number]: any },
children: { Prototype },
captureSources: { number },
}
local deserialize: (bytecode: buffer) -> Prototype
do
type ByteReader = {
source... | 29,289 |
SovereignSatellite/Fin | SovereignSatellite-Fin-7ff8432/Fin54/Source.luau | luau | .luau | --!strict
--!native
--!optimize 2
type Prototype = {
parameterCount: number,
varargFlags: number,
maximumStackSize: number,
code: { number },
constants: { [number]: any },
children: { Prototype },
captureSources: { number },
}
local deserialize: (bytecode: buffer) -> Prototype
do
type ByteReader = {
source... | 33,122 |
SovereignSatellite/Fin | SovereignSatellite-Fin-7ff8432/Fin55/Source.luau | luau | .luau | --!strict
--!native
--!optimize 2
type Prototype = {
parameterCount: number,
varargFlags: number,
maximumStackSize: number,
code: { number },
constants: { [number]: any },
children: { Prototype },
captureSources: { number },
}
local deserialize: (bytecode: buffer) -> Prototype
do
type ByteReader = {
source... | 35,071 |
SovereignSatellite/Fin | SovereignSatellite-Fin-7ff8432/tools/benchmarks/cases/fannkuch-redux/source.lua | luau | .lua | local function benchmark(permutationLength)
local permutation = {}
local workingPermutation = {}
local rotationCounts = {}
local checksum = 0
local maximumFlipCount = 0
local sign = 1
for value = 1, permutationLength do
permutation[value] = value
workingPermutation[value] = value
rotationCounts[value] = v... | 550 |
SovereignSatellite/Fin | SovereignSatellite-Fin-7ff8432/tools/benchmarks/cases/n-body/source.lua | luau | .lua | local DAYS_PER_YEAR = 365.24
local DELTA_TIME = 0.01
local SOLAR_MASS = 4 * math.pi * math.pi
local squareRoot = math.sqrt
local function createBodies()
return {
{
positionX = 0,
positionY = 0,
positionZ = 0,
velocityX = 0,
velocityY = 0,
velocityZ = 0,
mass = SOLAR_MASS,
},
{
positionX ... | 1,476 |
SovereignSatellite/Fin | SovereignSatellite-Fin-7ff8432/tools/benchmarks/cases/spectral-norm/source.lua | luau | .lua | local ITERATION_COUNT = 10
local function inverseMatrixValue(row, column)
local diagonal = row + column - 1
return 1 / (diagonal * (diagonal - 1) * 0.5 + row)
end
local function multiplyByMatrix(source, destination, vectorLength)
for row = 1, vectorLength do
local total = 0
for column = 1, vectorLength do
t... | 389 |
SovereignSatellite/Fin | SovereignSatellite-Fin-7ff8432/tools/benchmarks/harness/runtime.luau | luau | .luau | local strengthArgument, expectedResultArgument = ...
local MEASUREMENT_DURATION_SECONDS = 5
local assertValue = assert
local processClock = os.clock
local absoluteValue = math.abs
local maximum = math.max
local numberFromString = tonumber
local printValue = print
local formatString = string.format
local strength = a... | 232 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-edbbb0f/examples/basic_mouse_ball.luau | luau | .luau | --!strict
--!optimize 2
--!native
local raylib = require("@raylib")
local lib = raylib.lib;
local const = raylib.const;
local structs = raylib.structs;
local screenWidth = 800;
local screenHeight = 450;
lib.InitWindow(screenWidth, screenHeight, "ZUNE + Raylib");
lib.SetTargetFPS(240);
local pos: raylib.Vector2 = ... | 303 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-edbbb0f/src/init.luau | luau | .luau | --!strict
local native = require("@self/native");
local raylib = require("@self/native/raylib");
export type Vector2 = raylib.Vector2
export type Vector3 = raylib.Vector3
export type Vector4 = raylib.Vector4
export type Quaternion = raylib.Quaternion
export type Matrix = raylib.Matrix
export type Color = raylib.Color... | 468 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-edbbb0f/src/lib/tar.luau | luau | .luau | --!strict
--!optimize 2
--!native
local tar = {};
local function spanstring(buf: buffer, offset: number, max: number): string
return buffer.readstring(
buf,
offset,
math.min(
(zune.mem.findScalarPos(buf, offset, 0) or offset + max) - offset,
max
)
);
end... | 453 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-edbbb0f/src/lib/zip.luau | luau | .luau | --!strict
--!optimize 2
--!native
local mem = zune.mem;
local flate = zune.serde.flate;
local zip = {};
local EOCD_SIGNATURE = buffer.fromstring("\x50\x4b\x05\x06");
function zip.is(buf: buffer): boolean
local len = buffer.len(buf);
if len < 22 then
return false;
end
return mem.findPos(buf, ... | 577 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-edbbb0f/src/native/audio.luau | luau | .luau | --!strict
--!optimize 2
--!native
local ffi = zune.ffi;
local raylib = require("./raylib");
local structs = raylib.structs;
local void = ffi.types.void;
local int = ffi.types.i32;
local uint = ffi.types.u32;
local bool = ffi.types.u8;
local float = ffi.types.float;
local cstring = ffi.types.pointer;
type int = numb... | 2,870 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-edbbb0f/src/native/models.luau | luau | .luau | --!strict
--!optimize 2
--!native
local ffi = zune.ffi;
local raylib = require("./raylib");
local structs = raylib.structs;
local void = ffi.types.void;
local int = ffi.types.i32;
local bool = ffi.types.u8;
local float = ffi.types.float;
local cstring = ffi.types.pointer;
type int = number;
type uint = number;
type... | 5,037 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-edbbb0f/src/native/raylib.luau | luau | .luau | --!strict
--!optimize 2
--!native
local ffi = zune.ffi;
local int = ffi.types.i32;
local uint = ffi.types.u32;
local bool = ffi.types.u8;
local float = ffi.types.float;
local Vector2 = ffi.types.vector2_32;
export type Vector2 = vector;
local Vector3 = ffi.types.vector3_32;
export type Vector3 = vector;
local Vect... | 9,297 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-edbbb0f/src/native/shapes.luau | luau | .luau | --!strict
--!optimize 2
--!native
local ffi = zune.ffi;
local raylib = require("./raylib");
local structs = raylib.structs;
local void = ffi.types.void;
local int = ffi.types.i32;
local bool = ffi.types.u8;
local float = ffi.types.float;
type int = number;
type bool = number;
type float = number;
type cstring = str... | 4,915 |
Scythe-Technology/luau-raylib | Scythe-Technology-luau-raylib-edbbb0f/src/native/textures.luau | luau | .luau | --!strict
--!optimize 2
--!native
local ffi = zune.ffi;
local raylib = require("./raylib");
local structs = raylib.structs;
local void = ffi.types.void;
local int = ffi.types.i32;
local uint = ffi.types.u32;
local bool = ffi.types.u8;
local float = ffi.types.float;
local cstring = ffi.types.pointer;
type int = numb... | 6,821 |
ddeityies/quantum | ddeityies-quantum-535687b/algo.luau | luau | .luau | --!native
--!optimize 2
--!strict
local gate = require("gate")
local qb = require("qb")
local preset = require("preset")
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type matrix = {{complex}}
type matrix_sz = {r: number, c: number}
local algo = {}
function algo.shor(n: number):... | 1,286 |
ddeityies/quantum | ddeityies-quantum-535687b/anneal.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
type hamiltonian = {{number}}
local cpx = require("cpx")
local gate = require("gate")
local mtx = require("mtx")
local qb = require("qb")
local preset ... | 2,359 |
ddeityies/quantum | ddeityies-quantum-535687b/anyon.luau | luau | .luau | --!native
--!optimize 2
--!strict
local cpx = require("cpx")
local mtx = require("mtx")
local qb = require("qb")
type complex = {r: number, i: number}
type matrix = {{complex}}
type qubit = {complex}
type qubits = {qubit}
local anyon = {}
local function braidgenerator(n: number, i: number): matrix
local dim = 2^n
... | 1,250 |
ddeityies/quantum | ddeityies-quantum-535687b/circuitvis.luau | luau | .luau | --!native
--!optimize 2
--!strict
local circuitvis = {}
export type gate = string
export type qubit = {gate}
export type circuit = {qubit}
export type grid = {{string}}
local function creategrid(rows: number, cols: number): grid
local grid = table.create(rows)
for i = 1, rows do
grid[i] = table.create(cols, " ")... | 765 |
ddeityies/quantum | ddeityies-quantum-535687b/compiler.luau | luau | .luau | --!native
--!optimize 2
--!strict
-- feel free to advance this further i'm too lazy
-- dude?? it's literally like basic stuff
local EPSILON = 1e-10
local MAX_QUBITS = 10
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type operation = {gate: string, target: ... | 1,672 |
ddeityies/quantum | ddeityies-quantum-535687b/cpx.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
local cpx = {}
function cpx.new(real: number?, imaginary: number?): complex
return {r = real or 0, i = imaginary or 0}
end
function cpx.add(c1: complex, c2: complex)
return cpx.new(c1.r + c2.r, c1.i + c2.i)
end
function cpx.sub(c1: comple... | 1,370 |
ddeityies/quantum | ddeityies-quantum-535687b/crypmethods.luau | luau | .luau | --!native
--!optimize 2
--!strict
local bit32 = require("bit32")
local cpx = require("cpx")
local mtx = require("mtx")
local crypmethods = {}
type Vector = {number}
type Matrix = {Vector}
type EllipticCurve = {a: number, b: number}
type EllipticCurvePoint = {x: number, y: number}
local function keccak(message: stri... | 9,008 |
ddeityies/quantum | ddeityies-quantum-535687b/crypto.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type bits = {number}
local qb = require("qb")
local gate = require("gate")
local cpx = require("cpx")
local preset = require("preset")
local crypto = {}
local bb84 = {}
local function random_bit(): ... | 6,582 |
ddeityies/quantum | ddeityies-quantum-535687b/decay.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
local gate = require("gate")
local preset = require("preset")
local decay = {}
function decay.new(probabilities: {
amplitude_damping: number?;
phas... | 564 |
ddeityies/quantum | ddeityies-quantum-535687b/ent.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
local gate = require("gate")
local qb = require("qb")
local preset = require("preset")
local cpx = require("cpx")
local ent = {}
local bell = {}
loc... | 1,745 |
ddeityies/quantum | ddeityies-quantum-535687b/err.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
local cpx = require("cpx")
local gate = require("gate")
local mtx = require("mtx")
local qb = require("qb")
local preset = require("preset")
local err... | 4,823 |
ddeityies/quantum | ddeityies-quantum-535687b/gate.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type matrix = {{complex}}
export type gate = {{complex}}
local cpx = require("cpx")
local mtx = require("mtx")
local gate = {}
function gate.new(a11: complex, a12: complex, a21: complex, a22: complex... | 4,185 |
ddeityies/quantum | ddeityies-quantum-535687b/kitaev.luau | luau | .luau | --!native
--!optimize 2
--!strict
type kitaev_obj = {
__index : kitaev_obj;
init_chain: (chain_size: number?, delta: number?, mu: number?, t: number?, time_step: number?) -> kitaev_meta;
apply_majorana: (self: kitaev_meta, i: number, mode: number) -> ();
hamiltonian: (self: kitaev_meta) -> number;
detect_majorana... | 1,642 |
ddeityies/quantum | ddeityies-quantum-535687b/mtx.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type matrix = {{complex}}
type matrix_sz = {r: number, c: number}
local cpx = require("cpx")
local mtx = {}
function mtx.new(size: matrix_sz, ...: complex)
local elements = {...}
if #elements ~= size.r * size.c then
error("number of element... | 1,693 |
ddeityies/quantum | ddeityies-quantum-535687b/noise.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
export type noise_obj = {
__index: noise_obj;
new: ( probabilities: {
bitflip: number?;
phaseflip: number?;
depolarizing: number?;
}) -> noise_... | 727 |
ddeityies/quantum | ddeityies-quantum-535687b/preset.luau | luau | .luau | --!native
--!optimize 2
--!strict
local cpx = require("cpx")
local gate = require("gate")
return {
identity = gate.new(
cpx.new(1, 0), cpx.new(0, 0),
cpx.new(0, 0), cpx.new(1, 0)
);
paulix = gate.new(
cpx.new(0, 0), cpx.new(1, 0),
cpx.new(1, 0), cpx.new(0, 0)
);
pauliy = gate.new(
cpx.new(0, 0), cpx.ne... | 1,445 |
ddeityies/quantum | ddeityies-quantum-535687b/qb.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
local cpx = require("cpx")
local gate = require("gate")
local mtx = require("mtx")
-- NOTE: THIS IS FOR SINGULAR QUBIT SYSTEMS
-- MULTI-QUBIT FUNCTION... | 3,225 |
ddeityies/quantum | ddeityies-quantum-535687b/qmacs.luau | luau | .luau | --!native
--!optimize 2
--!strict
local quantum = require("quantum")
local cpx = quantum.cpx
local gate = quantum.gate
local qb = quantum.qb
local mtx = quantum.mtx
local preset = quantum.preset
export type complex = quantum.complex
export type qubit = quantum.qubit
export type qubits = quantum.qubits
export type gat... | 1,959 |
ddeityies/quantum | ddeityies-quantum-535687b/qml.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type kernel_t = ("polynomial" | "gaussian" | "quantum")?
local qb = require("qb")
local cpx = require("cpx")
local gate = require("gate")
local qml = {}
local qsvm = {}
local function get_kernel(ker... | 2,861 |
ddeityies/quantum | ddeityies-quantum-535687b/qsmc.luau | luau | .luau | --!native
--!optimize 2
--!strict
local qb = require("qb")
local cpx = require("cpx")
local gate = require("gate")
local preset = require("preset")
type Bit = number -- 0 or 1
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type Party = {
id: number,
input: Bit,
qubit: ... | 1,061 |
ddeityies/quantum | ddeityies-quantum-535687b/quantum.luau | luau | .luau | --!native
--!optimize 2
--!strict
math.randomseed(os.time())
export type complex = {r: number, i: number}
export type qubit = {complex}
export type qubits = {qubit}
export type gate = {{complex}}
export type matrix = {{complex}}
export type matrix_sz = {r: number, c: number}
return {
mtx = require("mtx");
cpx = requ... | 222 |
ddeityies/quantum | ddeityies-quantum-535687b/quantum.v0.luau | luau | .luau | math.randomseed(os.time())
----------------------------------------------------------------------------------------------
type complex = {r : number, i : number}
type qubit = {complex}
type gate = {{complex}}
----------------------------------------------------------------------------------------------
local cpx = ... | 2,258 |
ddeityies/quantum | ddeityies-quantum-535687b/secret_sharing.luau | luau | .luau | --!native
--!optimize 2
--!strict
local quantum = require("quantum")
local cpx = quantum.cpx
local qb = quantum.qb
local gate = quantum.gate
local preset = quantum.preset
local secret_sharing = {}
export type complex = {r: number, i: number}
export type qubit = {complex}
export type qubits = {qubit}
-- Classical S... | 1,345 |
ddeityies/quantum | ddeityies-quantum-535687b/tp.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
local gate = require("gate")
local qb = require("qb")
local preset = require("preset")
local tp = {}
function tp.entangle(): qubits
local qubits = q... | 349 |
ddeityies/quantum | ddeityies-quantum-535687b/wave.luau | luau | .luau | --!native
--!optimize 2
--!strict
type complex = {r: number, i: number}
type qubit = {complex}
type qubits = {qubit}
type gate = {{complex}}
type matrix = {{complex}}
local gate = require("gate")
local qb = require("qb")
local wave = {}
-- apply hadamard to qubits to create wave-like superposition
function wave.ap... | 316 |
dphfox/autput | dphfox-autput-24076b7/examples/01-hello-autput/lune/build-this-example.luau | luau | .luau | --!nocheck
--selene: allow(incorrect_standard_library_use)
local build_single_example = require("../../build-examples/build_single_example")
build_single_example("01-hello-autput", "bin") | 43 |
dphfox/autput | dphfox-autput-24076b7/examples/01-hello-autput/src-luau/init.server.luau | luau | .luau | --!nocheck
-- See src/main.rs for an introduction to this example.
local autput = require(script.Parent.autput)
local example_wasm_loader = require(script.Parent.target_luau.example_wasm)
local wasm_env = { func_list = {} }
local finish_autput_init = autput.init(wasm_env)
local example_wasm_module = example_wasm_load... | 100 |
dphfox/autput | dphfox-autput-24076b7/luau/autput.luau | luau | .luau | --!strict
--Licensed under BSD3 from Autput, (c) Daniel P H Fox 2025
--------------------------------------------------------------------------------
-- TYPE DEFINITIONS ------------------------------------------------------------
--------------------------------------------------------------------------------
-- Typ... | 1,101 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.