diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-04-26 13:03:50 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-04-26 13:03:50 -0300 |
commit | 4abe99dc341b2ec0cb59b8fa95006e9781938eed (patch) | |
tree | 93f9f9314d5fe985d79edd36741be97e7bf2b162 /lvm.h | |
parent | d4e6b750983febf3af0f09235169be9a9e9250d8 (diff) | |
download | lua-4abe99dc341b2ec0cb59b8fa95006e9781938eed.tar.gz lua-4abe99dc341b2ec0cb59b8fa95006e9781938eed.tar.bz2 lua-4abe99dc341b2ec0cb59b8fa95006e9781938eed.zip |
new interface for 'tonumber'
Diffstat (limited to 'lvm.h')
-rw-r--r-- | lvm.h | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.h,v 2.19 2013/04/15 15:44:46 roberto Exp roberto $ | 2 | ** $Id: lvm.h,v 2.20 2013/04/25 19:12:41 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -15,7 +15,8 @@ | |||
15 | 15 | ||
16 | #define tostring(L,o) (ttisstring(o) || (luaV_tostring(L, o))) | 16 | #define tostring(L,o) (ttisstring(o) || (luaV_tostring(L, o))) |
17 | 17 | ||
18 | #define tonumber(o,n) (ttisfloat(o) || (((o) = luaV_tonumber(o,n)) != NULL)) | 18 | #define tonumber(o,n) \ |
19 | (ttisfloat(o) ? (*(n) = fltvalue(o), 1) : luaV_tonumber_(o,n)) | ||
19 | 20 | ||
20 | 21 | ||
21 | #define luaV_rawequalobj(t1,t2) luaV_equalobj(NULL,t1,t2) | 22 | #define luaV_rawequalobj(t1,t2) luaV_equalobj(NULL,t1,t2) |
@@ -24,7 +25,7 @@ | |||
24 | LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); | 25 | LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); |
25 | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); | 26 | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); |
26 | LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); | 27 | LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); |
27 | LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); | 28 | LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); |
28 | LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); | 29 | LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); |
29 | LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, | 30 | LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, |
30 | StkId val); | 31 | StkId val); |