[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.2 - emulation of old setfenv
- From: Dirk Laurie <dpl@...>
- Date: Thu, 6 Jan 2011 16:18:51 +0200
On Thu, Jan 06, 2011 at 04:01:57PM +0200, Thomas Harning Jr. wrote:
> Perhaps the best way to work with versions is to do feature detection
> by the presence/non-presence of functions/variables. The danger in
> this is if a function's "signature" or behavior changes, though it
> seems this has been rare for the core Lua functionality.
That is a good idea. Why not carry it to its logical conclusion?
Don't even try to identify the Lua version, just check whether the
functions you need are present and behave in the expected way.
That should not take more than one or two pcalls per function.