diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-02-20 12:27:53 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-02-20 12:27:53 -0200 |
commit | 81245b1ad51c5f4a4dd71da272b65b2450929b80 (patch) | |
tree | 25b69ceb42d06e1c3a32aabda7212b805f605349 /lvm.h | |
parent | 397ce11996bb1b5a6ef81fdf44252cf58b230937 (diff) | |
download | lua-81245b1ad51c5f4a4dd71da272b65b2450929b80.tar.gz lua-81245b1ad51c5f4a4dd71da272b65b2450929b80.tar.bz2 lua-81245b1ad51c5f4a4dd71da272b65b2450929b80.zip |
'numisinteger' (for table keys) replaced by 'luaV_tointeger' (old
'tointeger_aux'), which can do the same job.
Diffstat (limited to 'lvm.h')
-rw-r--r-- | lvm.h | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.h,v 2.33 2014/07/30 14:42:44 roberto Exp roberto $ | 2 | ** $Id: lvm.h,v 2.34 2014/08/01 17:24:02 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 | */ |
@@ -27,11 +27,21 @@ | |||
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | 29 | ||
30 | /* | ||
31 | ** You can define LUA_FLOORN2I if you want to convert floats to integers | ||
32 | ** by flooring them (instead of raising an error if they are not | ||
33 | ** integral values) | ||
34 | */ | ||
35 | #if !defined(LUA_FLOORN2I) | ||
36 | #define LUA_FLOORN2I 0 | ||
37 | #endif | ||
38 | |||
39 | |||
30 | #define tonumber(o,n) \ | 40 | #define tonumber(o,n) \ |
31 | (ttisfloat(o) ? (*(n) = fltvalue(o), 1) : luaV_tonumber_(o,n)) | 41 | (ttisfloat(o) ? (*(n) = fltvalue(o), 1) : luaV_tonumber_(o,n)) |
32 | 42 | ||
33 | #define tointeger(o,i) \ | 43 | #define tointeger(o,i) \ |
34 | (ttisinteger(o) ? (*(i) = ivalue(o), 1) : luaV_tointeger_(o,i)) | 44 | (ttisinteger(o) ? (*(i) = ivalue(o), 1) : luaV_tointeger(o,i,LUA_FLOORN2I)) |
35 | 45 | ||
36 | #define intop(op,v1,v2) l_castU2S(l_castS2U(v1) op l_castS2U(v2)) | 46 | #define intop(op,v1,v2) l_castU2S(l_castS2U(v1) op l_castS2U(v2)) |
37 | 47 | ||
@@ -42,7 +52,7 @@ LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); | |||
42 | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); | 52 | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); |
43 | LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); | 53 | LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); |
44 | LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); | 54 | LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); |
45 | LUAI_FUNC int luaV_tointeger_ (const TValue *obj, lua_Integer *p); | 55 | LUAI_FUNC int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode); |
46 | LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, | 56 | LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, |
47 | StkId val); | 57 | StkId val); |
48 | LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, | 58 | LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, |