-- local str= '1'; -- local result = table.concat("2"); -- print(result); -- local tt = string.sub(str, 1, -2) -- print(tt); -- local strs = {}; -- for i = 1, 30000, 1 do -- strs[i] = "helloworld"; -- end -- local result = ""; -- local startTime = os.clock(); -- result = table.concat(strs); -- local endTime = os.clock(); -- local useTime = endTime - startTime; -- print("消耗时间:" .. useTime .. "s"); local strs = {}; for i = 1, 30000, 1 do strs[i] = "helloworld"; end local result = ""; local startTime = os.clock(); for index, str in ipairs(strs) do result = result .. str; end local endTime = os.clock(); local useTime = endTime - startTime; print("消耗时间:" .. useTime .. "s");