码迷,mamicode.com
首页 >  
搜索关键字:lua require module    ( 21569个结果
Lua基础(二)——表
表 a = { } b = { x = 1, ["hello, "] = "world!" } a.astring = "ni, hao!" a[1] = 100 a["a table"] = b function foo() end function bar() end a[foo] = bar --分别穷举表a和b for k, v in pairs(a) do print(k, "=>",...
分类:其他好文   时间:2014-07-22 23:00:33    阅读次数:261
Lua进阶(二)——函数环境、包
函数环境 function foo() print(g or "No g defined!") end foo() setfenv(foo, { g = 100, print = print }) --设置foo的环境为表{ g=100, ...} foo() print(g or "No g defined!") --No g defined! --100 --No g defined!...
分类:其他好文   时间:2014-07-22 22:59:54    阅读次数:338
Lua进阶(一)——函数闭包、元表
函数闭包 function createCountdownTimer(second) local ms=second * 1000; local function countDown() ms = ms - 1; return ms; end return countDown; end timer1 = createCountdownTimer(1); for...
分类:其他好文   时间:2014-07-22 22:59:53    阅读次数:307
Lua程序设计(第二版)学习笔记(一)
前段时间认真的看了一下《lua程序设计(第二版)》这本书,每一章写一个lua脚本,诸多注释,相信给初学者有一定帮助。 -- 第一章代码print("hello Hello");-- 全局函数function face(n) if n == 0 then return 1 else return n ...
分类:其他好文   时间:2014-05-06 00:57:20    阅读次数:339
Emacs 使用android模式
首先用package system安装android-mode, 然后编辑~/.emacs.d/init.el文件,添加下面几行:(require 'android-mode) (setq android-mode-sdk-dir "/opt/android-sdk-linux/")现在重新启动emacs,然后M-x 中运行命令android-start-emulator此时会提示输入Androi...
分类:移动开发   时间:2014-05-02 22:49:40    阅读次数:561
Lua--for循环控制结构
“参考Lua游戏开发实践指南” Lua提供两种控制结构(数字型和通用型)--Lua中的for语句的索引是从1开始的 数字型: 一个简单的示例如下1 for indx = 1, 10 do2 print(indx)3 end do关键字标记程序块的开始,end标记程序块的结束。 ...
分类:其他好文   时间:2014-05-02 17:26:51    阅读次数:702
Erlang练习题----shopping
直接就上代码了:-module(shop).-export([cost/1,total/1]).cost(orange) -> 5;cost(newspaper) -> 8;cost(apples) -> 2;cost(pears) -> 9;cost(milk) -> 7....
分类:其他好文   时间:2014-05-02 12:58:19    阅读次数:280
异常: undefined symbol: lua_setglobal
将Apache 与modsecurity集成后,启动Apache时,报出的异常: “..undefined symbol: lua_setglobal”        后来,发现自己安装了两个lua库。一个事手工安装,一个是centOS工具套件安装的。 删除了手工安装的lua后,一切OK。      但是,记得重新编译modsecurity。...
分类:其他好文   时间:2014-05-02 10:24:27    阅读次数:404
mac下lua环境搭建笔记
下载lua源码包,进入到根目录下1、执行makemacosx2、然后再sudomakeinstall即可
分类:其他好文   时间:2014-05-02 08:16:40    阅读次数:246
错误gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX -c -o lua.o lua.clua.c:67:31: error:
编译Lua时,出现这样的错误: gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX -c -o lua.o lua.clua.c:67:31: error:       查阅了一下,centOS上需要安装readline-devel ncurses-devel yum install readline-devel ncurses-devel  ...
分类:系统相关   时间:2014-05-02 07:03:00    阅读次数:455
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!