From: Tobias Ulmer Date: Tue, 4 Sep 2012 12:07:01 +0000 (+0200) Subject: Use strict module, but still allow for extending the scm interface X-Git-Tag: e2factory-2.3.13rc1~118 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=ec37aa631d64a6cedc8b64ff4ec0d12d927799d1;p=e2factory.git Use strict module, but still allow for extending the scm interface Signed-off-by: Tobias Ulmer --- 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: