lua-users home
lua-l archive

Re: Lua and C - misc questions

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.

AltStyle によって変換されたページ (->オリジナル) /