当前位置: 首页 > news >正文

临安做网站的公司有哪些网站开发可选择的方案有

临安做网站的公司有哪些,网站开发可选择的方案有,上海网站 备案,怎么查网站有没有做底部导航我们今天在windows平台编译lua#xff0c;生成 lua动态库,lua.exe#xff0c;luac.exe 我把这个目录上传到giee#xff0c;使用下面命令获取它: git clone gitgitee.com:jameschenbo/lua_c_application.git 或者直接访问:访问网页 目录结构如下#xff1a; build.cmd 是…我们今天在windows平台编译lua生成 lua动态库,lua.exeluac.exe 我把这个目录上传到giee使用下面命令获取它: git clone gitgitee.com:jameschenbo/lua_c_application.git 或者直接访问:访问网页 目录结构如下 build.cmd 是编译脚本在执行前我们需要修改里面的gcc路径 我使用的是本地安装好的QT5的编译器 点击运行 build.cmd 等待编译结束,生成lua文件夹 lua/bin/lua.exe 解析器 lua/bin/luac.exe 编译器 lua/bin/lua54.dll 动态库 lua/doc 帮助文档 lua/include 在其他平台使用lua需要包含的头文件 运行示例 进入example目录 运行build.cmd  同样需要更改里面GCC的路径 生成main.exe,执行如下: c_call_main.c#include lua/include/lua.h #include lua/include/lualib.h #include lua/include/lauxlib.hstatic int clua_add(lua_State* L, int a, int b) {int sum 0;/* 函数入栈 */lua_getglobal(L, add);/* 第一个函数参数入栈 */lua_pushnumber(L, a);/* 第二个函数参数入栈 */lua_pushnumber(L, b);/* 执行函数调用。2表示有两个函数形参1表示add函数只有一个返回值调用lua_call函数后lua自动出栈参数和函数并将函数的执行结果入栈 *//** 执行函数调用* 2表示lua脚本中add函数需要输入两个函数参数* 1表示lua脚本中add函数有一个返回值* 执行完函数调用后lua自动出栈函数和参数*/lua_call(L, 2, 1);/** 得到函数add函数执行结果* -1表示最后一个返回值因为lua的函数可以返回多个值的。*/sum lua_tonumber(L, -1);/* 出栈一个数据。此时栈中存的是add函数的执行结果所以需要出栈 */lua_pop(L, 1);return sum; } /*** 调用lua 函数,传递参数并获取返回值* lua_script/add.lua*/ void example_add(void) {int sum 0;lua_State* L;L luaL_newstate(); /* 创建一个句柄 */luaL_openlibs(L); /* 打开lua库 */#if 1if(luaL_dofile(L, ./lua_script/add.lua)) /* 从lua脚本文件 中加载lua脚本语句 */{printf( load lua script file error! \r\n);return;} #elseif(luaL_dostring(L, (const char *)function add(a, b) return a b end)) /* 从字符串中加载lua脚本语句 */{printf( LUA语句有误\r\n);return -1;} #endifsum clua_add(L, 10, 20);printf( sum %d \r\n, sum);lua_close(L); /* 关闭lua清理内存 */ }void load_config_file(lua_State* L, const char* fname, int *w, int *h) {if(luaL_loadfile(L, fname) || lua_pcall(L, 0, 0,0)) {printf(load config file error\n);}//1.读变量配置//入栈操作,和出栈操作要对应lua_getglobal(L, width);lua_getglobal(L, height);//出栈操作,先压栈的,后出栈if(!lua_isnumber(L, -2)) {printf(width should be number!\n);}if(!lua_isnumber(L, -1)) {printf(height should be number!\n);}//转换数据类型*w lua_tointeger(L, -2);*h lua_tointeger(L, -1);//清空栈lua_settop(L, 0);//2.读 table 配置lua_getglobal(L, sys_table_cfg);//入栈,指定位置lua_getfield(L, -1, sex);lua_getfield(L, -2, age);lua_getfield(L, -3, port);lua_getfield(L, -4, baud);lua_getfield(L, -5, isSave);//出栈,和入栈顺序相反printf(sys_table_cfg:\n\n);printf(sex:%s\n,lua_tostring(L, -5));printf(age:%d\n,lua_tointeger(L, -4));printf(port:%s\n,lua_tostring(L, -3));printf(baud:%d\n,lua_tointeger(L, -2));printf(isSave:%d\n,lua_tointeger(L, -1));printf(\n);lua_settop(L, 0); } /*** 读取lua格式的配置文件* lua_script/config.lua* 配置文件有全局变量,有表*/ void example_config_file(void) {lua_State *L luaL_newstate();luaL_openlibs(L);int w, h;load_config_file(L, ./lua_script/config.lua, w, h);printf(width%d,height%d\n, w, h); } int main(int argc, char* argv[]) {//下面是两个例子选择一个编译执行//// example_add(); //调用lua函数例子,传参和接收返回值example_config_file();//读取lua脚本编写的配置文件例子getchar();return 0; } lua当配置文件使用的脚本 config.lua --define windows size print my application config file (*.lua)!width 100height 80sys_table_cfg {sex male,age 18,port COM1,baud 9600,isSave 0 }lua函数调用脚本 add.lua function add(a, b) return a b 10 end
http://www.zqtcl.cn/news/512935/

相关文章:

  • 方维o2o 2.9蓝色团购网站程序源码模板做一电影网站怎么赚钱
  • 口碑好网站建设资源新昌网站建设
  • 苏州做网站的公司排名泉州网络推广专员
  • 无为县做互联网网站备案的时候网站建设方案书要吗
  • 修改网站的备案主体dede网站地图不显示文章列表
  • 建立个人网站的成本织梦html5手机网站模板
  • 怎么自己建一个网站吗php网页设计培训
  • 深圳大型论坛网站建设wordpress国内加速
  • 仿站怎么做广告装饰公司名字
  • 黄冈网站推广收费标准wordpress导航页面设置密码
  • 做网站会犯法吗贵州省建设厅城乡建设网站
  • 做网站和做公众号资金盘网站怎么建设
  • 全国最好的网站建设案例推广方法视频
  • 嘉兴网站建设策划方案在海口注册公司需要什么条件
  • 旅游网站国际业务怎样做建设企业官方网站企业登录
  • 北京市昌平网站建设小米网络营销案例分析
  • 怎么利用360域名做网站微信商城怎么弄
  • 中山h5网站建设天津网站建设技术托管
  • 建网站买的是什么商城网站建设合同
  • 购物网站制作样例有没有专门学做婴儿衣服的网站
  • 济南网站建设 找小七买友情链接有用吗
  • 南阳网站建设域名公司泉州关键词排名seo
  • 网站建设在线推广宁夏快速自助制作网站
  • 专业网站建设好不好wordpress编辑文章更新失败
  • 河南郑州网站建设哪家公司好html5 网站正在建设中
  • 免费ppt模板下载医学类江门seo网站推广
  • 智慧软文网站群辉wordpress地址
  • 自己怎么做拼单网站外贸网站 源码
  • 做网站如何防止被黑网页无法访问如何解决360浏览器
  • 专门做设计的网站互联网运营培训班哪个好