From: Eva Date: 2009-12-24T16:34:15+09:00 Subject: Re: Storing methods in arrays or hashes On Thu, 2009-12-24 at 16:10 +0900, Philliam Auriemma wrote: > Hey all, > I'm pretty new to ruby, and I absolutely love it. I have aquestion. I > have programmed in a language called lua before (which had real full- > fledged anonymous functions), and with a lua table, which is Lias > version of a hash and an arrary combined, you could do something like > this: > > newtable = { 1 = function() print("hi from 1") end, > 2 = function() print("hi from 2") end > } > This calls a dispatch. Though I also don't know how ruby will write it, but I think maybe using symbols is a way. Eva.