[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua and C - misc questions
- From: Diaa Sami <diaasami@...>
- Date: Tue, 23 Aug 2005 05:54:48 +0300
Ben Sunshine-Hill wrote:
You have to understand that there is no difference between a chunk and
a function. A registered global function is merely a chunk that has
been assigned as a value in the global table.
well, I do understand this, thank you.
what I'm asking about is how to identify which gobal functions and
variables were added by a specific chunk, so I'd be able to remove them.
example:
consider this lua chunk:
--------------------------------
yUpper = -240;
yLower = 480;
button_speed = 20;
function draw()
draw_image(upperPart, 0, yUpper);
draw_image(lowerPart, 0, yLower);
end
function update1()
local upperDone = false;
local lowerDone = false;
-- do some stuff, change yUpper and yLower.
return false;
end
function update2()
-- do some other stuff.
return false;
end
update = update1;
------------------------------
this chunk added 3 global functions(draw, update, update2) and 3 global
variables(yUpper, yLower and button_speed).
I want to remove such functions and variables when I don't need this
chunk anymore.