46b2ed80ae
Another nuke! This time, trying to do a client <-> server thing. Also a bit of messing with Lua.
25 lines
411 B
C++
25 lines
411 B
C++
#include "lib_lua_common.h"
|
|
|
|
#include <string.h>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
char buf[8192];
|
|
lua_State* L;
|
|
L = luaL_newstate ();
|
|
luaL_openlibs (L);
|
|
while (fgets (buf, 8191, stdin))
|
|
{
|
|
if (buf[strlen(buf)-1] == '\n')
|
|
buf[strlen(buf)-1] = 0;
|
|
if (strlen (buf) > 0)
|
|
{
|
|
printf (" => ");
|
|
fflush (stdout);
|
|
common_lua_run (L, "line", buf, strlen (buf));
|
|
}
|
|
}
|
|
lua_close (L);
|
|
return 0;
|
|
}
|