move actor definition stuff into ActorDef.lua

handle loading other definitions
This commit is contained in:
Glenn Maynard
2006-10-15 05:02:58 +00:00
parent 68db5dff42
commit b0e5b201e3
2 changed files with 149 additions and 32 deletions
@@ -92,38 +92,6 @@ function Actor:scale_or_crop_background()
end
end
Def = {}
setmetatable( Def, {
__index = function(self, Type)
-- t is an actor definition table. name is the type
-- given to Def. Fill in standard fields.
return function(t)
if not t.Type then
t.Type = Type;
end
local info = debug.getinfo(2,"Sl");
-- Source file of caller:
local Source = info.source;
t._Source = Source;
if Source:sub( 1, 1 ) == "@" then
local Path = Source:sub( 2 );
-- Directory of caller, for relative paths:
local pos = Path:find_last( '/' );
t._Dir = string.sub( Path, 1, pos );
end
-- Line number of caller:
t._Line = info.currentline;
return t;
end
end
});
-- (c) 2006 Glenn Maynard
-- All rights reserved.
--