From 2ac80fc6a8e9a54fee382a14c5a84873233053ed Mon Sep 17 00:00:00 2001 From: taynpg Date: Thu, 13 Feb 2025 15:48:08 +0800 Subject: [PATCH] =?UTF-8?q?add=EF=BC=9A=E6=B7=BB=E5=8A=A0=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E7=A4=BA=E4=BE=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/env.bat | 2 ++ demo/t1.lua | 3 +++ demo/t2.lua | 14 ++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 demo/env.bat create mode 100644 demo/t1.lua create mode 100644 demo/t2.lua diff --git a/demo/env.bat b/demo/env.bat new file mode 100644 index 0000000..cf7210e --- /dev/null +++ b/demo/env.bat @@ -0,0 +1,2 @@ +@echo off +cmd /k "set PATH=%PATH%;%~dp0..\build\bin\" \ No newline at end of file diff --git a/demo/t1.lua b/demo/t1.lua new file mode 100644 index 0000000..7a7ebb7 --- /dev/null +++ b/demo/t1.lua @@ -0,0 +1,3 @@ +local str = "中文" +local s = #str * 100 +print(s) \ No newline at end of file diff --git a/demo/t2.lua b/demo/t2.lua new file mode 100644 index 0000000..931f712 --- /dev/null +++ b/demo/t2.lua @@ -0,0 +1,14 @@ +local script_path = arg[0] -- 获取脚本路径 +local script_dir = script_path:match("(.*)[/\\]") or "./" -- 只要()部分的内容 +package.cpath = package.cpath .. ";" .. script_dir .. "/../export/?.dll;;" + +-- 试图加载 lua_fs +local fs = require("lua_fs") + +-- 获取目录下的文件列表 +local v = fs.get_dir_files(".") +if v then + for i, line in ipairs(v) do + print(i, line) + end +end