Exported mg_prepare_lua_environment()
merge