aboutsummaryrefslogtreecommitdiff
path: root/lobject.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-12-19 11:36:32 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-12-19 11:36:32 -0200
commit2b83711fbac0509a40cfb616b9a68bdf683e8471 (patch)
tree1f244bc08de68b01df8b9d2ff558558703a1a6bb /lobject.h
parent3ae21a352c4cad550a97974c68cd57c3abc39570 (diff)
downloadlua-2b83711fbac0509a40cfb616b9a68bdf683e8471.tar.gz
lua-2b83711fbac0509a40cfb616b9a68bdf683e8471.tar.bz2
lua-2b83711fbac0509a40cfb616b9a68bdf683e8471.zip
new macro 'nvalue' (to convert an object to a float when we know
object is a number)
Diffstat (limited to 'lobject.h')
-rw-r--r--lobject.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/lobject.h b/lobject.h
index 54e4c020..10dd7529 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 2.103 2014/10/01 11:52:33 roberto Exp roberto $ 2** $Id: lobject.h,v 2.104 2014/10/25 11:50:46 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*/
@@ -154,6 +154,8 @@ typedef struct lua_TValue TValue;
154/* Macros to access values */ 154/* Macros to access values */
155#define ivalue(o) check_exp(ttisinteger(o), val_(o).i) 155#define ivalue(o) check_exp(ttisinteger(o), val_(o).i)
156#define fltvalue(o) check_exp(ttisfloat(o), val_(o).n) 156#define fltvalue(o) check_exp(ttisfloat(o), val_(o).n)
157#define nvalue(o) check_exp(ttisnumber(o), \
158 (ttisinteger(o) ? cast_num(ivalue(o)) : fltvalue(o)))
157#define gcvalue(o) check_exp(iscollectable(o), val_(o).gc) 159#define gcvalue(o) check_exp(iscollectable(o), val_(o).gc)
158#define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p) 160#define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p)
159#define tsvalue(o) check_exp(ttisstring(o), gco2ts(val_(o).gc)) 161#define tsvalue(o) check_exp(ttisstring(o), gco2ts(val_(o).gc))