lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 3 September 2018 at 02:51, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> BTW that library is a beautiful example of how to write C API code
> that compiles on all Lua versions from 5.0 to 5.4 with only this
> version-dependent test:
>
> #if (LUA_VERSION_NUM >= 502)
> #define luaL_register(L,n,f)    luaL_newlib(L,f)
> #endif


I object: people should be writing against the newest lua version
available at the time, and using the preprocessor to gain *backwards*
compatibility.
Defining *older* functions in terms of new ones (forwards
compatibility) is in my opinion, an antipattern used for quicker
porting.