User Tools

Site Tools


lua:scripting

This is an old revision of the document!


Lua

Lua in WoW

  • /console scriptErrors 1 – Enable lua errors
  • /console scriptErrors 0 – Disable lua errors

Cheat sheet

Conditions

  • < (less than)
  • ⇐ (less than or equals)
  • > (greater than)
  • >= (greater than or equals)
  • == (equals)
  • ~= (not equals)
  • and
  • or
  • not

Tables

greetings = {}
greetings["Orcish"] = "Throm-Ka"
greetings["Draenei"] = "Chronakai Kristor!"
greetings.Thalassian = "Bal'a dash, malanore" -- Another method to fill the table
greetings = {
    ["Orcish"] = "Throm-Ka",
    ["Draenei"] = "Chronokai Kristor!",
    ["Thalassian"] = "Bal'a dash, malanore"
}
 
for key, value in pairs(greetings) do
    print("Language: " .. key .. ", greeting: " .. value)
end

Loops

i = 1
 
while(i <= 10) do
    print(i)
    i = i + 1
end
for i = 1, 10, 1 do
    print(i)
end
for var = start, end, increment do
    -- code
end
repeat
    -- code
until(condition)

Functions

function dummy()
    return "Hey", 54.54
end
 
lua/scripting.1668266616.txt.gz · Last modified: 2022/11/12 15:23 by utedass

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki