@@ -189,38 +189,38 @@ function cry_pls(str, vars)
189189 for v in inside :gmatch (" [^,]+" ) do -- adds args to array
190190 table.insert (_table , v )
191191 end
192- end
193- local num = vars and vars [ tonumber ( string.match ( str , " >(%d+) " ))] or 1 -- gets the number outside angle brackets, and its corresponding variable
194- local plural = _table [1 ] -- default
195- local checks = { [ 1 ] = " = " }
196- if # _table > 1 then
197- for i = 2 , # _table do
198- local isnum = tonumber ( _table [ i ])
199- if isnum then
200- checks [ isnum ] = " > " .. ( _table [ i + 1 ] or " " )
201- i = i + 1
202- elseif i == 2 then
203- checks [ 1 ] = " = " .. _table [ i ]
204- else
205- print ( " Unexpected string: " .. _table [ i ])
192+ local num = vars [ tonumber ( string.match ( str , " >(%d+) " ))]
193+ local plural = _table [ 1 ] -- default
194+ local checks = { [1 ] = " = " }
195+ if # _table > 1 then
196+ for i = 2 , # _table do
197+ local isnum = tonumber ( _table [ i ])
198+ if isnum then
199+ checks [ isnum ] = " > " .. ( _table [ i + 1 ] or " " )
200+ i = i + 1
201+ elseif i == 2 then
202+ checks [ 1 ] = " = " .. _table [ i ]
203+ else
204+ print ( " Unexpected string: " .. _table [ i ])
205+ end
206206 end
207207 end
208- end
209- local function fch (str , c )
210- return string.sub ( str , 1 , 1 ) == c -- gets first char and returns boolean
211- end
212- for k , v in pairs ( checks ) do
213- if fch ( v , " = " ) then
214- if math.abs ( to_big ( num ) - k ) < to_big ( 0.001 ) then
215- return string.sub ( v , 2 , - 1 )
216- end
217- elseif fch ( v , " > " ) then
218- if to_big ( num ) >= to_big ( k - 0.001 ) then
219- return string.sub ( v , 2 , - 1 )
208+ local function fch ( str , c )
209+ return string.sub (str , 1 , 1 ) == c -- gets first char and returns boolean
210+ end
211+ for k , v in pairs ( checks ) do
212+ if fch ( v , " = " ) then
213+ if math.abs ( to_big ( num ) - k ) < to_big ( 0.001 ) then
214+ return string.sub ( v , 2 , - 1 )
215+ end
216+ elseif fch ( v , " > " ) then
217+ if to_big ( num ) >= to_big ( k - 0.001 ) then
218+ return string.sub ( v , 2 , - 1 )
219+ end
220220 end
221221 end
222+ return plural
222223 end
223- return plural
224224end
225225
226226-- generate a random edition (e.g. Antimatter Deck)
0 commit comments