
lua
chuanyu
个人开发者
展开
-
lua 自己实现位运算
--转2进制function numberToBits(src) local result = {} local bitLen = 32 for i = 1, bitLen do result[i] = src % 2 src = math.floor(src / 2) end return result end...原创 2018-05-17 11:58:33 · 2950 阅读 · 0 评论 -
cocos2d-x-3.17 之Mac系统Xcode环境搭建教程
Mac上搭建iPhone的开发环境一、开发环境1.下载源码:http://www.cocos2d-x.org/download/自行解压到桌面 2.创建HelloWorld项目 a.打开“终端” b.输入以下命令 cd /Users/用户名/Desktop/cocos2d-x-3.17/...原创 2018-07-31 01:27:29 · 3342 阅读 · 0 评论 -
bugly 上传so符号表提示 文件非法问题
有可能是bugly服务器问题,过段时间再试就好了,正常情况会 提示 制作中,然后提示 制作完成。原创 2018-09-30 21:50:14 · 2454 阅读 · 1 评论 -
lua各种排序算法
----获取系统时间,计算代码执行所花费的时间--以下代码经过vs2013验证--socket.gettime()获取的正是时间戳,精确度很高,单位是秒。小数点后面还有很多位,可以通过乘以1000这样的换算,得到微秒(ms)。--local socket = require "socket"local sort = class("sort")--local start_time ...原创 2019-04-26 16:17:59 · 4484 阅读 · 0 评论 -
Lua中使用Json:table转json与json转table
Json.lua:------------------------------------------------------------------------------- JSON4Lua: JSON encoding / decoding support for the Lua language.-- json Module.-- Author: Craig Mason-Jon...转载 2019-05-15 15:34:32 · 3241 阅读 · 0 评论 -
转 lua下 string 和table 互转 (经过测试ok)
--table to string 序列化function serialize(obj) local lua = "" local t = type(obj) if t == "number" then lua = lua .. obj elseif t == "boolean" then lua = lua .. tost...转载 2019-05-22 16:04:14 · 2614 阅读 · 0 评论 -
lua 生成随机数
local socket = require("socket")local function get_seed() local t = string.format("%f", socket.gettime()) local st = string.sub(t, string.find(t, "%.") + 1, -1) return tonumber(string.revers...原创 2019-05-28 11:32:08 · 1965 阅读 · 1 评论 -
cocos2d lua或者 cocos2dx 中点击退出按钮 界面崩溃问题
错误信息:cocos2d:SpriteFrameCache:removeSpriteFramesFromFile: create dict by fail.Assert failed: Node still marked as running on node destruction! Was base class onExit() called in derived class onExi...原创 2019-08-03 19:50:41 · 779 阅读 · 0 评论 -
lua 中文字符判断
--中文字符判断function stringIsHaveChinese(str,iType) if str == nil then return false end if iType == 1 then -- local s = string.gsub(str, "^.", "")--标点符号 -- if #s...原创 2019-08-09 09:22:10 · 5051 阅读 · 0 评论