handmade/test/test_lua.cpp
Bubblegumdrop 46b2ed80ae Initial commit.
Another nuke! This time, trying to do a client <-> server thing.

Also a bit of messing with Lua.
2022-01-02 19:28:16 -05:00

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;
}