当前位置: 首页>>代码示例>>Python>>正文


Python lupa.LuaRuntime方法代码示例

本文整理汇总了Python中lupa.LuaRuntime方法的典型用法代码示例。如果您正苦于以下问题:Python lupa.LuaRuntime方法的具体用法?Python lupa.LuaRuntime怎么用?Python lupa.LuaRuntime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lupa的用法示例。


在下文中一共展示了lupa.LuaRuntime方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load_protocol

# 需要导入模块: import lupa [as 别名]
# 或者: from lupa import LuaRuntime [as 别名]
def load_protocol(self, path):
		lua = lupa.LuaRuntime(attribute_handlers=(getter, setter))
		self.lua = lua
		lua.globals()["flow"] = flow
		lua.globals()["channels"] = self.context.get_channels()
		lua.globals()["context"] = self.context
		source = open(path).read()

		try:
			lua.execute(source)
			self.guiBlocks = lua.eval('setup()')
			#lua.eval('gui()')
		except Exception as e:
			print ('Lua Exception occured: ', e, type(e))
			raise

		for block in self.guiBlocks:
			dock = Dock(block.name)
			dock.addWidget(block.widget())
			self.dockarea.addDock(dock)

		if 'doc_config' in lua.globals():
			self.restore_layout() 
开发者ID:strfry,项目名称:OpenNFB,代码行数:25,代码来源:launcher.py

示例2: __init__

# 需要导入模块: import lupa [as 别名]
# 或者: from lupa import LuaRuntime [as 别名]
def __init__(self):
        self._rt = lupa.LuaRuntime(unpack_returned_tuples=True, encoding=None)
        if self.eval("type(jit) == 'table'"):
            raise RuntimeError("lupa must be linked against Lua, not LuaJIT.\n"
                               "Please install lupa with `--no-luajit`.")
        self._setup_runtime() 
开发者ID:jbaiter,项目名称:chdkptp.py,代码行数:8,代码来源:lua.py

示例3: __init__

# 需要导入模块: import lupa [as 别名]
# 或者: from lupa import LuaRuntime [as 别名]
def __init__(self, server, chatbot):
        # Init interpreter, create functions/namespaces in Lua's global state
        self.lua = LuaRuntime(unpack_returned_tuples=True)
        self.lua.execute(load_script("lua_bridge/init.lua"))

        # Params: str:namespace, str:name, pyfunc:func
        self.new_bind = self.lua.eval("bridge.new_bind")

        # Params: str:namespace
        self.new_namespace = self.lua.eval("bridge.new_namespace")
        self.lua.eval("log.info(\"Initialisation complete\")")

        self.server = server
        self.chatbot = chatbot
        self.create_binds() 
开发者ID:th3-z,项目名称:kf2-magicked-admin,代码行数:17,代码来源:lua_bridge.py

示例4: get_label_for_problem

# 需要导入模块: import lupa [as 别名]
# 或者: from lupa import LuaRuntime [as 别名]
def get_label_for_problem(self):
        if not self.problem_label_script:
            return self.format.get_label_for_problem

        def DENY_ALL(obj, attr_name, is_setting):
            raise AttributeError()
        lua = LuaRuntime(attribute_filter=DENY_ALL, register_eval=False, register_builtins=False)
        return lua.eval(self.problem_label_script) 
开发者ID:DMOJ,项目名称:online-judge,代码行数:10,代码来源:contest.py

示例5: __init__

# 需要导入模块: import lupa [as 别名]
# 或者: from lupa import LuaRuntime [as 别名]
def __init__(self, username, accountname, apikey):
        self.username = username
        self.accountName = accountname
        self.apiKey = apikey
        self.lua = LuaRuntime()
        self.urlParser = re.compile('/([a-zA-Z0-9_-]+)/(\d+)')
        self.waList = {}
        self.waIgnored = {}
        self.uidCache = {}
        self.idCache = {}
        self.dataCache = {'slugs': [], 'uids': [], 'ids': []}
        if self.username == 'DISABLED':
            self.username = ''
        if not os.path.isfile(Path(f'WTF/Account/{self.accountName}/SavedVariables/WeakAuras.lua')):
            raise RuntimeError('Incorrect WoW account name!') 
开发者ID:AcidWeb,项目名称:CurseBreaker,代码行数:17,代码来源:Wago.py


注:本文中的lupa.LuaRuntime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。