From 87491bf031881a4f5b828aaf6826cf98bda1252e Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Sat, 28 Nov 2009 10:24:19 +0000 Subject: nixio: Improve number handling with non-double Lua setups --- libs/nixio/src/nixio.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libs/nixio/src/nixio.h') 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 #include #include +#include #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 -- cgit v1.2.3