Any good lua guides?

Feb 23, 2009 at 6:38 PM
I'm trying to make a simple addon that adds a name to a listbox from a testbox when a button is pressed. Can anyone point to a guide or some documentation where I can learn how to do this? Thanks!
Feb 23, 2009 at 7:00 PM
Edited Feb 24, 2009 at 4:26 PM
Programming Game AI by Example, Author: Mat buckland, ISBN: 1-55622-078-2

This is just a good guide on Lua, I picked up a bunch of tips.  It doesn't talk about World of Warcraft.   My response was to the title of the post: "Any good lua guides" and not the actual post.  

If you want to pick up more about Lua: http://www.lua.org/ 

So it was a big oops on my part.  However, the book is still a good read if you can pick it up used, no CD. :)

Thanks Daniel for keeping me on the beam.
Coordinator
Feb 23, 2009 at 8:55 PM
I'm not sure why Sam pointed you to an AI programming book to learn about Warcraft's Widget API (especially when their are Wow-related books), but hopefully these resources will help (copy/pasted from the FAQ on the home page).


What are some recommended resources for learning how to build Warcraft AddOns?

Thanks,
-Dan

Feb 23, 2009 at 9:56 PM
Can anyone (from your own experience) tell me what the best setup for this would be? I have been a programmer for some time but have never learned lua. The addon (as described above) that I am trying to make is seemingly very simple. I added a ScrollFrame to attempt to list the names, but i can't figure out how to add items to it. Any help would be appreciated. 

P.S- Thanks for the previous post!
Coordinator
Feb 24, 2009 at 6:30 AM
I'd suggest picking up the World of Warcraft programming book as it goes through Scrolling Frames in detail and they are tricky and not really intuitive for developers new to Warcraft's Widget API.

There's two ways to do this, use ScrollFrame and embed a nest frame per item or use faux scroll frames. Faux scroll frames are more code, but have the advantage of working with large data as they don't create a frame per item, but instead keep a list of visible frames and the data is swapped in/out when the scroll button is pressed.  

Imagine you have the following in a Lua table
[Alpha]
[Bravo]
[Charlie]
[Delta]
[Echo]


You create a scroll frame with three nested buttons, when you first load the data, you loop through each the Lua table and add each button
1st Button >> Alpha
2nd Button >> Bravo
3rd Button >> Charlie

Next, when someone clicks to scroll down, you can have an event handler swap out the data by setting an offset variable for the table and looping through again with the added offset of 1 so the data maps as follows:
1st Button >> Bravo
2nd Button >> Charlie
3rd Button >> Delta

For more information, you should check out - http://www.wowwiki.com/Making_a_scrollable_list_using_FauxScrollFrameTemplate