diff options
author | Rob Hoelz <rob@hoelz.ro> | 2012-06-25 23:16:39 +0200 |
---|---|---|
committer | Rob Hoelz <rob@hoelz.ro> | 2012-06-25 23:16:39 +0200 |
commit | a6e9ded55fd2852168976ed4e2010e9a38726a74 (patch) | |
tree | a87be246a80ee65481c24c7d275c7569c1409984 /core.c | |
download | lua-term-a6e9ded55fd2852168976ed4e2010e9a38726a74.tar.gz lua-term-a6e9ded55fd2852168976ed4e2010e9a38726a74.tar.bz2 lua-term-a6e9ded55fd2852168976ed4e2010e9a38726a74.zip |
Import of first release of lua-term
Diffstat (limited to 'core.c')
-rw-r--r-- | core.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -0,0 +1,22 @@ | |||
1 | #include <lua.h> | ||
2 | #include <lauxlib.h> | ||
3 | #include <lualib.h> | ||
4 | |||
5 | static int | ||
6 | lua_isatty(lua_State *L) | ||
7 | { | ||
8 | FILE *fp = (FILE *) luaL_checkudata(L, -1, LUA_FILEHANDLE); | ||
9 | |||
10 | lua_pushboolean(L, isatty(fileno(fp))); | ||
11 | return 1; | ||
12 | } | ||
13 | |||
14 | int | ||
15 | luaopen_term_core(lua_State *L) | ||
16 | { | ||
17 | lua_newtable(L); | ||
18 | lua_pushcfunction(L, lua_isatty); | ||
19 | lua_setfield(L, -2, "isatty"); | ||
20 | |||
21 | return 1; | ||
22 | } | ||