[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: (Q) How to protect C-functions from being redefined?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 31 Jan 2000 10:48:50 -0200 (EDT)
>From email@example.com Mon Jan 31 08:35:03 2000
>From: "Maciej Maczynski" <firstname.lastname@example.org>
>I have C-function registered with lua_register.
>How can I protect them from being re-defined in Lua code?
>I've tried the piece of code from FAQ, but it seems to be working only with
>native Lua functions.
Section 3.3 of the FAQ contains
This protects *all* Lua functions, because we are using "tag(protect)", and
"protect" is a Lua function.
To protect a C function named "f", do
but note that this protects *all* C functions because all C functions have the
If Lua allowed tags to be set for functions, then you could proctect only f
by simply setting a newtag for f and using this tag in settagmethod.
However, you can use the more elaborated scheme described in FAQ 3.3.