7/21
This commit is contained in:
parent
455b329c58
commit
da980e9f24
26
lua.c
26
lua.c
@ -1,26 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
#include <lualib.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
char buff[256];
|
||||
int error;
|
||||
lua_State *L = lua_open();
|
||||
luaL_openlibs(L);
|
||||
|
||||
while (fgets(buff, sizeof(buff), stdin) != NULL) {
|
||||
error = lua_loadbuffer(L, buff, strlen(buff), "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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user