diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-06-17 14:53:14 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-06-17 14:53:14 -0300 |
| commit | 6980cb1aa7bb0238b9cb916320b0c6365bfbb10e (patch) | |
| tree | 70d14f0d45e4d002d302a9f5404feff3e20c0c53 /lua.h | |
| parent | 59a59fafc6693e0f2656b59a1b278f6ca89d64cf (diff) | |
| download | lua-6980cb1aa7bb0238b9cb916320b0c6365bfbb10e.tar.gz lua-6980cb1aa7bb0238b9cb916320b0c6365bfbb10e.tar.bz2 lua-6980cb1aa7bb0238b9cb916320b0c6365bfbb10e.zip | |
new functions 'lua_arith' and 'lua_compare'
Diffstat (limited to 'lua.h')
| -rw-r--r-- | lua.h | 31 |
1 files changed, 26 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.237 2009/05/21 20:06:11 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.238 2009/06/15 19:51:31 roberto Exp roberto $ |
| 3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
| 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) | 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) |
| 5 | ** See Copyright Notice at the end of this file | 5 | ** See Copyright Notice at the end of this file |
| @@ -147,10 +147,6 @@ LUA_API int (lua_isuserdata) (lua_State *L, int idx); | |||
| 147 | LUA_API int (lua_type) (lua_State *L, int idx); | 147 | LUA_API int (lua_type) (lua_State *L, int idx); |
| 148 | LUA_API const char *(lua_typename) (lua_State *L, int tp); | 148 | LUA_API const char *(lua_typename) (lua_State *L, int tp); |
| 149 | 149 | ||
| 150 | LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2); | ||
| 151 | LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); | ||
| 152 | LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2); | ||
| 153 | |||
| 154 | LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); | 150 | LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); |
| 155 | LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); | 151 | LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); |
| 156 | LUA_API int (lua_toboolean) (lua_State *L, int idx); | 152 | LUA_API int (lua_toboolean) (lua_State *L, int idx); |
| @@ -163,6 +159,28 @@ LUA_API const void *(lua_topointer) (lua_State *L, int idx); | |||
| 163 | 159 | ||
| 164 | 160 | ||
| 165 | /* | 161 | /* |
| 162 | ** Comparison and arithmetic functions | ||
| 163 | */ | ||
| 164 | |||
| 165 | #define LUA_OPADD 0 /* ORDER TM */ | ||
| 166 | #define LUA_OPSUB 1 | ||
| 167 | #define LUA_OPMUL 2 | ||
| 168 | #define LUA_OPDIV 3 | ||
| 169 | #define LUA_OPMOD 4 | ||
| 170 | #define LUA_OPPOW 5 | ||
| 171 | #define LUA_OPUNM 6 | ||
| 172 | |||
| 173 | LUA_API void (lua_arith) (lua_State *L, int op); | ||
| 174 | |||
| 175 | #define LUA_OPEQ 0 | ||
| 176 | #define LUA_OPLT 1 | ||
| 177 | #define LUA_OPLE 2 | ||
| 178 | |||
| 179 | LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); | ||
| 180 | LUA_API int (lua_compare) (lua_State *L, int idx1, int idx2, int op); | ||
| 181 | |||
| 182 | |||
| 183 | /* | ||
| 166 | ** push functions (C -> stack) | 184 | ** push functions (C -> stack) |
| 167 | */ | 185 | */ |
| 168 | LUA_API void (lua_pushnil) (lua_State *L); | 186 | LUA_API void (lua_pushnil) (lua_State *L); |
| @@ -310,6 +328,9 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); | |||
| 310 | #define lua_Chunkreader lua_Reader | 328 | #define lua_Chunkreader lua_Reader |
| 311 | #define lua_Chunkwriter lua_Writer | 329 | #define lua_Chunkwriter lua_Writer |
| 312 | 330 | ||
| 331 | #define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) | ||
| 332 | #define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) | ||
| 333 | |||
| 313 | #endif | 334 | #endif |
| 314 | 335 | ||
| 315 | 336 | ||
