On Thursday 22 April 2004 14:36, Fabricio de Alexandria wrote:
> Hi everyone,
> I was developing scripts in Lua 5 and now I have to make them work with
> Lua 4 version. I'm using _G variable and I don't know the equivalent in
> Lua 4.
-- Jamie Webb
Thanks. I thought this was related to what I want. I've already had a look
at this in the manual but I just found the set/getglobal. I don't know if
I understood what this functions do but I think this is not what I'm
looking for. They get/set values of a global variable. I want to change a
function and introduce new instructions on it.
This is what I want to do. I have a function called test() and I want to
function change( f )
table = _G
local old_fn = table[f]
table[f] = function( ... )
print "function changed"
return (old_fn)(unpack( arg ))
print 'before change'
print 'after change'
And I get this:
What could be the equivalent code in Lua 4?
On Thu, 22 Apr 2004, Jamie Webb wrote:
> On Thursday 22 April 2004 14:36, Fabricio de Alexandria wrote:
> > Hi everyone,
> > I was developing scripts in Lua 5 and now I have to make them work
> > Lua 4 version. I'm using _G variable and I don't know the equivalent
> > Lua 4.
> -- Jamie Webb