Lizard
09-05-2006, 04:42 PM
I have a project which uses the luaCOM plugin to call a DLL (written in VB6) which updates a database by running a series of scripts. The DLL raises events whenever a script starts or stops. The following snippet shows what I'm doing:
DatabaseManager_events = {}
function DatabaseManager_events:OnScriptStart(Name)
SetupData.WriteToLogFile("Notice\tScript started: "..Name.."\r\n");
end
function DatabaseManager_events:OnScriptStop(Abort)
SetupData.WriteToLogFile("Notice\tScript stopped\r\n");
end
function UpdateDatabase(Action)
DatabaseManager = luacom.CreateObject("DBUpdate.DatabaseManager");
assert(DatabaseManager);
res, cookie = luacom.Connect(DatabaseManager, DatabaseManager_events);
DatabaseManager:UpdateDatabase();
DatabaseManager = nil;
collectgarbage();
end
The code executes fine, and the log has my lines showing the names of each script. The problem is that after the setup runs, I get a Windows popup saying "Setup Application has encountered an error and needs to close". If I comment out the luacom.Connect line, it works fine (but doesn't log the scripts, of course).
Anyone know what I'm doing wrong?
DatabaseManager_events = {}
function DatabaseManager_events:OnScriptStart(Name)
SetupData.WriteToLogFile("Notice\tScript started: "..Name.."\r\n");
end
function DatabaseManager_events:OnScriptStop(Abort)
SetupData.WriteToLogFile("Notice\tScript stopped\r\n");
end
function UpdateDatabase(Action)
DatabaseManager = luacom.CreateObject("DBUpdate.DatabaseManager");
assert(DatabaseManager);
res, cookie = luacom.Connect(DatabaseManager, DatabaseManager_events);
DatabaseManager:UpdateDatabase();
DatabaseManager = nil;
collectgarbage();
end
The code executes fine, and the log has my lines showing the names of each script. The problem is that after the setup runs, I get a Windows popup saying "Setup Application has encountered an error and needs to close". If I comment out the luacom.Connect line, it works fine (but doesn't log the scripts, of course).
Anyone know what I'm doing wrong?