questions about Wesnoth-Lua

Discussion of Lua and LuaWML support, development, and ideas.

Moderator: Forum Moderators

Post Reply
denispir
Posts: 184
Joined: March 14th, 2013, 12:26 am

questions about Wesnoth-Lua

Post by denispir »

Hello,

About cfg & __cfg & __literal:
  • Maybe it's just an issue of funny naming:Wwhy is cfg called that way? Why not input or params? Can I safely assume that it is always, and only, params/input stored in a table? (or userdata)
  • What is __cfg?
  • What is, clearly and factually, __literal? And why is it called that way?
Base modules & documentation:
  • I think I remember that the mysterious Wesnoth module is in fact cpp code: correct? But where is it? And can we find some documentation about it? The short lists provided in the LuaWML wiki page's subpages (or LuaAPI), open more questions than they answer... (and no example to help understand)
  • Where is the map module? (same questions as above possibly)
A funny problem:
When a unit is blocked on its path toward a goal, by an ally standing on its "virtual halt" tile, how to determine the 2 neighbour tiles +/- leading forwards? I have found:
wesnoth.map.rotate_right_around_center(loc, center, angle)
but the fact that it expects an "angle" in range 1...6 makes me doubt about its functionality.

Thank you!
User avatar
octalot
General Code Maintainer
Posts: 783
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: questions about Wesnoth-Lua

Post by octalot »

IIUC, the wesnoth module is a table of functions, which can be added to or even overridden. The table is created, and a lot of functions are added in, src/scripting/game_lua_kernel.cpp.
denispir
Posts: 184
Joined: March 14th, 2013, 12:26 am

Re: questions about Wesnoth-Lua

Post by denispir »

octalot wrote: November 6th, 2019, 1:56 pm IIUC, the wesnoth module is a table of functions, which can be added to or even overridden. The table is created, and a lot of functions are added in, src/scripting/game_lua_kernel.cpp.
Thank you! I will have a look.

EDIT: Ok, that's what I was searching for. Unfortunately, it can hardly be useful for my 2 use cases:
  • Understanding better what each func does, or what each structure contains, and the logic behind.
  • Expanding & improving the doc on all that online.
The problem is that it is mainly calls to other C++ code (indeed), and full of inner conventions of the Wesnoth codebase (expected). Thus, just studying the simplest functionality defined there requires a disproportianate efforts, and entails a high risk of misinterpretation.
Conclusion: only involved coders can improve that; or maybe also highly motivated "scriptors" who have done the work of longuish and penible trial & error explorations (on the Wesnoth platform even much more).
Last edited by denispir on November 7th, 2019, 10:51 am, edited 1 time in total.
Tad_Carlucci
Inactive Developer
Posts: 503
Joined: April 24th, 2016, 4:18 pm

Re: questions about Wesnoth-Lua

Post by Tad_Carlucci »

/s

"cfg" is named that to reduce the amount of work on the keypunch department, and ensure we stay within the 72-column limit for punchcards, to allow us to re-colate them should we drop the card tray.
I forked real life and now I'm getting merge conflicts.
denispir
Posts: 184
Joined: March 14th, 2013, 12:26 am

Re: questions about Wesnoth-Lua

Post by denispir »

Tad_Carlucci wrote: November 6th, 2019, 4:07 pm "cfg" is named that to reduce the amount of work on the keypunch department, and ensure we stay within the 72-column limit for punchcards, to allow us to re-colate them should we drop the card tray.
I would then propose "i" as in i/o.
Post Reply