Lua/wow api help menu

Shout-Out

User Tag List

Results 1 to 2 of 2
  1. #1
    yoyoyo's Avatar Active Member
    Reputation
    35
    Join Date
    Nov 2006
    Posts
    106
    Thanks G/R
    3/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lua/wow api help

    I'm learning LUA for wow addon's and it say's to look at samples so I downloaded a very simple addon and looked at the code this was it:

    Code:
    local frame = CreateFrame("FRAME");
    frame:RegisterEvent("ADDON_LOADED");
    frame:RegisterEvent("DUEL_REQUESTED");
    
    
    function frame:print(msg)
    	DEFAULT_CHAT_FRAME:AddMessage(msg)
    end
    
    
    function frame:OnEvent(event, arg1)
    	if event == "ADDON_LOADED" and arg1 == "DuelCancel" then
    		if duelcancelbool == nil then
    			duelcancelbool = "on";
    		end
    	elseif event == "DUEL_REQUESTED" then
    		if duelcancelbool == "on" then
    			CancelDuel();
    		end
    	end
    end
    
    
    frame:SetScript("OnEvent", frame.OnEvent);
    SLASH_DUELCANCEL1 = "/duelcancel";
    
    
    function SlashCmdList.DUELCANCEL(msg)
    	if msg ~= nil then
    		msg = string.lower(msg);
    	end
    	if msg == "on" then
    		print("DuelCancel: on");
    		duelcancelbool = "on";
    	elseif msg == "off" then
    		print("DuelCancel: off");
    		duelcancelbool = "off";
    	else
    		if duelcancelbool == "on" then
    			print("DuelCancel: ".. duelcancelbool);
    		else
    			print("DuelCancel: ".. duelcancelbool);
    		end
    		print("Type /duelcancel off or on to change");		
    	end
    end
    Let me type out what I believe its does.
    Assigns a local variable called frame which is equal to CreateFrame("FRAME")
    Then it tells the frame variable to register a event when the addon is loaded and also an event when a duel is requested.
    Then it creates a function called framerint(msg) .... ? that tells DEFAULT_CHAT_FRAME to add a message with the msg variable? and thats where I get confused...

    what assigns the "msg" variable? why is the function named "framerint(msg)"? I tried reading the wow api pages on wow wiki but holy shit.. that just sends me everywhere... something that would help me alot would be if you could tell me what the : after the variable does I went threw the entire LUA handbook and didn't find anything there about the colon... this is a simple addon and I don't understand it ... +rep for help... even links are good to get me started. I watched a whole video on lua tutorial and read the handbook.
    Harambe is a dead meme

    Lua/wow api help
  2. #2
    hp94's Avatar Legendary
    Reputation
    742
    Join Date
    Nov 2009
    Posts
    587
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What you're looking at is Widget API. There's a good page on WoWWiki for that that explains it. In the 'msg' case, msg is the parameter taken in to the function. For the rest, try reading lua-users wiki: Inheritance Tutorial .

Similar Threads

  1. WoW login help or something
    By asdsad in forum World of Warcraft General
    Replies: 2
    Last Post: 08-28-2007, 12:27 PM
  2. WoW Error Help please!
    By Bazerke in forum World of Warcraft General
    Replies: 4
    Last Post: 06-26-2007, 07:37 PM
  3. wow gold help
    By Ark in forum World of Warcraft General
    Replies: 1
    Last Post: 11-13-2006, 04:39 PM
  4. WoW Glider Help!
    By Kaladze in forum World of Warcraft General
    Replies: 10
    Last Post: 07-12-2006, 09:26 PM
  5. Installing WoW (need help!)
    By Shadowman2418 in forum World of Warcraft General
    Replies: 6
    Last Post: 07-09-2006, 12:15 AM
All times are GMT -5. The time now is 01:07 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search