Modding in Lua - An overview


#1

Hello everyone! I’m making this to help out people who want to learn Lua so they can get in on modding as soon as the game is in beta. I’m gonna start off by giving a small overview of Lua, and my personal background in Lua.

Lua is a scripting language made in South America, by a few gentlemen who spoke Portugese; hence the name Lua which means “moon”. When Lua is referenced we call it by the Portugese word not as L-U-A. It has a syntax similar to C and Java in many ways, but is FAR less picky about how you put it together and is FAR easier to code something simple; here is an example–

To print a line in C++;

#include <iostream>

void main()
{
      cout << "Hello World" << endl;
     
      system("PAUSE")
}

To print a line in Lua;

print("Hello World")

It seems to have no similarities, but this is to prove a looser syntax and how much easier Lua is to code. In C++ a “;” is required to end each line, whereas in Lua it can be put there, but is not required.

Lua can make a great first computer language, it is easy and kind of fun.

Now to explain my background in Lua. It was my first computer language, I learned it to code mods for Garry’s Mod roughly 5 years ago. After 5 years of coding Lua I have run into a brick wall with what I can do with it(I have made mods for many games, and used Lua engines like Love2D and torque2D). I really want to do some modding for this game and get back into Lua, but I also want to see some new faces in the community, and I want to teach people Lua. In my opinion the best place i have found to learn Lua right now is here. This teaches basic Lua and scripting arithmetic, the game will likely have it’s own hooks and libraries that we will have to learn too; when it is revealed I may make videos on how to code with the system the game has given us.

Feel free to ask any Lua questions here :smiley:


Learning how to mod Stonehearth
Learning how to mod Stonehearth
I've Got A Question About Modding
Notable Forum Posts
Welcome to the Bitcave! Nerdiness, Jokes, Mods, Ideas, and coding!
Notable Forum Posts by Likes
Welcome to the Bitcave! Nerdiness, Jokes, Mods, Ideas, and coding!
#2

I’m looking to pick up Lua myself, so I will be more than likely directing questions your way over the next however many years we are all around here for :)!

Looking forward to seeing what the future holds!


#3

Thank you for this resource. When I learned coding many years ago I was taught with java and C so hopefully Lua won’t be too hard to pick up. I’ve never done any modding for games before but would love to for this one. :slight_smile:


#4

Glad to hear you want to hop into it, I’m here for any questions you can also email me questions at prismcustomcomputers@gmail.com (business email).


#5

I agree - Lua is a great language. My friend and I have been working on a game using Lua for scripting, it’s so easy!

Great start!


#6

im looking forward to getting back into Lua (i’ve been playing around in Python for quite some time now)… both languages are among my favorite (given their relatively easy learning curve), and i too am looking forward to taking a crack at scripting!

see you all around the n3rd watercooler… :slight_smile:


#7

It should be easy for you then, I learned my languages in this order Lua>HTML>Java>CSS>JS>Python>C>C++ and honestly out of those I can only code in HTML Lua CSS and C++ the others I just couldn’t for the life of me remember. You could throw a simple piece of java code at me, I can tell you what it does and that’s about it, I couldn’t tell you how to fix it or a better way to code it. If you need any help feel free to ask questions, I put my email in the reply to Geoff if you want to reach me by that.


#8

i love you for this now <3, would you have a site where i can really learn the basics of coding though, i’m waay to unfamiliar with all this but i plan on learning lua in the next coming months so i’m able to mod for this game.


#9

mumbles HTML is no programming language… CSS is no programming language… -.- in no way…


#10

Dude this is awesome! Thank you!


#11

Well yeah, that should be known, hell if I wanted to I could get very strict on what each one is
HTML - Markup Language
CSS- Markup Language
Java- Interpreted Language
Python- Scripting Language
Lua-Scripting Language
There, I classify them as “Programming” because that’s everyone knows them as.


#12

Hmm well honestly, as far as the basics of coding is I personally ( I’m gonna Get shit for this) recommend learning batch commands and making a simple .bat file as your first program, something that just displays simple text, and requires nothing to interpret into machine code(this is supposing you are on windows) here is a tutorial on batch files.

Batch file TUTORIAL

As far as coding in general I suggest Code Academy


#13

@Colassal and for someone like me who has learned how to program as essential part of ones apprenticeship (working in this kind of job or not) makes it shiver to hear/read them named as programming languages ^^

Still, learning HTML in a proper structured way will help with a clear and good structured code without having to worry about an actual language.


#14

The site that Colassal provided does a pretty good job with explaining basics if coding. I’d say go ahead and dive right into it. Once you learn the basic syntax you’ll be able to start peiceing them together into more complex programs. Lua seems to be a great language for first time learners as its pretty straightforward.

Though this is coming from someone who’s known coding for a while ^^;

If you need any help feel free to ask me. (Or I’m sure Colassal would be happy to help as well.)


#15

my basic rule for elevating one over another is the presence of an object model… learning the basics of OOP is (in my opinion) a very fundamental programming learning objective… by, i digress (nerdily)… :stuck_out_tongue:


#16

Yeah, I find it just best to refer to them all as programming languages to people who know them as that. I mean in all honesty every language is different, and most aren’t programming languages, they are another way of “coding”. I work in tech also, I build computers, websites and other programs all under my own business, I understand what you are saying though.


#17

Always happy to help with those, code academy is a great place.


#18

OOP is just a point of view if the input and output are the same. =)

In my experience, the difficulty in modding is not the programming language itself. That’s just the syntax for expressions and data types. If you can do math, you’ll manage.

The tricky bit is learning how the game “ticks”.
How you find / identify a specific data structure like “actors without helmets on who are currently chopping wood”.
These calls or functions often don’t follow any logical pattern but were implemented on a base of “we needed the feature”. =)
If modding were logical, everyone could do it. =P


#19

hahaha… very well said… that is also part of the fun (when modding), figuring out the hooks and what to tie into to make X do Y… :wink:


#20

“Good” modding as in mods that get all the street cred is 1/3 technical bits (coding, modeling, etc)… and 2/3 show business.

Engaging the player. Making an actor mouth off or flip the player the bird if he doesn’t want to do something. Building a shrine to The Hand Cursor without having been ordered to.
All too often it’s the silly stuff that makes a game world feel “real”. When actors don’t act like robots following a script. (even if they are)

Modders are in the entertainment business. Plan accordingly. =)