From ec37aa631d64a6cedc8b64ff4ec0d12d927799d1 Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Tue, 4 Sep 2012 14:07:01 +0200 Subject: [PATCH] Use strict module, but still allow for extending the scm interface Signed-off-by: Tobias Ulmer --- local/scm.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/local/scm.lua b/local/scm.lua index db23a82..5a195aa 100644 --- a/local/scm.lua +++ b/local/scm.lua @@ -26,9 +26,10 @@ ]] local scm = {} -local err = require("err") local e2lib = require("e2lib") +local err = require("err") local environment = require("environment") +local strict = require("strict") -- scm modules local scms = {} @@ -87,7 +88,12 @@ function scm.register_interface(name) -- we have lots of calls like scm.(...). Register the interface -- function in the scm module to support those calls. - scm[name] = func + if strict.islocked(scm) then + strict.declare(scm, {[name]=func}) + else + scm[name] = func + end + return true, nil end @@ -263,6 +269,6 @@ scm.register_interface("working_copy_available") scm.register_interface("display") scm.register_interface("has_working_copy") -return scm +return strict.lock(scm) -- vim:sw=4:sts=4:et: -- 2.39.5