|
||||||
A Brief Introduction to Lua ScriptingThe First Step to World of Warcraft's Interface CustomizationLua (portuguese for "Moon") is the scripting language used for World of Warcraft's interface customization. It's light, fast, portable, embeddable and very easy to learn
The most interesting thing about the Lua scripting languages is not that:
No, the most interesting thing about Lua is that it is used by more people than there are living in Belgium, and they don't even realize it. How can the Number of Lua Users be Greater than the Population of Belgium?One reason for Lua's success is that it is used as part of the interface customization for World of Warcraft (WoW), and it's an interesting fact that:
As well as World of Warcraft, Lua is used in (to name but a few):
So, obviously Lua must be very complicated to use? Well, no, it's not. And that is why Lua is so powerful – it can be used as easily in a small scale development in Windows as a complex application targeted for a Playstation or a GameCube. Installing LuaThe Lua installation application can be downloaded directly from the a href='http://www.lua.org'>Lua web site. It's worth noting that Lua requires the Microsoft Visual C++ 2005 SP1 redistributable to be installed as well (although the installation process will attempt to do that if the redistributable is missing and the user's computer is connected to the Internet). A Simple Lua ScriptLua comes with its own command line interface, and so, once Lua has been installed the programmer can click the desktop shortcut to Lua, or start a command prompt and then type 'lua'. It's then just a matter of trying out some scripting (as can be seen in figure 1 at the bottom of this article): print ('Hello World')
Once the obligatory 'Hello World' has been tried out then it can be turned into a function: function hello ()
print ('Hello World')
end
Which can then be called by typing: hello()
And, of course, the programmer will then want the function to accept inputs: function hello (name)
print ('Hello ' .. name)
end
This is run by typing: hello ('Me')
If this code is now saved to a file (for example c:\lua\hello) then it can run from any command prompt (as shown in figure 2) by typing: lua c:\lua\hello
At this point the programmer can relax with a nice cup of Moca, look at WoW and say “I know how that all works”. Well, maybe not, but at least they'll have taken their first steps down that road.
The copyright of the article A Brief Introduction to Lua Scripting in Computer Programming Languages is owned by Mark Alexander Bain. Permission to republish A Brief Introduction to Lua Scripting in print or online must be granted by the author in writing.
|
||||||
|
|
||||||
|
|
||||||