首页 > 代码库 > hello lua

hello lua

 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include "lua.h" 5 #include "lualib.h" 6 #include "lauxlib.h" 7  8 int main(int argc, char** argv) 9 {10     char line[1024] = {0};11     lua_State* L = luaL_newstate();12     luaL_openlibs(L);13 14     while (fgets(line, sizeof(line), stdin)!=0)15     {16         luaL_dostring(L, line);17     }18 19     lua_close(L);20     21     return 0;22 }

 

hello lua