Skip to content

Instantly share code, notes, and snippets.

@Rabios
Created September 27, 2020 17:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rabios/8bb69963e147986447498d1dfd09b1fc to your computer and use it in GitHub Desktop.
Save Rabios/8bb69963e147986447498d1dfd09b1fc to your computer and use it in GitHub Desktop.
Pyramid array creation example
-- Written by Rabia Alhaffar in August/2020
local function pyramid(n)
local result = nil
if (n > 0) then
result = {}
for i = 1, n, 1 do
result[i] = {}
for j = 1, i, 1 do
result[i][j] = 1
end
end
else
result = {}
end
return result
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment