Advertisement
Hsiang_Nianian

1.lua

Oct 21st, 2022
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.30 KB | Fixit | 0 0
  1. json = require "json"
  2.  
  3. case = {
  4.   "module \'(.*)\' not found",
  5.  
  6.   "attempt to call a nil value",
  7.  
  8.   "attempt to index a nil value",
  9.  
  10.   "attempt%sto%sconcatenate%sa%snil%svalue",
  11.  
  12.   "bad argument #1 to \'(.*)\' (string expected, got nil)",
  13.  
  14.   "value expected",
  15.  
  16.   "attempt to perform arithmetic on a nil value (global \'(.*)\')",
  17.  
  18.   "bad argument #%d+ to \'(.*)\'(number has no integer representation)",
  19.  
  20.   "\'}\' expected (to close \'{\' at line 169) near \'%s\'",
  21.  
  22.   "\'end\' expected (to close \'function\' at line 240) near <eof>",
  23.  
  24.   "\'then\' expected near \'end\'",
  25.  
  26.   "unexpected symbol near \'(.*)\'",
  27.  
  28.   "attempt to get length of a nil value (local \'(.*)\')",
  29.  
  30.   "attempt to add a \'string\' with a \'string\'",
  31.  
  32.   "attempt to compare number with string",
  33.  
  34.   "error loading module \'(.*)\' from file",
  35.  
  36.   "no visible label \'(.*)\' for <goto> at line %d+",
  37.  
  38.   "invalid option \'(.*)\'"
  39.  
  40. }
  41.  
  42. output = {
  43.   "没有把被引用的lua或dll文件放在指定位置(多见于require与loadLua)",
  44.  
  45.   "解决方式:把所需文件放入Dice存档目录/plugin/或Diceki/lua/,dll文件或require对象必须置于后者 ",
  46.  
  47.   "将空变量%s用作函数(global表示被调用的是全局变量,local表示本地变量,method表示索引方法)",
  48.  
  49.   "对空变量%s使用索引(只有table等结构可以索引,形如msg.fromMsg)",
  50.  
  51.   "使用..连接字符串时连接了一个空变量%s",
  52.  
  53.   "函数%s的第1个参数类型错误,要求类型为string,但实际传入的参数为nil。特别地,got nil表示输入参数为nil或缺少参数",
  54.  
  55.   "要求参数,但没有传入",
  56.  
  57.   "将一个空变量%s当做数字表示",
  58.  
  59.   "函数format的第5个参数类型错误,要求是整数,但传入是小数,或者是其余类型不能化为整数",
  60.  
  61.   "脚本第169行的左花括号缺少配对的右花括号。此错误也可以由表格内缺少逗号分隔、括号外的中文等原因造成",
  62.  
  63.   "脚本第240行的function缺少收尾的end,<eof>表示文件结束(找到文件末也没找到)",
  64.  
  65.   "if then end逻辑结构缺少then",
  66.  
  67.   "符号%s边有无法识读的符号,比如中文字符",
  68.  
  69.   "对空变量tab作取长度运算(#)",
  70.  
  71.   "对(不能化为数字的)字符串用加法'+'(字符串只能用连接'..')",
  72.  
  73.   "对数字和(不能化为数字的)字符串用比较运算符",
  74.  
  75.   "使用require \"%s\"时加载出错",json = require "json"
  76.  
  77. case = {
  78.   "module \'(.*)\' not found",
  79.  
  80.   "attempt to call a nil value",
  81.  
  82.   "attempt to index a nil value",
  83.  
  84.   "attempt%sto%sconcatenate%sa%snil%svalue",
  85.  
  86.   "bad argument #1 to \'(.*)\' (string expected, got nil)",
  87.  
  88.   "value expected",
  89.  
  90.   "attempt to perform arithmetic on a nil value (global \'(.*)\')",
  91.  
  92.   "bad argument #%d+ to \'(.*)\'(number has no integer representation)",
  93.  
  94.   "\'}\' expected (to close \'{\' at line 169) near \'%s\'",
  95.  
  96.   "\'end\' expected (to close \'function\' at line 240) near <eof>",
  97.  
  98.   "\'then\' expected near \'end\'",
  99.  
  100.   "unexpected symbol near \'(.*)\'",
  101.  
  102.   "attempt to get length of a nil value (local \'(.*)\')",
  103.  
  104.   "attempt to add a \'string\' with a \'string\'",
  105.  
  106.   "attempt to compare number with string",
  107.  
  108.   "error loading module \'(.*)\' from file",
  109.  
  110.   "no visible label \'(.*)\' for <goto> at line %d+",
  111.  
  112.   "invalid option \'(.*)\'"
  113.  
  114. }
  115.  
  116. output = {
  117.   "没有把被引用的lua或dll文件放在指定位置(多见于require与loadLua)",
  118.  
  119.   "解决方式:把所需文件放入Dice存档目录/plugin/或Diceki/lua/,dll文件或require对象必须置于后者 ",
  120.  
  121.   "将空变量%s用作函数(global表示被调用的是全局变量,local表示本地变量,method表示索引方法)",
  122.  
  123.   "对空变量%s使用索引(只有table等结构可以索引,形如msg.fromMsg)",
  124.  
  125.   "使用..连接字符串时连接了一个空变量%s",
  126.  
  127.   "函数%s的第1个参数类型错误,要求类型为string,但实际传入的参数为nil。特别地,got nil表示输入参数为nil或缺少参数",
  128.  
  129.   "要求参数,但没有传入",
  130.  
  131.   "将一个空变量%s当做数字表示",
  132.  
  133.   "函数format的第5个参数类型错误,要求是整数,但传入是小数,或者是其余类型不能化为整数",
  134.  
  135.   "脚本第169行的左花括号缺少配对的右花括号。此错误也可以由表格内缺少逗号分隔、括号外的中文等原因造成",
  136.  
  137.   "脚本第240行的function缺少收尾的end,<eof>表示文件结束(找到文件末也没找到)",
  138.  
  139.   "if then end逻辑结构缺少then",
  140.  
  141.   "符号%s边有无法识读的符号,比如中文字符",
  142.  
  143.   "对空变量tab作取长度运算(#)",
  144. json = require "json"
  145.  
  146. case = {
  147.   "module \'(.*)\' not found",
  148.  
  149.   "attempt to call a nil value",
  150.  
  151.   "attempt to index a nil value",
  152.  
  153.   "attempt%sto%sconcatenate%sa%snil%svalue",
  154.  
  155.   "bad argument #1 to \'(.*)\' (string expected, got nil)",
  156.  
  157.   "value expected",
  158.  
  159.   "attempt to perform arithmetic on a nil value (global \'(.*)\')",
  160.  
  161.   "bad argument #%d+ to \'(.*)\'(number has no integer representation)",
  162.  
  163.   "\'}\' expected (to close \'{\' at line 169) near \'%s\'",
  164.  
  165.   "\'end\' expected (to close \'function\' at line 240) near <eof>",
  166.  
  167.   "\'then\' expected near \'end\'",
  168.  
  169.   "unexpected symbol near \'(.*)\'",
  170.  
  171.   "attempt to get length of a nil value (local \'(.*)\')",
  172.  
  173.   "attempt to add a \'string\' with a \'string\'",
  174.  
  175.   "attempt to compare number with string",
  176.  
  177.   "error loading module \'(.*)\' from file",
  178.  
  179.   "no visible label \'(.*)\' for <goto> at line %d+",
  180.  
  181.   "invalid option \'(.*)\'"
  182.  
  183. }
  184.  
  185. output = {
  186.   "没有把被引用的lua或dll文件放在指定位置(多见于require与loadLua)",
  187.  
  188.   "解决方式:把所需文件放入Dice存档目录/plugin/或Diceki/lua/,dll文件或require对象必须置于后者 ",
  189.  
  190.   "将空变量%s用作函数(global表示被调用的是全局变量,local表示本地变量,method表示索引方法)",
  191.  
  192.   "对空变量%s使用索引(只有table等结构可以索引,形如msg.fromMsg)",
  193.  
  194.   "使用..连接字符串时连接了一个空变量%s",
  195.  
  196.   "函数%s的第1个参数类型错误,要求类型为string,但实际传入的参数为nil。特别地,got nil表示输入参数为nil或缺少参数",
  197.  
  198.   "要求参数,但没有传入",
  199.  
  200.   "将一个空变量%s当做数字表示",
  201.  
  202.   "函数format的第5个参数类型错误,要求是整数,但传入是小数,或者是其余类型不能化为整数",
  203.  
  204.   "脚本第169行的左花括号缺少配对的右花括号。此错误也可以由表格内缺少逗号分隔、括号外的中文等原因造成",
  205.  
  206.   "脚本第240行的function缺少收尾的end,<eof>表示文件结束(找到文件末也没找到)",
  207.  
  208.   "if then end逻辑结构缺少then",
  209.  
  210.   "符号%s边有无法识读的符号,比如中文字符",
  211.  
  212.   "对空变量tab作取长度运算(#)",
  213.  
  214.   "对(不能化为数字的)字符串用加法'+'(字符串只能用连接'..')",
  215.  
  216.   "对数字和(不能化为数字的)字符串用比较运算符",
  217.  
  218.   "使用require \"%s\"时加载出错",
  219.  
  220.   "在循环结构中跳转不存在的节点",
  221.  
  222.   "传入的参数不是string或不在给定的字符串列表中"
  223. }
  224.  
  225. CER = function(fun, arg1, arg2, arg3, arg4, arg5)
  226.   local i
  227.   local ret, errMessage = pcall(fun, arg1, arg2, arg3, arg4, arg5);
  228.   wrong = ret and "false" or "true"
  229.   --return "是否错误:\n"..错误.." \n\n出错信息:\n" .. (errMessage or "无")
  230.   if wrong == "true" then --错误提示
  231.     local ret, errMessage = pcall(fun, arg1, arg2, arg3, arg4, arg5)
  232.     return "\n错误详情:\n" .. errMessage --output[i]
  233.   else --无错误正常执行
  234.     ret, back = pcall(fun, arg1, arg2, arg3, arg4, arg5)
  235.     return back
  236.   end
  237. end
  238.  
  239.   "对(不能化为数字的)字符串用加法'+'(字符串只能用连接'..')",
  240.  
  241.   "对数字和(不能化为数字的)字符串用比较运算符",
  242.  
  243.   "使用require \"%s\"时加载出错",
  244.  
  245.   "在循环结构中跳转不存在的节点",
  246.  
  247.   "传入的参数不是string或不在给定的字符串列表中"
  248. }
  249.  
  250. CER = function(fun, arg1, arg2, arg3, arg4, arg5)
  251.   local i
  252.   local ret, errMessage = pcall(fun, arg1, arg2, arg3, arg4, arg5);
  253.   wrong = ret and "false" or "true"
  254.   --return "是否错误:\n"..错误.." \n\n出错信息:\n" .. (errMessage or "无")
  255.   if wrong == "true" then --错误提示
  256.     local ret, errMessage = pcall(fun, arg1, arg2, arg3, arg4, arg5)
  257.     return "\n错误详情:\n" .. errMessage --output[i]
  258.   else --无错误正常执行
  259.     ret, back = pcall(fun, arg1, arg2, arg3, arg4, arg5)
  260.     return back
  261.   end
  262. end
  263.  
  264.  
  265.   "在循环结构中跳转不存在的节点",
  266.  
  267.   "传入的参数不是string或不在给定的字符串列表中"
  268. }
  269.  
  270. CER = function(fun, arg1, arg2, arg3, arg4, arg5)
  271.   local i
  272.   local ret, errMessage = pcall(fun, arg1, arg2, arg3, arg4, arg5);
  273.   wrong = ret and "false" or "true"
  274.   --return "是否错误:\n"..错误.." \n\n出错信息:\n" .. (errMessage or "无")
  275.   if wrong == "true" then --错误提示
  276.     local ret, errMessage = pcall(fun, arg1, arg2, arg3, arg4, arg5)
  277.     return "\n错误详情:\n" .. errMessage --output[i]
  278.   else --无错误正常执行
  279.     ret, back = pcall(fun, arg1, arg2, arg3, arg4, arg5)
  280.     return back
  281.   end
  282. end
  283.  
Tags: lua
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement