diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-03-02 13:04:52 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-03-02 13:04:52 -0300 |
commit | 6408bc0b7f23b580cb51b591277b82eac58f6e2e (patch) | |
tree | 4115261d82a14856ce9c193bc4408079c04564f6 /lobject.h | |
parent | 91efb4b895cabb3ece67c92feb6db84b1fe7906c (diff) | |
download | lua-6408bc0b7f23b580cb51b591277b82eac58f6e2e.tar.gz lua-6408bc0b7f23b580cb51b591277b82eac58f6e2e.tar.bz2 lua-6408bc0b7f23b580cb51b591277b82eac58f6e2e.zip |
new macros 'chgfltvalue'/'chgivalue' (numerical for loop does
not need to set the type of its internal variable at each iteration)
Diffstat (limited to 'lobject.h')
-rw-r--r-- | lobject.h | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 2.106 2015/01/05 13:52:37 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 2.107 2015/01/16 16:54:37 roberto Exp roberto $ |
3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -190,9 +190,15 @@ typedef struct lua_TValue TValue; | |||
190 | #define setfltvalue(obj,x) \ | 190 | #define setfltvalue(obj,x) \ |
191 | { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMFLT); } | 191 | { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMFLT); } |
192 | 192 | ||
193 | #define chgfltvalue(obj,x) \ | ||
194 | { TValue *io=(obj); lua_assert(ttisfloat(io)); val_(io).n=(x); } | ||
195 | |||
193 | #define setivalue(obj,x) \ | 196 | #define setivalue(obj,x) \ |
194 | { TValue *io=(obj); val_(io).i=(x); settt_(io, LUA_TNUMINT); } | 197 | { TValue *io=(obj); val_(io).i=(x); settt_(io, LUA_TNUMINT); } |
195 | 198 | ||
199 | #define chgivalue(obj,x) \ | ||
200 | { TValue *io=(obj); lua_assert(ttisinteger(io)); val_(io).i=(x); } | ||
201 | |||
196 | #define setnilvalue(obj) settt_(obj, LUA_TNIL) | 202 | #define setnilvalue(obj) settt_(obj, LUA_TNIL) |
197 | 203 | ||
198 | #define setfvalue(obj,x) \ | 204 | #define setfvalue(obj,x) \ |