[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Emulate setters and getters on table
- From: steve donovan <steve.j.donovan@...>
- Date: Mon, 25 Feb 2013 15:32:58 +0200
On Mon, Feb 25, 2013 at 3:28 PM, Alfredo Palhares
<masterkorp@masterkorp.net> wrote:
> Its there a way to call a method based on a string ?
> like method = "set" .. key and the use it?
Very easy.
local method = "set_" .. key
obj[method](obj,....)
Note passing the object as the first argument - that's basically all
what : does.