diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-14 12:13:48 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-14 12:13:48 -0300 |
| commit | 7dfa4cd655118faf164427356609fec31906dac2 (patch) | |
| tree | d39fac9afba1dc0ab01dd5d174824120650c9eab /lvm.c | |
| parent | fc6203ee4308173283f9ad9de6694d47f0908c4d (diff) | |
| download | lua-7dfa4cd655118faf164427356609fec31906dac2.tar.gz lua-7dfa4cd655118faf164427356609fec31906dac2.tar.bz2 lua-7dfa4cd655118faf164427356609fec31906dac2.zip | |
first implementation of light C functions
Diffstat (limited to 'lvm.c')
| -rw-r--r-- | lvm.c | 7 |
1 files changed, 4 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 2.109 2010/04/02 15:39:07 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.110 2010/04/05 16:26:37 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 | */ |
| @@ -218,7 +218,7 @@ static int l_strcmp (const TString *ls, const TString *rs) { | |||
| 218 | 218 | ||
| 219 | int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { | 219 | int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { |
| 220 | int res; | 220 | int res; |
| 221 | if (ttype(l) != ttype(r)) | 221 | if (ttypenv(l) != ttypenv(r)) |
| 222 | return luaG_ordererror(L, l, r); | 222 | return luaG_ordererror(L, l, r); |
| 223 | else if (ttisnumber(l)) | 223 | else if (ttisnumber(l)) |
| 224 | return luai_numlt(L, nvalue(l), nvalue(r)); | 224 | return luai_numlt(L, nvalue(l), nvalue(r)); |
| @@ -232,7 +232,7 @@ int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { | |||
| 232 | 232 | ||
| 233 | int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) { | 233 | int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) { |
| 234 | int res; | 234 | int res; |
| 235 | if (ttype(l) != ttype(r)) | 235 | if (ttypenv(l) != ttypenv(r)) |
| 236 | return luaG_ordererror(L, l, r); | 236 | return luaG_ordererror(L, l, r); |
| 237 | else if (ttisnumber(l)) | 237 | else if (ttisnumber(l)) |
| 238 | return luai_numle(L, nvalue(l), nvalue(r)); | 238 | return luai_numle(L, nvalue(l), nvalue(r)); |
| @@ -254,6 +254,7 @@ int luaV_equalval_ (lua_State *L, const TValue *t1, const TValue *t2) { | |||
| 254 | case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); | 254 | case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); |
| 255 | case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ | 255 | case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ |
| 256 | case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); | 256 | case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); |
| 257 | case LUA_TCFP: return fvalue(t1) == fvalue(t2); | ||
| 257 | case LUA_TSTRING: return eqstr(rawtsvalue(t1), rawtsvalue(t2)); | 258 | case LUA_TSTRING: return eqstr(rawtsvalue(t1), rawtsvalue(t2)); |
| 258 | case LUA_TUSERDATA: { | 259 | case LUA_TUSERDATA: { |
| 259 | if (uvalue(t1) == uvalue(t2)) return 1; | 260 | if (uvalue(t1) == uvalue(t2)) return 1; |
