diff options
author | Oscar Lim <olim@ucla.edu> | 2016-01-24 22:53:37 -0800 |
---|---|---|
committer | Oscar Lim <olim@ucla.edu> | 2016-02-10 23:45:49 -0800 |
commit | 7499b422e3f07bf25704cbf7989e845f89697fa8 (patch) | |
tree | 524d8a262a9d61486b858e70c64f8aedbda43095 /src/core.c | |
download | luasystem-7499b422e3f07bf25704cbf7989e845f89697fa8.tar.gz luasystem-7499b422e3f07bf25704cbf7989e845f89697fa8.tar.bz2 luasystem-7499b422e3f07bf25704cbf7989e845f89697fa8.zip |
Support for gettime and sleep functions
Provide `gettime` and `sleep` functions with at least 1 millisecond
resolution.
Diffstat (limited to 'src/core.c')
-rw-r--r-- | src/core.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c new file mode 100644 index 0000000..d2acb95 --- /dev/null +++ b/src/core.c | |||
@@ -0,0 +1,19 @@ | |||
1 | #include <lua.h> | ||
2 | #include <lauxlib.h> | ||
3 | |||
4 | #ifdef _WIN32 | ||
5 | #define LUAEXPORT __declspec(dllexport) | ||
6 | #else | ||
7 | #define LUAEXPORT __attribute__((visibility("default"))) | ||
8 | #endif | ||
9 | |||
10 | void time_open(lua_State *L); | ||
11 | |||
12 | /*------------------------------------------------------------------------- | ||
13 | * Initializes all library modules. | ||
14 | *-------------------------------------------------------------------------*/ | ||
15 | LUAEXPORT int luaopen_system_core(lua_State *L) { | ||
16 | lua_newtable(L); | ||
17 | time_open(L); | ||
18 | return 1; | ||
19 | } | ||