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-github-6408bc0b7f23b580cb51b591277b82eac58f6e2e.tar.gz |
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 @@ /* -** $Id: lobject.h,v 2.106 2015/01/05 13:52:37 roberto Exp roberto $ +** $Id: lobject.h,v 2.107 2015/01/16 16:54:37 roberto Exp roberto $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -190,9 +190,15 @@ typedef struct lua_TValue TValue; #define setfltvalue(obj,x) \ { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMFLT); } +#define chgfltvalue(obj,x) \ + { TValue *io=(obj); lua_assert(ttisfloat(io)); val_(io).n=(x); } + #define setivalue(obj,x) \ { TValue *io=(obj); val_(io).i=(x); settt_(io, LUA_TNUMINT); } +#define chgivalue(obj,x) \ + { TValue *io=(obj); lua_assert(ttisinteger(io)); val_(io).i=(x); } + #define setnilvalue(obj) settt_(obj, LUA_TNIL) #define setfvalue(obj,x) \ |