Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/lua-winreg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua_int64.h')
-rw-r--r--src/lua_int64.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/lua_int64.h b/src/lua_int64.h
new file mode 100644
index 0000000..9e954ec
--- /dev/null
+++ b/src/lua_int64.h
@@ -0,0 +1,37 @@
+#ifndef __LUA_INT64_H___
+#define __LUA_INT64_H___
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <windows.h>
+#include <stdlib.h> //lua_push?INT64
+#include <lua.h>
+#include <lualib.h>
+#include <lauxlib.h>
+
+UINT64 lua_checkUINT64(lua_State *L, int i);
+INT64 lua_checkINT64(lua_State *L, int i);
+int atoUINT64(const char* s, UINT64 * pv);
+int atoINT64(const char* s, INT64 *pv);
+
+#define lua_pushUINT64(L,n) \
+ if(n > 9007199254740992){ \
+ char buf[24]; \
+ lua_pushstring(L, _ui64toa(n, buf, 10)); \
+ }else{ \
+ lua_pushnumber(L, (lua_Number)(__int64)n); \
+ }
+
+#define lua_pushINT64(L,n) \
+ if(n > 9007199254740992 || n < -9007199254740992){ \
+ char buf[24]; \
+ lua_pushstring(L, _i64toa(n, buf, 10)); \
+ }else{ \
+ lua_pushnumber(L, (lua_Number)n); \
+ }
+
+#ifdef __cplusplus
+}
+#endif
+#endif //__LUA_INT64_H___ \ No newline at end of file