Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加基于Zip包形式的脚本包加载支持 #83

Merged
merged 9 commits into from
May 23, 2022

Conversation

only52607
Copy link
Owner

@only52607 only52607 commented May 22, 2022

简述

LMPK是一组脚本的集合,可用Zip或目录形式表述。

加载规则

与普通脚本载入方式相同,当加载文件符合以下条件时,该文件会被解析为LMPK脚本包

  1. ziplmpk后缀结尾的zip包
  2. 该文件是一个目录

其他情况下,文件会被解析为单个lua脚本文件

LMPK格式说明

LMPK可以是一个目录或zip文件,且其必须包含一个名为manifest.json的清单文件,以json形式表示。以下是manifest.json的一个示例

{
    "header": {
        "name": "lmpk测试",
        "author": "ooooonly",
        "version": "1.0",
        "description": "这是一个示例"
    },
    "main": "main.lua"
}

其中,main字段指定了入口文件,当脚本包被加载后,该入口文件首先会被执行。

header字段取代了普通脚本开头的头部信息,脚本头部的信息将被忽略,字段与原脚本头部字段相同。

入口文件可使用require等方式加载脚本包内其他模块,lm将从manifest.json所在目录进行路径搜寻。

@only52607 only52607 merged commit 43722e1 into master May 23, 2022
@only52607 only52607 deleted the enhance_multiple_script branch May 23, 2022 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant