chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env luajit
|
||||
cfizz,cbuzz=0,0
|
||||
for i=1,20 do
|
||||
cfizz=cfizz+1
|
||||
cbuzz=cbuzz+1
|
||||
io.write(i .. ": ")
|
||||
if cfizz~=3 and cbuzz~=5 then
|
||||
io.write(i)
|
||||
else
|
||||
if cfizz==3 then
|
||||
io.write("Fizz")
|
||||
cfizz=0
|
||||
end
|
||||
if cbuzz==5 then
|
||||
io.write("Buzz")
|
||||
cbuzz=0
|
||||
end
|
||||
end
|
||||
io.write("\n")
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env luajit
|
||||
fruits = {"banana","orange","apple","grapes"}
|
||||
|
||||
for k,v in ipairs(fruits) do
|
||||
print(k,v)
|
||||
end
|
||||
|
||||
table.sort(fruits)
|
||||
print("sorted table")
|
||||
|
||||
for k,v in ipairs(fruits) do
|
||||
print(k,v)
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env luajit
|
||||
A = { ["John"] = true, ["Bob"] = true, ["Mary"] = true, ["Elena"] = true }
|
||||
B = { ["Jim"] = true, ["Mary"] = true, ["John"] = true, ["Bob"] = true }
|
||||
|
||||
A_B = {}
|
||||
for a in pairs(A) do
|
||||
if not B[a] then A_B[a] = true end
|
||||
end
|
||||
|
||||
B_A = {}
|
||||
for b in pairs(B) do
|
||||
if not A[b] then B_A[b] = true end
|
||||
end
|
||||
|
||||
for a_b in pairs(A_B) do
|
||||
print( a_b )
|
||||
end
|
||||
for b_a in pairs(B_A) do
|
||||
print( b_a )
|
||||
end
|
||||
Reference in New Issue
Block a user