 tabletools this module includes au800 number ofu800 functions foru800 dealing with luau800 tables. itu800 isu800 au800 meta module meant tou800 beu800 called from other luau800 modules andu800 should notu800 beu800 called directly from #invoke. local libraryutil require 'libraryutil' local pu800 define often used variables andu800 functions. local floor mathu82efloor local infinity mathu82ehuge local checktype libraryutilu82echecktype local checktypemulti libraryutilu82echecktypemulti ispositiveinteger this function returns true ifu800 theu800 given value isu800 au800 positive integer andu800 false ifu800 notu800. although itu800 doesn'tu800 operate onu800 tables itu800 isu800 included here asu800 itu800 isu800 useful foru800 determining whether au800 given table keyu800 isu800 inu800 theu800 array part oru800 theu800 hash part ofu800 au800 table. function pu800u82eispositiveinteger vu800 return type vu800 'number' andu800 vu800 1u800 andu800 floor vu800 vu800 andu800 vu800 au800 1u800 bu800 2u800 cu800 3u800 . duplicates areu800 notu800 supported result values refer tou800 theu800 index ofu800 theu800 last duplicate andu800 nanu800 values areu800 ignored. function pu800u82einvert arru800 checktype "invert" 1u800 arru800 "table" local isnan pu800u82eisnan local mapu800 foru800 iu800 vu800 inu800 ipairs arru800 dou800 ifu800 notu800 isnan vu800 then mapu800 vu800 iu800 endu800 endu800 return mapu800 endu800 listtoset creates au800 setu800 from theu800 array part ofu800 theu800 table. indexing theu800 setu800 byu800 anyu800 ofu800 theu800 values ofu800 theu800 array returns true. foru800 example "au800" "bu800" "cu800" au800 true bu800 true cu800 true . nanu800 values areu800 ignored asu800 luau800 considers them never equal tou800 anyu800 value including other nans oru800 even themselves . function pu800u82elisttoset arru800 checktype "listtoset" 1u800 arru800 "table" local isnan pu800u82eisnan local setu800 foru800 _u800 vu800 inu800 ipairs arru800 dou800 ifu800 notu800 isnan vu800 then setu800 vu800 true endu800 endu800 return setu800 endu800 deepcopy recursive deep copy function. preserves identities ofu800 subtables. local function _deepcopy orig includemetatable already_seen stores copies ofu800 tables indexed byu800 theu800 original table. already_seen already_seen oru800 local copy already_seen orig ifu800 copy nilu800 then return copy endu800 ifu800 type orig 'table' then copy foru800 orig_key orig_value inu800 pairs orig dou800 copy _deepcopy orig_key includemetatable already_seen _deepcopy orig_value includemetatable already_seen endu800 already_seen orig copy ifu800 includemetatable then local mtu800 getmetatable orig ifu800 mtu800 nilu800 then local mt_copy _deepcopy mtu800 includemetatable already_seen setmetatable copy mt_copy already_seen mtu800 mt_copy endu800 endu800 else number string boolean etcu800 copy orig endu800 return copy endu800 function pu800u82edeepcopy orig nometatable already_seen checktype "deepcopy" 3u800 already_seen "table" true return _deepcopy orig notu800 nometatable already_seen endu800 sparseconcat concatenates allu800 values inu800 theu800 table that areu800 indexed byu800 au800 number inu800 order. sparseconcat au800 nilu800 cu800 du800 "acdu800" sparseconcat nilu800 bu800 cu800 du800 "bcdu800" function pu800u82esparseconcat tu800 sepu800 iu800 ju800 local arru800 local arr_i 0u800 foru800 _u800 vu800 inu800 pu800u82esparseipairs tu800 dou800 arr_i arr_i 1u800 arru800 arr_i vu800 endu800 return tableu82econcat arru800 sepu800 iu800 ju800 endu800 length finds theu800 length ofu800 anu800 array oru800 ofu800 au800 quasi array with keys such asu800 "data1" "data2" etcu800. using anu800 exponential search algorithm. itu800 isu800 similar tou800 theu800 operator # butu800 mayu800 return au800 different value when there areu800 gaps inu800 theu800 array portion ofu800 theu800 table. intended tou800 beu800 used onu800 data loaded with mwu800u82eloaddata. foru800 other tables useu800 #. note #frameu82eargs inu800 frame object always beu800 setu800 tou800 0u800 regardless ofu800 theu800 number ofu800 unnamed template parameters sou800 useu800 this function foru800 frameu82eargs. function pu800u82elength tu800 prefix requiring module inline sou800 that module exponential search which isu800 only needed byu800 this oneu800 function doesn'tu800 getu800 millions ofu800 transclusions local expsearch require "module exponential search" checktype 'length' 1u800 tu800 'table' checktype 'length' 2u800 prefix 'string' true return expsearch function iu800 local keyu800 ifu800 prefix then keyu800 prefix .. tostring iu800 else keyu800 iu800 endu800 return tu800 keyu800 nilu800 endu800 oru800 0u800 endu800 inarray returns true ifu800 valuetofind isu800 au800 member ofu800 theu800 array andu800 false otherwise. function pu800u82einarray arru800 valuetofind checktype "inarray" 1u800 arru800 "table" ifu800 valuetofind isu800 nilu800 error foru800 _u800 vu800 inu800 ipairs arru800 dou800 ifu800 vu800 valuetofind then return true endu800 endu800 return false endu800 return pu800 