summaryrefslogtreecommitdiffhomepage
path: root/libs/nixio/src/nixio.h
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-11-28 10:24:19 +0000
committerSteven Barth <steven@midlink.org>2009-11-28 10:24:19 +0000
commit87491bf031881a4f5b828aaf6826cf98bda1252e (patch)
treea67086f36d95dbac5ea02f3c06ecf827fa171fbf /libs/nixio/src/nixio.h
parent7f9c9d208e2465e80cba92dcc8d450022a8cfd1e (diff)
nixio: Improve number handling with non-double Lua setups
Diffstat (limited to 'libs/nixio/src/nixio.h')
-rw-r--r--libs/nixio/src/nixio.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/nixio/src/nixio.h b/libs/nixio/src/nixio.h
index 0c43cfe8a2..ff75cfd981 100644
--- a/libs/nixio/src/nixio.h
+++ b/libs/nixio/src/nixio.h
@@ -19,6 +19,7 @@
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
+#include <luaconf.h>
#define NIXIO_BUFFERSIZE 8192
@@ -39,6 +40,18 @@ typedef struct nixio_address {
int nixio__perror(lua_State *L);
int nixio__pstatus(lua_State *L, int condition);
+#if defined(LUA_NUMBER_DOUBLE) || defined(LNUM_DOUBLE) || defined(LNUM_LDOUBLE)
+#define NIXIO_DOUBLE 1
+#define nixio__checknumber luaL_checknumber
+#define nixio__pushnumber lua_pushnumber
+#define nixio__optnumber luaL_optnumber
+#else
+#define nixio__checknumber luaL_checkinteger
+#define nixio__pushnumber lua_pushinteger
+#define nixio__optnumber luaL_optinteger
+#endif
+
+
#ifndef __WINNT__
#define NIXIO_API extern