Wesnoth Lua Pack: Development Thread

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

Moderator: Forum Moderators

Post Reply
User avatar
Celtic_Minstrel
Developer
Posts: 1839
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Wesnoth Lua Pack: Development Thread

Post by Celtic_Minstrel »

Glancing over the WLP on GitHub, I notice that some of the things it implements are now in mainline, while others perhaps could be migrated to mainline… there are certainly things that probably don't need to be migrated to mainline as well, though.
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.
User avatar
Elvish_Hunter
Forum Moderator
Posts: 1482
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: Wesnoth Lua Pack: Development Thread

Post by Elvish_Hunter »

When you wrote on IRC about that, I answered you through Discord; however, because in that moment your client wasn't in the channel, you never saw my answer :(
This is the conversation as it was supposed to happen:

Code: Select all

02:12:29 <celticminstrel> Elvish_Hunter: Looking at WLP, I notice that most of the Lua utils seem to be redundant now?
02:13:08 <celticminstrel> Also redundant are [alert] and [confirm].
02:13:30 <celticminstrel> [choice_box] might be, I can't quite remember.
02:13:38 <celticminstrel> (Assuming it does what it sounds like.)
02:14:09 <celticminstrel> (Tags being redundant means they can be roughly a one-liner.)
02:19:41 <celticminstrel> I think most of the math/variable tags would do better merged to mainline…
02:20:04 <celticminstrel> (As part of [set_variable] or maybe [set_variables], though I think none fit the latter.)
02:25:10 <celticminstrel> I think it's totally worth it to add gui.prompt() as a standard dialog in Wesnoth. Maybe I could steal the definition from WLP?
09:31:30 <+wesdiscordbot> <Elvish_Hunter> celticminstrel: about [choice_box], you can read its documentation here: https://github.com/Elvish-Hunter/Wesnoth_Lua_Pack/blob/master/docs/InterfaceActionsWML.md
09:33:03 <+wesdiscordbot> <Elvish_Hunter> The math tags and [prompt] can be added to mainline, if you want.
09:42:10 <+wesdiscordbot> <Elvish_Hunter> Once you decide what code or tags should be moved to mainline, please notify me in some way, so I can remove the obsolete stuff from the WLP.
09:45:25 <+wesdiscordbot> <Elvish_Hunter> BTW, can you put in https://wiki.wesnoth.org/LuaAPI a list of all the functions that have been renamed or moved into a module and the corresponding new name?
09:46:41 <+wesdiscordbot> <Elvish_Hunter> It'd make updating UMC Lua code easier, even if someone doesn't read the changelog.
Current maintainer of these add-ons:
1.16: The Sojournings of Grog, Wesnoth Lua Pack
1.14: A Rough Life, The White Troll (co-author)
1.12, will port to 1.16: Children of Dragons
vghetto
Posts: 623
Joined: November 2nd, 2019, 5:12 pm

Re: Wesnoth Lua Pack: Development Thread

Post by vghetto »

Hi,

The [get_recruit_list] tag throws an error when [filter] is used.

Code: Select all

[get_recruit_list]
        [filter_side]
                side=1
        [/filter_side]
        [filter]
                side=1
        [/filter]
        variable=recruit_list
[/get_recruit_list]

Code: Select all

20210427 22:55:02 error scripting/lua: ~add-ons/Wild_Frontiers/lua/utils.lua:294: attempt to index a vconfig value (local 'filter')
stack traceback:
        ~add-ons/Wild_Frontiers/lua/utils.lua:294: in local 'cmd'
        lua/wml-utils.lua:145: in field 'handle_event_commands'
        lua/wml-flow.lua:6: in function <lua/wml-flow.lua:5>
The error corresponds to the line 634 in wml-tags.lua

Code: Select all

                        filter.side = side.side -- to avoid collecting extra_recruit from enemies
User avatar
Celtic_Minstrel
Developer
Posts: 1839
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Wesnoth Lua Pack: Development Thread

Post by Celtic_Minstrel »

I think the following replacement for that line should fix the issue:

Code: Select all

filter = wml.literal(filter)
filter.side = side.side
filter = wml.tovconfig(filter)
If that doesn't work, try wesnoth.tovconfig and either helper.literal or H.literal.
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.
User avatar
Elvish_Hunter
Forum Moderator
Posts: 1482
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: Wesnoth Lua Pack: Development Thread

Post by Elvish_Hunter »

Thank you for reporting this issue. I'll try to fix it as soon as I can.
Current maintainer of these add-ons:
1.16: The Sojournings of Grog, Wesnoth Lua Pack
1.14: A Rough Life, The White Troll (co-author)
1.12, will port to 1.16: Children of Dragons
User avatar
Elvish_Hunter
Forum Moderator
Posts: 1482
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: Wesnoth Lua Pack: Development Thread

Post by Elvish_Hunter »

Somewhat later than I originally planned, I just uploaded version 1.9.0 of the Wesnoth Lua Pack both on the 1.16 add-ons server and on the GitHub repository.
This version mainly features updates to be compliant with the refactored Lua API (which means that no deprecation warnings should be issued, unless I missed something); there are also a few deprecated tags (whose purpose can now be fulfilled by the [set_variable] tag and which I'm probably going to remove in version 1.10.0), a few bug fixes and a small test scenario which can be accessed by running Wesnoth in debug mode.
As usual, please report any issue that you find (either in this thread or on GitHub) and don't forget to propose anything that you'd like to see added to this pack!
Current maintainer of these add-ons:
1.16: The Sojournings of Grog, Wesnoth Lua Pack
1.14: A Rough Life, The White Troll (co-author)
1.12, will port to 1.16: Children of Dragons
Post Reply