@zero1036
2017-04-12T15:40:30.000000Z
字数 716
阅读 1262
Redis
local function decreaseChance()
end
local function lower(top)
result = top + 10;
end
lower(20);
local定义方法应优先定义,否则报错:
ERR Error running script (call to f_6a61b7950435646d00aaa5a535e2c3a0b9d356ec): @enable_strict_lua:15: user_script:6: Script attempted to access
--错误示例
if limit<=3 then
lower(limit);
else
upper();
end
local function upper()
...
end
local function lower(top)
...
end
--正确示例
local function upper()
...
end
local function lower(top)
...
end
if limit<=3 then
lower(limit);
else
upper();
end
tonumber (e [, base])
功能:尝试将参数e转换为数字,当不能转换时返回nil
base(2~36)指出参数e当前使用的进制,默认为10进制,如tonumber(11,2)=3
tostirng(e)
功能:将参数e转换为字符串,此函数将会触发元表的__tostring事件
type(v)
功能:返回参数的类型名("nil","number", "string", "boolean", "table", "function", "thread", "userdata")