@sunlight_xlz/y3-lualib-types 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 sunlight_xlz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # @sunlight_xlz/y3-lualib-types
2
+
3
+ 从 [y3-editor/y3-lualib](https://github.com/y3-editor/y3-lualib) 自动生成的 Y3 Lua API
4
+ TypeScript 声明,适用于 TypeScriptToLua。
5
+
6
+ ```sh
7
+ yarn add -D @sunlight_xlz/y3-lualib-types
8
+ ```
9
+
10
+ 在 `tsconfig.json` 配置:
11
+
12
+ ```json
13
+ {
14
+ "compilerOptions": {
15
+ "strict": true,
16
+ "allowUmdGlobalAccess": true,
17
+ "types": ["@sunlight_xlz/y3-lualib-types"]
18
+ },
19
+ "tstl": { "luaTarget": "5.4" }
20
+ }
21
+ ```
22
+
23
+ ```ts
24
+ const point: y3.Point = y3.point.create(100, 200);
25
+ const player = y3.player.get_by_id(1);
26
+ const unit = y3.unit.create_unit(player, 10001, point, 0);
27
+ y3.timer.wait(1, (timer) => {
28
+ const name: string = unit.get_name();
29
+ timer.remove();
30
+ });
31
+ ```
32
+
33
+ 这是纯声明包,不包含 Lua 运行库。请在地图中另外安装并初始化 `y3-lualib`,
34
+ 不要运行时 import 此包。类型通过全局 `y3` 命名空间提供;点调用、冒号调用和多返回值
35
+ 分别匹配原始 Lua API。模块文件中使用全局 y3 需要 `allowUmdGlobalAccess`。
36
+
37
+ 上游的嵌套类型名转换为下划线,例如 `y3.Const.UnitAttr` → `y3.Const_UnitAttr`。
38
+ 运行时属性名保持原样,例如 `y3.const.UnitAttr`。
39
+
40
+ `generation.json` 包含精确上游 SHA、生成范围、外部未定义类型及注释精度诊断。
41
+ 声明逐成员保留中文文档和对应版本的源码链接。
42
+ 未注解参数使用 `any`;未注解返回值和上游外部未定义类型使用 `unknown`。
43
+ 泛型表使用 `LuaTable`,多返回值使用 `LuaMultiReturn`。
44
+ 这些声明经过 TypeScript 严格检查和代表性 TypeScriptToLua 编译验证,
45
+ 不代表所有 API 已在 Y3 游戏环境中逐一运行验收。
46
+
47
+ MIT 许可证;上游许可证见 `UPSTREAM-LICENSE`。
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 y3-editor
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.