diff options
Diffstat (limited to 'lua-posixtz.c')
-rw-r--r-- | lua-posixtz.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lua-posixtz.c b/lua-posixtz.c new file mode 100644 index 0000000..0754f97 --- /dev/null +++ b/lua-posixtz.c @@ -0,0 +1,27 @@ + +#include <lua.h> +#include <lualib.h> +#include <lauxlib.h> +#include "posixtz.h" + +#define MYNAME "posixtz" + +static int Pfrom_file(lua_State *L) +{ + const char *s = luaL_checkstring(L, 1); + lua_pushstring(L, posix_tz(s)); + return 1; +} + +static const luaL_reg R[] = +{ + {"from_file", Pfrom_file}, + NULL, NULL +}; + + +LUALIB_API int luaopen_posixtz(lua_State *L) +{ + luaL_register(L,MYNAME,R); + return 1; +} |