[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Cheap way to add Lua 5.3 partial bit32 compatibility
- From: Enrico Colombini <erix@...>
- Date: Thu, 07 May 2015 09:39:07 +0200
On 07-May-15 08:53, Tom N Harris wrote:
Of course the other way to wrap a compatibility function with new syntax is
local bor = bit32 and bit32.bor
or load[[return function(a, b) return a | b end]]()
But a module has its own obvious advantages.
Yes, I needed those functions in more than one of my modules, so a
separate module was more convenient.
Apart from this, I thought about the above method (after my first
mistake), but my innate optimizer protested "why multiple loadings? Your
ration for today only allows one".
So I thought of grouping all of them into a single 'load' and at that
point I realized I was trying to reinvent the module :-)
(by the way: I really like the simplicity, clarity and convenience of
modules just returning a table. Thanks to the Lua authors for getting
things ever simpler and more powerful!)