上一页 1 ··· 3 4 5 6 7

2013年11月23日

摘要: lua中,如果碰到某个属性值改变了,但是修改的地方又特别多,调试就特别麻烦了,有个小技巧,直接贴代码local m = { __index = function( t, k ) if k == "x" then-- print( "看看属性", k );-- print( debug.traceback() ); end return t._old[k]; end, __eq = function( t, k, v ) print( "看看属性", k ); t._old[k]=v; end, __newindex = functio 阅读全文
posted @ 2013-11-23 22:06 marcher 阅读(279) 评论(0) 推荐(0) 编辑
摘要: lua面向对象的一个封装,直接贴代码--swfclass = {};local cs = {};function _class( child, base, ... )-- _.s( child ); if( cs[ child ] ) then error( "duplicate class : " .. child ) end; local c = _G[child]; table.copy( c, base or {} ); for ii = 1, select("#", ...) do table.copy( c, select(ii, ...) 阅读全文
posted @ 2013-11-23 21:50 marcher 阅读(394) 评论(0) 推荐(0) 编辑
摘要: as2写的json解析,带容错,如果要做格式检查,得自己修改了,直接贴代码//--------------------------------------------------json解析----------------------------------------------------------class Json extends Object{ public static var pos:Number=0; private static function isDigit( ch:String ):Boolean { return ( ch >= '0' &am 阅读全文
posted @ 2013-11-23 21:38 marcher 阅读(565) 评论(0) 推荐(0) 编辑
摘要: 自己写的lua解析json,带容错,如果要是用于格式检查,得修改下。很简单直接贴代码--------------------------------------------------json解析----------------------------------------------------------local function json2true(str,from,to) return true, from+3endlocal function json2false(str,from,to) return false, from+4endlocal function json2nu 阅读全文
posted @ 2013-11-23 21:36 marcher 阅读(6549) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7

导航