|
发表于 2010-11-30 19:02:57
|
显示全部楼层
唉~,放弃去理解胡小子的代码了,直接把翻译Jason的放上来了:
-
- str="e;e;e;w;w;w;wa(1);e;e;w;e;wa(4);u;d;e;w;e;s;sw;wa(2);e;e;e;e;w;w;u;d;sw;e;se;su;sd;"
- arr = split(str, ";")
- result = {}
- count = 0
- wait_step = 5
- line = ""
- for _, v in ipairs(arr) do
- if string.sub(v, 1, 2) ~= "wa" then
- if count >= wait_step then
- table.insert(result, line)
- table.insert(result, "wa(1);")
- count = 0
- line = ""
- end --if
- line = line .. v .. ";"
- count = count + 1
- else
- if #line ~= 0 then
- table.insert(result, line)
- count = 0
- line = ""
- end --if
- v = v .. ";"
- table.insert(result, v)
- end --if
- end --for
-
- str1 = table.concat(result)
-
- print(str1)
复制代码 |
|