Quantcast Cide, LUA Learning - WoWInterface
Thread Tools Display Modes
01-17-05, 02:30 PM   #1
guice
A Cobalt Mageweaver
Join Date: Jan 2005
Posts: 236
Cide, LUA Learning

Where did you pick it up? and did you use an IDE when you were first learning it? I'm interested in getting to know the language, but IDE's are a problem. Don't think I found any real IDE except for some SF project that wasn't done, but showed "promise".


*Edit -- Can a mod move this to LUA Scripting? I just realized there was a spereate forum for that.
  Reply With Quote
01-17-05, 04:05 PM   #2
Cide
Swedeheart
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 96
Well, I've always been good at programming(I know(more or less) PHP, ASP, Flash AS, mIRC script, LUA, C++, HTML), so I got a little help from that. I started learning LUA when our fansite wanted to make a UI mod. What I did was to read the interface files Blizzard has written. LUA is a really easy language to learn too, if you have previous experience in programming. All in all, it took me about a week to get a good grip on LUA .
__________________
CTMod Developer
  Reply With Quote
01-17-05, 04:07 PM   #3
Goatus
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 18
Well i personaly started from reading through lua manual (http://www.lua.org/manual/5.0/) but honestly it didn't help much. Maybe it is only me but i found that manual rather complicated and all it gave me was some basic info about lua.

Then i moved to orginal blizzard lua scripts (just use blizzard interface customization tool to unpack scripts from mpq files (http://www.blizzard.com/support/wow/?id=aww01669p) and existing addons. Lua is similar in many aspects to many programing languages which i had learned previously, so it was pretty easy. Just read lua scripts from some small adons and small interface parts like durability frame or player frame (leave action bars at the end because i think they are most complicated) and then start experimenting with what you have learned.

Another good idea is just copypasting some things from blizzard xml and lua files then changing their properities and names and position and then playing with them. (That is how i started enchanted durability addon which you may BTW download it is commented almost line by line so it should be helpfull also ^^)

Well few advices from me:

-Don't be afraid to experiment you can't actually break anything and if something goes wrong just delete your interface folder.

-For some quick script testing i found macro thingie in game is quicker than instantly going to editor and back to wow

-/script ReloadUI(); is your friend ;p

-if you use some blizzard function play with it first so you know what all arguments are for and what it returns

-(http://www.wowwiki.com/Interface_Customization) is very helpful

Good Luck

BTW im still ui customization noobie
BTW2 i guess you read tutorial in ui customization forum in us forums :]

Edit: I use EditPlus 2 and it is very good you can find link to it and to lua syntax file in tutorial (ui customisation forums)

Last edited by Goatus : 01-17-05 at 04:10 PM.
  Reply With Quote
01-18-05, 12:30 AM   #4
guice
A Cobalt Mageweaver
Join Date: Jan 2005
Posts: 236
Well, I've always been good at programming(I know(more or less) PHP, ASP, Flash AS, mIRC script, LUA, C++, HTML), so I got a little help from that. I started learning LUA when our fansite wanted to make a UI mod. What I did was to read the interface files Blizzard has written. LUA is a really easy language to learn too, if you have previous experience in programming. All in all, it took me about a week to get a good grip on LUA
More or less the same way. Never picked up Flash or ASP though. I do, however, have a very strong programming background. I do like learning new languages, thus why I was trying to look for some kind of LUA IDE. That way you're not forced to use the WoW game (BIG app) just to test a small script.

Well i personaly started from reading through lua manual (http://www.lua.org/manual/5.0/) but honestly it didn't help much. Maybe it is only me but i found that manual rather complicated and all it gave me was some basic info about lua.
Same boat. Went there and then realized that's just a reference site. Can't learn off that.

I think O'Reilly has a book or two out on LUA. Then again, from a quick search on their site, maybe not. /ponders
  Reply With Quote
01-18-05, 08:49 AM   #5
Svarten
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 25
LUA is such a simplistic script language that if you have done any programing in just about any script/program language you can pick this one up easily. The major problems with LUA learning is that you have to come up with other ways of doing things, since it lacks so many chnctions that you get used to in other languages

My background comes from UNIX world, like many others. I'v been working as a systemadministrator for over 15 years so script coding comes natural to some extent, just have to bother doing it.

Since I have always loved RPGs and played ALOT of MMORPGs though the years, WoW UI creation/modification came as a great fun for me, I actualy enjoy fiddling with the UI mods as much as I do playing the game itself!

I did some UIs for EverQuest and from that perspective I can only say that WoWs system is a bliz! You can do virtualy anything in this system, I just wish they'd let us have some kind of IO functions aswell, I can see the SavedVariables.lua file becoming a monolith a year after release, it wont be possible to work that way when you have to read a 2Gb file into memory af login

Anyways, Anyone who done any programing in any language can do this, noone should feel they can't learn it, it is realy easy, LUA have just a few functions build in and WoW API don't alove to any extensions.

Cheers,
Svarten
  Reply With Quote
02-23-05, 06:57 PM   #6
Random
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 93
Well, all I know is Visual Basic and I'm having a bit of difficulty here. I did accomplish a tiny little addon that hides the petbar, but I had tons of help and it took me 3days Im trying to make an addon now that toggles pet actions on certain events but still having trouble. Is there maybe a really good tutorial on LUA anywhere?
  Reply With Quote
03-22-05, 06:32 PM   #7
EricTetz
A Defias Bandit
Join Date: Mar 2005
Posts: 2
I've known Lua for years, and have used it for scripting my own applications. It's small, fast, has great data description capabilities, and is easy to read. And despite seeming "simplistic" (as Svarten puts it), it's a deceptively powerful language that gets a lot of mileage out of a few language features (like associative arrays, first class functions, metamethods, coroutines, etc) and supports a wide variety of programming styles.

Anyway, I was stoked to discover that WoW uses it. I wrote a few AddOns on Sunday to try it out (QuestQuery: text search of quest log, and AutoReply: answering machine for tells) and Lua makes it easy as pie.

The best source for information on Lua is lua.org or lua-users.org. There are also a few Lua books available now. Programming in Lua was written by one of Lua's designers.

I do all my coding (whatever the language in Vim), an extremely powerful programming editor that supports syntax highlighting for Lua and about 300 other language.
  Reply With Quote
08-07-05, 02:43 AM   #8
Arouin
A Deviate Faerie Dragon
Join Date: Jun 2005
Posts: 16
Unhappy What about the rest of us???

Ok, so it's been stated many times in this thread that anyone with a little programming or scripting background can learn LUA and make mods easily. What I want to know is what about the rest of us??

Over the past 2 years I have scoured the internet running through tutorial after tutorial. Reading site after site filled with various tidbits of information while I was teaching myself HTML and CSS (learned a bunch of neat Photoshop tricks too thanks to a really cool Tutorial site I found ), and was moving on to XML.

Here I am floating on cloud 9 thinking there's nothing to this technical coding stuff (yes, I know HTML and CSS and XML aren't really considered coding languages or "REAL" programming as my brother who works at Microsoft likes to remind me! *sigh*) and if I just put forth effort I can learn how to do all kinds of various coding things.

Around this time a friend introduces me to the Wide World of Warcraft Modding. I have been hooked now for the last 5 months. I have EASILY spent more than DOUBLE the hours poring over various forums (like these ones where I have read every thread in full up to this point and intend to finish reading all the others below this one), mod sites, programming sites etc... than I have playing the darn Game! And no, I dont' regret any of it

Yet here I am. 5 months later. Working on my 3rd time through the WoW Wiki, able to only get halfway through the LUA manual before getting so lost I have to start over, and seeing all these really cool (and supposedly simple) things people are doing with their UI's and a bit of scripting or LUA editing.

I have managed to do some very basic editing with the LUA on some mods if they are coded cleanly with detailed comments, but whenver I try to do anything even remotely advanced, I end up breaking everything! And there have been many times I've actually ended up having to reinstall my Interface, WDB and WTF folders because I've messed things up so bad.

I've been wanting to code this Mod that I thought up 4 months ago, but I don't have the skills and it seems no matter how much time I spend trying to learn them, I don't get very far. So where are the Beginners Tutorials??? (yes, I've done the Hello World one a few times but since it has absolutely nothing in common with what I want my mod to do, I am having a hard time adapting it for my purposes) Where are the Step by Step Walkthroughs????

When I was learning HTML, Photoshop, CSS, and even now XML (for website design, don't know if the same principles of it can be applied to Mods or not, more worried about learning the LUA first LOL ), I had no problem finding HUNDREDS of sites filled with Tutorials. There was the W3 site, there was HTML Goodies, GOod-Tutorials for Photoshop, complete CSS tutorials, the CSS factory etc... etc... I mean, the list goes on forever.

Maybe it's just because I'm blonde. But beyond the LUA manual, the occasional post explaining some bit of code in various forums, and the 3 Wiki sites, I have not found hardly any learning information at all for LUA.

Please tell me that I'm either blind or looking in the wrong place. Hopefully someone out there knows where I can find some Tutorials and Walkthroughs etc... to learn various parts of LUA the way I was able to learn the various tags of HTML.

And if this post makes no sense to all you very smart programming people, blame it not only on the already mentioned Blondeness, but on the fact I haven't slept in over 36 hours because I've been poring over about 20 various mod/forum sites LOL As a matter of fact, my Start Bar currently has almost 50 instances of IE open to various places because I click on links to more information so that I can go to them after I have finished at the current site

*wonders if there's some kind of program for people addicted to Modding, much like there is for those addicted to the actual game*

*Arouin
  Reply With Quote
08-07-05, 10:00 AM   #9
Littlejohn
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 90
Lua is not a simple language in the traditional sense -- it is simple in a minimalist, elegant sort of way. Most people describe Basic as a simple language. Lua is the exact opposite of Basic. IMHO the concepts in Lua take a long time to learn, but those concepts are worth 1000 times more than ASP. (Maybe not in the job market though...

EricTetz cited excellent references. I can vouch for Roberto Ierusalimschy's "Programming in Lua". The book is also available on the Web for free.

I use XEmacs and Lua 5.0 on Windows. Both are Open Source and can be downloaded for free. I also use two computers when developing -- one running WoW and the other for testing+editing Lua code. The WoW directory is shared over the network so it's easy to edit the code and watch the game at the same time. If you can scrape up the $200 needed to have a second computer, you will be amazed at how much easier it is to write WoW code. (The computer I edit Lua code on is "crap" by modern standards. Remember you are only going to edit code and do some light web browsing on this machine. 128MB RAM and a 500MHz CPU is more than adequate.)

My last unsolicited advice is that not everybody is a programmer. If learning Lua is hard and/or boring, don't waste your time on something you don't like. Team up with another person and divide up the job into Frame XML design and programming. Most AddOns really benefit from custom graphics and a better UI. All the Lua talent in the world can't make that happen.
  Reply With Quote
08-08-05, 06:43 AM   #10
shamaz
A Defias Bandit
Join Date: Aug 2005
Posts: 3
The IDE I use is wowscite
http://www.wowguru.com/ui/wow-scite-lua/

I think it's a good one.
  Reply With Quote
08-08-05, 07:46 AM   #11
Beladona
A Molten Giant
 
Beladona's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 539
LUA is one of the simplest languages you can learn. So if this is the first programming language you are trying to learn, then by all means go for it. Many of us here are willing to assist in any way we can to help make it a simpler prospect.

The only thing that you must remember is as follows:

LUA is very open in terms of how you use it. Usage and syntax is not nearly as strict as something like PHP or other languages that many of us here already know. As a result most of us with any type of previous programming experience already have the "Programming Sins" under control. We know how to structure our code, and how to add delimiters where they belong, even though LUA doesn't always HAVE to have them. This is a double edged sword however for anyone learning LUA for the first time with no previously known languages. Because the usage and syntax rules are fairly lax, you can learn LUA without really having huge or broad issues. You can create a woprking script rather quickly. At the same time however, simple errors that other languages would balk at, LUA will just ignore and work anyway, which means you would be considered a "sloppy coder" in any other language. If you were to try to apply your LUA knowledge to another language, and thus learn it, you might find yourself frustrated very quickly.

This is why having previous programming knowledge is such a huge boon to LUA development. You know the mistakes that can be made already, and tend to avoid them inherently. LUA really is very similar to other languages such as JAVA, so again you can easily pick it up if you already know those other languages. The lack of proper learning material hurts new programmers as well, and I can only hope that some day a newbie to programming will document his journey as he learns (and publish it, thus helping other new learners.) Those of us that picked it up so easily due to previous programming knowledge would be hard pressed to make such documentation, because we are basing our learning and advancement on previous knowledge that you do not have, thus our documentation would be nearly useless to you...

This is why the majority of us often say to just look at the blizzard code. I know this is never the answer you want to hear, but this really is how most of us picked it up, for better or worse...
  Reply With Quote
08-08-05, 03:02 PM   #12
Littlejohn
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 90
I really don't think optional semicolons make a language simple. Other parts of Lua are incredibly "simple" but hard for a beginner to understand. Take the general purpose "for" statement -- it uses an iterator which in Lua is implemented as a closure. Another simple thing in Lua is the object system -- it's just a thin layer of syntactic sugar over metatables. Even veteran programmers may trip on other "simple" things: arrays are really hash tables and strings are really immutable symbols.

Anyways, I've already tried to answer questions about Lua and I'll keep on trying to help. Beginners just need to set appropriate expectations. You can learn a tiny subset of Lua that ignores all of its power in a couple weeks. However, unlike some other programming languages (Java or VB for example), there are huge conceptual jumps going from "tiny Lua" to "real Lua". It will take time and effort.

(Beladona: Just wanted to mention that your WoW deltas are fantastic. I used them to quickly catch up on 1.6.1. Excellent site!)
  Reply With Quote
08-08-05, 04:29 PM   #13
EricTetz
A Defias Bandit
Join Date: Mar 2005
Posts: 2
"Yet here I am. 5 months later. Working on my 3rd time through the WoW Wiki, able to only get halfway through the LUA manual before getting so lost I have to start over..."

The Lua manual is written for C (and C++) programmers, so it's going to be a very tough read for a non-programmer. If you want less terse documentation, the book might be a little better (haven't read it myself).

Basically, you need to learn to program, starting from square one. HTML doesn't prepare you because it's not a programming language at all (the "ML" stands for "markup language" -- it's a document layout language). New programmers, and programmers learning a new language, usually start with this:

print ("Hello World")

What is print? (a function) What is a function? What is "Hello World" (string data). What is string data? Are the quotes necessary? Are the parenthesis necessary? Is the white space necessary? There are a lot of questions that could be asked about even this basic code, and you need to understand the answers before you can begin to make sense of stuff like:

_G.print [[Hello World]]
v, s = print,[[Hello World]] v(s)
io.write(string.format('%s %s\n', "Hello", 'World'))
t={print,"Hello",' ',"World"} t[1](t[2]..t[3]..t[4])

(which all produce the same result as print("Hello World") )

But you have to start simple. You write very small, simple programs that print output on the screen. Then you learn to use simple variables, learn about different types, learn about what syntax is required for them, learn about control flow statements (if,else,while,for,etc.), learn about data structures, learn how to write functions, etc. You will be writing dumb little programs that print your name on the screen 10 times, or translate Celsius in to Fahrenheit, or play guessing games.

Then, once you understand basic programming concepts and how they are expressed in Lua, you have to learn to program WoW. This is a totally different subject. You have to learn where WoW expects you to put your code, you need to learn it's API (application programmers interface) which tells you what functions WoW provides a programmer to allow the programmer to get information about what's going on in the game and to manipulate the user interface. This is a learning curve in of itself -- understanding programming and/or Lua is just a prerequisite.

Five months is more than enough time to do this. You've just had the wrong approach. Baby steps, man. If you dive straight into the deep end, you'll drown.
  Reply With Quote
01-14-10, 12:15 AM   #14
trav
Premium Member
 
trav's Avatar
Premium Member
Join Date: Jun 2007
Posts: 30
WoW Lua book

there is a book, Beginning Lua with World of Warcraft Add-ons, the author seems to have forgotten Mac users; he only included a windows compatible version of SciTE in the Source Code download:
http://apress.com/book/downloadfile/4447

However, he does discuss several GUI Lua Windows editors.
__________________
Submariners are a bunch of intelligent misfits that somehow seem to get along understand each other and work well together.
  • <Ah, my first boat SSN 571.
  Reply With Quote
01-14-10, 01:30 AM   #15
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
someone needs to write an advanced programing wow book.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
01-14-10, 04:00 AM   #16
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,306
I found this site helped me alot in the beginning . http://fara.webeddie.com/frames/ along with the wowwiki API and Event pages.

That was pretty much all I had to go on and I had no clue on how lua worked but thankfully it made some sense to me. Find a small simple addon and take a look at how it works.

Also, despite not being all about making your own addons, Hacking World of Warcraft is not as the title depicts. The first 200 or so pages talk about different addons and how useful they are to the game. The next 100 or so pages are the reason I got the book myself. It gives you several working examples of addons and explains each step as well as some macro commands I never knew existed before.

Some of us prefer to code with pure lua. Others with XML and still others with a combination of the two of varying levels. Find your 'comfort zone' and use that to guide you. wowwiki sometimes gives you pure lua code alongside its normal xml/lua example code which helped me alot at first.

I still don't know a hell of a lot on how many of the larger addons work but having learned as much as I have I appreciate them all the more. Also, helping out people with their problems has helped me understand things more, even to the extent of solving bugs in addons I don't even use so that others using it can download the patch as soon as they come across it.

I hope you find that one project that encourages you to continue.

What exactly are you trying to do ? Perhaps we can point you in the direction of some answers or examples or let you know its not even possible and hence your problems.


Originally Posted by Arouin View Post
Ok, so it's been stated many times in this thread that anyone with a little programming or scripting background can learn LUA and make mods easily. What I want to know is what about the rest of us??

Over the past 2 years I have scoured the internet running through tutorial after tutorial. Reading site after site filled with various tidbits of information while I was teaching myself HTML and CSS (learned a bunch of neat Photoshop tricks too thanks to a really cool Tutorial site I found ), and was moving on to XML.

Here I am floating on cloud 9 thinking there's nothing to this technical coding stuff (yes, I know HTML and CSS and XML aren't really considered coding languages or "REAL" programming as my brother who works at Microsoft likes to remind me! *sigh*) and if I just put forth effort I can learn how to do all kinds of various coding things.

Around this time a friend introduces me to the Wide World of Warcraft Modding. I have been hooked now for the last 5 months. I have EASILY spent more than DOUBLE the hours poring over various forums (like these ones where I have read every thread in full up to this point and intend to finish reading all the others below this one), mod sites, programming sites etc... than I have playing the darn Game! And no, I dont' regret any of it

Yet here I am. 5 months later. Working on my 3rd time through the WoW Wiki, able to only get halfway through the LUA manual before getting so lost I have to start over, and seeing all these really cool (and supposedly simple) things people are doing with their UI's and a bit of scripting or LUA editing.

I have managed to do some very basic editing with the LUA on some mods if they are coded cleanly with detailed comments, but whenver I try to do anything even remotely advanced, I end up breaking everything! And there have been many times I've actually ended up having to reinstall my Interface, WDB and WTF folders because I've messed things up so bad.

I've been wanting to code this Mod that I thought up 4 months ago, but I don't have the skills and it seems no matter how much time I spend trying to learn them, I don't get very far. So where are the Beginners Tutorials??? (yes, I've done the Hello World one a few times but since it has absolutely nothing in common with what I want my mod to do, I am having a hard time adapting it for my purposes) Where are the Step by Step Walkthroughs????

When I was learning HTML, Photoshop, CSS, and even now XML (for website design, don't know if the same principles of it can be applied to Mods or not, more worried about learning the LUA first LOL ), I had no problem finding HUNDREDS of sites filled with Tutorials. There was the W3 site, there was HTML Goodies, GOod-Tutorials for Photoshop, complete CSS tutorials, the CSS factory etc... etc... I mean, the list goes on forever.

Maybe it's just because I'm blonde. But beyond the LUA manual, the occasional post explaining some bit of code in various forums, and the 3 Wiki sites, I have not found hardly any learning information at all for LUA.

Please tell me that I'm either blind or looking in the wrong place. Hopefully someone out there knows where I can find some Tutorials and Walkthroughs etc... to learn various parts of LUA the way I was able to learn the various tags of HTML.

And if this post makes no sense to all you very smart programming people, blame it not only on the already mentioned Blondeness, but on the fact I haven't slept in over 36 hours because I've been poring over about 20 various mod/forum sites LOL As a matter of fact, my Start Bar currently has almost 50 instances of IE open to various places because I click on links to more information so that I can go to them after I have finished at the current site

*wonders if there's some kind of program for people addicted to Modding, much like there is for those addicted to the actual game*

*Arouin
__________________
  Reply With Quote
01-14-10, 04:00 AM   #17
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,306
Originally Posted by Grimsin View Post
someone needs to write an advanced programing wow book.
Rofl. Are you volunteering ?
__________________
  Reply With Quote
01-14-10, 12:51 PM   #18
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,609
/off-topic

I think this thread wins the award for oldest necro...
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
01-14-10, 12:55 PM   #19
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,306
Originally Posted by Seerah View Post
/off-topic

I think this thread wins the award for oldest necro...
rofl, I plead innocence rofl .. didn't even realise the date of the first couple of posts
__________________
  Reply With Quote
01-14-10, 01:47 PM   #20
CobraA1
A Cliff Giant
 
CobraA1's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 73
Lua is one of those things that is both simple and complex . . .

It's simple in that you can learn the basics really easily. It won't throw you off a cliff of mathematics like some other functional languages.

It's complex in that it does have some of the more advanced stuff. You just don't need to learn it in order to work with the language.

I think the biggest appeal to me is that it works with tables.

The great thing about tables is that they're fast and they're easily understood.

At the CPU level, a table indexed by numbers is just a lookup and a jump. A table indexed by strings is also very fast.

This is quite unlike a lot of other high level scripting languages where what you're doing is highly mathematical and is so unlike low level programming that the overhead of converting it to something the CPU understands cripples the performance of the language.

I think tables are also conceptually easy to understand - you have an index and you have a value. Easy for a human to remember, IMO.

For those reasons, I love the LUA language.

Not that there aren't weaknesses, though. LUA, especially the WoW implementation, isn't too keen on the information hiding concepts found in OOP languages. It tends to make a lot of stuff public by default, which can be a bit of a pain when names clash.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Cide, LUA Learning

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off