[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Four paradigms for programming Lua apllications
- From: Dirk Laurie <dirk.laurie@...>
- Date: Tue, 1 Apr 2014 11:08:39 +0200
2014-04-01 10:46 GMT+02:00 Eduardo Tongson <propolice@gmail.com>:
> What are the drawbacks of doing:
> local table = table
> ...
> table.concat(t)
>
> instead of:
>
> local concat = table.concat
> ...
> concat(t)
>
> Does it exactly have the same effect?
No.
If the program that requires your module says:
table.concat = nil
in the first case your module will fail, because your local `table`
still denotes the same table whose `concat` entry has been zapped.
In the second case, your module will work because your local
`concat` still refers to the original `concat` which the calling
program no longer can access directly.