1fd4d78c98 2024-02-03 1: local d_4 = {}
1fd4d78c98 2024-02-03 2: local 简文件库 = require("lfs")
b29c01f0b6 2024-02-02 3: --~ 排
2c6261c44d 2024-02-03 4: --~ 办排中值的能
104e1f0af4 2024-02-03 5: --~ 入参2
104e1f0af4 2024-02-03 6: --~ 入参3
fb63b2804e 2024-02-03 7: --~ 入参4
1fd4d78c98 2024-02-03 8: function d_4.历排(o1_11, o1, o2, o3, o4)
39eed9e6f2 2024-02-02 9: local k1_11
d6631e3f10 2024-02-03 10: --~ 集排
39eed9e6f2 2024-02-02 11: k1_11 = {}
39eed9e6f2 2024-02-02 12: for o5 = 1, #o1_11 do
39eed9e6f2 2024-02-02 13: k1_11[#k1_11 + 1] = o1(o1_11[o5], o2, o3, o4)
39eed9e6f2 2024-02-02 14: end
39eed9e6f2 2024-02-02 15: return k1_11
39eed9e6f2 2024-02-02 16: end
fb63b2804e 2024-02-03 17: --~ 文
fb63b2804e 2024-02-03 18: --~ 历文的能
fb63b2804e 2024-02-03 19: --~ 入参2
fb63b2804e 2024-02-03 20: --~ 入参3
1fd4d78c98 2024-02-03 21: function d_4.历文(o1, o2, o3, o4)
e5e5b44097 2024-02-03 22: local k1_9
0b316b136c 2024-02-03 23: --~ 集排
e5e5b44097 2024-02-03 24: k1_9 = {}
e5e5b44097 2024-02-03 25: for o5 in o2(o1, o3, o4) do
e5e5b44097 2024-02-03 26: k1_9[#k1_9 + 1] = o5
e5e5b44097 2024-02-03 27: end
e5e5b44097 2024-02-03 28: return k1_9
e5e5b44097 2024-02-03 29: end
2fe4cafc95 2024-02-03 30: --~ 表中值
2fe4cafc95 2024-02-03 31: --~ 值类
2fe4cafc95 2024-02-03 32: --~ 办值的能
1fd4d78c98 2024-02-03 33: function d_4.操类(o1, o2, o3)
2fe4cafc95 2024-02-03 34: if type(o1) == o2 then
2fe4cafc95 2024-02-03 35: return o3(o1)
2fe4cafc95 2024-02-03 36: else
2fe4cafc95 2024-02-03 37: return o1
2fe4cafc95 2024-02-03 38: end
2fe4cafc95 2024-02-03 39: end
1fd4d78c98 2024-02-03 40: --~ 排中文
1fd4d78c98 2024-02-03 41: --~ 入参2
1fd4d78c98 2024-02-03 42: --~ 入参3
1fd4d78c98 2024-02-03 43: --~ 入参4
1fd4d78c98 2024-02-03 44: function d_4.全筛文(o1, o2, o3, o4)
d1b9d0d34f 2024-02-03 45: if string.find(o1, o2, o3, o4) then
1fd4d78c98 2024-02-03 46: return o1
1fd4d78c98 2024-02-03 47: end
e94f91e6b3 2024-02-03 48: end
e94f91e6b3 2024-02-03 49: --~ 文
e94f91e6b3 2024-02-03 50: --~ 前缀
e94f91e6b3 2024-02-03 51: function d_4.加前缀(o1, o2)
e94f91e6b3 2024-02-03 52: return (o2 or "") .. o1
e94f91e6b3 2024-02-03 53: end
e94f91e6b3 2024-02-03 54: --~ 文
e94f91e6b3 2024-02-03 55: --~ 后缀
e94f91e6b3 2024-02-03 56: function d_4.加后缀(o1, o2)
e94f91e6b3 2024-02-03 57: return o1 .. (o2 or "")
e94f91e6b3 2024-02-03 58: end
e94f91e6b3 2024-02-03 59: --~ 令
e94f91e6b3 2024-02-03 60: function d_4.办令(o1)
e94f91e6b3 2024-02-03 61: print(o1)
e94f91e6b3 2024-02-03 62: os.execute(o1)
1fd4d78c98 2024-02-03 63: end
1fd4d78c98 2024-02-03 64: --~ 目表
1fd4d78c98 2024-02-03 65: function d_4.用令行工具操文件(o1)
1fd4d78c98 2024-02-03 66: local k1_9
e6ccf9f6b1 2024-02-03 67: --~ 令行排
1fd4d78c98 2024-02-03 68: k1_9 = d_4.历文(o1.文件目, 简文件库.dir)
1fd4d78c98 2024-02-03 69: k1_9 = d_4.历排(k1_9, d_4.全筛文, o1.文件类, -#o1.文件类, true)
1fd4d78c98 2024-02-03 70: for o2 = 1, #k1_9 do
1fd4d78c98 2024-02-03 71: k1_9[o2] = d_4.加前缀(k1_9[o2], o1.文件目 .. "/")
1fd4d78c98 2024-02-03 72: k1_9[o2] = d_4.加前缀(k1_9[o2], [["]])
1fd4d78c98 2024-02-03 73: k1_9[o2] = d_4.加后缀(k1_9[o2], [["]])
e94f91e6b3 2024-02-03 74: k1_9[o2] = d_4.加前缀(k1_9[o2], o1.令行前缀)
e94f91e6b3 2024-02-03 75: d_4.办令(k1_9[o2])
e94f91e6b3 2024-02-03 76: end
886d224d41 2024-02-03 77: end
886d224d41 2024-02-03 78: --~ 文件路
886d224d41 2024-02-03 79: --~ 式
886d224d41 2024-02-03 80: function d_4.读文件(o1, o2)
886d224d41 2024-02-03 81: local k1
886d224d41 2024-02-03 82: local k1_4
886d224d41 2024-02-03 83: --~ 文件
886d224d41 2024-02-03 84: k1_4 = io.open(o1, o2 or "r")
886d224d41 2024-02-03 85: --~ 文
886d224d41 2024-02-03 86: k1 = k1_4:read("a")
886d224d41 2024-02-03 87: k1_4:flush()
886d224d41 2024-02-03 88: k1_4:close()
886d224d41 2024-02-03 89: return k1
6635e5ac89 2024-02-03 90: end
6635e5ac89 2024-02-03 91: --~ 常量排
6635e5ac89 2024-02-03 92: function d_4.加对限(o1_11)
6635e5ac89 2024-02-03 93: for o1 = 1, #o1_11 do
e85a723505 2024-02-03 94: o1_11[o1] = d_4.加前缀(o1_11[o1], [[k1_11["]])
e85a723505 2024-02-03 95: o1_11[o1] = string.gsub(o1_11[o1], "=", "\"]=", 1)
6635e5ac89 2024-02-03 96: end
e85a723505 2024-02-03 97: table.insert(o1_11, 1, "local k1_11 = {}")
e85a723505 2024-02-03 98: table.insert(o1_11, "return k1_11")
e85a723505 2024-02-03 99: return table.concat(o1_11, "\n")
e85a723505 2024-02-03 100: end
e85a723505 2024-02-03 101: --~ 文
e85a723505 2024-02-03 102: --~ 文件路
e85a723505 2024-02-03 103: --~ 式
e85a723505 2024-02-03 104: function d_4.写文件(o1, o2, o3)
e85a723505 2024-02-03 105: local k1_4
e85a723505 2024-02-03 106: --~ 文件
e85a723505 2024-02-03 107: k1_4 = io.open(o2, o3 or "w")
e85a723505 2024-02-03 108: k1_4:write(o1)
e85a723505 2024-02-03 109: k1_4:flush()
e85a723505 2024-02-03 110: k1_4:close()
e85a723505 2024-02-03 111: end
e85a723505 2024-02-03 112: function d_4.删左右空白(o1)
e85a723505 2024-02-03 113: o1 = string.gsub(o1, "^%s+", "")
e85a723505 2024-02-03 114: return string.gsub(o1, "%s+$", "")
1fd4d78c98 2024-02-03 115: end
1fd4d78c98 2024-02-03 116: return d_4