mirror of
https://github.com/sususweet/midea-meiju-codec.git
synced 2025-11-12 07:51:54 +00:00
Merge pull request #41 from happyhaha1/master
feat(lua): enhance runtime environment with resilient module loading
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
import os
|
||||||
import lupa
|
import lupa
|
||||||
import threading
|
import threading
|
||||||
import json
|
import json
|
||||||
@@ -20,12 +20,12 @@ class LuaRuntime:
|
|||||||
self._runtimes.execute('require "cjson"')
|
self._runtimes.execute('require "cjson"')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
MideaLogger.warning(f"Failed to load cjson: {e}")
|
MideaLogger.warning(f"Failed to load cjson: {e}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._runtimes.execute('require "bit"')
|
self._runtimes.execute('require "bit"')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
MideaLogger.warning(f"Failed to load bit: {e}")
|
MideaLogger.warning(f"Failed to load bit: {e}")
|
||||||
|
|
||||||
# 加载设备特定的Lua文件
|
# 加载设备特定的Lua文件
|
||||||
string = f'dofile("{file}")'
|
string = f'dofile("{file}")'
|
||||||
self._runtimes.execute(string)
|
self._runtimes.execute(string)
|
||||||
|
|||||||
Reference in New Issue
Block a user