返回介绍

7.2 - Changes in the Libraries

发布于 2019-08-25 13:16:40 字数 1485 浏览 998 评论 0 收藏 0

7.2 - Changes in the Libraries

  • Function string.gfind was renamed string.gmatch.
    (Option LUA_COMPAT_GFIND)
  • When string.gsub is called with a function as its
    third argument,
    whenever this function returns nil or false the
    replacement string is the whole match,
    instead of the empty string.
  • Function table.setn was deprecated.
    Function table.getn corresponds
    to the new length operator (#);
    use the operator instead of the function.
    (Option LUA_COMPAT_GETN)
  • Function loadlib was renamed package.loadlib.
    (Option LUA_COMPAT_LOADLIB)
  • Function math.mod was renamed math.fmod.
    (Option LUA_COMPAT_MOD)
  • Functions table.foreach and table.foreachi are deprecated.
    You can use a for loop with pairs or ipairs instead.
  • There were substantial changes in function require due to
    the new module system.
    However, the new behavior is mostly compatible with the old,
    but require gets the path from package.path instead
    of from LUA_PATH.
  • Function collectgarbage has different arguments.
    Function gcinfo is deprecated;
    use collectgarbage("count") instead.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文