Search found 9 matches

by Siroh
February 16th, 2024, 12:36 pm
Forum: Lua Labs
Topic: Lua type annotations
Replies: 14
Views: 2485

Re: Lua type annotations

Hi !

Could we add some typing to the terrain_map class, to support the map style read/write access to terrain codes ?

Updating the class definition to

Code: Select all

---@class terrain_map : wesnoth.map, {[{[1]:integer, [2]:integer}]: string}
should do the trick
by Siroh
February 12th, 2024, 8:10 am
Forum: Lua Labs
Topic: Lua type annotations
Replies: 14
Views: 2485

Re: Lua type annotations

Thank you very much !
by Siroh
February 8th, 2024, 1:06 pm
Forum: Lua Labs
Topic: Lua type annotations
Replies: 14
Views: 2485

Re: Lua type annotations

Thank you !

I think the typing of gui.simple_widget.label is too restrictive : for instance, for image widget, the label is not a tstring, just a simple string.
Could it be changed to string|tstring ?
by Siroh
February 7th, 2024, 11:50 am
Forum: Lua Labs
Topic: Lua type annotations
Replies: 14
Views: 2485

Re: Lua type annotations

Another one : it seems that the definitions for

Code: Select all

interface.remove_item
interface.add_item_halo
are missing in wesnoth/interface.lua
by Siroh
February 7th, 2024, 11:36 am
Forum: Lua Labs
Topic: Lua type annotations
Replies: 14
Views: 2485

Re: Lua type annotations

Another small fix I had to make in wesnoth/interface.lua is replacing

Code: Select all

---@type table<string, fun()>
wesnoth.game_display = {}
by

Code: Select all

---@type table<string, fun(): WMLTag[]>
wesnoth.interface.game_display = {}
by Siroh
February 7th, 2024, 9:54 am
Forum: Lua Labs
Topic: Lua type annotations
Replies: 14
Views: 2485

Re: Lua type annotations

I've have copied the files from #7359, and it works fine, thank you. Except perhaps for this function : gui.widget.remove_items_at (documented at https://wiki.wesnoth.org/LuaAPI/gui/widget#remove_items_at) Since it is a replacement for the old wesnoth.remove_dialog_item it seems to me that its signa...
by Siroh
February 5th, 2024, 6:06 pm
Forum: Lua Labs
Topic: Lua type annotations
Replies: 14
Views: 2485

Re: Lua type annotations

I've indeed seen some inaccuracies fixed by #7359, I'll give a second look when it's merged.
Thank you for providing these definitions.
by Siroh
February 5th, 2024, 3:27 pm
Forum: Lua Labs
Topic: Lua type annotations
Replies: 14
Views: 2485

Re: Lua type annotations

Many thanks for your quick reply.
https://github.com/wesnoth/wesnoth/tree ... ua/wesnoth is exactly what I had in mind !
by Siroh
February 4th, 2024, 6:05 pm
Forum: Lua Labs
Topic: Lua type annotations
Replies: 14
Views: 2485

Lua type annotations

Hi !

Do you know if there are some Lua type annotations (following this format https://luals.github.io/wiki/annotations/#class) available for the
LuaAPI exposed by the game engine. I would make developing UMC so much easier !

Thank you !