Re: [ANN] LuaJIT-2.0.0-beta11

  • From: 云风 <cloudwu@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 17 Oct 2012 23:11:50 +0800

In most situation, lua_version is used by luaL_checkversion .

I think that is seldom used for checking the specific lua version
number . We don't care it returns 5.1 or 5.2 . It can help us to
detect loading the c library with the wrong version lua , or detect
multiple Lua VMs.

Without luaL_checkversion, we can hardly know whether the C library
link the lua library correctly . The host program and the C library
link to different version library (the ABI is the same).

Sometimes the host program static linked with liblua.a , sometimes
dynamic linked with  lua.so . luaL_checkversion can helps the C
library detect the wrong way immediately.

So I think lua_version is useful.

2012/10/17 Mike Pall <mike-1210@xxxxxxxxxx>:
> Daurnimator wrote:
>> How is this different to the other new 5.2 C functions already added
>> to the lua.h header?
>> (lua_upvalueid,lua_upvaluejoin)
>
> They are there for the Lua-side of things, i.e. the corresponding
> debug.* functions. But they are explicitly marked as "5.2". So if
> you use them, you ought to know what you're doing.
>
> The 5.2 version check OTOH works as a macro (!) and has the Lua
> version from the header hard-coded into the call. That would lead
> to the silly situation of having a 5.2-only function that receives
> a 5.1 version indicator to check against ... I don't think that
> solves anything.
>
> --Mike
>



-- 
http://blog.codingnow.com

Other related posts: