加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Lua的`package.config`中的最后几行是什么意思?

发布时间:2020-12-14 21:49:47 所属栏目:大数据 来源:网络整理
导读:Lua specs say about package.config (由我添加的编号): The first line is the directory separator string. Default is ‘ ‘ for Windows and ‘ / ‘ for all other systems. The second line is the character that separates templates in a path.
Lua specs say about package.config(由我添加的编号):

  1. The first line is the directory separator string. Default is ‘‘ for Windows and ‘/‘ for all other systems.
  2. The second line is the character that separates templates in a path. Default is ‘;‘.
  3. The third line is the string that marks the substitution points in a template. Default is ‘?‘.
  4. The fourth line is a string that,in a path in Windows,is replaced by the executable’s directory. Default is ‘!‘.
  5. The fifth line is a mark to ignore all text before it when building the luaopen_ function name. Default is ‘-‘.

我的解释:

>绝对清晰(Windows /其他系统的示例使其成为傻瓜证明)
>路径字符串中可以有多个路径.它们由此符号分隔(默认情况下为;).
>无论Lua在路径字符串中找到此字符(默认情况下为?),它都会将其替换为提供给require或package.searchpath函数的模块名称,并检查该文件是否存在.

到目前为止,这么好,但最后两行对我来说并不完全清楚.

>为什么它说“在Windows中的路径”?这是否意味着在其他平台上,这没有任何意义?如果是这样,为什么?
>我花了一段时间来理解这一点,但最终another part of the specs给了我一个提示:

The name of this C function is the string “luaopen_” concatenated with a copy of the module name where each dot is replaced by an underscore. Moreover,if the module name has a hyphen,its prefix up to (and including) the first hyphen is removed. For instance,if the module name is a.v1-b.c,the function name will be luaopen_b_c.

这个符号( – 默认情况下)也是如此,它可以同时提供不同版本的库 – 可能是对最新版本的无前缀符号链接,以便可以在两个路径上访问相同的库(即在两个模块名称下),但只有一个C符号名称?

解决方法

4:Linux应用程序在系统范围内安装了库;但是,对于Windows,库可以安装在当前目录中.

5:我认为版本控制和项目分叉将是背后的原因.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读