From a8609ccd901b1942e862c14205026d841e640add Mon Sep 17 00:00:00 2001 From: EliteTK Date: Thu, 10 Jul 2014 22:35:35 +0100 Subject: More stuff. --- luaing.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 luaing.c (limited to 'luaing.c') 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 +#include +#include +#include +#include + +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; +} -- cgit v1.2.3-54-g00ecf