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 |
|---|---|---|---|---|---|
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/DataTypes/bool.luau | luau | .luau | -- Written by @TenebrisNoctua
-- DataType module for booleans
local readu8 = buffer.readu8
local writeu8 = buffer.writeu8
--// Return Handler
return table.freeze({
size = 1,
default = false,
requiredType = "boolean",
read = @native function(buf: buffer, cursor: number)
return readu8(buf, cursor) == 1
end,
... | 128 |
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/DataTypes/float32.luau | luau | .luau | -- Written by @TenebrisNoctua
-- DataType module for float32
local readf32 = buffer.readf32
local writef32 = buffer.writef32
--// Return Handler
return table.freeze({
size = 4,
default = 0,
requiredType = "number",
read = @native function(buf: buffer, cursor: number)
return readf32(buf, cursor)
end,
write ... | 118 |
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/DataTypes/float64.luau | luau | .luau | -- Written by @TenebrisNoctua
-- DataType module for float64
local readf64 = buffer.readf64
local writef64 = buffer.writef64
--// Return Handler
return table.freeze({
size = 8,
default = 0,
requiredType = "number",
read = @native function(buf: buffer, cursor: number)
return readf64(buf, cursor)
end,
write ... | 118 |
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/DataTypes/int16.luau | luau | .luau | -- Written by @TenebrisNoctua
-- DataType module for int16
local readi16 = buffer.readi16
local writei16 = buffer.writei16
--// Return Handler
return table.freeze({
size = 2,
default = 0,
requiredType = "number",
read = @native function(buf: buffer, cursor: number)
return readi16(buf, cursor)
end,
write = ... | 118 |
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/DataTypes/int32.luau | luau | .luau | -- Written by @TenebrisNoctua
-- DataType module for int32
local readi32 = buffer.readi32
local writei32 = buffer.writei32
--// Return Handler
return table.freeze({
size = 4,
default = 0,
requiredType = "number",
read = @native function(buf: buffer, cursor: number)
return readi32(buf, cursor)
end,
write = ... | 118 |
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/DataTypes/int64.luau | luau | .luau | -- Written by @TenebrisNoctua
-- DataType module for int64
local readi32 = buffer.readi32
local writei32 = buffer.writei32
--// Return Handler
return table.freeze({
size = 8,
default = 0,
requiredType = "number",
read = @native function(buf: buffer, cursor: number)
local low = readi32(buf, cursor)
if low < ... | 317 |
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/DataTypes/int8.luau | luau | .luau | -- Written by @TenebrisNoctua
-- DataType module for int8
local readi8 = buffer.readi8
local writei8 = buffer.writei8
--// Return Handler
return table.freeze({
size = 1,
default = 0,
requiredType = "number",
read = @native function(buf: buffer, cursor: number)
return readi8(buf, cursor)
end,
write = @nativ... | 118 |
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/DataTypes/string.luau | luau | .luau | -- Written by @TenebrisNoctua
-- DataType module for string
local writestring = buffer.writestring
local readstring = buffer.readstring
local readu16 = buffer.readu16
local writeu16 = buffer.writeu16
local len = string.len
--// Return Handler
return {
size = 2,
default = "",
requiredType = "string",
ref = nil,... | 185 |
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/DataTypes/uint16.luau | luau | .luau | -- Written by @TenebrisNoctua
-- DataType module for uint16
local readu16 = buffer.readu16
local writeu16 = buffer.writeu16
--// Return Handler
return table.freeze({
size = 2,
default = 0,
requiredType = "number",
read = @native function(buf: buffer, cursor: number)
return readu16(buf, cursor)
end,
write =... | 118 |
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/DataTypes/uint32.luau | luau | .luau | -- Written by @TenebrisNoctua
-- DataType module for uint32
local readu32 = buffer.readu32
local writeu32 = buffer.writeu32
--// Return Handler
return table.freeze({
size = 4,
default = 0,
requiredType = "number",
read = @native function(buf: buffer, cursor: number)
return readu32(buf, cursor)
end,
write =... | 118 |
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/DataTypes/uint64.luau | luau | .luau | -- Written by @TenebrisNoctua
-- DataType module for uint64
local readu32 = buffer.readu32
local writeu32 = buffer.writeu32
--// Return Handler
return table.freeze({
size = 8,
default = 0,
requiredType = "number",
read = @native function(buf: buffer, cursor: number)
local low = readu32(buf, cursor)
local hi... | 196 |
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/DataTypes/uint8.luau | luau | .luau | -- Written by @TenebrisNoctua
-- DataType module for uint8
local readu8 = buffer.readu8
local writeu8 = buffer.writeu8
--// Return Handler
return table.freeze({
size = 1,
default = 0,
requiredType = "number",
read = @native function(buf: buffer, cursor: number)
return readu8(buf, cursor)
end,
write = @nati... | 118 |
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/Proxy.luau | luau | .luau | --!native
-- Written by @TenebrisNoctua
-- Creates a proxy for the buffer object, so metamethods can be applied.
--// Variables
local Types = require('./Types')
--// Types
type anyTable = Types.anyTable
--// Return Constructor
return function(metatable: anyTable)
--[[
-- To use it with userdata proxy, replace ... | 168 |
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/Types.luau | luau | .luau | -- Written by @TenebrisNoctua
-- Contains the types which will be used within the library.
--// Essential Types
export type anyTable = {[any]: any}
export type dataType<T> = {
read size: number,
read default: any,
read requiredType: string,
read ref: any?,
read write: (buf: buffer, cursor: number, value: any)... | 198 |
TenebrisNoctua/StructU | TenebrisNoctua-StructU-75e2871/src/init.luau | luau | .luau | --!strict
--!native
-- Written by @TenebrisNoctua
-- Contains the main StructU code.
--// Variables
local Types = require('@self/Types')
local Proxy = require('@self/Proxy')
local int8 = require('@self/DataTypes/int8')
local int16 = require('@self/DataTypes/int16')
local int32 = require('@self/DataTypes/int32')
loc... | 1,020 |
TheNexusAvenger/Nexus-Instance | TheNexusAvenger-Nexus-Instance-b380c16/src/Event/TypedEvent.luau | luau | .luau | --Typed event with support for table-based payloads.
--!strict
local HttpService = game:GetService("HttpService")
local RunService = game:GetService("RunService")
local TypedEventConnection = require(script.Parent:WaitForChild("TypedEventConnection"))
local TypedEvent = {}
TypedEvent.LastArguments = {} :: {[string]:... | 986 |
TheNexusAvenger/Nexus-Instance | TheNexusAvenger-Nexus-Instance-b380c16/src/Event/TypedEventConnection.luau | luau | .luau | --Connection for a typed event.
--!strict
local TypedEventConnection = {}
TypedEventConnection.__index = TypedEventConnection
export type TypedEventStub<T...> = {
Disconnected: (TypedEventStub<T...>, TypedEventConnection<T...>) -> (),
[any]: any,
}
export type TypedEventConnection<T...> = {
Connected: bo... | 342 |
TheNexusAvenger/Nexus-Instance | TheNexusAvenger-Nexus-Instance-b380c16/src/init.luau | luau | .luau | --Main module for Nexus Instance.
--!strict
local METATABLE_METHODS = {
"__call",
"__concat",
"__unm",
"__add",
"__sub",
"__mul",
"__div",
"__idiv",
"__mod",
"__pow",
"__tostring",
"__eq",
"__lt",
"__le",
"__gc",
"__len",
"__iter",
}
local TypedEvent... | 1,773 |
CompeyDev/rusty-luau | CompeyDev-rusty-luau-648c534/.lune/lint.luau | luau | .luau | --> Run selene for linting
local process = require("@lune/process")
local CommandBuilder = require("./util/exec")
process.exit(CommandBuilder.new("selene"):withArg("."):withStdioStrategy("forward"):exec().code)
| 50 |
CompeyDev/rusty-luau | CompeyDev-rusty-luau-648c534/.lune/typecheck.luau | luau | .luau | --> Run luau-lsp analysis to check for type errors
local process = require("@lune/process")
local CommandBuilder = require("./util/exec")
process.exit(
CommandBuilder.new("luau-lsp")
:withArg("analyze")
:withArgs({ "--platform", "standard" })
:withArgs({ "--settings", ".vscode/settings.json" })
:withArgs(... | 122 |
CompeyDev/rusty-luau | CompeyDev-rusty-luau-648c534/examples/russianRoullete.luau | luau | .luau | local result = require("../lib/result")
type Result<T, E> = result.Result<T, E>
local Ok = result.Ok
local Err = result.Err
local function canError(): Result<number, string>
if math.round(math.random()) == 1 then
return Err("you DIED")
end
return Ok(69)
end
function main()
local val = canError():unwrap()
pri... | 95 |
CompeyDev/rusty-luau | CompeyDev-rusty-luau-648c534/lib/conversion.luau | luau | .luau | --[[
This exists because if the Option module were to have methods to convert
to Result, and the Result module were to have methods to convert to Option,
there would be a cyclic dependency.
So, if a consumer of this library wants to convert between the two, they
would rather import this conversion module.
]]
loc... | 1,507 |
CompeyDev/rusty-luau | CompeyDev-rusty-luau-648c534/lib/match.luau | luau | .luau | --[=[
@class Match
A match expression branches on a pattern.
Match expressions must be exhaustive, meaning that every possible
pattern must be matched, i.e., have an arm handling it. The catch all
arm (`_`), which matches any value, can be used to do this.
Match expressions also ensure that all of the left... | 833 |
CompeyDev/rusty-luau | CompeyDev-rusty-luau-648c534/lib/option.luau | luau | .luau | local tableEq = require("./util").tableEq
--[=[
@class Option
Type [Option] represents an optional value: every [Option] is either [Option:Some]
and contains a value, or [Option:None], and does not. Common uses of an [Option]
may involve:
* Initial values
* Return values for functions that are not defined ove... | 5,857 |
CompeyDev/rusty-luau | CompeyDev-rusty-luau-648c534/lib/result.luau | luau | .luau | local tableEq = require("./util").tableEq
--[=[
@class Result
Error handling with the [Result] type.
[Result]`<T, E>` is the type used for returning a possible error. It is a class with the
constructor variants, [Result:Ok]`(T)`, representing success and containing a value, and
[Result:Err]`(E)`, representing... | 6,030 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Doom/Sounds.luau | luau | .luau | --!native
--!optimize 2
-- Port of the musicenum_t and sfxenum_t id slices from sounds.h.
-- This is enough to resolve Doom sound/music constants without porting the
-- full sound backend.
const Sounds: { [string]: number } = {}
Sounds.mus_None = 0
Sounds.mus_e1m1 = 1
Sounds.mus_e1m2 = 2
Sounds.mus_e1m3 = 3
Sounds.m... | 4,104 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Doom/SpriteNames.luau | luau | .luau | --!native
--!optimize 2
-- Sprite name table and spritenum_t values from info.c, info.h.
-- Thing frame/state LUT support data used by `Renderer/Things.luau`.
const sprnames = {
[0] = "TROO", "SHTG", "PUNG", "PISG", "PISF", "SHTF", "SHT2", "CHGG", "CHGF", "MISG",
"MISF", "SAWG", "PLSG", "PLSF", "BFGG", "BFGF", "BLU... | 1,836 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Engine/Definitions.luau | luau | .luau | --!native
--!optimize 2
-- Port of doomdef.c, doomdef.h
-- basic defines for DOOM, e.g. Version, game mode
-- and skill level, and display parameters.
return {
-- Global parameters/defines.
-- DOOM version
VERSION = 110,
DEMO_VERSION = 109,
DOOM_191_VERSION = 111,
-- Game mode handling - identify IWAD version... | 1,238 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Engine/Tables.luau | luau | .luau | --!native
--!optimize 2
-- Port of tables.c, tables.h
-- Lookup tables.
--[[
In the order of appearance:
finetangent[4096] - Tangens LUT.
Should work with BAM fairly well (12 of 16bit, effectively, by shifting).
nfinesine[10240] - Sine lookup.
Guess what, serves as cosine, too.
R... | 74,123 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Engine/Timing.luau | luau | .luau | --!optimize 2
--!native
--[[
Timing.luau
Tracks fixed-timestep frame timing, pending simulation tics, interpolation alpha, and host time.
]]
const Definitions = require("./Definitions")
const SIMULATION_HZ = Definitions.TICRATE
const SECONDS_PER_TIC = 1 / SIMULATION_HZ
const EXTERNAL_MAX_CATCH_UP_TICS = 0
l... | 576 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Interface/Title.luau | luau | .luau | --!native
--!optimize 2
-- Port of the D_Page*/D_AdvanceDemo/D_StartTitle slice from d_main.c.
-- Demo playback stays host-driven so the outer engine owns the transition
-- into gameplay demo sessions.
const Definitions = require("../Engine/Definitions")
const Setup = require("../Play/Setup")
const Sounds = require("... | 1,137 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Miscellaneous/BoundingBox.luau | luau | .luau | --!optimize 2
--!native
--[[
BoundingBox.luau
Public API:
- Module returns bounding box coordinate constants and buffer helpers.
- Create returns an initialized bounding box buffer.
- ClearBox resets a bounding box buffer.
- AddToBox expands a bounding box buffer to include a point.
Port of m_bbox.c and m_bbo... | 420 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Miscellaneous/Fixed.luau | luau | .luau | --!native
--!optimize 2
-- Port of m_fixed.c, m_fixed.h
-- Fixed point implementation.
const function ToSigned32(value: number): number
value = bit32.band(value, 0xFFFFFFFF)
return if value >= 2147483648 then value - 4294967296 else value
end
const function FixedMul(a: number, b: number): number
a = T... | 469 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Miscellaneous/Random.luau | luau | .luau | --!optimize 2
--!native
--[[
Random.luau
Public API:
- Module returns Doom random number generators backed by the m_random lookup table.
- PlayRandom and MenuRandom return 0-255 values.
- ClearRandom resets both generator indices.
]]
const RndTable = {
[0] = 0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 14... | 973 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Play/Ceiling.luau | luau | .luau | --!native
--!optimize 2
-- Port of p_ceilng.c, p_spec.h
-- Ceiling animation (lowering, crushing, raising)
-- Thinker registration/removal, plane motion, and sound playback come from
-- the shared play runtime.
-- Note: `getNextSector`, `FindSectorFromLineTag`, and
-- `FindHighestCeilingSurrounding` are implemented lo... | 2,805 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Play/Doors.luau | luau | .luau | --!native
--!optimize 2
-- Port of Doors.c, p_spec.h
-- Door animation code (opening/closing)
-- Thinker registration/removal, plane motion, and sound playback come from
-- the shared play runtime.
-- Note: `getNextSector`, `FindSectorFromLineTag`, and
-- `FindLowestCeilingSurrounding` are implemented locally ... | 3,721 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Play/Floor.luau | luau | .luau | --!native
--!optimize 2
-- Port of p_floor.c, p_spec.h
-- Floor animation: raising stairs.
-- Thinker registration/removal, sector collision updates, and sound playback
-- are provided by the shared play runtime.
-- Note: `twoSided`, `getSide`, `getSector`, `getNextSector`,
-- `FindSectorFromLineTag`, and surr... | 5,103 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Play/Host.luau | luau | .luau | --!optimize 2
--!native
--[[
Host.luau
Exports host callback stubs for play systems when no platform host handlers are installed.
]]
const function startSound(...: unknown)
end
const function startSoundSystem(...: unknown)
end
const function startStatus(...: unknown)
end
const function startHUD(...: unknown)
en... | 245 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Play/Lights.luau | luau | .luau | --!native
--!optimize 2
-- Port of p_lights.c
-- Handle Sector base lighting effects.
-- Muzzle flash?
-- Thinker registration goes through the shared play runtime, and this module
-- keeps the spawned effect tables as the owner of those light thinkers.
-- Note: `getNextSector`, `FindSectorFromLineTag`, and
-- `FindMi... | 2,648 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Play/MapUtil.luau | luau | .luau | --!native
--!optimize 2
-- Port of p_maputl.c, p_local.h
-- Movement/collision utility functions.
-- This file ports the block/sector thing-link routines, block iterators,
-- line/divline helpers, and `LineOpening`.
-- Note: blockmap state is shared through `WorldState.luau`.
const Fixed = require("../Miscel... | 5,968 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Play/Platforms.luau | luau | .luau | --!native
--!optimize 2
-- Port of p_plats.c, p_spec.h
-- Plats (i.e. elevator platforms) code, raising/lowering.
-- Thinker registration/removal, plane motion, and sound playback come from
-- the shared play runtime.
const Random = require("../Miscellaneous/Random")
const Fixed = require("../Miscellaneous/F... | 2,363 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Play/Sight.luau | luau | .luau | --!native
--!optimize 2
-- Port of p_sight.c
-- LineOfSight/Visibility checks, uses REJECT lookup table.
const Fixed = require("../Miscellaneous/Fixed")
const MapUtil = require("./MapUtil")
const State = require("../Renderer/State")
const WorldState = require("./WorldState")
const TWOSIDED = 4
const SUBSECTOR = 0x80... | 2,371 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Play/Teleport.luau | luau | .luau | --!native
--!optimize 2
-- Port of p_telept.c
-- Teleportation.
-- Note: fog spawning and sound playback come from the shared play runtime.
const Map = require("./Map")
const Mobj = require("./Mobj")
const Runtime = require("./Runtime")
const State = require("../Renderer/State")
const Tables = require("../Engine/Tabl... | 732 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Play/WorldState.luau | luau | .luau | --!native
--!optimize 2
-- Shared play-world state for modules that need map/block/reject data
-- without bouncing through per-field indirection.
const WorldState = {
bmapwidth = 0,
bmapheight = 0,
blockmap = {},
blockmaplump = {},
bmaporgx = 0,
bmaporgy = 0,
blocklinks = {},
rejectmatrix = buffer.create(0),
... | 185 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Renderer/Bsp.luau | luau | .luau | --!native
--!optimize 2
-- Port of r_bsp.c, r_bsp.h
-- BSP traversal, handling of LineSegs for rendering.
-- `StoreWallRange` from `Segs.luau` and sprite submission from
-- `Things.luau` route through the shared renderer runtime so BSP stays acyclic.
const BoundingBox = require("../Miscellaneous/BoundingBox")
const G... | 4,851 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Renderer/Data.luau | luau | .luau | --!native
--!optimize 2
-- Port of r_data.c, r_data.h
-- Refresh module, data I/O, caching, retrieval of graphics
-- by name.
-- `R_PrecacheLevel` prefers thinker-driven sprite discovery when play code has
-- populated the shared renderer host bridge; otherwise it falls back to sector
-- thinglists.
-- COLORMAP pointe... | 6,124 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Renderer/Draw.luau | luau | .luau | --!native
--!optimize 2
-- Port of r_draw.c, r_draw.h
-- The actual span/column drawing functions.
-- Here find the main potential for optimization,
-- e.g. inline assembly, different algorithms.
const Definitions = require("../Engine/Definitions")
const State = require("./State")
const Video = require("../System/Vi... | 6,178 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Renderer/Geometry.luau | luau | .luau | --!native
--!optimize 2
-- Port of r_main.c, r_main.h
-- Rendering main loop and setup functions,
-- utility functions (BSP, geometry, trigonometry).
-- See tables.c, too.
-- Geometry helpers shared by renderer and play code.
const BoundingBox = require("../Miscellaneous/BoundingBox")
const Fixed = require(... | 1,950 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Renderer/Host.luau | luau | .luau | --!native
--!optimize 2
--[[
Host.luau
Provides the renderer host table and resets runtime callback fields.
]]
type Host = {
getThinkerCap: unknown?,
mobjThinker: unknown?,
netUpdate: unknown?,
Reset: (() -> ())?,
}
const host: Host = {}
const function Reset()
host.getThinkerCap = nil
host.mobjThinker = ni... | 105 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Renderer/Main.luau | luau | .luau | --!native
--!optimize 2
-- Port of r_main.c, r_main.h
-- Rendering main loop and setup functions,
-- utility functions (BSP, geometry, trigonometry).
-- See tables.c, too.
-- `RenderPlayerView` calls the renderer owners directly. Shared bridge state
-- is only used where direct requires would create cycles.
const Fix... | 3,346 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Renderer/Runtime.luau | luau | .luau | --!native
--!optimize 2
const runtime: {
storeWallRange: unknown?,
addSprites: unknown?,
Reset: (() -> ())?,
} = {}
const function Reset()
runtime.storeWallRange = nil
runtime.addSprites = nil
end
Reset()
runtime.Reset = Reset
return runtime
| 66 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Renderer/Shared.luau | luau | .luau | --!native
--!optimize 2
-- Shared renderer math helpers.
-- Keep these leaf-level so renderer modules do not require each other just for
-- pure calculations.
const Fixed = require("../Miscellaneous/Fixed")
const Tables = require("../Engine/Tables")
const State = require("./State")
const finesine = Tables.finesine
... | 322 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Renderer/Sky.luau | luau | .luau | --!optimize 2
--!native
--[[
Sky.luau
Provides sky renderer state accessors and resets sky texture midpoint for view changes.
]]
const SKYFLATNAME = "F_SKY1"
const ANGLETOSKYSHIFT = 22
-- sky mapping
-- `skyflatnum` is assigned by play/setup code after flats are initialized.
local skyflatnum = 0
local skytexture ... | 288 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Renderer/SpriteState.luau | luau | .luau | --!optimize 2
--!native
--[[
SpriteState.luau
Shared renderer sprite clipping and masked-column draw state.
]]
type SpriteState = {
Reset: () -> (),
negonearray: buffer | false,
screenheightarray: buffer | false,
maskedColumnDrawer: ((buffer, number) -> ())?,
maskedFloorClip: buffer | false,
maskedCeilingCli... | 281 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/Renderer/State.luau | luau | .luau | --!native
--!optimize 2
-- Port of r_state.h
-- Refresh/render internal state variables (global).
-- Some values intentionally stay unset until their owning renderer module runs:
-- `colormaps` from `Renderer/Data`, `viewplayer` from `Renderer/Main`,
-- `sprites` from `Renderer/Things`, and `floorplane` / `ceilingplan... | 903 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/System/Sound.luau | luau | .luau | --!native
--!optimize 2
-- Port of the high-level s_sound.c/s_sound.h ownership layer.
-- Actual backend playback stays host-driven for the runtime.
const Definitions = require("../Engine/Definitions")
const Sounds = require("../Doom/Sounds")
const Fixed = require("../Miscellaneous/Fixed")
const Tables = require("../... | 5,019 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/System/Video.luau | luau | .luau | --!native
--!optimize 2
-- Port of v_video.c, v_video.h
-- Gamma correction LUT stuff.
-- Functions to draw patches (by post) directly to screen.
-- Functions to blit a block to the screen.
const Definitions = require("../Engine/Definitions")
const BoundingBox = require("../Miscellaneous/BoundingBox")
const... | 8,408 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/System/VideoMode.luau | luau | .luau | --!native
--!optimize 2
const Definitions = require("../Engine/Definitions")
const STATUSBAR_LOGICAL_HEIGHT = 32
const ALLOWED_RENDER_SIZES = {
["320x200"] = 1,
["640x400"] = 2,
["960x600"] = 3,
}
const State = {
LogicalWidth = Definitions.BASE_WIDTH,
LogicalHeight = Definitions.BASE_HEIGHT,
LogicalHalfWidth ... | 1,908 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/System/Wad.luau | luau | .luau | --!native
--!optimize 2
-- Port of w_wad.c, w_wad.h
-- Handles WAD file header, directory, lump I/O.
-- Buffer-based WAD directory parsing and lump access.
-- TODO: Add an InitMultipleFiles-style buffer wrapper if higher-level boot code wants it.
-- TODO: Add a Reload equivalent if live map/WAD replacement is needed.
... | 2,132 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/System/Wipe.luau | luau | .luau | --!native
--!optimize 2
-- Port of f_wipe.c, f_wipe.h
-- DESCRIPTION:
-- Mission begin melt/wipe screen special effect.
-- Mission start screen wipe/melt, special effects.
const Random = require("../Miscellaneous/Random")
const Video = require("./Video")
-- simple gradual pixel change for 8-bit only
co... | 2,108 |
vantoanvh/LuauDOOM | vantoanvh-LuauDOOM-2dbeeb2/LuauDOOM/System/Zone.luau | luau | .luau | --!native
--!optimize 2
-- Port of z_zone.c, z_zone.h
-- Zone Memory Allocation. Neat.
-- This Luau port emulates Doom's memblock list and rover behavior.
-- Ownership still uses `ownerTable` + `ownerKey` instead of C pointers.
-- ZONE MEMORY
-- PU - purge tags.
-- Tags < 100 are not overwritten until freed.
const ST... | 1,680 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-2565337/tests/cases/export-keyword.luau | luau | .luau | export function thing()
return
end
export local version = "5.1"
export const TAU = math.pi * 2
export local settings: Settings = getSettings()
export local a, b, c = 1, 2, 3
export local d
@native
export function fast()
return
end
| 69 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-2565337/tests/cases/numeric-failure.luau | luau | .luau | local num01 = 123e4.5
local num02 = 1.2E3.4
local num03 = _123
local num04 = _123.4
local num05 = 0.1.5
local num06 = 0xA_B_Ce_D.E
local num07 = 0b10e10
local num08 = 0b10.10
local num09 = 0x
local num10 = 0b
local num11 = 1e
local num12 = -1e-
local num13 = 1e_-1
local num14 = 1e_+1
local num15 = 0x_
local num16 = 0b_... | 180 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-2565337/tests/cases/numeric-integer.luau | luau | .luau | local i1: integer = 123456789i
local i2: integer = -1_048_576i
local i3: integer = -99i
const i4: integer = 0xfedcba9876543210i
const i5: integer = -0xFFFF_FFFFi
local i6: integer = 0b01010101i
local i7: integer = -0b_0101_0101i
-- failure cases
local i8: integer = 1.i
local i9: integer = -1.0i
local i10: integer = 5e... | 168 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-2565337/tests/cases/numeric-negative.luau | luau | .luau | local num01 = -123456789
local num02 = -1_048_576
local num03 = -99
const num04 = -0xfedcba9876543210
const num05 = -0xFFFF_FFFF
local num06 = -0b01010101
local num07 = -0b_0101_0101
const num08 = -1e5
local num09 = -1e-5
local num10 = -1e+5
local num11 = -1_2._3e-_5_6
local num12 = -0_x_A_B_Cd_E0_x_A_B_Cd_E
local num1... | 148 |
Roblox/symbol-luau | Roblox-symbol-luau-83d7311/scripts/run-tests.lua | luau | .lua | local Root = script.Parent["SymbolTest"]
local processServiceExists, ProcessService = pcall(function()
return game:GetService("ProcessService")
end)
local Packages = Root.Packages
if not Packages or not Packages:FindFirstChild("Dev") then
game:GetService("TestService"):Error("Invalid Package configuration. Try runni... | 200 |
Roblox/symbol-luau | Roblox-symbol-luau-83d7311/src/Registry.global.lua | luau | .lua | local Symbol = require(script.Parent.Symbol)
local GlobalRegistry: { [string]: Symbol.Symbol } = {}
return {
getOrInit = function(name: string): Symbol.Symbol
if GlobalRegistry[name] == nil then
GlobalRegistry[name] = Symbol.new(name)
end
return GlobalRegistry[name]
end,
-- Used for testing
__clear = fu... | 86 |
Roblox/symbol-luau | Roblox-symbol-luau-83d7311/src/init.lua | luau | .lua | --!strict
--[[
A 'Symbol' is an opaque marker type, implemented to behave similarly to JS:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol
]]
local Symbol = require(script.Symbol)
export type Symbol = Symbol.Symbol
local GlobalRegistry = require(script["Registry.global"])
loca... | 152 |
Roblox/symbol-luau | Roblox-symbol-luau-83d7311/src/jest.config.lua | luau | .lua | return {
displayName = "Symbol",
testMatch = { "**/__tests__/**/*.spec" },
}
| 21 |
luau-ecs/oxgz | luau-ecs-oxgz-93c0114/lune/styling.luau | luau | .luau | local process = require("@lune/process")
local result = process.exec("stylua", { "lune", "src", "test", "--check" }, {
stdio = "forward",
})
process.exit(result.code)
| 46 |
luau-ecs/oxgz | luau-ecs-oxgz-93c0114/lune/test.luau | luau | .luau | local process = require("@lune/process")
print("hi")
process.exit(0)
| 18 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/examples/basic/luau-lint.config.luau | luau | .luau | --!strict
--[=[
Basic luau-lint configuration example
This shows a minimal configuration for a typical Luau project.
]=]
return {
-- Enable recommended rules plugin
plugins = {
"@luau-lint/recommended-rules",
},
-- Configure individual rules
rules = {
["generalized-iteration"] = "error",
},
-- This... | 96 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/examples/concept.luau | luau | .luau | -- Final Proof-of-Concept Demonstration
-- Luau Hybrid Linter: Complete Functionality Test
local luau = require("@lute/luau")
local parser = require("@batteries/syntax/parser")
local visitor = require("@batteries/syntax/visitor")
print("🎯 LUAU HYBRID LINTER - FINAL DEMONSTRATION")
print("=" .. string.rep("=", 60))
pr... | 1,246 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/examples/example-rule.luau | luau | .luau | --[[
Example Rule: Generalized Iteration
This example demonstrates a single rule implementation following the proposed
Rule API for the Luau Linter. This showcases how rules are structured and
how they interact with the AST visitor system.
The rule detects usage of pairs() and ipairs() in ... | 1,450 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/cli/src/args.luau | luau | .luau | -- src/cli/args.luau
-- Placeholder for command-line argument parsing logic
-- Will be implemented to support --help, --version, --config, --fix flags
-- and file/directory path handling.
-- TODO: Replace with actual Lute process API usage for argument access
export type ParsedArgs = {
help: boolean,
version: boole... | 487 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/cli/src/init.luau | luau | .luau | --!strict
--[=[
@class LuauLintCLI
Command-line interface for luau-lint
This module provides the main entry point for the luau-lint CLI package.
@since v0.1.0
]=]
local Args = require("@self/args")
local Main = require("@self/main")
local Output = require("@self/output")
return {
Args = Args,
Main = Main,
... | 91 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/cli/src/main.luau | luau | .luau | -- src/cli/main.luau
-- Main command-line interface entry point for Luau Linter.
local Args = require("./args")
local Fs = require("@lute/fs")
local Luau = require("@lute/luau")
local OutputFormatter = require("./output")
local Parser = require("@batteries/syntax/parser")
local PluginApi = require("@luau-lint/plugin-a... | 1,798 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/cli/src/output.luau | luau | .luau | -- src/cli/output.luau
-- Handles formatting of linting results.
local PluginApi = require("plugin_api")
local json = require("@batteries/json")
type LintResult = PluginApi.LintResult
export type FormatterOptions = {
showSourceContext: boolean?, -- For text formatter
}
local function formatAsText(results: { LintRe... | 932 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/config/src/init.luau | luau | .luau | --!strict
--[=[
@class LuauLintConfig
Configuration system for luau-lint
This module handles loading, validating, and managing luau-lint configuration.
@since v0.1.0
]=]
export type LuauLintConfig = {
plugins: { string }?,
rules: { [string]: "error" | "warn" | "off" }?,
extends: { string }?,
root: boolean?... | 229 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/core/src/context/context.luau | luau | .luau | --!strict
local ApiTypes = require("../api-types/api")
local types = require("../types")
type Pick<K, V> = types.Pick<K, V>
--[=[
@class RuleContext
RuleContext Implementation for luau-lint Plugin API
This module implements the RuleContext interface that provides utilities for rules
to report issues, create fi... | 1,392 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/core/src/engine/engine.luau | luau | .luau | --!strict
--[=[
@class RuleEngine
Rule Execution Engine for luau-lint Plugin API
This module implements the rule execution engine that orchestrates the
linting process. It performs single-pass AST traversal, calls relevant rule
listeners for each node type, handles errors gracefully, and collects all
issues fo... | 4,288 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/core/src/init.luau | luau | .luau | --!strict
--[=[
@class LuauLintCore
Core linting engine for luau-lint
This module provides the main entry point for the luau-lint core package.
It exports the essential components needed for linting Luau code.
@since v0.1.0
]=]
local ApiTypes = require("@self/api-types/api")
local Engine = require("@self/engi... | 294 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/core/src/pretty-print.luau | luau | .luau | type ExistingOptions = {
rawStrings: boolean?,
depth: number?,
keys: { string }?,
shouldPrint: boolean?,
}
local isPrimitiveType = { string = true, number = true, boolean = true }
local typeSortOrder: { [string]: number } = {
["boolean"] = 1,
["number"] = 2,
["string"] = 3,
["function"] = 4,
["vector"] = 5,
... | 1,560 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/core/src/registry/registry.luau | luau | .luau | --!strict
--[=[
@class RuleRegistry
Rule Registration System for luau-lint Plugin API
This module implements the rule registration system that manages rule definitions,
validates rule metadata, and provides efficient batching of rules by their node
type interests. This enables the engine to handle 200+ rules ef... | 2,792 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/core/src/rule/rule.luau | luau | .luau | --!strict
--[=[
@class Rule
Rule Implementation for luau-lint Plugin API
This module provides validation functions for rule definitions and listener maps.
It works with the types defined in the core types/api module.
@since v0.1.0
]=]
local ApiTypes = require("../api-types/api")
-- Import types from the API m... | 1,541 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/core/src/traversal/visitor-keys.luau | luau | .luau | local VisitorKeys: { [string]: { string } } = {
-- AstExprGroup
["group"] = {
"openParens",
"expression",
"closeParens",
},
-- AstExprConstantNil
["nil"] = {
-- Token fields inherited
},
-- AstExprConstantBool
["boolean"] = {
"value",
-- Token fields inherited
},
-- AstExprConstantNumber
["num... | 2,015 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/plugin-api/src/init.luau | luau | .luau | --!strict
--[=[
@class LuauLintPluginAPI
Public API for luau-lint plugin authors
This module provides the complete API surface that plugin authors need
to create custom rules for luau-lint.
@since v0.1.0
]=]
local PluginAPI = require("@self/plugin-api")
return {
PluginAPI = PluginAPI,
}
| 78 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/plugin-api/src/plugin-api.luau | luau | .luau | --!strict
--[=[
@class PluginAPI
Main Plugin API for luau-lint
This module provides the primary API for the luau-lint plugin system, implementing
the listener pattern architecture. It offers a clean, intuitive developer experience
for creating custom linting rules with comprehensive validation, e... | 1,279 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/test-utils/src/init.luau | luau | .luau | --!strict
--[=[
@class LuauLintTestUtils
Shared testing utilities for luau-lint packages
This module provides common testing utilities, fixtures, and the
"tiniest" testing framework for all luau-lint packages.
@since v0.1.0
]=]
local TestFixtures = require("@self/test-fixtures")
local Tiniest = require("@self... | 147 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/test-utils/src/tiniest/tiniest.luau | luau | .luau | -- From dphfox/tiniest, licenced under BSD
--!strict
local tiniest_plugin = require("./tiniest_plugin")
type Context = DescribeContext | RunContext
type DescribeContext = {
type: "describe",
labels: { string },
add_test: (Test) -> (),
}
type RunContext = {
type: "run",
}
export type ErrorReport = {
type: "tin... | 1,332 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/test-utils/src/tiniest/tiniest_expect.luau | luau | .luau | -- From dphfox/tiniest, licenced under BSD
--!strict
local tiniest_quote = require("./tiniest_quote")
local types = require("./types")
local tiniest_expect = {}
type Context = {
target: unknown,
test: string,
params: { unknown },
}
local context: Context = {
target = nil,
test = "",
params = {},
}
local func... | 1,125 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/test-utils/src/tiniest/tiniest_for_lute.luau | luau | .luau | -- From dphfox/tiniest, licensed under BSD3
--!strict
local fs = require("@lute/fs")
local luau = require("@lute/luau")
local tiniest = require("./tiniest")
local tiniest_expect = require("./tiniest_expect")
local tiniest_pretty = require("./tiniest_pretty")
local tiniest_snapshot = require("./tiniest_snapshot")
loca... | 836 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/test-utils/src/tiniest/tiniest_pretty.luau | luau | .luau | -- From dphfox/tiniest, licenced under BSD
--!strict
local tiniest = require("./tiniest")
local tiniest_plugin = require("./tiniest_plugin")
type Test = tiniest.Test
type TestRunResult = tiniest.TestRunResult
type RunResult = tiniest.RunResult
export type Options = {
plugins: nil | { tiniest_plugin.Plugin },
disabl... | 1,773 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/test-utils/src/tiniest/tiniest_snapshot.luau | luau | .luau | -- From dphfox/tiniest, licensed under BSD3
--!strict
local tiniest = require("./tiniest")
local tiniest_quote = require("./tiniest_quote")
type Test = tiniest.Test
export type TestRunResult = tiniest.TestRunResult & {
num_snapshots_updated: number,
num_snapshots_obsolete: number,
}
export type RunResult = tiniest.... | 1,240 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/packages/test-utils/src/tiniest/types.luau | luau | .luau | --!strict
--[[
Type definitions for the tiniest testing framework Based on dphfox/tiniest,
licensed under BSD
This file provides comprehensive type definitions for all tiniest framework
functions to improve type safety in test files.
]]
-- Core tiniest framework types
export type Test = {
labels: { ... | 873 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/plugins/recommended/src/init.luau | luau | .luau | --!strict
--[=[
@class RecommendedRules
Default recommended rules for luau-lint
This plugin contains the core set of rules that are recommended for
most Luau projects. These rules enforce best practices and help
catch common issues.
@since v0.1.0
]=]
local GeneralizedIteration = require("./rules/generaliz... | 134 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/run-tests.luau | luau | .luau | #!/usr/bin/env lute
--!strict
-- Simple test runner script
local tiniest_module = require("./packages/test-utils/src/tiniest/tiniest_for_lute")
local fs = require("@lute/fs")
-- Configure tiniest
local tiniest = tiniest_module.configure({
snapshot_path = "./tests/__snapshots__",
save_snapshots = true,
})
-- List o... | 563 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/scripts/clean-directories.luau | luau | .luau | #!/usr/bin/env lune
--[[
Clean Directories Script for luau-lint
This script recursively removes all directories with specified names
throughout the project. Useful for cleaning up generated files like
luau_packages, node_modules, .pesde, etc.
Usage:
lune run scripts/clean-directories.luau... | 2,132 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/scripts/copy-license.luau | luau | .luau | #!/usr/bin/env lune
--[[
Copy License Script for luau-lint
This script copies the root LICENSE file to each package directory
in the packages/ folder to ensure all publishable packages have
the proper licensing information.
Usage: lune run scripts/copy-license.luau
]]
local fs = require("@lune/f... | 781 |
christopher-buss/luau-lint | christopher-buss-luau-lint-a56b501/tests/__snapshots__/some_cool_features.snapshots.snap.luau | luau | .luau | -- Auto-generated by dphfox/tiniest. Do not modify!
--!nocheck
return {[====[{
["bar"] = 2;
["foo"] = true;
["hello"] = "world";
}]====]} | 51 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.