luafor里面v = nil无效

--[[
local test01 =
{
[1] = {{1,2,3,4},{1,2,3,4}},
[2] = {{1,2,3,4},{1,2,3,4}},
}
for k,v in pairs(test01)do
for kk,vv in pairs(v)do
if(kk == 1)then
test01[k][kk] = nil
end
end
end
--test01[1][1] = nil
print(GetCount(test01[1]))
]]

lua 取整 取余

使用math.modf(x/y),此函数,第一参数返回整数部分,第二个参数返回小数部分

lua获得时分秒

function todate()
local t=os.date("*t",os.time())
return t["hour"],t["min"], t["sec"]
end
print(todate())

lua字符串合并

local a = 1
local b = ","
local c = 2
local str = tostring(a)..tostring(b)..tostring(c)
print(str)

lua 类型转换

string to int
tonumber
print(tonumber("1234"))

lua分割字符串

function FGUtilStringSplit(str,split_char)
-------------------------------------------------------
-- 参数:待分割的字符串,分割字符
-- 返回:子串表.(含有空串)
local sub_str_tab = {};
while (true) do
local pos = string.find(str, split_char);
if (not pos) then
sub_str_tab[#sub_str_tab + 1] = str;
break;
end
local sub_str = string.sub(str, 1, pos - 1);
sub_str_tab[#sub_str_tab + 1] = sub_str;
str = string.sub(str, pos + 1, #str);
end
return sub_str_tab;
end

lua continue

for i = 1, 10 do
repeat
if i == 5 then
break
end
print(i)
until true
end

lua 中pairs 和 ipairs区别​

 lua与c++的结合