Remove dependency on marshal and push the Lua error handler only once

This makes a number of changes:
  * Remove the dependency on marshal by using string.dump and loadstring.
  * Use lua_tolstring rather than having Lua functions pass string lengths to C++.
  * Move lua_api/l_async_events.* to cpp_api/s_async.*, where it belongs.
  * Make AsyncWorkerThread a child of ScriptApiBase, this removes some duplicate functionality.
  * Only push the error handler once per Lua stack by storing it's index in ScriptApiBase::m_errorhandler.
  * Code style fixes
  * Pop some more items from the stack
  * Other misc changes

I am unsure of whether the check for broken LuaJIT versions is still relevant, as string.dump may not be broken on those versions.