add:添加两个示例。

This commit is contained in:
taynpg 2025-02-13 15:48:08 +08:00
parent 98a64e5a2f
commit 2ac80fc6a8
3 changed files with 19 additions and 0 deletions

2
demo/env.bat Normal file
View File

@ -0,0 +1,2 @@
@echo off
cmd /k "set PATH=%PATH%;%~dp0..\build\bin\"

3
demo/t1.lua Normal file
View File

@ -0,0 +1,3 @@
local str = "中文"
local s = #str * 100
print(s)

14
demo/t2.lua Normal file
View File

@ -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