repo stringclasses 302
values | file_path stringlengths 18 241 | language stringclasses 2
values | file_type stringclasses 4
values | code stringlengths 76 697k | tokens int64 10 271k |
|---|---|---|---|---|---|
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-hang-prefix.lua.luau | luau | .luau | ("foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" .. "barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"):format()
do
("foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" .. "barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"):format()
end
print(("fooooooooooooooooooooooooooooooooo... | 129 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-if-comments-3.lua.luau | luau | .luau | if true then
else
end
if true then
-- this is a comment
-- but this is another comment
-- and another one - we should hence indent the comments overall
else
end
| 44 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-indented-multiline-comments.lua.luau | luau | .luau | function foo()
function bar()
function baz()
--[[
comment
]]
local x = 1
end
end
end | 34 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-index-comments.lua.luau | luau | .luau | local x = foo[
index -- test
]
foo[
var -- string
] = baz
local x = foo[
x -- string
][y][z][p
-- string
]
local x = foo[index --[[comment]]]
| 50 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-long-assignment-2.lua.luau | luau | .luau | do
local HitPart, HitPoint, HitNormal, HitMaterial = nil, Ray.Origin + Ray.Direction, Vector3.new(0, 1, 0), Enum.Material.Air
end | 42 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-long-assignment-3.lua.luau | luau | .luau | local something = fooooooooooooooo == barrrrrrrrrrrr and func(arggggggggggggggggggggggggggggggggggggggggg1, argggggggggg2) or somethingeeeeeeeeeeee
| 54 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-long-assignment-4.lua.luau | luau | .luau | do
do
local FrontDistanceX, FrontDistanceY =
self.settings.FWsBoneLen * math.cos(math.rad(self.settings.FWsBoneAngle)),
self.settings.FWsBoneLen * math.sin(math.rad(self.settings.FWsBoneAngle))
end
end
| 56 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-long-assignment.lua.luau | luau | .luau | local LoadAddOn, UnitName, GetRealmName, UnitRace, UnitFactionGroup, IsInRaid = LoadAddOn, UnitName, GetRealmName, UnitRace, UnitFactionGroup, IsInRaid
LoadAddOn, UnitName, GetRealmName, UnitRace, UnitFactionGroup, IsInRaid = LoadAddOn, UnitName, GetRealmName, UnitRace, UnitFactionGroup, IsInRaid
do
local LoadAddOn,... | 214 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-multiline-comments.lua.luau | luau | .luau | checkVisitorFnArgs(
expect,
ast,
{ ... },
true --[[ isEdited ]]
)
local test --[[foo]] = true
--[[test]]
local x = true | 39 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-multiline-expressions-2.lua.luau | luau | .luau | if not (one and two and three and not (four and five) and six and not (seven and eight and nine and ten and eleven and twelve and thirteen and fourteen and fifteen and sixteen and seventeen)) then
print("foo")
end
local longString = foo(
"We are wrapping this %s " .. "onto multiple lines " .. "for ease of editing an... | 184 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-multiline-expressions-3.lua.luau | luau | .luau | do
do
do
do
local text = "Players: " .. #Server_Container.ARandomVariableWhichIsVeryLongSoThatThisGetsOverTheColumnLimit.Players_F:GetChildren() - 1 .. "/20"
local ratio = (minAxis - minAxisSize) / delta * (self.props.maxScaleRatio - self.props.minScaleRatio) + self.props.minScaleRatio
local ratio2 = ... | 138 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-multiline-expressions-4.lua.luau | luau | .luau | function SetCallsign(Player, Callsign)
if Settings.PolicingSetup.Radio or (table.find(Settings.PolicingSetup.CallsignPrefix, string.sub(Callsign, 1, 2)) and tonumber(string.sub(Callsign, 3, 4))) then
Player:SetAttribute("Callsign", Callsign)
end
end | 73 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-multiline-expressions-indent-block.lua.luau | luau | .luau | local expr = first_______________________________________________________________________________________________________
and function()
foo()
end | 16 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-multiline-expressions.lua.luau | luau | .luau | if someReallyLongCondition and someOtherReallyLongCondition and somethingElse and someReallyLongCondition and someOtherReallyLongCondition and somethingElse then
print("foo")
end
foo = someReallyLongCondition * someOtherReallyLongCondition * somethingElse * someReallyLongCondition * someOtherReallyLongCondition * ... | 322 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-number.lua.luau | luau | .luau | local a = 0.5
local b = .5
local c = 100
local d = 5e-5
local e = -.5
local f = .2e-5
local g = -.1e+5
local h = 0x12 | 60 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-repeat-block-2.lua.luau | luau | .luau | local function foo(bar)
local count = 0
repeat
count = count + 1
until count == 10
end | 30 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-return-hanging-expression-2.lua.luau | luau | .luau | return cframe
-- Clamp & transform into world space
* Vector3.new(
math.clamp(transform.X, -halfSize.X, halfSize.X),
math.clamp(transform.Y, -halfSize.Y, halfSize.Y),
math.clamp(transform.Z, -halfSize.Z, halfSize.Z)
), cframe.Position
| 76 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-return-hanging-expression-3.lua.luau | luau | .luau | function foo()
return (
long_variable_name
+ long_variable_name
+ long_variable_name
+ long_variable_name
+ long_variable_name
+ long_variable_name
+ long_variable_name
+ long_variable_name
+ long_variable_name
+ long_variable_name
), (
long_variable_name
+ long_variable_name
+ long_variable... | 309 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-return-hanging-expression.lua.luau | luau | .luau | function foo()
return fooooooooooooooooooo(barrr) or foooooooooooooooooooooooooooooooooooooooooooooooooooooopppo(barrrrrrrrrrrrrr)(hello) or bazzzzzzzzzzzzzzzzzz
end
| 48 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-semicolon-1.lua.luau | luau | .luau | local x = 1; -- comment
do
return; -- bad
end; -- comment
local y; -- comment
z = 5; -- comment
repeat x = x + 1 until x > 5; -- comment
for x,y in pairs(z) do
break; -- comment
end; -- comment
if x then end; -- comment
function foo()
end; -- comment
local function bar()
end; -- comment
for i = 1, 10 do
end; -... | 148 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-semicolon-comments-ordering.lua.luau | luau | .luau | local foo = a <= b --[[ some block comment ]]; -- inline comment
fn() --[[ some block comment 2 ]]; -- inline comment 2
| 32 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-single-arg-function-calls.lua.luau | luau | .luau | do
do
do
do
do
do
jestExpect(ReactIs.typeOf(React.createElement(React.Profiler, { id = "foo", onRender = jest.fn() }))).toBe(ReactIs.Profiler)
end
end
end
end
end
end
| 70 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-string-escapes-2.lua.luau | luau | .luau | -- standard escapes
local a = "foo \a \b \f \n \r \t \v \\ \" \'"
-- decimal escapes
local b = "\000 \001 \189 \254 \255"
local b2 = "\1 \2 \71\9"
-- lua 5.2: hex escapes
local c = "hello \x77\x6f\x72\x6c\x64\x99"
-- lua 5.2: \z
local d = "hello \z test"
-- lua 5.3: utf8
local e = "\u{123} \u{255}"
-- wrong:
loca... | 145 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-string-escapes.lua.luau | luau | .luau | local foo = 'this \'string\' has \'escaped\' single quotes with "double quotes"'
local bar = "test \'foo\' \"bar\""
local baz = '\\"""' | 38 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-table-1.lua.luau | luau | .luau | local foo = {"bar", "baz", "foo", "bar", "baz", "foo", "bar", "baz", "foo", "bar", "baz", "foo", "bar", "baz", "foo", "bar", "baz"}
local foo = {"bar", "baz", "foo", "bar", "baz", "foo",
"bar", "baz", "foo", "bar", "baz", "foo", "bar",
"baz", "foo", "bar", "baz", "foo", "bar", "baz"}
local foo = {
} | 124 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-table-2.lua.luau | luau | .luau | local foo = { "aaaa", "aaaa", "aaaa", "aaaa", "aaaa", "aaaa", "aaaa", "aaaa", "aaaa", "aaaa", "aaaa", "aaaa", "aaaa", "aaaa" } | 49 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-table-3.lua.luau | luau | .luau | local foooooooooooooo = { "barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr" .. "bazzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"}
local barrrrrrrrrrrrr = { foooooooooooooooooo = "barrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr" .. "bazzzzz... | 249 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-table-4.lua.luau | luau | .luau | local thisisathing = {this_is_one = "one", this_is_two = "two", this_is_three = "three", this_is_four = "four", f = "b"}
| 39 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-table-5.lua.luau | luau | .luau | a = {
key1 = string.format("test", "test", "test", "test", "test", "test", "test", "test", "test", "test", variable_names),
key2 = string.format("test", "test", "test", "test", "test", "test", "test", "test", "test", "test", variable_names),
}
| 80 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-table-comments.lua.luau | luau | .luau | local x = {
"foo", -- comment
"bar", -- test
"baz" -- test
}
local foo = {
MinSize = call(0, 0),
MaxSize = call(math.huge, 500) -- TODO: Set this up
}
local x = { -- comment
hello = "world",
foo = "bar",
}
local foo = { -- bar
}
local bar = { baz -- bar
}
local baz = {
-- foo
}
local foobar = {
"st... | 141 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-table-multiline-fields.lua.luau | luau | .luau | local obj = { method1 = function(self) end, method2 = function(self, name) end }
local obj = { method1 = function(self) print(true) end, method2 = function(self, name) end }
local obj = { method1 = function(self) end, method2 = function(self, name) end, method3 = function(self) end, method4 = function(self, name) end... | 135 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-table-wrapping.lua.luau | luau | .luau | local foo = {
{"foobarbazfoobarbaz", "foobarbazfoobarbaz"},
{"foobarbazfoobarbaz", "foobarbazfoobarbaz"},
{"foobarbazfoobarbaz", "foobarbazfoobarbaz"},
{"foobarbazfoobarbaz", "foobarbazfoobarbaz"}
} | 57 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-lua-while-2.lua.luau | luau | .luau | function foo()
while NextFreq.Access ~= true and not Llama.List.find(NextFreq.Access, Players.LocalPlayer.Team.Name) and NextIndex > #Constants.RADIO_CHANNEL_ORDER do
print("test")
end
end | 46 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-anonymous-function-types.lua.luau | luau | .luau | local Object = {ClassName = "Object"}
Object.__tostring = function(self) return self.ClassName end
Object.__tostring = function(self): string
return self.ClassName
end | 40 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-function-call-comments-1.lua.luau | luau | .luau | do
for _, foo in
applyFoooooo(
aaaaaaaaaaaaaaaaaaaa, --[[:: Array<aaaaaaaaaaaaaaaaa>]]
bbbbbbbbbbbbbbbbbb --[[:: Array<bbbbbbbbbbbbbbb>]]
) :: Array<aaaaaaaaaaaaaaaaa | bbbbbbbbbbbbbbb>
do
end
end
| 70 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-function_types_2.lua.luau | luau | .luau | local function foo(bar: Instance, baz: Instance, qux: Instance, quux: Instance, corge: Instance, grault: Instance, garply: Instance, waldo: Instance, fred: Instance, plugh: Instance, xyzzy: Instance, thud: Instance)
end | 61 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-function_types_3.lua.luau | luau | .luau | function foo(args: {
id: string,
fenderer: SubBassGuitar,
fendererInterface: BasGuitarInterface,
})
print("foo")
end
function foo(args: {
id: string,
fenderer: SubBassGuitar,
fendererInterface: BasGuitarInterface,
}, type: string)
print("foo")
end
local subs = {
amps.sub("fenderer-nations", function(
args:... | 135 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-generic-for-multiline.lua.luau | luau | .luau | for _id: number, transform: Components.Transform, angularControls: Components.AngularControls, characterModel: Components.CharacterModel in world:query(Transform, AngularControls, CharacterModel) do
-- ...
end
| 45 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-if-expression-4.lua.luau | luau | .luau | cache:writeQuery({
data = {
items = Array.concat({}, (function()
local ref = if Boing.toXYZBoxinf(data) and data ~= nil
then data.items
else data
return Boing.toXYZBoxinf(ref) and ref
end)() or {}, { item }),
},
})
local error_ = if errors and #(errors :: Array<any>) > 0
then ApolloError.new({ ... | 216 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-if-expression-comments.lua.luau | luau | .luau | local options = if useDisposableConcast
-- Disposable Concast fetches receive a shallow copy of this.options
-- (merged with newOptions), leaving this.options unmodified.
then compact(self.options, newOptions)
else Object.assign(self.options, compact(newOptions))
do
local state: S = if hook ~= nil
t... | 266 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-if-expression.lua.luau | luau | .luau | local scale = if someReallyLongFlagName() or someOtherReallyLongFlagName() then foo else bar
local scale = if someReallyLongFlagName() or someOtherReallyLongFlagName() then foooooooooooooBarrrrrrrrr else barrrrrrrrrBazzzzzz
local scale = if someReallyLongFlagName() or someOtherReallyLongFlagName() then Vector2.new(1,... | 503 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-large_example.lua.luau | luau | .luau | --!strict
type Array<T> = { [number]: T }
type Dictionary<T> = { [string]: T }
local RunService = game:GetService("RunService")
local INVALID_DUMP_VERSION = "API dump is an invalid version `%i` (expected version 1)"
local MODULE_NOT_READY_MESSAGE = "API has not been fetched yet; try using API.isReady() before callin... | 2,050 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-string-brackets-index.lua.luau | luau | .luau | local foo = {
[ [[test]] :: test ] = true,
}
foo[ [[test]] :: test ] = false
| 27 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-type-callback-hang-parameters.lua.luau | luau | .luau | export type ObservableQueryFields<TData, TVariables> = ObservableQueryPick<TData, TVariables> & {
fetchMore: ((
_self: any,
fetchMoreOptions: FetchMoreQueryOptions<TVariables, TData> & FetchMoreOptions<TData, TVariables>
) -> Promise<ApolloQueryResult<TData>>) & ((<TData2, TVariables2>(
... | 313 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-type-callback-hanging-2.lua.luau | luau | .luau | export type XYZ = {
onSubmitTigerFoot: (
FendererID,
Object,
-- Added in v96.1 to support Prelifer priority lamerz
number?,
-- Added in v96.9 to support Star Refresh
boolean?
) -> (),
}
| 64 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-type-callback-hanging.lua.luau | luau | .luau | export type Thenable<R, U> = {
andTheeeeeeeeeeeeeeen: (any, (R) -> () | Thenable<R, U> | U, (any) -> () | Thenable<R, U> | U) -> () | Thenable<R, U>,
}
| 60 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-type-generic-variadics.lua.luau | luau | .luau | local function mergeDeep<T...>(...: T...) -- : TupleToIntersection<...T>
return mergeDeepArray({ ... })
end
| 29 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-type-hanging-3.lua.luau | luau | .luau | export type GraphQLInputType =
GraphQLScalarType
| GraphQLEnumType
| GraphQLInputObjectType
| GraphQLList<GraphQLScalarType | GraphQLEnumType | GraphQLInputObjectType | GraphQLList<any> | GraphQLNonNull<GraphQLScalarType | GraphQLEnumType | GraphQLInputObjectType | GraphQLList<GraphQLScalarType | GraphQLEnumType | ... | 166 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-type-hanging-intersection.lua.luau | luau | .luau | export type Cache_WriteOptions<TResult = any, TVariables = any> = Omit_id_from_DataProxy_Query<TVariables, TResult> & Omit_data_from_DataProxy_WriteOptions<TResult> & { dataId: string?, result: TResult }
| 49 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-type-hanging-multiline-comment.lua.luau | luau | .luau | export type CoverageReporterWithOptions<K> =
Array<string | Object> --[[ [K, Partial<ReportOptions[K]>] ]]
| nil
export type CoverageReporterWithOptions<K> =
Array<string | Object> --[[ [K, Partial<ReportOptions[K]>] ]]
& nil
| 60 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-type-hanging.lua.luau | luau | .luau | export type IntrospectionType = IntrospectionScalarType | IntrospectionObjectType | IntrospectionInterfaceType | IntrospectionUnionType | IntrospectionEnumType | IntrospectionInputObjectType
export type IntrospectionOutputType = IntrospectionScalarType | IntrospectionObjectType | IntrospectionInterfaceType | Introspec... | 104 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-type-multiline-comments.lua.luau | luau | .luau | -- Shouldn't hang since multiline comments arent an issue
export type GraphQLEnumType = --[[ <T> ]]{
name: string,
description: string?,
extensions: ReadOnlyObjMap<any>?,
astNode: EnumTypeDefinitionNode?,
extensionASTNodes: Array<EnumTypeExtensionNode>?,
_values: Array<GraphQLEnumValue --[[ <T> ]]>,
_valueLoo... | 274 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-type-parentheses-comments.lua.luau | luau | .luau | function foo(): (
nil -- Some comment
)
return nil
end
type X = (
string,
number -- testing
) -> (
number,
string -- testing
)
| 35 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-type-parentheses-multiline.lua.luau | luau | .luau | type PseudoEnumItemConstructor = (((GuiThemeTypeEnum, string) -> GuiThemeType) & ((GuiBrandTypeEnum, string) -> GuiBrandType) & ((GuiStateModifierEnum, string) -> GuiStateModifier) & ((GuiBrandTypeEnum, string) -> GuiBrandType) & ((GuiStateModifierEnum, string) -> GuiStateModifier) & ((GuiDensityModifierEnum, string) -... | 259 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-type_parameter_comments.lua.luau | luau | .luau | function foo(
bar: number,
baz: number -- test
): number
print("test")
end | 22 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-type_tables.lua.luau | luau | .luau | type PromptSettings = {
object: string,
action: string,
holdDuration: number,
keyboardKey: KeyCode,
gamepadKey: KeyCode,
distance: number,
lineOfSight: boolean,
offset: Vector2,
}
export type Sprite = {
Image: string, ImageRectOffset: Vector2, ImageRectSize: Vector2 }
| 77 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-types-declaration-equal-hang.lua.luau | luau | .luau | type SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData> =
watchQueryOptionsModule.SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>
| 37 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-types-generic-pack.lua.luau | luau | .luau | type X = {
useMemo: <T...>(nextCreate: () -> T..., deps: Array<any> | nil) -> T...,
}
| 31 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-types_comments.lua.luau | luau | .luau | export type IntrospectionNamedTypeRef<
T, -- TODO: add generic constraints and default types: IntrospectionType = IntrospectionType,
P
> = {
kind: any, -- deviation: add this type spec later: $PropertyType<T, 'kind'>,
name: string,
ofType: T -- TODO: this field is missing
}
export type ReactScopeQuery = (
s... | 197 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/stylua-luau-types_example.lua.luau | luau | .luau | local srcWorkspace = script.Parent.Parent
local PromiseModule = require(srcWorkspace.luaUtils.Promise)
type Promise<T> = PromiseModule.Promise<T>
type Resolver<T, U> = any
type Result = any
export type SubscriptionArgs = {
rootValue: any?,
contextValue: any?,
variableValues: { [string]: any },
operatio... | 192 |
JohnnyMorganz/Luau.tmLanguage | JohnnyMorganz-Luau.tmLanguage-16adf16/tests/cases/type-functions.luau | luau | .luau | type function UserDefinedTypeFunction(Foo: type, Bar: type, Qux: type): type
return types.intersectionof(Foo, Bar, Qux)
end
export type function ExportUserDefinedTypeFunction(Foo: type, Bar: type, Qux: type): type
return types.unionof(Foo, Bar, Qux)
end | 75 |
ddeityies/quantum | ddeityies-quantum-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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,440 |
ddeityies/quantum | ddeityies-quantum-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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,840 |
ddeityies/quantum | ddeityies-quantum-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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-2ee5ae4/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 |
CompeyDev/rusty-luau | CompeyDev-rusty-luau-648c534/.lune/fmt.luau | luau | .luau | --> Run stylua to check for formatting errors
local process = require("@lune/process")
local CommandBuilder = require("./util/exec")
process.exit(CommandBuilder.new("stylua"):withArgs(process.args):withArg("."):withStdioStrategy("forward"):exec().code)
| 57 |
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/.lune/util/exec.luau | luau | .luau | --> lib: Builder pattern class to spawn child processes
local process = require("@lune/process")
local stdio = require("@lune/stdio")
local CommandBuilder = {}
export type CommandBuilder = typeof(setmetatable({} :: CommandBuilderFields, { __index = CommandBuilder }))
type CommandBuilderFields = {
program: string,
... | 640 |
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 |
folly-org/folly | folly-org-folly-46a5fc3/editor/core/config.luau | luau | .luau | local loaded_config = {
user = {
cursor = {
-- BLOCK, LINE
style = "LINE"
},
tab_spacing = 4,
},
}
-- replace loaded_config with the file read from disk,
-- if not found, create new file with the config above
local config = {}
local metatable = {
__index = function (t,k)
return loa... | 122 |
folly-org/folly | folly-org-folly-46a5fc3/editor/core/init.luau | luau | .luau | local util = require("util/main")
local kc = require("util/keycodes")
local config = require("config")
local font = Renderer.Font.load("./resources/JetBrainsMono-Regular.ttf")
local font2 = Renderer.Font.load("./resources/Raveo-Regular.otf")
local buf = File.read("./editor/core/init.luau"):gsub("\r", "")
local font_... | 1,446 |
folly-org/folly | folly-org-folly-46a5fc3/editor/core/util/keycodes.luau | luau | .luau | return {
null = 0,
apostrophe = 39,
comma = 44,
minus = 45,
period = 46,
slash = 47,
zero = 48,
one = 49,
two = 50,
three = 51,
four = 52,
five = 53,
six = 54,
seven = 55,
eight = 56,
nine = 57,
semicolon = 59,
equal = 61,
a = 65,
b = 66,
... | 732 |
folly-org/folly | folly-org-folly-46a5fc3/editor/core/util/main.luau | luau | .luau | local t = {}
function t:MakeColor(r: number, g: number, b: number, a: number)
return {
red = r,
green = g,
blue = b,
alpha = a
}
end
return t | 54 |
rbx-rsml/rsml-luau | rbx-rsml-rsml-luau-cba92a0/build.luau | luau | .luau | --[[
Used to build the rbxts version.
]]
--!strict
local fs = require("@lune/fs")
local SRC_PATH = "./src"
local OUT_PATH = "./rbxts/src"
local INCLUDE_PATH = `./rbxts/include`
local OTHER_INCLUDED_PATHS = {
"LICENSE.md",
"default.project.json"
}
if fs.isDir(OUT_PATH) then fs.removeDir(OUT_PATH) end
fs.w... | 391 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.