diff --git a/chatcommand_say_all.lua b/chatcommand_say_all.lua index a02106e..19c7758 100644 --- a/chatcommand_say_all.lua +++ b/chatcommand_say_all.lua @@ -15,7 +15,7 @@ local chatcommand_definition = { minetest.log("warning", "[yl_announcements] player " .. name .. " sent all announcements: " .. param .. - " unsuccessfully, message: " .. message) + " unsuccessfully, message: " .. dump(message)) return false, message end end diff --git a/globalsteps.lua b/globalsteps.lua index cc14a40..16048c8 100644 --- a/globalsteps.lua +++ b/globalsteps.lua @@ -73,7 +73,7 @@ local gs = function(dtime) announcement._next_runtime + (announcement.frequency or 3600) end - yl_announcements.say(os.date("!%H:%M:%S", os.time()) .. "=" .. + yl_announcements.log(os.date("!%H:%M:%S", os.time()) .. "=" .. tostring(announcement.id)) end end diff --git a/internal.lua b/internal.lua index 0d20033..bfa6131 100644 --- a/internal.lua +++ b/internal.lua @@ -2,12 +2,12 @@ -- Those that do real work should be local and wrapped in public functions local debug = yl_announcements.settings.debug or true -local function say(text) +local function log(text) if debug then minetest.log("action", "[MOD] yl_announcements : " .. text) end end -function yl_announcements.say(text) - return say(text) +function yl_announcements.log(text) + return log(text) end -- Storage @@ -15,13 +15,13 @@ end local function get_savepath() local save_path = yl_announcements.settings.save_path local path = yl_announcements.worldpath .. DIR_DELIM .. save_path - say("get_savepath : " .. dump(path)) + log("get_savepath : " .. dump(path)) return path end local function get_filepath(filename) local path_to_file = get_savepath() .. DIR_DELIM .. filename - say("get_filepath : " .. dump(filename) .. ":" .. dump(path_to_file)) + log("get_filepath : " .. dump(filename) .. ":" .. dump(path_to_file)) return path_to_file end @@ -31,7 +31,7 @@ local function save_json(filename, content) end local save_path = get_filepath(filename) local save_content = minetest.write_json(content) - say("save_json : " .. dump(save_path) .. ":" .. dump(save_content)) + log("save_json : " .. dump(save_path) .. ":" .. dump(save_content)) return minetest.safe_file_write(save_path, save_content) end @@ -43,7 +43,7 @@ local function load_json(path_to_file) file:close() if not content then return false, "Error reading file: " .. path_to_file end - say("load_json : " .. dump(path_to_file) .. ":" .. dump(content)) + log("load_json : " .. dump(path_to_file) .. ":" .. dump(content)) return true, minetest.parse_json(content) end @@ -68,7 +68,7 @@ local function validate_json(content, schema) -- Are all fields mentioned in the schema? for key, _ in pairs(content) do if schema[key] == nil then - say("validate_json : Unexpected field in key = " .. dump(key)) + log("validate_json : Unexpected field in key = " .. dump(key)) return false, "Unexpected field in " .. dump(key) end end @@ -76,7 +76,7 @@ local function validate_json(content, schema) -- Are all fields of the expected type? for key, expected_type in pairs(schema) do if type(content[key]) ~= expected_type then - say("validate_json : Validation error in key = " .. dump(key)) + log("validate_json : Validation error in key = " .. dump(key)) return false, "Validation error in " .. dump(key) .. " not of type " .. dump(expected_type) end end @@ -164,7 +164,7 @@ local function check_privs() end end end - say("PASS priv check") + log("PASS priv check") end function yl_announcements.check_privs() return check_privs() end