标签:os io 文件 ar line size ad table
(1)添加文件核路径
(2)库文件路径
(3)main.cpp
#include <stdio.h>
#include <string.h>
extern "C"{
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
#pragma comment(lib, "lua51.lib")
#pragma comment(lib, "lua5.1.lib")
int main(int argc, _TCHAR* argv[])
{
char buff[256];
int error;
lua_State *L = lua_open();
luaL_openlibs(L);
//lua_State *L = lua_open(); /* opens Lua */
//luaopen_base(L); /* opens the basic library */
//luaopen_table(L); /* opens the table library */
//luaopen_io(L); /* opens the I/O library */
//luaopen_string(L); /* opens the string lib. */
//luaopen_math(L); /* opens the math lib. */
while (fgets(buff, sizeof(buff), stdin) != NULL) {
error = luaL_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); /* pop error message from the stack */
}
}
lua_close(L);
return 0;
}
vs2005 测试 lua环境,布布扣,bubuko.com
标签:os io 文件 ar line size ad table
原文地址:http://www.cnblogs.com/lynx/p/3907881.html