Lua: Difference between revisions

From Total War Modding
(Created page with "Test main page.")
 
mNo edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
Test main page.
Welcome to the landing page of all things Lua - at least, in the context of the Total War series. Enjoy your stay!
 
== What It Is ==
'''Lua''' is a ''scripting language'' - which is a type of programming language that is not precompiled. That's fancy jargon for "it isn't translated into computer-speak until we run it". It's a super flexible language with a lot of quirks, designed to be an easy-to-approach language for people who aren't programmers but want to do some programming. Therefore it consists of very few forced assumptions or designs, most of its syntax is plain-English, and for the most part it doesn't have a ''lot'' going on within.
 
Why do we care? Lua is the embedded scripting language within most Total War games, and it's a super flexible toolkit that allows us to interact with the game in dynamic and complex ways.
 
Some highlighted features of things that are ''scripted'':
 
* Every Quest Battle (the actions and responses taken by the AI armies, the objectives and how they react to the flow of battle)
* Varied start positions (ie. a faction owning one or another region based on the player's starting faction)
* LOADS of in-game mechanics:
* Rites/Rituals
* Many Missions
* Dynamic encounters
* Story-driven experiences (Attila: The Last Roman, Warhammer III: Prologue, Troy)
 
Scripting is a design tool that is used whenever you want to have the following system:<blockquote>When [something happens], do [something else].</blockquote>Lua is run by the game through individual text files, with the *.lua extension. Each of these files is called a "script". And we'll call writing up these files, you guessed it, scripting!
 
== How To Use It ==
As we can see, Lua is a useful tool! It can provide a lot of power in the hands of a modder with some big dreams and some time to kill, and maybe some tears here and there.
 
But the good news is that Lua is also a great and powerful language, with MANY tools available to easily debug and resolve issues you might have with your scripts, and the TW Lua environment is rife with example scripts, from Creative Assembly and many modders throughout the game series.
 
In pages to follow, we'll go over writing our first script, some details of how the Lua language works, how to debug, how to dream big and small, but before we go anywhere else we have to start at the beginning:
 
[[Lua/Setup|Let's get set up!]]
 
[[Category:Lua]]
[[Category:Tutorial]]

Latest revision as of 20:32, 7 June 2023

Welcome to the landing page of all things Lua - at least, in the context of the Total War series. Enjoy your stay!

What It Is

Lua is a scripting language - which is a type of programming language that is not precompiled. That's fancy jargon for "it isn't translated into computer-speak until we run it". It's a super flexible language with a lot of quirks, designed to be an easy-to-approach language for people who aren't programmers but want to do some programming. Therefore it consists of very few forced assumptions or designs, most of its syntax is plain-English, and for the most part it doesn't have a lot going on within.

Why do we care? Lua is the embedded scripting language within most Total War games, and it's a super flexible toolkit that allows us to interact with the game in dynamic and complex ways.

Some highlighted features of things that are scripted:

  • Every Quest Battle (the actions and responses taken by the AI armies, the objectives and how they react to the flow of battle)
  • Varied start positions (ie. a faction owning one or another region based on the player's starting faction)
  • LOADS of in-game mechanics:
  • Rites/Rituals
  • Many Missions
  • Dynamic encounters
  • Story-driven experiences (Attila: The Last Roman, Warhammer III: Prologue, Troy)

Scripting is a design tool that is used whenever you want to have the following system:

When [something happens], do [something else].

Lua is run by the game through individual text files, with the *.lua extension. Each of these files is called a "script". And we'll call writing up these files, you guessed it, scripting!

How To Use It

As we can see, Lua is a useful tool! It can provide a lot of power in the hands of a modder with some big dreams and some time to kill, and maybe some tears here and there.

But the good news is that Lua is also a great and powerful language, with MANY tools available to easily debug and resolve issues you might have with your scripts, and the TW Lua environment is rife with example scripts, from Creative Assembly and many modders throughout the game series.

In pages to follow, we'll go over writing our first script, some details of how the Lua language works, how to debug, how to dream big and small, but before we go anywhere else we have to start at the beginning:

Let's get set up!