aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2024-06-17 03:52:59 +0800
committer简律纯 <i@jyunko.cn>2024-06-17 03:52:59 +0800
commit525de52d687b44fb14be7da2c46c548eb8a32fbd (patch)
treef696587114334a87bcc672f08b9c161d797abf13 /tests
parent5597a8af382e256951d3813aad1cedf41fcde9ac (diff)
downloadHydroRoll-525de52d687b44fb14be7da2c46c548eb8a32fbd.tar.gz
HydroRoll-525de52d687b44fb14be7da2c46c548eb8a32fbd.zip
refactor(examples): update file tree
Diffstat (limited to 'tests')
-rw-r--r--tests/lua_in_python.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/lua_in_python.py b/tests/lua_in_python.py
index 0cb2700..0f929df 100644
--- a/tests/lua_in_python.py
+++ b/tests/lua_in_python.py
@@ -18,20 +18,35 @@ from lupa import LuaRuntime
lua = LuaRuntime(unpack_returned_tuples=True)
import os
+
def get_Dice_Dir():
- return os.path.dirname(os.path.abspath(__file__))
+ return os.path.dirname(os.path.abspath("__file__"))
lua.globals().getDiceDir = get_Dice_Dir
-lua.globals().package.path = lua.globals().package.path + ';' + os.path.join(get_Dice_Dir(), '?.lua')
+lua.globals().package.path = (
+ lua.globals().package.path
+ + ";"
+ + os.path.join(get_Dice_Dir(), "?.lua")
+ + ";"
+ + os.path.join(get_Dice_Dir(), "?.dll")
+ + ";"
+ + os.path.join(os.path.dirname(os.path.abspath(__file__)), "?.lua")
+ + ";"
+ + os.path.join(os.path.dirname(os.path.abspath(__file__)), "?.dll")
+)
+
try:
lua.execute(
"""\
+ print()
print(getDiceDir())
+ print()
print(package.path)
js = require('json')
+ print()
print(js)
- """
+ """
)
except Exception as e:
- print(f'{e!r}') \ No newline at end of file
+ print(f"{e!r}")