handmade/test/test_lua.cpp

25 lines
411 B
C++
Raw Normal View History

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