lua-users home
lua-l archive

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

Hi all,

I'm still a beginner and I'm experimenting w/ Lua; I tried the archives but
didn't find any answers to this. In C++ I'd like to be able to load a .lua file
containing some functions like this:

-- FirstFile.lua
function Func1 ( a, b )
	return a + b

function Func2 ( c )
	-- Do something w/ c

Later on I'd like to load a different .lua file with some (or all) of the same
function names but different function bodies:

-- SecondFile.lua
function Func1 ( a, b )
	return a + b + 100

-- Func2 is not implemented

So before loading SecondFile.lua I'd like to go through the list of defined
functions in FirstFile.lua and undefine all (or some - based on certain
conditions) of them - as some of them will be redefined in SecondFile.lua.

Is there a way to learn what functions are defined when I call lua_dofile() /
lua_dostring()? And using this information, is there a way to programmatically
undefine these functions?

Thanks a lot,
Gyorgy Bozoki