--****************************************************************************** --* * --* File: FunctionProtection.lua Revision: 1.0 * --* * --* Purpose: protects Lua functions from being overwritten * --* * --* Creation: 04.04.2002 Last Modification: 04.04.2002 * --* * --* Platform: IBM-compatible PC running Windows 98SE * --* * --* Environment: Lua 4.0, TkLua 4.0 * --* * --* Author: Andreas Rozek Phone: ++49 (711) 6770682 * --* Kirschblütenweg 15 Fax: - * --* D-70569 Stuttgart EMail: Andreas.Rozek@T-Online.De * --* Germany * --* * --* URL: http://www.Andreas-Rozek.de/ * --* * --* Copyright: the software is published under the "GNU Lesser General Pub- * --* lic License" (see "http://www.fsf.org/copyleft/lesser.html" * --* for additional information) * --* * --* Comments: this code was mainly taken from * --* * --* http://www.lua.org/faq.html#3.3 * --* * --****************************************************************************** --**** do not execute this script more often than once **** if (type(protectFunction) == "function") then return nil; end; --****************************************************************************** --* * --* protectFunction protects functions from being overwritten * --* * --****************************************************************************** function protectFunction (FunctionName) error("unable to redefine function \""..protectFunction.."\""); end; settagmethod(tag(protectFunction), "setglobal", protectFunction);