From eaa823a5971bfd2e9cb38dd8f30fefee2da95c2e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 21 Feb 2015 10:36:37 +0100 Subject: util.*: Remove use of module() function, make all module functions local and return them in a table at the end --- util/watchdog.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'util/watchdog.lua') diff --git a/util/watchdog.lua b/util/watchdog.lua index bcb2e274..aa8c6486 100644 --- a/util/watchdog.lua +++ b/util/watchdog.lua @@ -2,12 +2,12 @@ local timer = require "util.timer"; local setmetatable = setmetatable; local os_time = os.time; -module "watchdog" +local _ENV = nil; local watchdog_methods = {}; local watchdog_mt = { __index = watchdog_methods }; -function new(timeout, callback) +local function new(timeout, callback) local watchdog = setmetatable({ timeout = timeout, last_reset = os_time(), callback = callback }, watchdog_mt); timer.add_task(timeout+1, function (current_time) local last_reset = watchdog.last_reset; @@ -31,4 +31,6 @@ function watchdog_methods:cancel() self.last_reset = nil; end -return _M; +return { + new = new; +}; -- cgit v1.2.3