Dear Friends,
Inspired by the fun question that CoronaPaper asks developers in their interviews (“How would you get an elephant into a refrigerator using Corona and Lua?”), I composed a new post on my website/blog where I composed my own answer (you can view the post here). My own answer is below, but I thought it’d be fun to see how others on the forum would accomplish the same problem.
Please post your own answer on this thread! I think this is oddly enough a very interesting way to get a real glimpse into how others structure their code and programming logic. Have fun!
OPERATION DUMBO (temperature) DROP:
[lua]
local function DumboTempDrop()
for i = 1, #animalCrackersBox do
cracker = local animalCrackersBox[i]
if cracker.shape==“bear” then
mouth:chomp(cracker) – bears were always my favorite
elseif cracker.shape==“elephant” then
table.remove(animalCrackersBox, i)
refrigerator:insert(cracker)
timer.performWithDelay(3600000, eatFridgeCrackers) – we’ll eat in an hour!
end
end
end
[/lua]