Recent Topics


How to learn LUA?

Here you can post addons, or anything related to addons.

Moderators: Management, Web Developer

Forum rules
Before posting on this forum, be sure to read the Terms of Use
User avatar
Posts: 549

How to learn LUA?

Post#1 » Thu Apr 19, 2018 3:23 pm

Was wondering how hard is it to learn LUA programming language for someone without any IT experience, besides basic user stuff?
I got few ideas and i`d like to learn how to make few simple addons for RoR.
Is there anyone else able to make addon besides Sullemonk?
Slacking (checking out EvE)

User avatar
Posts: 9

Re: How to learn LUA?

Post#2 » Thu Apr 19, 2018 5:00 pm

Its easy if you understand syntax well.

Posts: 22

Re: How to learn LUA?

Post#3 » Thu Apr 19, 2018 6:08 pm

I recommend you a book from the Lua creator, Roberto Ierusalimschy, his "Programming in Lua" and the recommended site up here ofc.

User avatar
Posts: 7

Re: How to learn LUA?

Post#4 » Sat Apr 21, 2018 7:49 am

The server is patching so I figured I'd peck away for a few minutes and see if I can give you some more information.

Aside from the Syntax documentation and learning "how". You should also get Notepad++ or some other quasi-IDE for coding.

It would also be useful for you to get the LUA interpreter so that you can practice with smaller concepts of LUA like tables and see how things scope.

Their are some key concepts you'll want to pay special attention to with regard to any programming language compiled or interpreted.

The biggest one that comes to mind is "scope": This is the concept that basically means something is only relevant or "visible" to something else in it's current context. Their are 1000s of articles and blog posts dealing with every programming language that teach what "scope" is. And it's effectively the same with every language.

A simple pseudo-code/lua-like example:

Code: Select all

FirstNumber = 10
Result = 0

function Addition(SecondNumber) 
	Result = FirstNumber +  SecondNumber

function Subtraction(AnotherNumber)
	Result = SecondNumber - AnotherNumber
In the example above, the function Addition can "see" FirstNumber and Result because those variables have "global" scope. They are outside the function. Also, SecondNumber is a parameter for the function and has "scope" to that function only.

The function Subtraction doesn't work, because it's trying to use the variable "SecondNumber" but it's only scoped to the function it lives in and not global and won't work, you'll get an error telling you so by the interpreter.

This wasn't meant to be a "lesson" as much as to say it's important you learn this concept or you'll quickly get frustrated.

The next big thing is "Inheritance". Read about it: This is an even less LUA-like example but it's important:

Code: Select all

Class_Animal() {
	HasTail = true;
	HasFur = true;

Class_Cat() : ClassAnimal() {
	SoundMade = "meow";

Class_Dog() {
	EatsCatPoop = true;
Class_Animal is a rough "base class" for Class_Cat. Class_Cat inherits all the functionality of Class_Animal. So you could write Class_Cat().HasTail = false. But in Class_Dog it doesn't inherit from Class_Animal and doesn't know anything about HasFur or HasTail. Base classes and inheritance are your friend. The reason this is vital is
you can make a class that has all the common things between several classes so you don't have to code them 2-5-100 times for each class.

These are the most basic of concepts you'll need to learn aside from syntax to be take advantage of the power of any programming language.

Good luck, and I hope it helps.


User avatar
Addon Developer
Posts: 952

Re: How to learn LUA?

Post#5 » Sat Apr 21, 2018 7:39 pm

i had no pre coding experience when i started to code addons for this game, and haven't read anny guides/tutorials for it yet...

And my sloppy coding will probably give real coders a hemmorage trying to desciffer it..
Image Ethreal   Image Corque   Image Urgiz   Image Loxley   Image Chilli   Image Maduza

Who is online

Users browsing this forum: No registered users and 10 guests