ssb 发表于 2010-4-24 17:12:20

error_desc [result] 这样用对么

check.lua

function check (result)
if result ~= error_code.eOK then
    error (error_desc or
         string.format ("Unknown error code: %i", result),
         2) -- error level - whoever called this function
end -- if
end -- function check

return check


红字部分用法可对? error_code ,error_desc在check.lua里都没有定义,
这两个是怎么个意思呢

ddid 发表于 2010-4-24 17:28:23

http://www.gammon.com.au/scripts/doc.php?general=errors

ssb 发表于 2010-4-24 17:43:08


这些我理解
我想问 error_code和error_desc是默认的表还是自定义的表,还是别的什么

[ 本帖最后由 ssb 于 2010-4-24 05:44 PM 编辑 ]

ddid 发表于 2010-4-24 18:08:34

The "error_desc" table is automatically supplied by MUSHclient for Lua scripts.

ssb 发表于 2010-4-24 19:27:23

I wasn't sure whether I could access error_code and the others without importing constants.lua first (which is really wrapped by XML). Now I see error_code is an entirely separate table, and it seems that I can access it, so thank you for letting me know!


error_code也找到了
多谢ddid了!

[ 本帖最后由 ssb 于 2010-4-24 07:32 PM 编辑 ]

ddid 发表于 2010-4-24 21:44:55

nothank
页: [1]
查看完整版本: error_desc [result] 这样用对么