[Commits] [wesnoth/wesnoth] 2486b8: lua: refactor to use lua 5.2 syntax for custom met...

GitHub noreply at github.com
Fri Dec 26 22:26:16 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 2486b8ba4bcef056fb523d91f4a8445b48aef685
      https://github.com/wesnoth/wesnoth/commit/2486b8ba4bcef056fb523d91f4a8445b48aef685
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-12-25 (Thu, 25 Dec 2014)

  Changed paths:
    M src/scripting/game_lua_kernel.cpp
    M src/scripting/lua_common.cpp
    M src/scripting/lua_common.hpp
    M src/scripting/lua_gui2.cpp
    M src/scripting/lua_types.cpp
    M src/scripting/lua_types.hpp

  Log Message:
  -----------
  lua: refactor to use lua 5.2 syntax for custom metatables

In lua 5.0, the preferred way to define custom metatables is to
use registry keys defined by pushing pointers as lightuserdata to
lua. (These pointers can be pointers to arbitrary constant objects,
as long as they are unique.)

In lua 5.2, the preferred way is to use constant strings as the
registry indices, and several lua API functions are introduced:
"luaL_newmetatable, luaL_setmetatable, luaL_checkudata,
luaL_testudata" which greatly simplify the operations for creating
the metatable, assigning it to a userdata, and checking if the
userdata has that type.

This commit switches over the keys associated to textdomains,
translatable strings, vconfigs, and lua gui2 dialogs to use the
new style, and simplifies some of the implementation details in
the process. For instance, luaW_toconfig no longer has to have an
optional argument to an index on the stack where the tstring
metatable is... these details are handled by the lua API instead.


  Commit: 017050df7069f27f468e19c23fbd7782bd7972fe
      https://github.com/wesnoth/wesnoth/commit/017050df7069f27f468e19c23fbd7782bd7972fe
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-12-26 (Fri, 26 Dec 2014)

  Changed paths:
    M data/lua/ilua.lua

  Log Message:
  -----------
  ilua: eliminate the "_" holds last executed command feature

the ilua `_pretty_print` feature has the property that it sets _
to be what was printed, as an interpreter feature so that _
represents the results of the previous expression. However it
appears that this may conflict with some parts of our api, for
instance the _ is used to hold the return value of
wesnoth.textdomain in the lua implementation of [harm_unit].

Note that there is no actual bug that I have observed, I merely
anticipate that this _ feature won't be compatible with our
established gettext conventions.


  Commit: 95b2c41a19251e8f849110572d776c91a4008906
      https://github.com/wesnoth/wesnoth/commit/95b2c41a19251e8f849110572d776c91a4008906
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-12-26 (Fri, 26 Dec 2014)

  Changed paths:
    M src/scripting/application_lua_kernel.cpp
    M src/scripting/lua_types.cpp
    M src/scripting/lua_types.hpp

  Log Message:
  -----------
  lua: get rid of lua "currentscriptKey" from an old branch

This key was created in the first attempt at application scripting
but it was reappropriated to be used as the key for the
"thread table" when the present solution based on coroutines was
found. The key has been renamed and moved to its site of usage now.


  Commit: 2239ab3f6592bdd18b0c07051b4b3fe5b8142459
      https://github.com/wesnoth/wesnoth/commit/2239ab3f6592bdd18b0c07051b4b3fe5b8142459
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-12-26 (Fri, 26 Dec 2014)

  Changed paths:
    A data/test/scenarios/test_lua.cfg
    M wml_test_schedule

  Log Message:
  -----------
  add a unit test for lua get_sides return object


  Commit: 1969267d192da67d1e20f176cef13937978698d3
      https://github.com/wesnoth/wesnoth/commit/1969267d192da67d1e20f176cef13937978698d3
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-12-26 (Fri, 26 Dec 2014)

  Changed paths:
    M src/CMakeLists.txt
    M src/SConscript
    M src/scripting/game_lua_kernel.cpp
    A src/scripting/lua_team.cpp
    A src/scripting/lua_team.hpp
    M src/scripting/lua_types.cpp
    M src/scripting/lua_types.hpp

  Log Message:
  -----------
  lua: move code related to get_sides metatable to its own file


  Commit: 2aca986bcb79b64a0befcc9266b96b9396328a79
      https://github.com/wesnoth/wesnoth/commit/2aca986bcb79b64a0befcc9266b96b9396328a79
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-12-26 (Fri, 26 Dec 2014)

  Changed paths:
    M src/unit_types.cpp
    M src/unit_types.hpp

  Log Message:
  -----------
  move unit_type::alignment_description impl into .cpp file


  Commit: a669f2525557c46e554cb851a536eec6a1390bd8
      https://github.com/wesnoth/wesnoth/commit/a669f2525557c46e554cb851a536eec6a1390bd8
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-12-26 (Fri, 26 Dec 2014)

  Changed paths:
    M src/CMakeLists.txt
    M src/SConscript
    M src/scripting/game_lua_kernel.cpp
    M src/scripting/lua_types.cpp
    M src/scripting/lua_types.hpp
    A src/scripting/lua_unit_type.cpp
    A src/scripting/lua_unit_type.hpp

  Log Message:
  -----------
  lua: move code related to getting unit types to its own file


  Commit: 53b1309691c8695c191b234324999f9792019ec0
      https://github.com/wesnoth/wesnoth/commit/53b1309691c8695c191b234324999f9792019ec0
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-12-26 (Fri, 26 Dec 2014)

  Changed paths:
    M data/lua/ilua.lua
    A data/test/scenarios/test_lua.cfg
    M src/CMakeLists.txt
    M src/SConscript
    M src/scripting/application_lua_kernel.cpp
    M src/scripting/game_lua_kernel.cpp
    M src/scripting/lua_common.cpp
    M src/scripting/lua_common.hpp
    M src/scripting/lua_gui2.cpp
    A src/scripting/lua_team.cpp
    A src/scripting/lua_team.hpp
    M src/scripting/lua_types.cpp
    M src/scripting/lua_types.hpp
    A src/scripting/lua_unit_type.cpp
    A src/scripting/lua_unit_type.hpp
    M src/unit_types.cpp
    M src/unit_types.hpp
    M wml_test_schedule

  Log Message:
  -----------
  Merge branch 'lua'


Compare: https://github.com/wesnoth/wesnoth/compare/4613275ec6fc...53b1309691c8


More information about the Commits mailing list