Allow Lua concatenated tables to concatenate functions. This means

that code loading an actor can have an InitCommand even if the actor
itself also has an InitCommand.  The actor's own InitCommand will be
run first, followed by the caller's.
This commit is contained in:
Glenn Maynard
2007-02-06 02:59:48 +00:00
parent c95f22f013
commit 0ec4356901
@@ -17,8 +17,15 @@ local function MergeTables( left, right )
for key, val in pairs(right) do
if ret[key] then
Warn( string.format( "%s\n\nOverriding \"%s\"",
debug.traceback(), key) );
if type(val) == "function" and
type(ret[key]) == "function" then
local f1 = ret[key];
local f2 = val
val = function(...) f1(...); return f2(...) end
else
Warn( string.format( "%s\n\nOverriding \"%s\"",
debug.traceback(), key) );
end
end
ret[key] = val;