I believe the camera's boot up self test will return a lens or other mechanical error if the lens/zoom module has been removed.
Very likely.
The primitive LUA script below does not work,when run it prints: :3: name or '...' expected near "MechaUnRegisterEventProcedure" Press Shutter To Close. Any suggestions very appreciated
function call_event_proc("MechaUnRegisterEventProcedure")
The "function" is a mistake, it tells you lua you are trying to create a new function called call_event_proc and putting a constant string in the parameter list. call_event_proc is already a function, so correct usage would be
call_event_proc("MechaUnRegisterEventProcedure")
However, this will not help you. MechaUnRegisterEventProcedure would just unregister some eventprocs, it won't do what you want. Even if those functions were responsible for the error detection, almost all of the normal canon code calls functions directly, without going through the eventproc interface.
There have been some discussions of how to get the cameras to work without lenses, for example
http://chdk.setepontos.com/index.php?topic=6725.0