[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: string.gsub and table replacements
- From: HyperHacker <hyperhacker@...>
- Date: Fri, 27 Jan 2012 23:29:05 -0700
On Fri, Jan 27, 2012 at 06:39, Matthew Wild <mwild1@gmail.com> wrote:
> On 27 January 2012 11:21, HyperHacker <hyperhacker@gmail.com> wrote:
>> On Fri, Jan 27, 2012 at 04:20, Luiz Henrique de Figueiredo
>> <lhf@tecgraf.puc-rio.br> wrote:
>>>> to make this work, you need to wrap the lookup:
>>>
>>> Or do
>>> params = {["1"]='file.c', ["2"]='file.o'}
>>>
>>
>> Well yes, but that isn't always feasible, e.g. with the {...} example.
>
> setmetatable({...}, { __index = function (t, k) return rawget(t,
> tonumber(k)); end })
>
> Regards,
> Matthew
>
That's not really much simpler, and still assumes you can modify the table.
I feel like the point has been largely missed. :|
--
Sent from my toaster.