WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   OnLoad script error (Please help!) (https://www.wowinterface.com/forums/showthread.php?t=113)

Eilina 01-18-05 03:23 PM

OnLoad script error (Please help!)
 
Ok.. I'm writing a script that does a few things when a player/pet enters combat. I've fleshed out the whole .lua/.xml/.toc files, and went to load it for the first time. Here's the error that I get in WoW when the script loads.

Code:

String: Interface\AddOns\BarSwitch\BarSwitch.lua
Line: 14
Count: 1
Error: `=' expected near `BarSwitch_OnLoad'
--------------------------------------------------
String: Frame_BarSwitch:OnLoad
Line: 2
Count: 1
Error: attempt to call global `BarSwitch_OnLoad' (a nil value)

Here's the offending code in the .lua starting at line 14.

Code:

fuction BarSwitch_OnLoad()

        -- Registers Events
        this:RegisterEvent("VARIABLES_LOADED");
        this:RegisterEvent("PLAYER_REGEN_DISABLED");
        this:RegisterEvent("PLAYER_REGEN_ENABLED");
        this:RegisterEvent("PET_ATTACK_START");
        this:RegisterEvent("CHAT_MSG_SYSTEM");
       
        -- Registers Slash Commands
        SLASH_BarSwitch1 = "/BarSwitch";
        SLASH_BarSwitch2 = "/bs";
        SlashCmdList["BarSwitch"] = function(msg)
                BarSwitch_ChatCommandHandler(msg);
        end
       
        ChatMessage("BarSwitch v1.0 by Eilina Loaded");
       
end

and now the .xml file.

Code:

<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ C:ProjectsWoWBinInterfaceFrameXMLUI.xsd">
        <Script file="BarSwitch.lua"/>
        <Frame name="Frame_BarSwitch" hidden="true">
                <Scripts>
                        <OnLoad>
                                BarSwitch_OnLoad();
                        </OnLoad>
                        <OnEvent>
                                BarSwitch_OnEvent(event, arg1);
                        </OnEvent>
                </Scripts>
        </Frame>
</Ui>

I'm assuming the error generated from the xml file is because of the error in the lua file, and will go away once the lua is fixed. I however cannot see an error in the lua file to save my life. Any ideas what could be wrong?

Freki 01-18-05 03:28 PM

Quote:

fuction BarSwitch_OnLoad()
"fuction" should be "function" :)

Eilina 01-18-05 03:31 PM

DOH! Damn.. I guess looking at it for too long made me miss a stupid spelling error.. Guess I just needed a pair of fresh eyes. Heh. Thanks a bunch.

*bonks self for stupidity*


All times are GMT -6. The time now is 10:56 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI