lua
凡人道
这个作者很懒,什么都没留下…
展开
-
判断字符串中是否包含中文
--返回值 true有中文和中文符号function UIBase:judgeHasWord(string, displayCenter)local hasWord = falselocal lenInByte = #stringfor i=1, lenInByte dolocal curByte = string.byte(string, i)-- local转载 2015-06-03 22:11:55 · 1242 阅读 · 0 评论 -
lua实现一个小数取整数部分
function getIntPart(x) if x<= 0 then return math.ceil(x) end if math.ceil(x) == x then x = math.ceil(x) else x = math.ceil(x)-1 end return xend转载 2015-06-03 21:50:34 · 10046 阅读 · 1 评论 -
lua实现查找一个字符串中的某些字符
local starts, ends = string.find(string, char)在lua中string的下标从1开始例:starts, ends = string.find("ahsss3", "hs")print(starts, ends)打印结果是 2, 3上例如果是查找“sbc” 返回是nil,直接print会报错转载 2015-06-03 21:55:09 · 4662 阅读 · 1 评论 -
鉴别一串字符串中只包含数字
local string = "asd112 344dff" local isAllNum = false --先屏蔽加号和空格 local s1, e1 = string.find(string, "+") local s2, e2 = string.find(string, " ") if s1 ~= nil or e1 ~= nil or s2 ~= nil or e2 ~= n原创 2015-06-03 22:03:54 · 2472 阅读 · 0 评论 -
protobuf 在lua中使用(3)
proto文件导出lua文件工具参考http://download.csdn.net/detail/c471961491/9414388通过前两篇的介绍已经能搭建一个lua的probuf使用结构了前两篇博文地址http://blog.csdn.net/daydayup_chf/article/details/49904785http://blog.csdn.ne原创 2016-01-22 15:13:03 · 3256 阅读 · 0 评论 -
mac上安装lua
资源 http://download.csdn.net/detail/c471961491/9432927下载资源解压到本地mac下安装lua步骤1 打开终端2 查看是否已经装过lua,用命令 which lua 或者lua。没找到会提示 command not found3 没找到lua进行安装4 进入到lua文件,执行 make clean5 之后执行原创 2016-02-16 12:15:41 · 504 阅读 · 0 评论 -
lua string库
出处:http://blog.sina.com.cn/s/blog_6d9d6d160101975u.html--lua中字符串索引从前往后是1,2,……,从后往前是-1,-2……。--string库中所有的function都不会直接操作字符串,只返回一个结果。---------------------------------------------------转载 2016-07-25 19:43:38 · 391 阅读 · 0 评论 -
lua math库
转载 2016-07-25 19:46:06 · 393 阅读 · 0 评论 -
图形裁切
c++----------------------------------------------------------------------------------------------------------------------------------------------CCSprite * UnivCoreTest::maskedSprite(CCSprite *textur...转载 2019-04-15 10:29:22 · 408 阅读 · 0 评论