initial release
This commit is contained in:
29
cosmic rage/lua/check.lua
Normal file
29
cosmic rage/lua/check.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
--
|
||||
-- check.lua
|
||||
--
|
||||
-- ----------------------------------------------------------
|
||||
-- return-code checker for MUSHclient functions that return error codes
|
||||
-- ----------------------------------------------------------
|
||||
--
|
||||
--[[
|
||||
|
||||
Call for those MUSHclient functions that return a result code (like eOK).
|
||||
Not all functions return such a code.
|
||||
|
||||
eg.
|
||||
|
||||
require "check
|
||||
check (SetVariable ("abc", "def")) --> works ok
|
||||
check (SetVariable ("abc-", "def")) --> The name of this object is invalid
|
||||
|
||||
--]]
|
||||
|
||||
function check (result)
|
||||
if result ~= error_code.eOK then
|
||||
error (error_desc [result] or
|
||||
string.format ("Unknown error code: %i", result),
|
||||
2) -- error level - whoever called this function
|
||||
end -- if
|
||||
end -- function check
|
||||
|
||||
return check
|
||||
Reference in New Issue
Block a user