summaryrefslogtreecommitdiff
path: root/lobject.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-03-02 13:04:52 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-03-02 13:04:52 -0300
commit6408bc0b7f23b580cb51b591277b82eac58f6e2e (patch)
tree4115261d82a14856ce9c193bc4408079c04564f6 /lobject.h
parent91efb4b895cabb3ece67c92feb6db84b1fe7906c (diff)
downloadlua-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.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/lobject.h b/lobject.h
index cb194105..2897deac 100644
--- a/lobject.h
+++ b/lobject.h
@@ -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) \