dev c++ 实现 c 嵌入 lua5.3

1.折腾了好久,发现网上的教程都是lua5.1的使用方法,这里介绍lua5.3的用法,这里使用上篇文章编译的静态库和lua5.3.4的源码

2.新建console application工程

3.加入生成的静态链接库

4.复制lua5.3.4源码到工程目录

      

  我新建立了个文件夹,把源文件都放了进去

  

5.设置包含文件路径

6.新建main.c

 1 #include "lua.h"
 2 #include "lauxlib.h"
 3 #include "lualib.h" 
 4   
 5 int main(int argc, char *argv[])  
 6 {  
 7     lua_State *L = luaL_newstate();
 8     luaL_openlibs(L);
 9     const char *buf = "print('hello, world!')";   
10     luaL_dostring(L,buf);
11     lua_close(L);  
12     return 0;  
13 }  

直接编译,大功告成

 

posted @ 2018-01-18 11:32  李小鸡去你家  阅读(227)  评论(0编辑  收藏  举报