【问个弱弱的问题】怎么在C代码中使用lua?
lua吧
全部回复
仅看楼主
level 13
比如说《Programming in Lua》第三版给出的第一个这样的例子是:
#include <stdio.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
int main (void) {
char buff[256];
int error;
lua_State *L = luaL_newstate(); /* opens Lua */
luaL_openlibs(L); /* opens the standard libraries */
while (fgets(buff, sizeof(buff), stdin) != NULL) {
error = luaL_loadstring(L, buff) || lua_pcall(L, 0, 0, 0);
if (error) {
fprintf(stderr, "%s\n", lua_tostring(L, -1));
lua_pop(L, 1); /* pop error message from the stack */
}
}
lua_close(L);
return 0;
}
可是lua.h、lauxlib.h等在哪里呀?我下的lua只有lua53.dll、lua53.exe、luac53.exe和wlua53.exe这几个文件[乖]
2016年04月10日 10点04分 1
level 13
没人吗?是不是要下未编译过的lua文件呀?
2016年04月11日 10点04分 3
level 5
源文件是肯定有的。去下源文件吧,把这几个头文件挑出来
2016年04月11日 13点04分 4
level 5
新手建议直接装luaforwindows。5.1.4版本
2016年04月11日 13点04分 5
level 5
英语可以的话,可以用zerobrane,环境都是全的,不用到处折腾
2016年04月11日 13点04分 6
level 11
你这是lua编译版,去lua.org下载源码,[滑稽]然后你就会爱上这个狗东西[滑稽]
2016年04月11日 23点04分 7
1