[wesnoth-commits] [wesnoth/wesnoth] 86f66a: Lua: Add a few more useful functions to the WML mo...

Celtic Minstrel noreply at github.com
Mon Dec 2 01:26:21 UTC 2019


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 86f66a5825764837570c23d544e0feab568675a5
      https://github.com/wesnoth/wesnoth/commit/86f66a5825764837570c23d544e0feab568675a5
  Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
  Date:   2019-12-01 (Sun, 01 Dec 2019)

  Changed paths:
    M data/lua/core.lua
    M src/scripting/game_lua_kernel.cpp
    M src/scripting/lua_common.cpp
    M src/scripting/lua_kernel_base.cpp

  Log Message:
  -----------
  Lua: Add a few more useful functions to the WML module and make WML table conversion a little more robust

- New functions: wml.find_child, wml.attribute_count, wml.equal, wml.valid
- When converting a Lua table to WML, the engine will no longer accept invalid attributes
- Use of wml.tovconfig in plugin or map generation scripts is deprecated (it already doesn't quite work properly in those contexts but still could've been used as a way to test a table's validity as WML)


  Commit: aa5ac6af29897c09d50cd4194634327bbc19e5d4
      https://github.com/wesnoth/wesnoth/commit/aa5ac6af29897c09d50cd4194634327bbc19e5d4
  Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
  Date:   2019-12-01 (Sun, 01 Dec 2019)

  Changed paths:
    M data/lua/core.lua
    M src/scripting/lua_common.cpp
    M src/scripting/lua_kernel_base.cpp

  Log Message:
  -----------
  Add stringx module that exposes Wesnoth's split/join functions to Lua

The built-in string module is set as the metatable index for the stringx module, and the stringx module is set as the metatable index for strings, meaning all string and stringx methods are available through (''):method_name.

This also enables direct indexing of strings to get individual characters (ie ('str')[1] and the like), which package.lua already assumed even though it didn't work. Negative indices are supported to, and index from the end of the srring.

New functions:
- stringx.split
- stringx.parenthetical_split
- stringx.map_split
- stringx.escaped_split
- stringx.quoted_split
- stringx.anim_split
- stringx.join
- stringx.join_map


  Commit: 57bb4224b0d37b1e9c7cfade26dec6782ef9266d
      https://github.com/wesnoth/wesnoth/commit/57bb4224b0d37b1e9c7cfade26dec6782ef9266d
  Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
  Date:   2019-12-01 (Sun, 01 Dec 2019)

  Changed paths:
    M data/lua/wml/items.lua

  Log Message:
  -----------
  Declare wesnoth.interface.remove_overlay directly instead of declaring it local and then assigning it


Compare: https://github.com/wesnoth/wesnoth/compare/680e7741ff60...57bb4224b0d3



More information about the Commits mailing list