summaryrefslogtreecommitdiff
path: root/scratch/refresh.lua
diff options
context:
space:
mode:
Diffstat (limited to 'scratch/refresh.lua')
-rw-r--r--scratch/refresh.lua22
1 files changed, 21 insertions, 1 deletions
diff --git a/scratch/refresh.lua b/scratch/refresh.lua
index 86eb40d..f4c81c7 100644
--- a/scratch/refresh.lua
+++ b/scratch/refresh.lua
@@ -1,3 +1,23 @@
R("99")
-function fizz_buzz(count) end
+function fizz_buzz(count)
+ local result = {}
+ for i = 1, count do
+ if i % 15 == 0 then
+ vim.list_extend(result, { "FizzBuzz" })
+ elseif i % 3 == 0 then
+ vim.list_extend(result, { "Fizz" })
+ elseif i % 5 == 0 then
+ vim.list_extend(result, { "Buzz" })
+ else
+ vim.list_extend(result, { tostring(i) })
+ end
+ end
+ return result
+end
+
+--- @param numbers number[]
+function sort(numbers)
+ table.sort(numbers)
+ return numbers
+end