Exemplo n.º 1
0
 def start_main(self, lua_source):
     """
     Start "main" function and return it as a coroutine.
     """
     splash_obj = self._get_wrapper()
     if self.sandboxed:
         main, env = get_main_sandboxed(self.lua, lua_source)
         main_coro = self._sandbox.create_coroutine(main)
         return main_coro(splash_obj)
     else:
         main, env = get_main(self.lua, lua_source)
         return main.coroutine(splash_obj)
Exemplo n.º 2
0
 def start_main(self, lua_source):
     """
     Start "main" function and return it as a coroutine.
     """
     splash_obj = self._get_wrapper()
     if self.sandboxed:
         main, env = get_main_sandboxed(self.lua, lua_source)
         main_coro = self._sandbox.create_coroutine(main)
         return main_coro(splash_obj)
     else:
         main, env = get_main(self.lua, lua_source)
         return main.coroutine(splash_obj)
Exemplo n.º 3
0
 def start_main(self, lua_source):
     """
     Start "main" function and return it as a coroutine.
     """
     splash_obj = self.get_wrapper()
     if self.sandboxed:
         main, env = get_main_sandboxed(self.lua, lua_source)
         # self.script_globals = env  # XXX: does it work well with GC?
         create_coroutine = self.lua.globals()["create_sandboxed_coroutine"]
         coro = create_coroutine(main)
         return coro(splash_obj)
     else:
         main, env = get_main(self.lua, lua_source)
         # self.script_globals = env  # XXX: does it work well with GC?
         return main.coroutine(splash_obj)
Exemplo n.º 4
0
 def get_main(self, lua_source):
     if self.sandboxed:
         main, env = get_main_sandboxed(self.lua, lua_source)
     else:
         main, env = get_main(self.lua, lua_source)
     return self.lua.create_coroutine(main)
Exemplo n.º 5
0
 def _get_main(self, lua_source):
     if self.sandboxed:
         main, env = get_main_sandboxed(self.lua, lua_source)
     else:
         main, env = get_main(self.lua, lua_source)
     return self.lua.create_coroutine(main)