Re: metatable abuse..
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: metatable abuse..
- From: "Soni \"They/Them\" L." <fakedme@...>
- Date: 2019年6月15日 20:24:33 -0300
On 2019年06月15日 8:20 p.m., Aaron B. wrote:
On 2019年6月15日 21:50:41 +0200
Francisco Olarte <folarte@peoplecall.com> wrote:
> So, is there any problem with storing strange things in an object metatable?
My database library SqlTable does exactly this, to prevent it's
internal state information from colliding with the keys of data within
the database.
It hasn't caused problems in Lua 5.1 through to 5.3, so it at least
works well. If it's actually a good idea... I don't know.
I use
local KEY = {}
local foo = {[KEY] = {stuff}, your, data, here}
this will never conflict with something like a database. it also avoids
going through a function call to do a metatable lookup and stuff. but it
does get in the way of pairs, so if pairs is important for you then I
guess you can't use it.