游戏王残局简化版

Annotation For 残局文料/lua_lib/常用库.lua
Login

Annotation For 残局文料/lua_lib/常用库.lua

Origin for each line in 残局文料/lua_lib/常用库.lua from check-in 168300f866:

65d8c2fcdd 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
65d8c2fcdd 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
65d8c2fcdd 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: --~ 办值的能
65d8c2fcdd 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
65d8c2fcdd 2024-02-03   44: function d_4.全筛文(o1, o2, o3, o4)
d1b9d0d34f 2024-02-03   45:   if string.find(o1, o2, o3, o4) then
e94f91e6b3 2024-02-03   46:     return o1
e94f91e6b3 2024-02-03   47:     end
e94f91e6b3 2024-02-03   48:   end
e94f91e6b3 2024-02-03   49: --~ 文
e94f91e6b3 2024-02-03   50: --~ 前缀
65d8c2fcdd 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: --~ 后缀
65d8c2fcdd 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: --~ 令
65d8c2fcdd 2024-02-03   60: function d_4.办令(o1)
e94f91e6b3 2024-02-03   61:   print(o1)
e94f91e6b3 2024-02-03   62:   os.execute(o1)
e94f91e6b3 2024-02-03   63:   end
4d150d683b 2024-02-03   64: --~ 文
4d150d683b 2024-02-03   65: --~ 前缀
65d8c2fcdd 2024-02-03   66: function d_4.全筛前缀(o1, o2)
4d150d683b 2024-02-03   67:   if string.sub(o1, 1, #o2) == o2 then
4d150d683b 2024-02-03   68:     return o1
4d150d683b 2024-02-03   69:     end
4d150d683b 2024-02-03   70:   end
4d150d683b 2024-02-03   71: --~ 文
4d150d683b 2024-02-03   72: --~ 后缀
65d8c2fcdd 2024-02-03   73: function d_4.全筛后缀(o1, o2)
4d150d683b 2024-02-03   74:   if string.sub(o1, -#o2) == o2 then
4d150d683b 2024-02-03   75:     return o1
4d150d683b 2024-02-03   76:     end
4d150d683b 2024-02-03   77:   end
1fd4d78c98 2024-02-03   78: --~ 目表
65d8c2fcdd 2024-02-03   79: function d_4.用令行工具操文件(o1)
1fd4d78c98 2024-02-03   80:   local k1_9
e6ccf9f6b1 2024-02-03   81:   --~ 令行排
1fd4d78c98 2024-02-03   82:   k1_9 = d_4.历文(o1.文件目, 简文件库.dir)
4d150d683b 2024-02-03   83:   k1_9 = d_4.历排(k1_9, d_4.全筛后缀, o1.文件类)
1fd4d78c98 2024-02-03   84:   for o2 = 1, #k1_9 do
0893c58ef4 2024-02-03   85:     k1_9[o2] = d_4.加前缀(k1_9[o2], o1.文件目)
0893c58ef4 2024-02-03   86:     k1_9[o2] = d_4.加前缀(k1_9[o2], [["]])
0893c58ef4 2024-02-03   87:     k1_9[o2] = d_4.加后缀(k1_9[o2], [["]])
e94f91e6b3 2024-02-03   88:     k1_9[o2] = d_4.加前缀(k1_9[o2], o1.令行前缀)
e94f91e6b3 2024-02-03   89:     d_4.办令(k1_9[o2])
e94f91e6b3 2024-02-03   90:     end
886d224d41 2024-02-03   91:   end
886d224d41 2024-02-03   92: --~ 文件路
886d224d41 2024-02-03   93: --~ 式
65d8c2fcdd 2024-02-03   94: function d_4.读文件(o1, o2)
886d224d41 2024-02-03   95:   local k1
886d224d41 2024-02-03   96:   local k1_4
886d224d41 2024-02-03   97:   --~ 文件
886d224d41 2024-02-03   98:   k1_4 = io.open(o1, o2 or "r")
886d224d41 2024-02-03   99:   --~ 文
886d224d41 2024-02-03  100:   k1 = k1_4:read("a")
886d224d41 2024-02-03  101:   k1_4:flush()
886d224d41 2024-02-03  102:   k1_4:close()
886d224d41 2024-02-03  103:   return k1
6635e5ac89 2024-02-03  104:   end
6635e5ac89 2024-02-03  105: --~ 常量排
65d8c2fcdd 2024-02-03  106: function d_4.加对限(o1_11)
6635e5ac89 2024-02-03  107:   for o1 = 1, #o1_11 do
e85a723505 2024-02-03  108:     o1_11[o1] = d_4.加前缀(o1_11[o1], [[k1_11["]])
e85a723505 2024-02-03  109:     o1_11[o1] = string.gsub(o1_11[o1], "=", "\"]=", 1)
6635e5ac89 2024-02-03  110:     end
e85a723505 2024-02-03  111:   table.insert(o1_11, 1, "local k1_11 = {}")
e85a723505 2024-02-03  112:   table.insert(o1_11, "return k1_11")
e85a723505 2024-02-03  113:   return table.concat(o1_11, "\n")
e85a723505 2024-02-03  114:   end
e85a723505 2024-02-03  115: --~ 文
e85a723505 2024-02-03  116: --~ 文件路
e85a723505 2024-02-03  117: --~ 式
65d8c2fcdd 2024-02-03  118: function d_4.写文件(o1, o2, o3)
168300f866 2024-02-03  119:   local k1_3
e85a723505 2024-02-03  120:   --~ 文件
168300f866 2024-02-03  121:   k1_3 = io.open(o2, o3 or "w")
168300f866 2024-02-03  122:   k1_3:write(o1)
168300f866 2024-02-03  123:   k1_3:flush()
168300f866 2024-02-03  124:   k1_3:close()
e85a723505 2024-02-03  125:   end
65d8c2fcdd 2024-02-03  126: function d_4.删左右空白(o1)
e85a723505 2024-02-03  127:   o1 = string.gsub(o1, "^%s+", "")
e85a723505 2024-02-03  128:   return string.gsub(o1, "%s+$", "")
1fd4d78c98 2024-02-03  129:   end
65d8c2fcdd 2024-02-03  130: return d_4