-- util.lua
-- Common Lua Function
-- Author: Liu Denghong
-- Date: 20080702
require "liu"
liu.util = liu.util or {version = 0.1;};
liu.util.Print=function(msg)
print(msg);
end;
-- Min
liu.util.Min = function(a,b)
return (a<b and a) or b;
end;
-- Max
liu.util.Max = function(a,b)
return (a>b and a) or b;
end;
-- IsTrue
liu.util.IsTrue = function(a)
return (a~=false and a~=nil);
end;
-- 只适用于表: a={"liu","deng","hong"};
-- 不适用于记录型表: b={name="liu", name1="deng", name2="hong"}
-- 等价于ipairs(t)
liu.util.TableIter = function(t)
local i = 0
local n = table.getn(t)
return function ()
i = i + 1
if i <= n then return t[i] end
end
end