repo
stringclasses
254 values
file_path
stringlengths
29
241
code
stringlengths
100
233k
tokens
int64
14
69.4k
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Array/reverse.luau
--!native --!optimize 2 --!strict -- https://programming-idioms.org/idiom/19/reverse-a-list/1314/lua local types = require("../../ES7Types") type Array<T> = types.Array<T> return function<T>(t: Array<T>): Array<T> local n = #t local i = 1 while i < n do t[i], t[n] = t[n], t[i] i += 1 n -= 1 end return t en...
118
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Array/shift.luau
--!native --!optimize 2 --!strict local isArray = require("./isArray") local types = require("../../ES7Types") local __DEV__ = _G.__DEV__ type Array<T> = types.Array<T> return function<T>(value: Array<T>): T? if __DEV__ and not isArray(value) then error(string.format("Array.shift called on non-array %s", typeof(val...
110
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Array/slice.luau
--!native --!optimize 2 --!strict local types = require("../../ES7Types") type Array<T> = types.Array<T> -- Implements Javascript's `Array.prototype.slice` as defined below, but with 1-indexing -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice return function<T>(t: Array<T...
310
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Array/some.luau
--!native --!optimize 2 --!strict local types = require("../../ES7Types") type Array<T> = types.Array<T> type Object = types.Object -- note: JS version can return anything that's truthy, but that won't work for us since Lua deviates (0 is truthy) type callbackFn<T> = (element: T, index: number, array: Array<T>) -> boo...
337
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Array/sort.luau
--!native --!optimize 2 --!strict local None = require("../Object/None") local types = require("../../ES7Types") type Array<T> = types.Array<T> type Comparable = (any, any) -> number local defaultSort = function<T>(a: T, b: T): boolean return type(a) .. tostring(a) < type(b) .. tostring(b) end return function<T>(arr...
291
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Array/splice.luau
--!native --!optimize 2 --!strict local types = require("../../ES7Types") type Array<T> = types.Array<T> -- Implements equivalent functionality to JavaScript's `array.splice`, including -- the interface and behaviors defined at: -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/...
449
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Array/unshift.luau
--!native --!optimize 2 --!strict local isArray = require("./isArray") local types = require("../../ES7Types") local __DEV__ = _G.__DEV__ type Array<T> = types.Array<T> return function<T>(array: Array<T>, ...: T): number if __DEV__ and not isArray(array) then error(string.format("Array.unshift called on non-array ...
155
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Map/Map.luau
--!native --!optimize 2 --!strict local arrayForEach = require("../Array/forEach") local arrayMap = require("../Array/map") local instanceof = require("../../InstanceOf") local isArray = require("../Array/isArray") local types = require("../../ES7Types") local __DEV__ = _G.__DEV__ type Object = types.Object type Arra...
1,411
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Map/coerceToMap.luau
--!native --!optimize 2 local Map = require("./Map") local Object = require("../Object") local instanceOf = require("../../InstanceOf") local types = require("../../ES7Types") type Map<K, V> = types.Map<K, V> type Table<K, V> = types.Table<K, V> local function coerceToMap(mapLike: Map<any, any> | Table<any, any>): Ma...
145
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Map/coerceToTable.luau
--!native --!optimize 2 local Map = require("./Map") local arrayReduce = require("../Array/reduce") local instanceOf = require("../../InstanceOf") local types = require("../../ES7Types") type Map<K, V> = types.Map<K, V> type Table<K, V> = types.Table<K, V> local function coerceToTable(mapLike: Map<any, any> | Table<a...
164
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Map/init.luau
--!native --!optimize 2 local ES7Types = require("../../ES7Types") local Map = require("./Map") local coerceToMap = require("./coerceToMap") local coerceToTable = require("./coerceToTable") export type Map<K, V> = ES7Types.Map<K, V> return table.freeze({ Map = Map; coerceToMap = coerceToMap; coerceToTable = coerce...
97
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Object/None.luau
--!native --!optimize 2 --!nonstrict -- Marker used to specify that the value is nothing, because nil cannot be -- stored in tables. local None = newproxy(true) local mt = getmetatable(None) mt.__tostring = function() return "Object.None" end return None
67
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Object/assign.luau
--!native --!optimize 2 --!strict local None = require("./None") local types = require("../../ES7Types") type Object = types.Object --[[ Merges values from zero or more tables onto a target table. If a value is set to None, it will instead be removed from the table. This function is identical in functionality to ...
523
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Object/freeze.luau
--!native --!optimize 2 --!strict local types = require("../../ES7Types") type Array<T> = types.Array<T> type Object = types.Object return function<T>(t: T & (Object | Array<any>)): T -- Luau FIXME: model freeze better so it passes through the type constraint and doesn't erase return (table.freeze(t :: any) :: any) ...
92
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Object/init.luau
--!native --!optimize 2 --!strict return table.freeze({ assign = require("./assign"); entries = require("./entries"); freeze = require("./freeze"); is = require("./is"); isFrozen = require("./isFrozen"); keys = require("./keys"); preventExtensions = require("./preventExtensions"); seal = require("./seal"); va...
119
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Object/is.luau
--!native --!optimize 2 -- Implements Javascript's `Object.is` as defined below -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is return function(value1: any, value2: any): boolean return if value1 == value2 then value1 ~= 0 or 1 / value1 == 1 / value2 else value1 ~= value1 ...
97
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Object/isFrozen.luau
--!native --!optimize 2 --!strict local __DEV__ = _G.__DEV__ local types = require("../../ES7Types") type Array<T> = types.Array<T> type Object = types.Object return function(t: Object | Array<any>): boolean if __DEV__ then print("Luau now has a direct table.isfrozen call that can save the overhead of this library...
101
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Object/keys.luau
--!native --!optimize 2 local Set = require("../Set") local instanceOf = require("../../InstanceOf") local types = require("../../ES7Types") type Array<T> = types.Array<T> type Set<T> = types.Set<T> type Table = {[any]: any} return function(value: Set<any> | Table | string): Array<string> if value == nil then error...
205
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Object/preventExtensions.luau
--!native --!optimize 2 --!strict local types = require("../../ES7Types") type Array<T> = types.Array<T> type Object = types.Object -- FIXME: This should be updated to be closer to the actual -- `Object.preventExtensions` functionality in JS. This requires additional -- support from the VM local function preventExtens...
171
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Object/values.luau
--!native --!optimize 2 --!strict local types = require("../../ES7Types") type Array<T> = types.Array<T> -- TODO Luau: needs overloads to model this more correctly return function<T>(value: {[string]: T} | Array<T> | string): Array<T> | Array<string> if value == nil then error("cannot extract values from a nil valu...
231
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/Set.luau
--!native --!optimize 2 --!nonstrict local arrayForEach = require("./Array/forEach") local arrayFromString = require("./Array/from/fromString") local inspect = require("./inspect") local isArray = require("./Array/isArray") local types = require("../ES7Types") local __DEV__ = _G.__DEV__ type Array<T> = types.Array<T...
1,054
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/WeakMap.luau
--!native --!optimize 2 --!strict local ES7Types = require("../ES7Types") type WeakMap<K, V> = ES7Types.WeakMap<K, V> type WeakMapPrivate<K, V> = { _weakMap: {[K]: V}, -- method definitions get: (self: WeakMapPrivate<K, V>, K) -> V, set: (self: WeakMapPrivate<K, V>, K, V) -> WeakMapPrivate<K, V>, has: (self: Wea...
298
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Collections/init.luau
--!native --!optimize 2 --!strict local Array = require("./Array") local Map = require("./Map") local Object = require("./Object") local Set = require("./Set") local WeakMap = require("./WeakMap") local inspect = require("./inspect") local types = require("../ES7Types") export type Array<T> = types.Array<T> export ty...
181
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Console/init.luau
--!native --!optimize 2 --!strict local makeConsoleImpl = require("./makeConsoleImpl") return makeConsoleImpl()
30
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Console/makeConsoleImpl.luau
--!native --!optimize 2 --!strict local Chalk = require("@packages/Chalk") local Collections = require("../Collections") local Map = Collections.Map local inspect = Collections.inspect local INDENT = " " local YELLOW = Chalk.Rgb(243, 174, 53) local function Concat(...) local length = select("#", ...) if length ...
865
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/ES7Types.luau
--!native --!optimize 2 --!strict export type Object = {[string]: any} export type Array<T> = {[number]: T} export type Function = (...any) -> ...any export type Table<T, V> = {[T]: V} export type Tuple<T, V> = Array<T | V> export type mapCallbackFn<K, V> = (element: V, key: K, map: Map<K, V>) -> () export type mapCal...
836
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Error.luau
--!optimize 2 --!strict local types = require("./ES7Types") type Function = types.Function export type Error = { name: string, message: string, stack: string?, } type Private = Error & {__stack: string?} local Error = {} local DEFAULT_NAME = "Error" Error.__index = Error Error.__tostring = function(self) -- Lua...
742
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/InstanceOf.luau
--!native --!optimize 2 --!strict -- polyfill for https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof local __DEV__ = _G.__DEV__ -- FIXME Luau: typing class as Object gives: Type '{ @metatable {| __call: <a>(a, ...any) -> Error, __tostring: <b, c>({+ message: b, name: c +}) -> string...
364
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Number/MAX_SAFE_INTEGER.luau
--!native --!optimize 2 --!strict -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER return 9007199254740991
48
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Number/MIN_SAFE_INTEGER.luau
--!native --!optimize 2 --!strict -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_SAFE_INTEGER return -9007199254740991
48
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Number/init.luau
--!native --!optimize 2 --!strict return { isFinite = require("./isFinite"); isInteger = require("./isInteger"); isNaN = require("./isNaN"); isSafeInteger = require("./isSafeInteger"); MAX_SAFE_INTEGER = require("./MAX_SAFE_INTEGER"); MIN_SAFE_INTEGER = require("./MIN_SAFE_INTEGER"); NaN = 0 / 0; toExponential ...
91
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Number/isFinite.luau
--!native --!optimize 2 --!strict return function(value) return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge end
46
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Number/isInteger.luau
--!native --!optimize 2 --!strict -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger return function(value) return type(value) == "number" and value ~= math.huge and value == math.floor(value) end
64
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Number/isNaN.luau
--!native --!optimize 2 --!strict -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN return function(value) return type(value) == "number" and value ~= value end
56
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Number/isSafeInteger.luau
--!native --!optimize 2 --!strict -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger local MAX_SAFE_INTEGER = require("./MAX_SAFE_INTEGER") local isInteger = require("./isInteger") return function(value) return isInteger(value) and math.abs(value) <= MAX_SAFE_INTE...
79
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Number/toExponential.luau
--!native --!optimize 2 --!strict -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential return function(value: string | number, fractionDigits: number?): string? local num = value if type(value) == "string" then -- ROBLOX FIXME: add parseInt to encapsulate this log...
294
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Promise.luau
--!native --!optimize 2 -- this maps onto community promise libraries which won't support Luau, so we inline local Promise = require("@packages/Promise") export type PromiseLike<T> = { Then: ( self: PromiseLike<T>, resolve: ((T) -> ...(nil | T | PromiseLike<T>))?, reject: ((any) -> ...(nil | T | PromiseLike<T>...
116
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/String/charCodeAt.luau
--!native --!optimize 2 --!strict local Number = require("../Number") local NaN = Number.NaN -- js https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt -- lua http://www.lua.org/manual/5.4/manual.html#pdf-utf8.codepoint return function(str: string, index: number): number...
263
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/String/endsWith.luau
--!native --!optimize 2 --!strict local function endsWith(value: string, substring: string, optionalLength: number?): boolean local substringLength = #substring if substringLength == 0 then return true end local valueLength = #value local length = optionalLength or valueLength if length > valueLength then le...
129
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/String/findOr.luau
--!native --!optimize 2 --!strict type Match = { index: number, match: string, } -- excluding the `+` and `*` character, since findOr tests and graphql use them explicitly local luaPatternCharacters = "([" .. string.gsub("$%^()-[].?", "(.)", "%%%1") .. "])" local function findOr(str: string, patternTable: {string},...
425
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/String/includes.luau
--!native --!optimize 2 --!strict -- excluding the `+` and `*` character, since findOr tests and graphql use them explicitly local luaPatternCharacters = "([" .. string.gsub("$%^()-[].?", "(.)", "%%%1") .. "])" local function includes(str: string, substring: string, position: (string | number)?): boolean local strLe...
252
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/String/indexOf.luau
--!native --!optimize 2 --!strict -- excluding the `+` and `*` character, since findOr tests and graphql use them explicitly local luaPatternCharacters = "([" .. string.gsub("$%^()-[].?", "(.)", "%%%1") .. "])" -- Implements equivalent functionality to JavaScript's `String.indexOf`, -- implementing the interface and ...
274
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/String/init.luau
--!native --!optimize 2 --!strict return { charCodeAt = require("./charCodeAt"); endsWith = require("./endsWith"); findOr = require("./findOr"); includes = require("./includes"); indexOf = require("./indexOf"); lastIndexOf = require("./lastIndexOf"); slice = require("./slice"); split = require("./split"); star...
143
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/String/lastIndexOf.luau
--!native --!optimize 2 --!strict local function lastIndexOf(str: string, searchValue: string, fromIndex: number?): number local strLength = #str local calculatedFromIndex if fromIndex then calculatedFromIndex = fromIndex else calculatedFromIndex = strLength end if fromIndex and fromIndex < 1 then calculat...
326
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/String/slice.luau
--!native --!optimize 2 --!strict local function slice(str: string, startIndexStr: string | number, lastIndexStr: (string | number)?): string local strLen, invalidBytePosition = utf8.len(str) assert(strLen ~= nil, string.format("string `%*` has an invalid byte at position %*", str, `{invalidBytePosition}`)) local s...
339
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/String/split.luau
--!native --!optimize 2 --!strict local Number = require("../Number") local findOr = require("./findOr") local slice = require("./slice") local types = require("../ES7Types") local MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER type Array<T> = types.Array<T> type Pattern = string | Array<string> local function split(str...
502
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/String/startsWith.luau
--!native --!optimize 2 --!strict local function startsWith(value: string, substring: string, position: number?): boolean if #substring == 0 then return true end -- Luau FIXME: we have to use a tmp variable, as Luau doesn't understand the logic below narrow position to `number` local position_ if position == nil...
140
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/String/substr.luau
--!native --!optimize 2 --!strict return function(s: string, startIndex: number, numberOfCharacters: number?): string if numberOfCharacters and numberOfCharacters <= 0 then return "" end return string.sub(s, startIndex, numberOfCharacters and startIndex + numberOfCharacters - 1 or nil) end
69
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/String/trim.luau
--!native --!optimize 2 --!strict local trimEnd = require("./trimEnd") local trimStart = require("./trimStart") return function(source: string): string return trimStart(trimEnd(source)) end
49
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/String/trimEnd.luau
--!native --!optimize 2 --!strict return function(source: string): string return (string.gsub(source, "[%s]+$", "")) end
35
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/String/trimStart.luau
--!native --!optimize 2 --!strict return function(source: string): string return (string.gsub(source, "^[%s]+", "")) end
36
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Symbol/RegistryGlobal.luau
--!native --!optimize 2 local Symbol = require("./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 ...
94
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Symbol/Symbol.luau
--!native --!optimize 2 --!strict --[[ Symbols have the type 'userdata', but when printed or coerced to a string, the symbol will turn into the string given as its name. **This implementation provides only the `Symbol()` constructor and the global registry via `Symbol.for_`.** Other behaviors, including the abil...
178
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Symbol/init.luau
--!native --!optimize 2 --!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 GlobalRegistry = require("./RegistryGlobal") local Symbol = require("./Symbol") export type Symbol = Symb...
161
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Timers/init.luau
--!native --!optimize 2 --!strict local task = require("@lune/task") local Object = require("../Collections").Object local makeIntervalImpl = require("./makeIntervalImpl") local makeTimerImpl = require("./makeTimerImpl") export type Timeout = makeTimerImpl.Timeout export type Interval = makeIntervalImpl.Interval re...
88
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Timers/makeIntervalImpl.luau
--!native --!optimize 2 local Status = newproxy(false) type TaskStatus = number export type Interval = {[typeof(Status)]: TaskStatus} local SCHEDULED = 1 local CANCELLED = 3 return function(delayImpl) local function setInterval(callback, intervalTime: number, ...): Interval local args = {...} local task = { ...
279
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/Timers/makeTimerImpl.luau
--!native --!optimize 2 local Status = newproxy(false) type TaskStatus = number export type Timeout = {[typeof(Status)]: TaskStatus} local SCHEDULED = 1 local DONE = 2 local CANCELLED = 3 return function(delayImpl) local function setTimeout(callback, delayTime: number?, ...): Timeout local args = {...} local ta...
273
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/encodeURIComponent.luau
--!native --!optimize 2 -- reference documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent local Error = require("./Error") local String = require("./String") local net = require("@lune/net") local charCodeAt = String.charCodeAt local function encodeURIComp...
380
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/extends.luau
--!native --!optimize 2 --!nonstrict --[[ deviation: Our constructors currently have no notion of 'super' so any such behavior in upstream JS must be implemented manually by setting fields A constructor passed to this class would typically look along the lines of: function(self, arg, otherArg) self.arg = arg s...
299
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LuauPolyfill/init.luau
--!native --!optimize 2 --!strict local AssertionError = require("./AssertionError") local Boolean = require("./Boolean") local Collections = require("./Collections") local Console = require("./Console") local Error = require("./Error") local Math = require("./Math") local Number = require("./Number") local PromiseMod...
386
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LunePolyfill/Utf8.luau
--!native --!optimize 2 --!strict local Utf8 = {} function Utf8.Graphemes(value: string, start: number?, finish: number?): () -> (number, number) local trueStart = start or 1 local trueFinish = finish or #value local codePoints = {} local length = 0 for point in utf8.codes(value) do if point >= trueStart and ...
204
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/LunePolyfill/init.luau
--!native --!optimize 2 --!strict local Utf8 = require("./Utf8") local LunePolyfill = table.freeze({ Utf8 = Utf8; }) return LunePolyfill
46
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/PathFileSystem.luau
--!optimize 2 --!strict local LuauPath = require("@packages/LuauPath") local LuauPolyfill = require("@packages/LuauPolyfill") local fs = require("@lune/fs") local process = require("@lune/process") local PathFileSystem = {} local Path = LuauPath.Path local console = LuauPolyfill.console export type Path = LuauPath...
1,050
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Packages/TypeOf.luau
--!optimize 2 --!strict local STRING_CASES: {[string]: string} = {} local function TypeOf(value: any): string local typeOf = typeof(value) if typeOf == "userdata" or typeOf == "table" then local metatable = getmetatable(value) if metatable then if type(metatable) == "table" then local internalType = meta...
155
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Utilities/FastSpawn.luau
--!native --!optimize 2 --!strict local task = require("@lune/task") local freeThreads: {thread} = table.create(500) local freeAmount = 0 local function Execute<Arguments...>(callback: (Arguments...) -> (), thread: thread, ...: Arguments...) callback(...) freeAmount += 1 freeThreads[freeAmount] = thread end loca...
199
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Utilities/FileSystemUtilities.luau
--!optimize 2 --!strict local Debug = require("@packages/Debug") local PathFileSystem = require("@packages/PathFileSystem") local FileSystemUtilities = {} local Path = PathFileSystem.Path local function AsPathToString(asPath: PathFileSystem.AsPath): string if type(asPath) == "string" then return asPath end ret...
1,146
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Utilities/PathUtilities.luau
--!optimize 2 --!strict local process = require("@lune/process") local PathUtilities = {} local SEPARATOR = if process.os == "windows" then "\\" else "/" PathUtilities.Separator = SEPARATOR --- Fixes the path so that it's properly formatted to the local operating system --- @param path The path to format --- @return...
531
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Utilities/ReadWallyToml.luau
--!optimize 2 --!strict local GreenTea = require("@packages/GreenTea") local PathFileSystem = require("@packages/PathFileSystem") local serde = require("@lune/serde") export type Result<T, E> = { Success: true, Value: T, } | { Success: false, Error: E, } local isWallyPackage = GreenTea.build({ dependencies = Gr...
653
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Utilities/ReducedInstance.luau
--!native --!optimize 2 --!strict --[[ MIT License Copyright (c) 2024 BusyCityGuy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to ...
687
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Utilities/Runtime.luau
--!native --!optimize 2 --!strict --[[ MIT License Copyright (c) 2024 BusyCityGuy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to ...
550
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Utilities/StringUtilities.luau
--!optimize 2 --!strict local StringUtilities = {} function StringUtilities.ToPascalCase(value: string) return ( string.gsub( string.gsub(string.gsub(string.lower(value), "[ _-](%a)", string.upper), "^%a", string.upper), "%p", "" ) ) end return table.freeze(StringUtilities)
79
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/Utilities/WallyPackageTypes.luau
--!optimize 2 --!strict --[[ Wraps `wally install` with type exports in link files. Roughly equivalent to wally-package-types, but with support for generics with defaults and some support for WaitForChild require paths. --]] local Option = require("@classes/Option") local LuauLexer = require("@packages/LuauLexer"...
2,039
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/build-release.luau
--!optimize 2 --!strict --[=[ lunar about = "Creates a built release of the project." args = "[-s --skip-confirmation] [-i --include-packages] [-b --bad-package-types] [package-name]" ]=] local FileInstance = require("@classes/FileInstance") local LuauPolyfill = require("@packages/LuauPolyfill") local PathFileSystem...
2,528
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/enable-loadmodule.luau
--!optimize 2 --!strict --[=[ lunar about = "Enables FFlagEnableLoadModule in ClientAppSettings.json for Jest tests on Windows." ]=] local LuauPolyfill = require("@packages/LuauPolyfill") local PathFileSystem = require("@packages/PathFileSystem") local process = require("@lune/process") local serde = require("@lune/s...
591
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/run-unit-tests-local.luau
--!optimize 2 --!strict --[=[ lunar about = "Builds and runs the unit tests place file." args = "[-d, --debug] [rojo-path]" ]=] local LuauPolyfill = require("@packages/LuauPolyfill") local PathFileSystem = require("@packages/PathFileSystem") local ReducedInstance = require("@utilities/ReducedInstance") local Runtime...
1,567
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/run-unit-tests.luau
--!optimize 2 --!strict --[=[ lunar about = "Builds and runs the unit tests place file." args = "" ]=] error("This is not to be used. Just use the local version.") local Execute = require("@utilities/Execute") local PathFileSystem = require("@packages/PathFileSystem") if not PathFileSystem.IsFile("test-place.rbxl"...
178
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/.lune/update-versions.luau
--!optimize 2 --!strict --[=[ lunar about = "Updates the versions in the Wally configuration as well as the documentation." args = "[next-version]" ]=] local LuauPolyfill = require("@packages/LuauPolyfill") local PathFileSystem = require("@packages/PathFileSystem") local SemanticVersion = require("@packages/Semantic...
469
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Arrays/SortedArray.luau
--!native --!optimize 2 --!strict local Error = require(script.Parent.Parent.Parent.Error) local GreenTea = require(script.Parent.Parent.Parent.GreenTea) local GreenTeaUtilities = require(script.Parent.Parent.Parent.GreenTeaUtilities) local Types = require(script.Parent.Parent.Types) type ComparisonFunction<T> = Typ...
6,019
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Caches/LRUCache.luau
--!native --!optimize 2 --!strict local Error = require(script.Parent.Parent.Parent.Error) local GreenTea = require(script.Parent.Parent.Parent.GreenTea) type Node<K, V> = { Key: K, Next: Node<K, V>?, Previous: Node<K, V>?, Value: V, } export type LRUCache<K, V> = typeof(setmetatable( {} :: { Capacity: number...
2,921
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Caches/__tests__/LRUCache.test.luau
--!optimize 2 --!strict local TestService = game:GetService("TestService") local JestGlobals = require(TestService.UnitTesting.DevPackages.JestGlobals) local LRUCache = require(script.Parent.Parent.LRUCache) local describe = JestGlobals.describe local expect = JestGlobals.expect local it = JestGlobals.it type LRUCa...
799
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Queues/MaxPriorityQueue.luau
--!native --!optimize 2 --!strict local Error = require(script.Parent.Parent.Parent.Error) local GreenTea = require(script.Parent.Parent.Parent.GreenTea) local Types = require(script.Parent.Parent.Types) type ComparisonFunction<T> = Types.ComparisonFunction<T> type HeapEntry<T> = Types.HeapEntry<T> export type MaxP...
3,659
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Queues/MinPriorityQueue.luau
--!native --!optimize 2 --!strict local Error = require(script.Parent.Parent.Parent.Error) local GreenTea = require(script.Parent.Parent.Parent.GreenTea) local Types = require(script.Parent.Parent.Types) type ComparisonFunction<T> = Types.ComparisonFunction<T> type HeapEntry<T> = Types.HeapEntry<T> export type MinP...
3,665
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Queues/__tests__/MaxPriorityQueue.test.luau
--!optimize 2 --!strict local TestService = game:GetService("TestService") local JestGlobals = require(TestService.UnitTesting.DevPackages.JestGlobals) local MaxPriorityQueue = require(script.Parent.Parent.MaxPriorityQueue) local describe = JestGlobals.describe local expect = JestGlobals.expect local it = JestGlobal...
643
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Queues/__tests__/MinPriorityQueue.test.luau
--!optimize 2 --!strict local TestService = game:GetService("TestService") local JestGlobals = require(TestService.UnitTesting.DevPackages.JestGlobals) local MinPriorityQueue = require(script.Parent.Parent.MinPriorityQueue) local describe = JestGlobals.describe local expect = JestGlobals.expect local it = JestGlobal...
647
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Random/LiveRandom.luau
--!native --!optimize 2 --!strict local Error = require(script.Parent.Parent.Parent.Error) local GreenTea = require(script.Parent.Parent.Parent.GreenTea) export type LiveRandom = { Get: (self: LiveRandom) -> number, Peek: (self: LiveRandom) -> number, Rig: (self: LiveRandom, value: number) -> LiveRandom, } type Pr...
1,714
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Random/__tests__/LiveRandom.test.luau
--!optimize 2 --!strict local TestService = game:GetService("TestService") local JestGlobals = require(TestService.UnitTesting.DevPackages.JestGlobals) local LiveRandom = require(script.Parent.Parent.LiveRandom) local describe = JestGlobals.describe local expect = JestGlobals.expect local it = JestGlobals.it local ...
602
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Tries/SimpleTrie.luau
--!native --!optimize 2 --!strict local Error = require(script.Parent.Parent.Parent.Error) local GreenTea = require(script.Parent.Parent.Parent.GreenTea) local Types = require(script.Parent.Types) export type SimpleTrie = Types.BasicTrie type Static = { ClassName: "SimpleTrie", new: () -> SimpleTrie, Is: (value:...
2,116
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Tries/Types.luau
--!optimize 2 --!strict export type BasicTrie = { Root: Node, Insert: (self: BasicTrie, word: string) -> (), Search: (self: BasicTrie, word: string) -> boolean, StartsWith: (self: BasicTrie, prefix: string) -> boolean, } export type Node = { Children: {[number]: Node}, IsEnding: boolean, } return false
96
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Tries/Utf8Trie.luau
--!native --!optimize 2 --!strict local Error = require(script.Parent.Parent.Parent.Error) local GreenTea = require(script.Parent.Parent.Parent.GreenTea) local Types = require(script.Parent.Types) export type Utf8Trie = Types.BasicTrie type Static = { ClassName: "Utf8Trie", new: () -> Utf8Trie, Is: (value: any) ...
2,201
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Tries/__tests__/SimpleTrie.test.luau
--!optimize 2 --!strict local TestService = game:GetService("TestService") local JestGlobals = require(TestService.UnitTesting.DevPackages.JestGlobals) local SimpleTrie = require(script.Parent.Parent.SimpleTrie) local beforeEach = JestGlobals.beforeEach local describe = JestGlobals.describe local expect = JestGlobal...
496
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Tries/__tests__/Utf8Trie.test.luau
--!optimize 2 --!strict local TestService = game:GetService("TestService") local JestGlobals = require(TestService.UnitTesting.DevPackages.JestGlobals) local Utf8Trie = require(script.Parent.Parent.Utf8Trie) local beforeEach = JestGlobals.beforeEach local describe = JestGlobals.describe local expect = JestGlobals.ex...
723
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/Types.luau
--!strict --[=[ All the types related to this library. @class Types ]=] local Types = {} -- Luau really, really, really needs strict arrays. export type Tuple<K, V> = {K | V} --[=[ The data structure that represents an element in a [MaxPriorityQueue] or [MinPriorityQueue]. @interface HeapEntry @field Priority...
188
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/init.luau
--!optimize 2 --!strict local LRUCache = require(script.Caches.LRUCache) local LiveRandom = require(script.Random.LiveRandom) local MaxPriorityQueue = require(script.Queues.MaxPriorityQueue) local MinPriorityQueue = require(script.Queues.MinPriorityQueue) local SimpleTrie = require(script.Tries.SimpleTrie) local Sorte...
316
Bura-Games/data-structures
Bura-Games-data-structures-00bb85a/src/jest.config.luau
type Serialize = ( value: unknown, config: unknown, indentation: number, depth: number, references: unknown, printer: Serialize ) -> string type Serializer = { serialize: Serialize, test: (value: unknown) -> boolean, } type JestConfiguration = { clearmocks: boolean?, displayName: { color: string, name: st...
301
techs-sus/azalea
techs-sus-azalea-4a65cd6/encoding/__tests__/expectedValueHelper.luau
local ServerScriptService = game:GetService("ServerScriptService") local Decoder = require(ServerScriptService.Decoder.decoder) return function(expect) return function(payload: buffer, expectedClassName: string, expectedValue: any) return function(_, done) local root = Decoder(payload) expect(root).toEqual(ex...
127
techs-sus/azalea
techs-sus-azalea-4a65cd6/encoding/oldDecoder.luau
--!native --!optimize 2 -- TODO: Ensure decoded output is sane and correct local TYPE_ID = table.freeze({ String = 0, Attributes = 1, Axes = 2, Bool = 3, BrickColor = 4, CFrame = 5, Color3 = 6, Color3uint8 = 7, ColorSequence = 8, Enum = 9, Faces = 10, Float32 = 11, Float64 = 12, Int32 = 13, MaterialCol...
5,940
techs-sus/azalea
techs-sus-azalea-4a65cd6/scripts/runTests.luau
local ServerScriptService = game:GetService("ServerScriptService") local runCLI = require(ServerScriptService.DevPackages.Jest).runCLI local processServiceExists, ProcessService = pcall(function() return game:GetService("ProcessService") end) local status, result = runCLI(ServerScriptService.Decoder, { verbose = tr...
167
techs-sus/azalea
techs-sus-azalea-4a65cd6/src/luau/base122.luau
--!native --!optimize 2 --!strict --[[ Base122 - A space efficent alternative to base-64. >>> https://blog.kevinalbs.com/base122 ]] -- to create Base123, we comment out ampersand being illegal... local kIllegals = { 0, -- null 10, -- newline 13, -- carriage return 34, -- double quote -- 38, -- SKIP! ampersand,...
1,230
techs-sus/azalea
techs-sus-azalea-4a65cd6/src/luau/mergedCombinator.luau
--!native --!optimize 2 --!strict -- to create Base123, we comment out ampersand being illegal... local kIllegals = table.freeze({ 0, -- null 10, -- newline 13, -- carriage return 34, -- double quote -- 38, -- SKIP! ampersand, without this being illegal we have base123 92, -- backslash }) -- local kShortened = ...
639
techs-sus/azalea
techs-sus-azalea-4a65cd6/src/luau/minifiedCombinator.luau
local a,b=table.freeze({0,10,13,34,92}),bit32 local c,d,e=b.lshift,b.rshift,b.band local f=function(f)local g,h,i=0,0,0 for j,k in utf8.codes(f)do if k>127 then local l=e(d(k,8),7)i+=if l~=0b111 then 1 else 0 end i+=1 while i~=0 do h+=7 if h>=8 then g+=1 h-=8 end i-=1 end end local j=buffer.create(g)g,h,i=0,0,0 local k...
235