Thread Tools Display Modes
01-18-05, 03:23 PM   #1
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 4
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.

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.

fuction BarSwitch_OnLoad()

	-- Registers Events
	-- Registers Slash Commands
	SLASH_BarSwitch1 = "/BarSwitch";
	SLASH_BarSwitch2 = "/bs";
	SlashCmdList["BarSwitch"] = function(msg)
	ChatMessage("BarSwitch v1.0 by Eilina Loaded");
and now the .xml file.

<Ui xmlns="" xmlns:xsi="" xsi:schemaLocation=" C:ProjectsWoWBinInterfaceFrameXMLUI.xsd">
	<Script file="BarSwitch.lua"/>
	<Frame name="Frame_BarSwitch" hidden="true">
				BarSwitch_OnEvent(event, arg1);
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?
  Reply With Quote
01-18-05, 03:28 PM   #2
A Deviate Faerie Dragon
Freki's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 18
fuction BarSwitch_OnLoad()
"fuction" should be "function"
  Reply With Quote
01-18-05, 03:31 PM   #3
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 4
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*
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » OnLoad script error (Please help!)

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off