• Home
  • About Jason
  • Apps
    • Dentist Bird: A West African Folktale
    • Social Poetry
    • Spanish School Bus
    • Chungaboo Language Series
    • Gordon & Li Li:
      Learn Animals in Mandarin
    • Corban Walker: Ireland at Venice 2011
  • Corona SDK Resources
  • Client Testimonials
  • Contact

Operation Dumbo (temperature) Drop

Apr12
2013
4 Comments Written by Jason

Dumbo DropI’m obviously a big fan of the Corona SDK. Thus far it’s the tool I’ve used to create all my apps. CoronaLabs’ easy-to-use software and API libraries, combined with the not-so-steep learning curve of the Lua programming language make it less daunting for new developers to jump into the game without sacrificing much flexibility (now for free!). Additionally, the SDK’s online user community has rightfully earned a reputation for being a helpful and involved bunch—even the trolls on the Corona Forums are sort of lovable in their own way. (Alex M., someday we’ll make you smile!)

In the last year, it’s been interesting to see the Corona community grow from a grassroots-style collection of independent developers communicating on forums into more of a cottage industry: there’s now a weekly podcast (CoronaGeek), occasional Corona-only Game Jams (like the upcoming 48-hour GIG Jam) and even a glossy monthly magazine, CoronaPaper.

On more than one occasion, CoronaPaper has ended interviews with developers by asking them to answer an old riddle with a Corona twist: How would they get an elephant into a refrigerator using Corona and Lua? Now I’m still a small fry in the app development game, and unlikely to get interviewed by a magazine—even though CoronaLabs recently declared me one of the three Most Interesting Developers in the Universe—but that didn’t stop me from coming up with my very own answer to this question.

And without any further ado, I’m pleased to present Operation Dumbo (temperature) Drop!

local function DumboTempDrop()
   for i = #animalCrackersBox, 1, -1 do
      local cracker = 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

So, dear readers: how would YOU get an elephant into a refrigerator using Corona and Lua?

Posted in General
SHARE THIS Twitter Facebook Delicious StumbleUpon E-mail
« A Summer Update
» Elementropy: My GIGJam48 Experience

4 Comments

  1. Sam's Gravatar Sam
    April 17, 2013 at 7:12 pm | Permalink

    Beginners mistake. Use the loop in reverse from the last element to 1.

    Reply
    • Jason's Gravatar Jason
      April 17, 2013 at 9:28 pm | Permalink

      Good call! I’ve updated the original post so that the for loop iterates backwards. Thanks for reading and posting!

      Reply
  2. foo's Gravatar foo
    April 20, 2013 at 4:06 pm | Permalink

    The following is invalid syntax, you probably meant for keyword to go the lhs of the name making cracker local to the for body.
    cracker = local animalCrackersBox[i]

    Reply
    • Jason's Gravatar Jason
      April 20, 2013 at 4:19 pm | Permalink

      Yikes! I was apparently way off my game when punching this into the blog. I’ve updated the post. Thanks for reading!

      Reply

Leave a Reply to Jason Cancel reply

Your email address will not be published. Required fields are marked *

Please Do Not Feed The Developers

The Corona SDK tutorials, modules and code snippets that I post on this site are free for you to use, with no expectation of repayment. But a few kind souls have told me that they wanted to toss me a few bucks as a way of saying "thanks," so I've added this donation button. If you like what I'm doing here, and wanted to contribute, feel free. And if not, that's cool too. I'm just glad you're here.

Jason on GitHub

© 2011–2018 Jason Schroeder  ·  Admin Login
QR Code Business Card