update test

This commit is contained in:
白茶清欢 2025-05-12 17:37:44 +08:00
parent 3253191437
commit 6df50488ba

View File

@ -23,6 +23,27 @@ skills = {"typescript", "unity", "lua"}
}
local json_str = json.encode(lua_table)
print(json_str) -- 输出JSON字符串`,
"http": `
local http = require("http.request")
-- 创建一个HTTP请求的选项表
local options = {
url = "http://example.com",
method = "GET",
}
-- 发起请求
local res, code = http.request(options)
-- 检查请求是否成功
if code == 200 then
print("请求成功,下面是返回内容:")
print(res)
else
print("请求失败,状态码:" .. code)
end
`,
}
if err := InitVM(1024, nil, scriptTable); err != nil {
panic(err.Error())
@ -30,4 +51,7 @@ print(json_str) -- 输出JSON字符串`,
_, err := VMInstance.RunPreCompileScript("json")
fmt.Println(err)
_, err = VMInstance.RunPreCompileScript("http")
fmt.Println(err)
}