9942dfa51d 2024-02-04 1: local d = {}
1fd4d78c98 2024-02-03 2: local 简文件库 = require("lfs")
b29c01f0b6 2024-02-02 3: --~ 排
2c6261c44d 2024-02-03 4: --~ 办排中值的能
fb63b2804e 2024-02-03 5: --~ 入参2
fb63b2804e 2024-02-03 6: --~ 入参3
fb63b2804e 2024-02-03 7: --~ 入参4
9942dfa51d 2024-02-04 8: function d.历排(o1_0, o1, o2_0, o3_0, o4_0)
dbb3ab98a4 2024-02-03 9: local k1_0
fb63b2804e 2024-02-03 10: --~ 集排
dbb3ab98a4 2024-02-03 11: k1_0 = {}
dbb3ab98a4 2024-02-03 12: for o2 = 1, #o1_0 do
dbb3ab98a4 2024-02-03 13: k1_0[#k1_0 + 1] = o1(o1_0[o2], o2_0, o3_0, o4_0)
fb63b2804e 2024-02-03 14: end
dbb3ab98a4 2024-02-03 15: return k1_0
fb63b2804e 2024-02-03 16: end
fb63b2804e 2024-02-03 17: --~ 文
fb63b2804e 2024-02-03 18: --~ 历文的能
fb63b2804e 2024-02-03 19: --~ 入参2
fb63b2804e 2024-02-03 20: --~ 入参3
9942dfa51d 2024-02-04 21: function d.历文(o1, o2, o1_0, o2_0)
4af7b78130 2024-02-03 22: local k1_0
0b316b136c 2024-02-03 23: --~ 集排
4af7b78130 2024-02-03 24: k1_0 = {}
4af7b78130 2024-02-03 25: for o3_0 in o2(o1, o1_0, o2_0) do
4af7b78130 2024-02-03 26: k1_0[#k1_0 + 1] = o3_0
4af7b78130 2024-02-03 27: end
4af7b78130 2024-02-03 28: return k1_0
4af7b78130 2024-02-03 29: end
f4c48d2eb7 2024-02-05 30: function d.历对(o1_0, o1)
f4c48d2eb7 2024-02-05 31: local k1_0, k2_0, k3_0
f4c48d2eb7 2024-02-05 32: --~ 对
f4c48d2eb7 2024-02-05 33: k1_0 = {}
f4c48d2eb7 2024-02-05 34: for o2_0, o3_0 in pairs(o1_0) do
f4c48d2eb7 2024-02-05 35: --~ 键
f4c48d2eb7 2024-02-05 36: --~ 值
f4c48d2eb7 2024-02-05 37: k2_0, k3_0 = o1(o2_0, o3_0)
f4c48d2eb7 2024-02-05 38: if k2_0 then
f4c48d2eb7 2024-02-05 39: k1_0[k2_0] = k3_0
f4c48d2eb7 2024-02-05 40: else
f4c48d2eb7 2024-02-05 41: end
f4c48d2eb7 2024-02-05 42: end
f4c48d2eb7 2024-02-05 43: return k1_0
f4c48d2eb7 2024-02-05 44: end
2fe4cafc95 2024-02-03 45: --~ 表中值
2fe4cafc95 2024-02-03 46: --~ 值类
2fe4cafc95 2024-02-03 47: --~ 办值的能
9942dfa51d 2024-02-04 48: function d.操类(o1_0, o1, o2)
733d68b305 2024-02-04 49: if type(o1_0) == o1 then
733d68b305 2024-02-04 50: return o2(o1_0)
2fe4cafc95 2024-02-03 51: else
733d68b305 2024-02-04 52: return o1_0
1fd4d78c98 2024-02-03 53: end
1fd4d78c98 2024-02-03 54: end
1fd4d78c98 2024-02-03 55: --~ 排中文
1fd4d78c98 2024-02-03 56: --~ 入参2
1fd4d78c98 2024-02-03 57: --~ 入参3
1fd4d78c98 2024-02-03 58: --~ 入参4
9942dfa51d 2024-02-04 59: function d.全筛文(o1, o2, o3, o4)
d1b9d0d34f 2024-02-03 60: if string.find(o1, o2, o3, o4) then
e94f91e6b3 2024-02-03 61: return o1
e94f91e6b3 2024-02-03 62: end
e94f91e6b3 2024-02-03 63: end
e94f91e6b3 2024-02-03 64: --~ 文
e94f91e6b3 2024-02-03 65: --~ 前缀
9942dfa51d 2024-02-04 66: function d.加前缀(o1, o2)
4d150d683b 2024-02-03 67: return (o2 or "") .. o1
4d150d683b 2024-02-03 68: end
4d150d683b 2024-02-03 69: --~ 文
4d150d683b 2024-02-03 70: --~ 后缀
9942dfa51d 2024-02-04 71: function d.加后缀(o1, o2)
4d150d683b 2024-02-03 72: return o1 .. (o2 or "")
4d150d683b 2024-02-03 73: end
4d150d683b 2024-02-03 74: --~ 令
9942dfa51d 2024-02-04 75: function d.办令(o1)
4d150d683b 2024-02-03 76: print(o1)
4d150d683b 2024-02-03 77: os.execute(o1)
4d150d683b 2024-02-03 78: end
4d150d683b 2024-02-03 79: --~ 文
4d150d683b 2024-02-03 80: --~ 前缀
9942dfa51d 2024-02-04 81: function d.全筛前缀(o1, o2)
4d150d683b 2024-02-03 82: if string.sub(o1, 1, #o2) == o2 then
4d150d683b 2024-02-03 83: return o1
4d150d683b 2024-02-03 84: end
4d150d683b 2024-02-03 85: end
4d150d683b 2024-02-03 86: --~ 文
4d150d683b 2024-02-03 87: --~ 后缀
9942dfa51d 2024-02-04 88: function d.全筛后缀(o1, o2)
168300f866 2024-02-03 89: if string.sub(o1, -#o2) == o2 then
168300f866 2024-02-03 90: return o1
168300f866 2024-02-03 91: end
168300f866 2024-02-03 92: end
0ebfa0e128 2024-02-04 93: --~ 目对
9942dfa51d 2024-02-04 94: function d.用令行工具操文件(o1_0)
4e48ffd0e5 2024-02-03 95: local k1_9
4e48ffd0e5 2024-02-03 96: --~ 令行排
9942dfa51d 2024-02-04 97: k1_9 = d.历文(o1_0.文件目, 简文件库.dir)
9942dfa51d 2024-02-04 98: k1_9 = d.历排(k1_9, d.全筛后缀, o1_0.文件类)
0ebfa0e128 2024-02-04 99: for o1 = 1, #k1_9 do
9942dfa51d 2024-02-04 100: k1_9[o1] = d.加前缀(k1_9[o1], o1_0.文件目)
9942dfa51d 2024-02-04 101: k1_9[o1] = d.加前缀(k1_9[o1], [["]])
9942dfa51d 2024-02-04 102: k1_9[o1] = d.加后缀(k1_9[o1], [["]])
9942dfa51d 2024-02-04 103: k1_9[o1] = d.加前缀(k1_9[o1], o1_0.令行前缀)
9942dfa51d 2024-02-04 104: d.办令(k1_9[o1])
4e48ffd0e5 2024-02-03 105: end
4e48ffd0e5 2024-02-03 106: end
4e48ffd0e5 2024-02-03 107: --~ 文件路
4e48ffd0e5 2024-02-03 108: --~ 式
9942dfa51d 2024-02-04 109: function d.读文件(o1, o2)
4e48ffd0e5 2024-02-03 110: local k1
4e48ffd0e5 2024-02-03 111: local k1_3
4e48ffd0e5 2024-02-03 112: --~ 文件
4e48ffd0e5 2024-02-03 113: k1_3 = io.open(o1, o2 or "r")
4e48ffd0e5 2024-02-03 114: --~ 文
4e48ffd0e5 2024-02-03 115: k1 = k1_3:read("a")
4e48ffd0e5 2024-02-03 116: k1_3:flush()
4e48ffd0e5 2024-02-03 117: k1_3:close()
4e48ffd0e5 2024-02-03 118: return k1
4e48ffd0e5 2024-02-03 119: end
4e48ffd0e5 2024-02-03 120: --~ 常量排
9942dfa51d 2024-02-04 121: function d.加对限(o1_0)
b92c73c8f3 2024-02-04 122: table.insert(o1_0, 1, "local k1_0 = {}")
b92c73c8f3 2024-02-04 123: table.insert(o1_0, "return k1_0")
b92c73c8f3 2024-02-04 124: return table.concat(o1_0, "\n")
4e48ffd0e5 2024-02-03 125: end
4e48ffd0e5 2024-02-03 126: --~ 文
4e48ffd0e5 2024-02-03 127: --~ 文件路
4e48ffd0e5 2024-02-03 128: --~ 式
9942dfa51d 2024-02-04 129: function d.写文件(o1, o2, o3)
168300f866 2024-02-03 130: local k1_3
168300f866 2024-02-03 131: --~ 文件
168300f866 2024-02-03 132: k1_3 = io.open(o2, o3 or "w")
168300f866 2024-02-03 133: k1_3:write(o1)
168300f866 2024-02-03 134: k1_3:flush()
168300f866 2024-02-03 135: k1_3:close()
168300f866 2024-02-03 136: end
1b64e61bc7 2024-02-04 137: --~ 文
9942dfa51d 2024-02-04 138: function d.删左右空白(o1)
168300f866 2024-02-03 139: o1 = string.gsub(o1, "^%s+", "")
168300f866 2024-02-03 140: return string.gsub(o1, "%s+$", "")
f4c48d2eb7 2024-02-05 141: end
f4c48d2eb7 2024-02-05 142: --~ 对
f4c48d2eb7 2024-02-05 143: --~ 对
f4c48d2eb7 2024-02-05 144: function d.连两对(o1_0, o2_0)
f4c48d2eb7 2024-02-05 145: for o3_0, o4_0 in pairs(o2_0) do
f4c48d2eb7 2024-02-05 146: o1_0[o3_0] = o4_0
f4c48d2eb7 2024-02-05 147: end
f4c48d2eb7 2024-02-05 148: return o1_0
f4c48d2eb7 2024-02-05 149: end
f4c48d2eb7 2024-02-05 150: --~ 键
f4c48d2eb7 2024-02-05 151: --~ 值
f4c48d2eb7 2024-02-05 152: function d.修对类(o1_0, o2_0)
f4c48d2eb7 2024-02-05 153: if tonumber(o1_0) then
f4c48d2eb7 2024-02-05 154: return tonumber(o1_0), o2_0
f4c48d2eb7 2024-02-05 155: else
f4c48d2eb7 2024-02-05 156: return o1_0, o2_0
f4c48d2eb7 2024-02-05 157: end
f4c48d2eb7 2024-02-05 158: end
f4c48d2eb7 2024-02-05 159: do
f4c48d2eb7 2024-02-05 160: --~ 加数
f4c48d2eb7 2024-02-05 161: local k1 = 0
f4c48d2eb7 2024-02-05 162: function d.递增()
f4c48d2eb7 2024-02-05 163: k1 = k1 + 1
f4c48d2eb7 2024-02-05 164: return k1
f4c48d2eb7 2024-02-05 165: end
f4c48d2eb7 2024-02-05 166: end
f4c48d2eb7 2024-02-05 167: --~ 左加数
f4c48d2eb7 2024-02-05 168: --~ 右加数
f4c48d2eb7 2024-02-05 169: function d.加法(o1, o2)
f4c48d2eb7 2024-02-05 170: return o1 + o2
f4c48d2eb7 2024-02-05 171: end
f4c48d2eb7 2024-02-05 172: --~ 左减数
f4c48d2eb7 2024-02-05 173: --~ 右减数
f4c48d2eb7 2024-02-05 174: function d.减法(o1, o2)
f4c48d2eb7 2024-02-05 175: return o1 - o2
f4c48d2eb7 2024-02-05 176: end
f4c48d2eb7 2024-02-05 177: --~ 左乘数
f4c48d2eb7 2024-02-05 178: --~ 右乘数
f4c48d2eb7 2024-02-05 179: function d.乘法(o1, o2)
f4c48d2eb7 2024-02-05 180: return o1 * o2
f4c48d2eb7 2024-02-05 181: end
f4c48d2eb7 2024-02-05 182: --~ 左除数
f4c48d2eb7 2024-02-05 183: --~ 右除数
f4c48d2eb7 2024-02-05 184: function d.除法(o1, o2)
f4c48d2eb7 2024-02-05 185: return o1 / o2
7a7894a746 2024-02-05 186: end
7a7894a746 2024-02-05 187: --~ 左数
7a7894a746 2024-02-05 188: --~ 右数
7a7894a746 2024-02-05 189: function d.位和(o1, o2)
7a7894a746 2024-02-05 190: return bit.band(o1, o2)
9942dfa51d 2024-02-04 191: end
9942dfa51d 2024-02-04 192: return d