Wait, what do you mean?
Lua is super versatile in terms of what you can do with it. Seriously; anything you can do in C++ can be bound to it and executed in script. The implications of this are.. Well... You can have your entire game compiled once and then simply hotloaded when you make changes. So in this post, I'll go in depth with how I went about binding my C++ functions into Lua scripts which are executed as if they were native to the C++ project.
Running a Lua file is easy.
The second you download and install Lua for windows on your system, you're pretty much ready to import it into your C++ project and begin scripting in Lua. But before that, you have to know what you're going to do with the scripts. Good examples of script use would be extending existing C++ stuff by having a Lua file as a throw-away configuration file, or having some AI reference a Lua script for it's next action using fuzzy logic.
Code Editor
But what I have, personally, is a small 2D rendering engine in C++ that exports all it's functionality into a 'main' Lua file. That main Lua file initializes a window and draws anything I need to said window using OpenGL function calls that I've dumbed down for ease of use and prototyping. Think something along the lines of 'Love2D' or even Angel2D.
Example Lua Main File
Code Editor
As you can see, it's pretty clean.
In terms of 'how is this better than just doing it all in C++', this is a very simple and easy way to be able to write code while the game is running and have it reload into the game when you save the file.
It's just so awesome being able to see the game come together while you're writing code, rather than writing code, hitting compile and running the executable to see if what you've done worked. This method of "Is this working? Just CTRL+S and check what happened in like a second" increases both happiness and productivity, and I'll continue using hotloaded scripts because I can get instant feedback when I need it.
It's just so awesome being able to see the game come together while you're writing code, rather than writing code, hitting compile and running the executable to see if what you've done worked. This method of "Is this working? Just CTRL+S and check what happened in like a second" increases both happiness and productivity, and I'll continue using hotloaded scripts because I can get instant feedback when I need it.