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 |
|---|---|---|---|---|---|
Roblox/luau-regexp | Roblox-luau-regexp-5672cbe/src/init.lua | luau | .lua | local RegExp = require(script["Regexp.global"])
export type RegExp = RegExp.RegExp
return RegExp
| 21 |
Nicell/lynx | Nicell-lynx-a35d21b/benchmark.luau | luau | .luau | --!native
-- Implementation of this benchmark: https://hono.dev/docs/concepts/benchmarks
local process = require("@lute/process")
local Router = require("@lynx/router")
local includeInit = table.find(process.args, "--init") ~= nil
local noop = function()
return nil
end
local function buildRouter()
local router = ... | 734 |
Nicell/lynx | Nicell-lynx-a35d21b/src/init.luau | luau | .luau | return require("@self/lynx")
| 8 |
Nicell/lynx | Nicell-lynx-a35d21b/src/middleware/compress.luau | luau | .luau | local Runtime = require("../runtime")
local Context = require("../context")
type Context = Context.Context
local ENCODINGS: { { name: string, encode: string } } = {
{
name = "br",
encode = "brotli",
},
{
name = "gzip",
encode = "gzip",
},
}
local warnedUnsupported = false
local function compress()
local... | 289 |
Nicell/lynx | Nicell-lynx-a35d21b/src/middleware/logger.luau | luau | .luau | local Runtime = require("../runtime")
local Context = require("../context")
type Context = Context.Context
local Types = require("@lynx/types")
type Middleware = Types.Middleware
local color = if Runtime.env.NO_COLOR then false else true
local function dim(string: string): string
if not color then
return string
e... | 416 |
Nicell/lynx | Nicell-lynx-a35d21b/src/node.test.luau | luau | .luau | --!nocheck
local test = require("@std/test")
local Node = require("./node")
local function handler(value: string)
return function()
return value
end
end
local function values(matches)
local result = {}
for _, match in matches do
table.insert(result, (match.handler :: any)())
end
return result
end
local fun... | 687 |
Nicell/lynx | Nicell-lynx-a35d21b/src/router.test.luau | luau | .luau | --!nocheck
local test = require("@std/test")
local router = require("./router")
local function handler(value: string)
return function()
return value
end
end
local function values(matches)
local result = {}
for _, match in matches do
table.insert(result, (match.handler :: any)())
end
return result
end
test.... | 801 |
Nicell/lynx | Nicell-lynx-a35d21b/src/static.luau | luau | .luau | local Runtime = require("./runtime")
local Context = require("./context")
type Context = Context.Context
-- From https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
local mimeTypes: { [string]: string } = {
aac = "audio/aac",
abw = "application/x-abiword",
apng = "image/apng",
... | 1,055 |
dphfox/lingua | dphfox-lingua-575ec37/examples/01-hello-lingua/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-lingua", "bin") | 44 |
dphfox/lingua | dphfox-lingua-575ec37/examples/01-hello-lingua/src-luau/add_panic_handler.luau | luau | .luau | -- When Rust panics, it doesn't exit helpfully by default. This function gives
-- the Rust side an external function it can call with details of the panic,
-- so the error can be emitted on the Luau side instead.
return function(extern_fns)
local current_panic = nil
function extern_fns.panic_reporter(
len_or_byte:... | 160 |
dphfox/lingua | dphfox-lingua-575ec37/examples/02-simple-library/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("02-simple-library", "lib") | 41 |
dphfox/lingua | dphfox-lingua-575ec37/examples/02-simple-library/src-luau/init.server.luau | luau | .luau | --!nocheck
-- See src/lib.rs for an introduction to this example.
local library = require(script.library)
local prices = {
apple = 10,
orange = 5,
banana = 25
}
local fridge = {
"apple",
"apple",
"banana",
"orange",
"apple",
"orange",
"orange",
"banana",
"banana"
}
local fridge_value = library.calculate_... | 163 |
dphfox/lingua | dphfox-lingua-575ec37/examples/02-simple-library/src-luau/library.luau | luau | .luau | local lingua = require(script.Parent.Parent.lingua)
local library_wasm_loader = require(script.Parent.Parent.target_luau.example_wasm)
local add_panic_handler = require(script.Parent.add_panic_handler)
local wasm_env = { func_list = {} }
add_panic_handler(wasm_env.func_list)
local finish_lingua_init = lingua.init(was... | 202 |
dphfox/lingua | dphfox-lingua-575ec37/examples/build-examples/build_single_example.luau | luau | .luau | -- Lune-style imports make both Luau LSP and Selene very unhappy...
--!nocheck
--!nolint LocalShadow
--selene: allow(incorrect_standard_library_use)
local process = require("@lune/process")
--selene: allow(incorrect_standard_library_use)
local stdio = require("@lune/stdio")
--selene: allow(incorrect_standard_library_us... | 923 |
dphfox/lingua | dphfox-lingua-575ec37/luau/lingua.luau | luau | .luau | --!strict
--Licensed under BSD3 from Lingua, (c) Daniel P H Fox 2024
--------------------------------------------------------------------------------
-- TYPE DEFINITIONS ------------------------------------------------------------
--------------------------------------------------------------------------------
-- Typ... | 2,530 |
OMouta/PyLua | OMouta-PyLua-475c865/.config.luau | luau | .luau | return {
project = {
name = "PyLua",
version = "0.3.0",
description = "Embedded Python Interpreter for Luau",
license = "MIT",
authors = {
"OMouta"
},
},
luau = {
languageMode = "strict",
lint = {
["*"] = true,
... | 241 |
OMouta/PyLua | OMouta-PyLua-475c865/examples/basics.luau | luau | .luau | local PyLua = require("../src/PyLua")
-- Create a Python runtime
local python = PyLua.new()
-- Execute multi-line Python code (statements)
python:execute([[
x = 10
y = 32
print("sum:", x + y)
]])
-- Evaluate a Python expression and get the result in Luau
local value = python:eval("1 + 2 * 3")
print("eval result:", ... | 134 |
OMouta/PyLua | OMouta-PyLua-475c865/examples/builtins.luau | luau | .luau | local PyLua = require("../src/PyLua")
local python = PyLua.new()
python:execute([[
print("PyLua Version:", __pylua_version__)
string = "Hello, PyLua!"
print("len of string:", len(string))
print("type of 123:", type(123))
if string[0] == "H":
print("First character is H")
if isinstance(123, int):
print("123 is a... | 120 |
OMouta/PyLua | OMouta-PyLua-475c865/examples/bytes_and_strings.luau | luau | .luau | local PyLua = require("../src/PyLua")
local python = PyLua.new()
python:execute([[
s = "hello"
b = b"hello"
print("str:", s)
print("bytes:", b)
print("len(bytes):", len(b))
print("b[1] (first byte):", b[0])
print("concat bytes:", b + b" world")
]])
| 82 |
OMouta/PyLua | OMouta-PyLua-475c865/examples/classes.luau | luau | .luau | local PyLua = require("../src/PyLua")
local python = PyLua.new()
python:execute([[
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def greet(self):
return f"Hello, my name is {self.name} and I am {self.age} years old."
person = Person("Alice", 30)
print(p... | 315 |
OMouta/PyLua | OMouta-PyLua-475c865/examples/collections.luau | luau | .luau | local PyLua = require("../src/PyLua")
local python = PyLua.new()
python:execute([[
# Lists, tuples, dicts, sets
nums = [1, 2, 3]
pair = ("a", 42)
conf = {"host": "localhost", "port": 8080}
letters = {"a", "b", "c"}
# Unpacking into new dict
conf2 = {**conf, "debug": True}
print("nums:", nums)
print("pair:", pair)
p... | 252 |
OMouta/PyLua | OMouta-PyLua-475c865/examples/control_flow.luau | luau | .luau | local PyLua = require("../src/PyLua")
local python = PyLua.new()
python:execute([[
x = 7
if x < 5:
print("small")
elif x < 10:
print("medium")
else:
print("large")
# chained comparisons combine checks without repeating the middle operand
value = 8
if 5 < value < 10:
print("value is between 5 and 10")... | 442 |
OMouta/PyLua | OMouta-PyLua-475c865/examples/exceptions.luau | luau | .luau | local PyLua = require("../src/PyLua")
local python = PyLua.new()
python:execute([[
def divide(a, b):
return a / b
try:
print("divide(10, 2) =", divide(10, 2))
print("divide(5, 0) =", divide(5, 0))
except ZeroDivisionError as e:
print("Error:", e)
try:
array = [1, 2, 3]
print("Accessing array... | 262 |
OMouta/PyLua | OMouta-PyLua-475c865/examples/functions.luau | luau | .luau | local PyLua = require("../src/PyLua")
local python = PyLua.new()
python:execute([[
def add(a, b):
return a + b
def greet(name):
return "Hello, " + name
print("add(2, 3) =", add(2, 3))
print(greet("World"))
# Simple function with one default argument
def greet(name, greeting="Hello"):
print(greeting + ",... | 363 |
OMouta/PyLua | OMouta-PyLua-475c865/examples/hello_world.luau | luau | .luau | local PyLua = require("../src/PyLua")
local python = PyLua.new()
python:execute([[
print("Hello world from python!")
]])
| 31 |
OMouta/PyLua | OMouta-PyLua-475c865/examples/imports/lune.luau | luau | .luau | local PyLua = require("../../src/PyLua")
local FileSystem = require("../../src/Packages/FileSystem/Lune")
-- Create a Python runtime
local python = PyLua.new({
fileSystem = FileSystem,
searchPath = {"examples/imports/libs"},
enableFilesystem = true,
})
python:execute([[
import my_lib
my_lib.pretty_print(... | 83 |
OMouta/PyLua | OMouta-PyLua-475c865/examples/imports/lute.luau | luau | .luau | local PyLua = require("../../src/PyLua")
local FileSystem = require("../../src/Packages/FileSystem/Lute")
-- Create a Python runtime
local python = PyLua.new({
fileSystem = FileSystem,
searchPath = {"examples/imports/libs"},
enableFilesystem = true,
})
python:execute([[
import my_lib
my_lib.pretty_print(... | 83 |
OMouta/PyLua | OMouta-PyLua-475c865/examples/imports/virtual.luau | luau | .luau | local PyLua = require("../../src/PyLua")
local FileSystem = require("../../src/Packages/FileSystem/Virtual")
-- 1. Define a native module (Luau table)
local myMathModule = {
add = function(a:number, b:number) return a + b end,
PI = 3.14159
}
-- 2. Define a virtual filesystem (mocking real files)
local files =... | 245 |
OMouta/PyLua | OMouta-PyLua-475c865/examples/interop_minimal.luau | luau | .luau | local PyLua = require("../src/PyLua")
local python = PyLua.new()
-- Minimal interop: expose a Luau value/function via globals
local globals = python:globals()
-- Expose a simple Luau function that multiplies numbers
globals.lua_mul = function(a: number, b: number): number
return a * b
end
python:execute([[
prin... | 119 |
OMouta/PyLua | OMouta-PyLua-475c865/src/Packages/FileSystem/Lute.luau | luau | .luau | --!strict
-- Lute FileSystem Implementation
-- https://lute.luau.org/reference/lute/fs.html
local fs = require("@lute/fs")
local LuteFS = {}
function LuteFS.readFile(path: string): string?
if fs.exists(path) and fs.type(path) == "file" then
return fs.readfiletostring(path)
end
return nil
end
function LuteFS.ex... | 133 |
OMouta/PyLua | OMouta-PyLua-475c865/src/Packages/FileSystem/Virtual.luau | luau | .luau | --!strict
-- Virtual FileSystem (Memory-based)
local VirtualFS = {}
function VirtualFS.new(files: { [string]: string })
return {
readFile = function(path: string): string?
return files[path]
end,
exists = function(path: string): boolean
-- Check exact match
if files[path] then
return true
end
... | 249 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/ast/nodes.luau | luau | .luau | local Nodes = {}
-- Operator types
export type UnaryOpType = "Invert" | "Not" | "UAdd" | "USub"
export type BinOpType =
"Add"
| "Sub"
| "Mult"
| "MatMult"
| "Div"
| "Mod"
| "Pow"
| "LShift"
| "RShift"
| "BitOr"
| "BitXor"
| "BitAnd"
| "FloorDiv"
export type CmpOp = "Eq" | "NotEq" | "Lt" | "LtE" | "Gt" | "... | 2,525 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/ast/visitor.luau | luau | .luau | local Visitor = {}
local nodes = require("./nodes")
type ASTNode = nodes.ASTNode
type AnyNode = nodes.AnyNode
type AnyStmt = nodes.AnyStmt
type AnyExpr = nodes.AnyExpr
-- Base visitor class for AST traversal
export type Visitor = {
visit: (self: Visitor, node: ASTNode) -> any,
generic_visit: (self: Visitor, node: A... | 2,471 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/bytecode/instructions.luau | luau | .luau | local Instructions = {}
local opcodes = require("./opcodes")
type Opcode = opcodes.Opcode
-- Bytecode instruction
export type Instruction = {
opcode: Opcode,
arg: number?, -- Optional numeric argument (index / delta / small int)
lineno: number?, -- Source line for debug / traceback
}
-- Create an instruction; val... | 363 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/compiler/expressions.luau | luau | .luau | local nodes = require("../ast/nodes")
local opcodes = require("../bytecode/opcodes")
local State = require("./state")
type CompilerState = State.CompilerState
type ExprContext = nodes.ExprContext
type ListComp = nodes.ListComp
type BinOpType = nodes.BinOpType
type CmpOp = nodes.CmpOp
local function deepCopy(value: an... | 4,646 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/compiler/init.luau | luau | .luau | local State = require("@self/state")
local expressionsFactory = require("@self/expressions")
local statementsFactory = require("@self/statements")
export type CodeObject = State.CodeObject
local Compiler = {}
local compileStmtImpl: ((State.CompilerState, any) -> ())? = nil
local function compileStmt(st: State.Compi... | 455 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/compiler/state.luau | luau | .luau | local instructions = require("../bytecode/instructions")
local opcodes = require("../bytecode/opcodes")
type Instruction = instructions.Instruction
type Opcode = opcodes.Opcode
export type CodeObject = {
constants: { any },
names: { string },
varnames: { string },
bytecode: { Instruction },
firstlineno: number?,... | 851 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/compiler/statements.luau | luau | .luau | local State = require("./state")
type CompilerState = State.CompilerState
type StatementDeps = {
compileExpr: (CompilerState, any) -> (),
compileAssignmentTarget: (CompilerState, any) -> (),
compileLoadTarget: (CompilerState, any) -> (),
compileStoreTarget: (CompilerState, any) -> (),
resolveBinOpOpcode: (any) -... | 4,190 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/interop/bridge.luau | luau | .luau | local Bridge = {}
local Base = require("../objects/base")
local Collections = require("../objects/collections")
type PyObject = Base.PyObject
type PyType = Base.PyType
type VisitedPy = { [PyObject]: any }
type VisitedLuau = { [any]: PyObject }
type LuauFunctionRecord = { func: (...any) -> any }
type ClassBindingOp... | 3,504 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/objects/builtins.luau | luau | .luau | local Builtins = {}
local base = require("./base")
type PyObject = base.PyObject
-- Forward references to type registration already performed in base bootstrap
-- None
export type PyNone = PyObject & { __type: "NoneType", __value: nil }
function Builtins.None(): PyNone
return base.newNone() :: PyNone
end
-- Boolea... | 3,427 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/objects/collections.luau | luau | .luau | local Collections = {}
local base = require("./base")
local builtins = require("./builtins")
type PyObject = base.PyObject
type PyType = base.PyType
export type PyList = PyObject & { __type: "list", __value: { PyObject } }
export type PyTuple = PyObject & { __type: "tuple", __value: { PyObject } }
export type PyDict ... | 4,982 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/objects/module.luau | luau | .luau | local Base = require("./base")
local Module = {}
-- Register the module type
local moduleType = Base.registerType("module", {
bases = { Base.getTypeObject("object") },
})
function Module.new(name: string, doc: string?): Base.PyObject
local dict = {
["__name__"] = Base.newPyObject("str", name),
["__doc__"] = if... | 185 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/parser/errors.luau | luau | .luau | local errors = {}
export type Location = { line: number, column: number }
local function fmtLocation(loc: Location?): string
if not loc then
return "<unknown>"
end
return string.format("line %d, column %d", loc.line, loc.column)
end
function errors.expected(expected: string, got: string?, loc: Location?)
retur... | 263 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/parser/expressions/binary.luau | luau | .luau | local tokens = require("../../tokens")
local nodes = require("../../ast/nodes")
local precedenceModule = require("../precedence")
export type Token = tokens.Token
export type Expr = nodes.Expr
export type CmpOp = nodes.CmpOp
export type BinaryDeps = {
precedence: typeof(precedenceModule),
parsePrimary: (state: any)... | 1,985 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/parser/expressions/fstring.luau | luau | .luau | local tokens = require("../../tokens")
local nodes = require("../../ast/nodes")
export type Token = tokens.Token
export type Expr = nodes.Expr
export type FStringDeps = {
lexer: any,
wrapCall: (funcName: string, argList: { Expr }, baseNode: Expr, token: Token) -> Expr,
foldConcat: (parts: { Expr }, token: Token) -... | 2,400 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/parser/expressions/init.luau | luau | .luau | -- This module handles expression parsing
local tokens = require("../tokens")
local nodes = require("../ast/nodes")
local precedence = require("./precedence")
local postfix = require("./postfix")
local lexer = require("../lexer")
local utils = require("@self/utils")
local fstringFactory = require("@self/fstring")
l... | 412 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/parser/expressions/lambda.luau | luau | .luau | local tokens = require("../../tokens")
local nodes = require("../../ast/nodes")
export type Token = tokens.Token
export type Expr = nodes.Expr
export type Arguments = nodes.Arguments
local MAX_LAMBDA_NESTING = 64
export type LambdaDeps = {
precedence: any,
postfix: any,
parseBinaryExpression: (state: any, minPrec... | 726 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/parser/expressions/primary.luau | luau | .luau | local tokens = require("../../tokens")
local nodes = require("../../ast/nodes")
local postfix = require("../postfix")
export type Token = tokens.Token
export type Expr = nodes.Expr
export type PrimaryDeps = {
postfix: typeof(postfix),
prefixContains: (prefix: string?, flag: string) -> boolean,
makeStringConstant: ... | 3,035 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/parser/expressions/utils.luau | luau | .luau | local tokens = require("../../tokens")
local nodes = require("../../ast/nodes")
export type Token = tokens.Token
export type Expr = nodes.Expr
export type Arguments = nodes.Arguments
local function prefixContains(prefix: string?, flag: string): boolean
if not prefix then
return false
end
return string.find(prefi... | 854 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/parser/init.luau | luau | .luau | local tokens = require("./tokens")
local nodes = require("./ast/nodes")
local errors = require("@self/errors")
local expressions = require("@self/expressions")
local statements = require("@self/statements")
export type Token = tokens.Token
export type Module = nodes.Module
export type Expr = nodes.Expr
export type Stm... | 691 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/parser/postfix.luau | luau | .luau | local tokens = require("../tokens")
local nodes = require("../ast/nodes")
export type Token = tokens.Token
export type Expr = nodes.Expr
local postfix = {}
-- Forward-declared expression parser injected to avoid cycles
export type ExpressionParser = (state: any) -> Expr
-- Parse function call arguments and keywords... | 774 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/parser/precedence.luau | luau | .luau | local precedence = {}
-- Precedence levels (lower number = lower precedence)
precedence.LEVELS = {
LAMBDA = 0,
OR = 1,
AND = 2,
NOT = 3, -- unary not
IN = 4,
NOT_IN = 4,
IS = 4,
IS_NOT = 4,
LESS = 4,
LESSEQUAL = 4,
GREATER = 4,
GREATEREQUAL = 4,
EQEQUAL = 4,
NOTEQUAL = 4,
VBAR = 5, -- bitwise or
CIRCUM... | 400 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/parser/statements.luau | luau | .luau | local nodes = require("../ast/nodes")
local precedence = require("./precedence")
local expressions = require("./expressions")
export type Expr = nodes.Expr
export type Stmt = nodes.Stmt
local statements = {}
-- Helper to recursively parse assignment targets (including nested tuples)
local function parseForTarget(sta... | 4,648 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/vm/interpreter/blocks.luau | luau | .luau | local FrameModule = require("../frame")
local Stack = require("../stack")
local Base = require("../../objects/base")
local Blocks = {}
export type Frame = FrameModule.Frame
export type Block = FrameModule.Block
local function truncateToBlock(frame: Frame, block: Block)
local target = block.stackSize
local current ... | 865 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/vm/interpreter/call_function.luau | luau | .luau | local FrameModule = require("../frame")
local Functions = require("../../objects/functions")
local Instructions = require("../../bytecode/instructions")
local Base = require("../../objects/base")
local State = require("./state")
local Generator = require("./generator")
local CallFunction = {}
type CallOptions = {
lo... | 1,670 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/vm/interpreter/dispatcher.luau | luau | .luau | local FrameModule = require("../frame")
local Stack = require("../stack")
local Base = require("../../objects/base")
local Collections = require("../../objects/collections")
local ObjBuiltins = require("../../objects/builtins")
local ClassBuilder = require("../../objects/class_builder")
local Exceptions = require("../.... | 6,302 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/vm/interpreter/generator.luau | luau | .luau | local Base = require("../../objects/base")
local FrameModule = require("../frame")
local State = require("./state")
local Generator = {}
export type PyObject = Base.PyObject
export type VMState = State.VMState
export type ResumeFunction = (
vm: VMState,
frame: FrameModule.Frame,
instruction: any,
constants: { an... | 1,087 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/vm/interpreter/helpers.luau | luau | .luau | local Base = require("../../objects/base")
local Helpers = {}
export type PyObject = Base.PyObject
local function isPyObject(value: any): boolean
return type(value) == "table" and value.__type ~= nil and value.__typeobj ~= nil
end
local function coercePyObject(value: any): PyObject
if isPyObject(value) then
ret... | 1,270 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/vm/interpreter/iteration.luau | luau | .luau | local Base = require("../../objects/base")
local Collections = require("../../objects/collections")
local Iteration = {}
local ITERATOR_TYPES = {
list_iterator = true,
tuple_iterator = true,
set_iterator = true,
dict_iterator = true,
str_iterator = true,
}
export type PyObject = Base.PyObject
function Iteratio... | 1,016 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/vm/interpreter/state.luau | luau | .luau | local FrameModule = require("../frame")
local State = {}
export type Frame = FrameModule.Frame
export type VMState = {
current_frame: Frame?,
call_stack: { Frame },
globals: { [string]: any },
builtins: { [string]: any },
return_value: any,
instruction_count: number,
max_instructions: number?,
deadline: numb... | 331 |
OMouta/PyLua | OMouta-PyLua-475c865/src/PyLua/vm/stack.luau | luau | .luau | local Stack = {}
-- Value stack for VM operations
export type Stack = {
values: { any },
top: number,
}
-- Create a new stack
function Stack.new(): Stack
return {
values = {},
top = 0,
}
end
-- Push value onto stack
function Stack.push(stack: Stack, value: any)
stack.top = stack.top + 1
stack.values[stack.... | 789 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/framework.luau | luau | .luau | --!strict
-- PyLua Test Framework
-- Simple testing utilities for PyLua development
local TestFramework = {}
-- Configuration (can be overridden via configure())
export type FrameworkConfig = {
showPassed: boolean?, -- Print each passed assertion
color: boolean?, -- Use ANSI colors
showFailuresInline: boolean?, --... | 1,430 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/run_tests.luau | luau | .luau | --!strict
-- PyLua Test Runner
local TestFramework = require("./framework")
-- Aggregate run: disable per-suite summary; final summary printed manually
TestFramework.configure({ showPassed = false, color = true, showFailuresInline = false, autoSummaryPerFile = false })
require("./suites/test_api")
require("./suites/t... | 220 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_api.luau | luau | .luau | --!strict
-- PyLua API Tests
-- Test the main PyLua API interface
local TestFramework = require("../framework")
local PyLua = require("../../src/PyLua")
-- Test suite for PyLua API
local apiTests: TestFramework.TestSuite = {
name = "PyLua API Tests",
tests = {
{
name = "Create Runtime Instance",
test = func... | 632 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_ast.luau | luau | .luau | --!strict
-- PyLua AST System Tests
-- Phase 1.3 - Test AST node creation and visitor pattern
local TestFramework = require("../framework")
local nodes = require("../../src/PyLua/ast/nodes")
local visitor = require("../../src/PyLua/ast/visitor")
local astTests = {
name = "PyLua AST Tests",
tests = {
{
name = "... | 944 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_bytecode.luau | luau | .luau | --!strict
-- PyLua Bytecode / Compiler Tests (Phase 4.1 minimal subset)
local TestFramework = require("../framework")
local Lexer = require("../../src/PyLua/lexer")
local Parser = require("../../src/PyLua/parser")
local Compiler = require("../../src/PyLua/compiler")
local instr = require("../../src/PyLua/bytecode/inst... | 2,088 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_classes.luau | luau | .luau | --!strict
-- Tests for Python class definitions and inheritance
local TestFramework = require("../framework")
local Lexer = require("../../src/PyLua/lexer")
local Parser = require("../../src/PyLua/parser")
local Compiler = require("../../src/PyLua/compiler")
local Interpreter = require("../../src/PyLua/vm/interpreter"... | 924 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_control_flow.luau | luau | .luau | --!strict
-- Tests for control flow statements (if, while, for, break, continue)
local TestFramework = require("../framework")
local Lexer = require("../../src/PyLua/lexer")
local Parser = require("../../src/PyLua/parser")
local Compiler = require("../../src/PyLua/compiler")
local Interpreter = require("../../src/PyLu... | 3,053 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_error_reporting.luau | luau | .luau | --!nocheck
local TestFramework = require("../framework")
local Lexer = require("../../src/PyLua/lexer")
local Parser = require("../../src/PyLua/parser")
local errorTests = {
name = "Error Reporting Tests",
tests = {
{
name = "Parse Error with Line Number (Indentation)",
test = function()
local code = "x ... | 421 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_exceptions.luau | luau | .luau | --!strict
-- Tests for exception handling (try/except)
local TestFramework = require("../framework")
local Lexer = require("../../src/PyLua/lexer")
local Parser = require("../../src/PyLua/parser")
local Compiler = require("../../src/PyLua/compiler")
local Interpreter = require("../../src/PyLua/vm/interpreter")
local B... | 1,160 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_functions.luau | luau | .luau | --!strict
-- Tests for Python function support
local TestFramework = require("../framework")
local Lexer = require("../../src/PyLua/lexer")
local Parser = require("../../src/PyLua/parser")
local Compiler = require("../../src/PyLua/compiler")
local Interpreter = require("../../src/PyLua/vm/interpreter")
local Builtins ... | 1,559 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_generators.luau | luau | .luau | --!strict
-- Tests for generator functions and yield semantics
local TestFramework = require("../framework")
local Lexer = require("../../src/PyLua/lexer")
local Parser = require("../../src/PyLua/parser")
local Compiler = require("../../src/PyLua/compiler")
local Interpreter = require("../../src/PyLua/vm/interpreter")... | 838 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_interop.luau | luau | .luau | --!strict
-- Interop tests ensure Luau ↔ Python conversions behave as expected
local TestFramework = require("../framework")
local PyLua = require("../../src/PyLua")
local Bridge = require("../../src/PyLua/interop/bridge")
local interopSuite: TestFramework.TestSuite = {
name = "Interop Tests",
tests = {
{
name... | 1,342 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_lexer.luau | luau | .luau | --!strict
-- PyLua Lexer Tests
-- Test the Python tokenization functionality
local TestFramework = require("../framework")
local Lexer = require("../../src/PyLua/lexer")
local function dedentsBeforeDef(tokens: { any }, targetDefIndex: number): number
local defsSeen = 0
local dedents = 0
for _, token in ipairs(toke... | 2,676 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_modules.luau | luau | .luau | local TestFramework = require("../framework")
local PyLua = require("../../src/PyLua")
local modulesTests: TestFramework.TestSuite = {
name = "Modules",
tests = {
{
name = "import sys",
test = function()
local py = PyLua.new()
py:execute("import sys")
local sysPy = py:getGlobalPy("sys")
TestF... | 694 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_modules_advanced.luau | luau | .luau | local TestFramework = require("../framework")
local PyLua = require("../../src/PyLua")
local advancedModulesTests = {
name = "Advanced Modules",
tests = {
{
name = "Native module import",
test = function()
local nativeMod = {
foo = 42,
bar = function(x: number)
return x * 2
end,
... | 559 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_objects_base.luau | luau | .luau | --!strict
-- PyLua Object System Tests - Phase 3.1 Base Object System
local TestFramework = require("../framework")
local base = require("../../src/PyLua/objects/base")
local tests: TestFramework.TestSuite = {
name = "PyLua Base Object System",
tests = {
{
name = "Create primitive objects via ensurePyObject",
... | 1,079 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_objects_builtins.luau | luau | .luau | --!strict
-- Tests for Phase 3.2 Built-in Types (numbers, strings, booleans, None, type objects placeholder)
local TestFramework = require("../framework")
local base = require("../../src/PyLua/objects/base")
local builtins = require("../../src/PyLua/objects/builtins")
local suite: TestFramework.TestSuite = {
name = ... | 1,694 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_objects_collections.luau | luau | .luau | --!strict
-- Tests for Phase 3.3 Collections
local TestFramework = require("../framework")
local base = require("../../src/PyLua/objects/base")
local builtins = require("../../src/PyLua/objects/builtins")
local collections = require("../../src/PyLua/objects/collections")
local PyLua = require("../../src/PyLua")
local... | 3,406 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_parser.luau | luau | .luau | --!nocheck
-- PyLua Parser Tests - Phase 2.1 Expression Parser
-- Test the expression parsing functionality
local TestFramework = require("../framework")
local Lexer = require("../../src/PyLua/lexer")
local Parser = require("../../src/PyLua/parser")
-- Test suite for PyLua Parser
local parserTests: TestFramework.Test... | 6,267 |
OMouta/PyLua | OMouta-PyLua-475c865/tests/suites/test_vm.luau | luau | .luau | --!strict
-- PyLua Virtual Machine Tests
-- Tests for Phase 4 - VM execution
local TestFramework = require("../framework")
local Interpreter = require("../../src/PyLua/vm/interpreter")
local Frame = require("../../src/PyLua/vm/frame")
local Stack = require("../../src/PyLua/vm/stack")
local Instructions = require("../.... | 3,738 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/.globals/marionette.d.luau | luau | .luau | type WatchHandler = (newValue: any?) -> any
declare debugger: {
halt: (conditional: boolean?) -> (),
watch: (name: string, handler: WatchHandler) -> (),
watchBatch: (vars: { [string]: WatchHandler }) -> (),
check: <T>(current: T, newValue: T?) -> T,
watchStack: { [string]: WatchHandler },
} | 85 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/.globals/pcmp.d.luau | luau | .luau | declare __COMPOSER: {
Insert: (text: string) -> string,
genDate: string,
build: string,
cfg: string,
vers: string
}
declare __SH: {[any]: any} | 50 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Animation/ExternalTime.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
Outputs the current external time as a state object.
]]
local Types = require("../Types")
local External = require("../External")
-- Graph
local change = require("../Graph/change")
-- Utility
local ... | 534 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Animation/Stopwatch.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
State object for measuring time since an event using a reference timer.
TODO: this should not be exposed to users until it has a proper reactive API
surface
]]
local Types = require("../Types")
-... | 733 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Animation/Tween.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
A specialised state object for following a goal state smoothly over time,
using a TweenInfo to shape the motion.
https://elttob.uk/Fusion/0.3/api-reference/animation/types/tween/
]]
local Types =... | 1,392 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Animation/lerpType.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
Linearly interpolates the given animatable types by a ratio.
If the types are different or not animatable, then the first value will be
returned for ratios below 0.5, and the second value for 0.5 ... | 1,514 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Animation/packType.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
Packs an array of numbers into a given animatable data type.
If the type is not animatable, nil will be returned.
]]
local Types = require("../Types")
local Oklab = require("../Colour/Oklab")
loca... | 804 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Animation/unpackType.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
Unpacks an animatable type into an array of numbers.
If the type is not animatable, an empty array will be returned.
]]
local Oklab = require("../Colour/Oklab")
local function unpackType(
value: ... | 847 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/External.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
Abstraction layer between Fusion internals and external environments,
allowing for flexible integration with schedulers and test mocks.
]]
local formatError = require("./Logging/formatError")
local... | 930 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/ExternalDebug.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
Abstraction layer between Fusion internals and external debuggers, allowing
for deep introspection using function hooks.
Unlike `External`, attaching a debugger is optional, and all debugger
fun... | 402 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Graph/Observer.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
A graph object that runs user code when it's updated by the reactive graph.
http://elttob.uk/Fusion/0.3/api-reference/state/types/observer/
]]
local Types = require("../Types")
local External = re... | 654 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Graph/castToGraph.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
Returns the input *only* if it is a graph object.
]]
local Types = require("../Types")
local function castToGraph(
target: any
): Types.GraphObject?
if
typeof(target) == "table" and
typeof(t... | 157 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Graph/change.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
Prompts a graph object to re-evaluate its own value. If it meaningfully
changes, then dependents will have to re-evaluate their own values in the
future.
https://fluff.blog/2024/04/16/monotonic-... | 582 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Graph/depend.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
Forms a dependency on a graph object.
]]
local Types = require("../Types")
local External = require("../External")
local evaluate = require("../Graph/evaluate")
local nameOf = require("../Utility/na... | 234 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Graph/evaluate.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
Evaluates the graph object if necessary, so that it is up to date.
Returns true if it meaningfully changed.
https://fluff.blog/2024/04/16/monotonic-painting.html
]]
local Types = require("../Type... | 368 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Instances/Attribute.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
A special key for property tables, which allows users to apply custom
attributes to instances
]]
local Types = require("../Types")
-- Memory
local checkLifetime = require("../Memory/checkLifetime")... | 345 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Instances/AttributeChange.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
A special key for property tables, which allows users to connect to
an attribute change on an instance.
]]
local Types = require("../Types")
local External = require("../External")
local keyCache:... | 284 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Instances/AttributeOut.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
A special key for property tables, which allows users to save instance attributes
into state objects
]]
local Types = require("../Types")
local External = require("../External")
-- Memory
local che... | 397 |
cascadeui/Cascade | cascadeui-Cascade-6ea63de/packages/_index/elttob_fusion@0.3.0/fusion/src/Instances/Child.luau | luau | .luau | --!strict
--!nolint LocalUnused
--!nolint LocalShadow
local task = nil -- Disable usage of Roblox's task scheduler
--[[
Helper function for type checking purposes. Casts the input to a `Child`
type, while constraining the input to be an array of `Child` - this prevents
Luau from erroneously inferring a different ar... | 118 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.