diff options
author | EliteTK <tomasz.kramkowski@gmail.com> | 2014-07-10 22:36:56 +0100 |
---|---|---|
committer | EliteTK <tomasz.kramkowski@gmail.com> | 2014-07-10 22:36:56 +0100 |
commit | b60441758f9832a67f60e51a4ee92d16b166b9fb (patch) | |
tree | 7388adc9743181457834cc5eed95e3c452266ab0 /luaing.c | |
parent | a26f2837166f7232d13322e013883ed003d46f27 (diff) | |
parent | a8609ccd901b1942e862c14205026d841e640add (diff) | |
download | c-stuff-b60441758f9832a67f60e51a4ee92d16b166b9fb.tar.gz c-stuff-b60441758f9832a67f60e51a4ee92d16b166b9fb.tar.xz c-stuff-b60441758f9832a67f60e51a4ee92d16b166b9fb.zip |
Merge branch 'master' of https://github.com/EliteTK/c-stuff
Conflicts:
xcb.c
Diffstat (limited to 'luaing.c')
-rw-r--r-- | luaing.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/luaing.c b/luaing.c new file mode 100644 index 0000000..ac08668 --- /dev/null +++ b/luaing.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <string.h> +#include <lua.h> +#include <lauxlib.h> +#include <lualib.h> + +int main(int argc, char **argv) +{ + char buffer[256]; + int error; + lua_State *L = luaL_newstate(); + luaL_openlibs(L); + + while (fgets(buffer, sizeof(buffer), stdin) != NULL) { + error = luaL_loadbuffer(L, buffer, strlen(buffer), "line") + || lua_pcall(L, 0, 0, 0); + if (error) { + fprintf(stderr, "%s", lua_tostring(L, -1)); + lua_pop(L, 1); + } + } + + lua_close(L); + return 0; +} |