Lua versus WML?

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

Moderator: Forum Moderators

Post Reply
shevegen
Posts: 497
Joined: June 3rd, 2004, 4:35 pm

Lua versus WML?

Post by shevegen »

Does anyone have any experience in "Lua versus WML"? I assume that WML has more generic
and far reaching support than Lua but I would be interested how far one can go via lua. For me it
may be easier to go via lua for my campaign, but my impression is that WML is more widely in
use - but I may be wrong. I really don't know right now, hence why I wanted to ask this question
specifically, e. g. advantages/disadvantages of lua versus WML centric approaches.
User avatar
Pentarctagon
Project Manager
Posts: 5526
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Lua versus WML?

Post by Pentarctagon »

WML is more widely used since it's (usually) simpler to use and easier to start off with. Lua is not as easy to use compared to WML, but it is more concise and allows you to do many more things than WML would.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Bobit
Posts: 33
Joined: February 10th, 2015, 2:42 pm

Re: Lua versus WML?

Post by Bobit »

My first impression is that Lua has lots of functions that require you to know WML anyways, like this:

https://wiki.wesnoth.org/LuaAPI/wesnoth ... ts.matches

But of course it's a full-featured programming language, if you've used one like C# or Java then you know what to expect, while WML you're not sure what it can do easily.
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Lua versus WML?

Post by Celtic_Minstrel »

Bobit wrote: January 12th, 2022, 3:05 am My first impression is that Lua has lots of functions that require you to know WML anyways,
Lua is not a substitute for WML. It's only a substitute for ActionWML, which is a subset of WML.

You can pretty much write an entire campaign in Lua apart from the unit type definitions and the campaign and scenario definitions, if you want. World Conquest gives some idea of how to go about that. There are a few places where Lua is still inferior though – for example, you can't register a serializable, one-off event using pure Lua. (That's the equivalent of nesting [event] tags.) You can easily register recurring events, though; and you can create a one-off event if you really want. It'll just break when you reload the game from that point… or you can write the event in ActionWML even if it's registered from Lua.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply