diff options
author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2023-11-09 23:03:21 +0100 |
---|---|---|
committer | Thijs Schreijer <thijs@thijsschreijer.nl> | 2023-11-15 19:17:57 +0100 |
commit | d45768de3e6f7b28bfecf4d19b192ccac9ce5dc2 (patch) | |
tree | 2d4f86ec87eb87a77f6663924aaaa9286756ce3e /src/core.c | |
parent | d4222ce6da2a2d7179fc79f9d0cc65fd6c09a686 (diff) | |
download | luasystem-d45768de3e6f7b28bfecf4d19b192ccac9ce5dc2.tar.gz luasystem-d45768de3e6f7b28bfecf4d19b192ccac9ce5dc2.tar.bz2 luasystem-d45768de3e6f7b28bfecf4d19b192ccac9ce5dc2.zip |
feat(*): add environment variable and random functions
Diffstat (limited to 'src/core.c')
-rw-r--r-- | src/core.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -1,3 +1,6 @@ | |||
1 | /// Platform independent system calls for Lua. | ||
2 | // @module system | ||
3 | |||
1 | #include <lua.h> | 4 | #include <lua.h> |
2 | #include <lauxlib.h> | 5 | #include <lauxlib.h> |
3 | 6 | ||
@@ -10,6 +13,8 @@ | |||
10 | #endif | 13 | #endif |
11 | 14 | ||
12 | void time_open(lua_State *L); | 15 | void time_open(lua_State *L); |
16 | void environment_open(lua_State *L); | ||
17 | void random_open(lua_State *L); | ||
13 | 18 | ||
14 | /*------------------------------------------------------------------------- | 19 | /*------------------------------------------------------------------------- |
15 | * Initializes all library modules. | 20 | * Initializes all library modules. |
@@ -19,6 +24,15 @@ LUAEXPORT int luaopen_system_core(lua_State *L) { | |||
19 | lua_pushstring(L, "_VERSION"); | 24 | lua_pushstring(L, "_VERSION"); |
20 | lua_pushstring(L, LUASYSTEM_VERSION); | 25 | lua_pushstring(L, LUASYSTEM_VERSION); |
21 | lua_rawset(L, -3); | 26 | lua_rawset(L, -3); |
27 | lua_pushstring(L, "windows"); | ||
28 | #ifdef _WIN32 | ||
29 | lua_pushboolean(L, 1); | ||
30 | #else | ||
31 | lua_pushboolean(L, 0); | ||
32 | #endif | ||
33 | lua_rawset(L, -3); | ||
22 | time_open(L); | 34 | time_open(L); |
35 | random_open(L); | ||
36 | environment_open(L); | ||
23 | return 1; | 37 | return 1; |
24 | } | 38 | } |