Category: Developer Utilities
Addon Information
Works with 3.2
Download Latest Version.
To add favorites please register for a free account. If you already have one you need to login. How do I install this? (FAQ)
Cladhaire's Portal Bug Reports Feature Requests
Author:
Version:
r32
Date:
09-07-2009 05:27 AM
Size:
168.86 Kb
Downloads:
17,830
Favorites:
265
MD5:
Pictures
Click to enlarge
WowLua   Popular! (More than 5000 hits)
WowLua is an in-game Lua scripting environment that includes an interactive Lua interpreter as well as a multi-page script editor. Other features include:

* Syntax coloring, courtesy of krka's spectacular For All Indents and Purposes library
* Sleek buttons, courtesy of Mikk
* When WowLua is running code, it defines a global function print() which directs output to the WowLua window, for convenience. This global is removed when not running from WowLua
* Can open WowLua using /wowlua or /lua. Both of these slash commands will take a lua expression and run it, if provided:

/lua print(14) will open WowLua and print the number 14 to the output window.

Please feel free to post any comments or questions here, you'll find I'm relatively responsible. This addon has been written primarily as a companion tool for World of Warcraft Programming: A Guide and Reference for Creating WoW Addons.
  Change Log - WowLua
------------------------------------------------------------------------
r32 | Cladhaire-15704 | 2009-09-07 10:26:38 +0100 (Mon, 07 Sep 2009) | 1 line

Clicking on the output frame sets the focus to to the commandline edit box, courtesy of Sarog
------------------------------------------------------------------------
r31 | Cladhaire-15704 | 2009-08-05 10:23:50 +0100 (Wed, 05 Aug 2009) | 1 line

Interface version update

------------------------------------------------------------------------
r30 | Cladhaire-15704 | 2009-06-02 20:44:40 +0100 (Tue, 02 Jun 2009) | 3 lines

* Updated interface number
* Fixed an issue with slash commands when not using AddonLoader

------------------------------------------------------------------------
r29 | Cladhaire-15704 | 2008-11-24 09:28:45 +0000 (Mon, 24 Nov 2008) | 2 lines

Added the keybindings file, and the redo icon

------------------------------------------------------------------------
r28 | Cladhaire-15704 | 2008-11-23 18:49:29 +0000 (Sun, 23 Nov 2008) | 3 lines

* Added a primative undo/redo system for WowLua that should make the editor a bit more functional.
Please play with this feature before deciding to rely on it.

------------------------------------------------------------------------
r27 | Cladhaire-15704 | 2008-11-11 16:56:43 +0000 (Tue, 11 Nov 2008) | 2 lines

Added keybindings to RUN, SAVE, and SHOW/HIDE the window

------------------------------------------------------------------------
r26 | Cladhaire-15704 | 2008-11-11 16:46:01 +0000 (Tue, 11 Nov 2008) | 3 lines

* Fixed a mis-spelling in the .toc file that lead to AddonLoader support not working
* Fixed an issue where loading the addon via AddOnLoader would cause the main edit box to be too small

------------------------------------------------------------------------
r25 | Cladhaire-15704 | 2008-11-10 11:50:05 +0000 (Mon, 10 Nov 2008) | 2 lines

Updated .toc version and added AddonLoader support for /wowlua and /lua

------------------------------------------------------------------------
r24 | Cladhaire-15704 | 2008-10-17 09:06:18 +0100 (Fri, 17 Oct 2008) | 2 lines

* Removed wrath compatability checks

------------------------------------------------------------------------
r23 | Cladhaire-15704 | 2008-08-10 19:38:57 +0100 (Sun, 10 Aug 2008) | 2 lines

Added code to check whether we're running on a wrath client or not

------------------------------------------------------------------------
r22 | Cladhaire-15704 | 2008-08-10 17:51:27 +0100 (Sun, 10 Aug 2008) | 2 lines

Fixing a call into UIPanelTemplates

------------------------------------------------------------------------
r21 | Cogwheel-17646 | 2008-05-09 15:14:31 -0700 (Fri, 09 May 2008) | 1 line

Fixed delete on an unsaved page
------------------------------------------------------------------------
r20 | Cladhaire-15704 | 2008-05-08 23:56:28 -0700 (Thu, 08 May 2008) | 2 lines

Added history back into the interpreter line

------------------------------------------------------------------------
r19 | Cladhaire-15704 | 2008-05-01 15:20:33 -0700 (Thu, 01 May 2008) | 2 lines

Revert the change that requires untitled pages to be renamed

------------------------------------------------------------------------
r18 | Cladhaire-15704 | 2008-04-30 05:15:32 -0700 (Wed, 30 Apr 2008) | 2 lines

Added dirname property so zips are generated correctly

------------------------------------------------------------------------
r17 | Cogwheel-17646 | 2008-04-29 20:16:23 -0700 (Tue, 29 Apr 2008) | 2 lines

Close button now shows unsaved dialog
No longer auto-saves on run (should we add an auto save check box?)
------------------------------------------------------------------------
r16 | Cogwheel-17646 | 2008-04-29 19:23:59 -0700 (Tue, 29 Apr 2008) | 1 line

... Finished reorganizing imagages ><
------------------------------------------------------------------------
r15 | Cogwheel-17646 | 2008-04-29 19:19:11 -0700 (Tue, 29 Apr 2008) | 1 line

Reorganized images
------------------------------------------------------------------------
r14 | Cogwheel-17646 | 2008-04-29 15:58:35 -0700 (Tue, 29 Apr 2008) | 1 line

Added localization support
------------------------------------------------------------------------
r13 | Cogwheel-17646 | 2008-04-29 15:23:41 -0700 (Tue, 29 Apr 2008) | 4 lines

Delete button works again
Added basic Open functionality (sorry cladhaire... selecting names from a dropdown is still > typing from memory)
Saving a new script asks for a name
Creating a new page shows the unsaved page dialog
------------------------------------------------------------------------
r12 | Cogwheel-17646 | 2008-04-29 13:29:23 -0700 (Tue, 29 Apr 2008) | 4 lines

Run button works
Line numbers are no longer editable
Lock/unlock buttons work
Lock button now shows the lock icon based on the current state (tooltip reflects this)
------------------------------------------------------------------------
r11 | Cladhaire-15704 | 2008-04-29 06:07:26 -0700 (Tue, 29 Apr 2008) | 7 lines

Massive changes

* New button implemented
* Undo button implemented
* Prev/Next buttons implemented, including warnings
* Save (and rename) implemented

------------------------------------------------------------------------
r10 | Cladhaire-15704 | 2008-04-29 02:33:15 -0700 (Tue, 29 Apr 2008) | 2 lines

Change the resizing so the code pane will grow instead of the interpreter output

------------------------------------------------------------------------
r9 | Cogwheel-17646 | 2008-04-29 00:05:54 -0700 (Tue, 29 Apr 2008) | 3 lines

Refactored click handler
Delete button creates a new page if you delete the only remaining one
Window title displays name of current page
------------------------------------------------------------------------
r8 | Cogwheel-17646 | 2008-04-28 18:21:25 -0700 (Mon, 28 Apr 2008) | 1 line

Next button correctly removes desaturation from the Previous button
------------------------------------------------------------------------
r7 | Cladhaire-15704 | 2008-04-28 15:41:23 -0700 (Mon, 28 Apr 2008) | 2 lines

Remove debug messages

------------------------------------------------------------------------
r6 | Cladhaire-15704 | 2008-04-28 15:40:22 -0700 (Mon, 28 Apr 2008) | 2 lines

Ensure that lines are highlighted when they contain an error

------------------------------------------------------------------------
r5 | Cladhaire-15704 | 2008-04-28 15:34:10 -0700 (Mon, 28 Apr 2008) | 2 lines

Fixed issues with line numbering

------------------------------------------------------------------------
r4 | Cladhaire-15704 | 2008-04-28 13:46:52 -0700 (Mon, 28 Apr 2008) | 2 lines

Adding resize texture

------------------------------------------------------------------------
r3 | Cladhaire-15704 | 2008-04-28 13:32:10 -0700 (Mon, 28 Apr 2008) | 2 lines

Added the topleft texture

------------------------------------------------------------------------
r2 | Cladhaire-15704 | 2008-04-28 13:23:20 -0700 (Mon, 28 Apr 2008) | 2 lines

Initial import

------------------------------------------------------------------------
r1 | Cladhaire-15704 | 2008-04-28 13:21:43 -0700 (Mon, 28 Apr 2008) | 2 lines

Initial directory setup

------------------------------------------------------------------------
  Beta Files - WowLua
File Name
Version
Hits
Size
Author
Date
r8
252
161kB
Cogwheel
04-29-2008 11:25 PM
  Archived Versions - WowLua
File Name
Version
Size
Author
Date
r31
169kB
Cladhaire
08-05-2009 10:35 AM
r30
169kB
Cladhaire
06-02-2009 03:45 PM
r29
169kB
Cladhaire
11-24-2008 04:30 AM
  Comments - WowLua
Post A Reply Comment Options
Old 11-24-2008, 04:51 PM  
Cladhaire
Salad!
 
Cladhaire's Avatar
WoWInterface Super Moderator
Interface Author - Click to view interfaces

Forum posts: 1473
File comments: 3156
Uploads: 15
Quote:
Originally posted by Lombra
Thank you for the key bindings! But the key I use to toggle the window is also inserted into the command line. Either way, could you make the frame not request focus upon opening it?

And a minor thing.. the counter for new page naming isn't being reset. When I create a new page, it's named like "Untitled 48", when I only have 5 or so saved pages.
I'll look into the first, but the naming isn't something I really plan to change right now. It helps prevent any duplicates without having to do any checking.
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."

http://cladhaire.wowinterface.com
Cladhaire is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-24-2008, 02:31 PM  
Lombra
A Deviate Faerie Dragon
 
Lombra's Avatar
Interface Author - Click to view interfaces

Forum posts: 19
File comments: 170
Uploads: 16
Thank you for the key bindings! But the key I use to toggle the window is also inserted into the command line. Either way, could you make the frame not request focus upon opening it?

And a minor thing.. the counter for new page naming isn't being reset. When I create a new page, it's named like "Untitled 48", when I only have 5 or so saved pages.
__________________
Grab your sword and fight the Horde!

Shattered Hand-EU
Lombra is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-24-2008, 05:07 AM  
Lonny
A Deviate Faerie Dragon
 
Lonny's Avatar
Interface Author - Click to view interfaces

Forum posts: 16
File comments: 103
Uploads: 18
Quote:
Originally posted by Cladhaire
I could probably add a system where it does series of changes but I don't really want to turn this into that type of a text editor, considering the overhead it would incur.
Heya, I think that the option would be handy to have.

Anyhow, it's awesome, great job mate.
__________________
Lonny, Best Regards.

Click me and paste your code.

Last edited by Lonny : 11-24-2008 at 05:07 AM.
Lonny is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-24-2008, 04:31 AM  
Cladhaire
Salad!
 
Cladhaire's Avatar
WoWInterface Super Moderator
Interface Author - Click to view interfaces

Forum posts: 1473
File comments: 3156
Uploads: 15
I've added an undo/redo system to WowLua as well as a set of keybindings to Run/Save the current page. Please play with the undo/redo system before relying on it as there may still be some edge cases where it may not behave as expected.

The "undo" points are whenever you run or save the code. I could probably add a system where it does series of changes but I don't really want to turn this into that type of a text editor, considering the overhead it would incur.
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."

http://cladhaire.wowinterface.com
Cladhaire is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-19-2008, 12:07 AM  
Tifi
A Murloc Raider
Interface Author - Click to view interfaces

Forum posts: 6
File comments: 93
Uploads: 5
The fix for Lombra's error is in my last post. I just failed to include the error message.
Tifi is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-13-2008, 08:12 PM  
Lombra
A Deviate Faerie Dragon
 
Lombra's Avatar
Interface Author - Click to view interfaces

Forum posts: 19
File comments: 170
Uploads: 16
I'm getting this when trying to open any page through the "Open" dropdown menu:
Code:
Message: ..\AddOns\WowLua\WowLua.lua line 476:
   attempt to index local 'entry' (a nil value)
Debug:
   [C]: ?
   WowLua\WowLua.lua:476: GoToPage()
   WowLua\WowLua.lua:303: func()
   ..\FrameXML\UIDropDownMenu.lua:568: UIDropDownMenuButton_OnClick()
   [string "*:OnClick"]:1:
      [string "*:OnClick"]:1
I can still access all pages by navigating through them.
__________________
Grab your sword and fight the Horde!

Shattered Hand-EU
Lombra is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-11-2008, 03:04 PM  
Cladhaire
Salad!
 
Cladhaire's Avatar
WoWInterface Super Moderator
Interface Author - Click to view interfaces

Forum posts: 1473
File comments: 3156
Uploads: 15
Quote:
Originally posted by Scilia
whew...lol...ok, how would i get more information on that per say?
You'd need to give us at the very least a stack traceback.. or the code that is calling into the UI template, etc. The easiest way to get a stack traceback is to download and install Swatter, a bug-tracking addon:

http://auctioneeraddon.com/dl/Swatter/
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."

http://cladhaire.wowinterface.com
Cladhaire is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-11-2008, 02:37 PM  
Scilia
A Defias Bandit

Forum posts: 3
File comments: 7
Uploads: 0
whew...lol...ok, how would i get more information on that per say?
Scilia is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-11-2008, 02:29 PM  
Cladhaire
Salad!
 
Cladhaire's Avatar
WoWInterface Super Moderator
Interface Author - Click to view interfaces

Forum posts: 1473
File comments: 3156
Uploads: 15
Re: not really about the addon per say..

Quote:
Originally posted by Scilia
but im getting a strange lua error, thought you savy people could possibly tell me what it is, getting no help from bliz:

Interface/frameXML/UIpanel templates.lua:32: attempt to index local 'tab' (a number value)

any help would be appreciated
It means someone or something is calling the function that's on or near line 32, and being passed incorrect arguments. Most specifically you probably need to pass the frame as the first argument to that function. However, without more information, it's almost impossible to tell.
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."

http://cladhaire.wowinterface.com
Cladhaire is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-11-2008, 02:17 PM  
Scilia
A Defias Bandit

Forum posts: 3
File comments: 7
Uploads: 0
not really about the addon per say..

but im getting a strange lua error, thought you savy people could possibly tell me what it is, getting no help from bliz:

Interface/frameXML/UIpanel templates.lua:32: attempt to index local 'tab' (a number value)

any help would be appreciated
Scilia is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-11-2008, 02:08 PM  
AnrDaemon
A Cyclonian
Interface Author - Click to view interfaces

Forum posts: 41
File comments: 1005
Uploads: 1
Nice changes, Thank you, Cladhaire!
AnrDaemon is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-10-2008, 06:52 AM  
Cladhaire
Salad!
 
Cladhaire's Avatar
WoWInterface Super Moderator
Interface Author - Click to view interfaces

Forum posts: 1473
File comments: 3156
Uploads: 15
Quote:
Originally posted by xbeeps
Excellent addon, and a very good replacement for myDebug which is now broken. I have two suggestions:

1) Add the following code to the toc:

## LoadManagers: AddonLoader
## X-LoadOn-Slash: /wowlua, /lua

This allows it to load automatically when the slash command is executed, if AddonLoader is installed. Otherwise it is just ignored. This saves the load time for those 99/100 sessions where you're not using it.

2) Use something else than print, as that symbol is now already in the global namespace for use by addons (it was introduced in 3.0.2 i believe).
The .TOC changes have been made. I had meant to put AddonLoader support in a while ago, so the code should support it just fine. As for changing the name of the print function, I have no plans to do that at this time. This addon is meant to be able to act as a Lua interpreter, and that means taking code that works in stock Lua and having it work here.

It should not redefine the global print function, which you can still access via getfenv(0).print, if desired.
__________________
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."

http://cladhaire.wowinterface.com
Cladhaire is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-09-2008, 12:49 PM  
Aesir
An Aku'mai Servant
 
Aesir's Avatar
Interface Author - Click to view interfaces

Forum posts: 30
File comments: 159
Uploads: 1
Quote:
Originally posted by xbeeps
1) Add the following code to the toc:

## LoadManagers: AddonLoader
## X-LoadOn-Slash: /wowlua, /lua
May as well update ## Interface: 20400 in TOC also.
__________________
-- æsir
Aesir is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-09-2008, 09:16 AM  
xbeeps
A Kobold Labourer

Forum posts: 0
File comments: 3
Uploads: 0
Excellent addon, and a very good replacement for myDebug which is now broken. I have two suggestions:

1) Add the following code to the toc:

## LoadManagers: AddonLoader
## X-LoadOn-Slash: /wowlua, /lua

This allows it to load automatically when the slash command is executed, if AddonLoader is installed. Otherwise it is just ignored. This saves the load time for those 99/100 sessions where you're not using it.

2) Use something else than print, as that symbol is now already in the global namespace for use by addons (it was introduced in 3.0.2 i believe).
xbeeps is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-01-2008, 07:15 AM  
Tifi
A Murloc Raider
Interface Author - Click to view interfaces

Forum posts: 6
File comments: 93
Uploads: 5
Code:
local function dropDownFunc(page)
	WowLua:GoToPage(page)
end
needs to be changed to
Code:
local function dropDownFunc(btn, page)
	WowLua:GoToPage(page)
end
Oh and could you please either remove the Undo button or implement a Redo? ATM this "Undo" just loads the previously saved version of the script. All this button ever did for me was destroy work, because I accidentally clicked it when I wanted to click Save.
An Undo without Redo is no real Undo IMHO. What I would love to see is an undo queue. Every time the script is executed, the current version is saved to the queue (unless it wasn't changed of course). Undo loads the previous script from the queue, Redo the next. The queue is flushed when another page is loaded. It's not hard to implement, you just have to maintain the current position in the queue, and remove stuff after this position when a new item enters the queue.

Code:
local queue, queuePos = {}, 0
local function queueFlush(all)
	if all then
		table.wipe(queue)
		queuePos = 0
	end
end
local function queueAction(text)
	if text ~= queue[queuePos] then
		queuePos = queuePos+1
		queue[queuePos] = text
		for i=queuePos+1,#queue do
			queue[i]=nil
		end
	end
end
local function queueUndo()
	local item = queue[queuePos-1]
	if item then 
		queuePos = queuePos-1
		return item
	end
	return queue[queuePos]
end
local function queueRedo()
	local item = queue[queuePos+1]
	if item then
		queuePos = queuePos+1
		return item
	end
	return queue[queuePos]
end

function WowLua:Button_Undo()
	local page, entry = self:GetCurrentPage()
	WowLuaFrameEditBox:SetText(queueUndo() or entry.content)
end
function WowLua:Button_Redo()
	local page, entry = self:GetCurrentPage()
	WowLuaFrameEditBox:SetText(queueRedo())
end
function WowLua:Button_Run()
	local text = WowLuaFrameEditBox:GetText()
	
	-- Run the script, if there is an error then highlight it
	if text then
		local succ,err = WowLua:RunScript(text)
		if not succ then
			local chunkName,lineNum = err:match("(%b[]):(%d+):")
			lineNum = tonumber(lineNum)
			WowLua:UpdateLineNums(lineNum)

			-- Highlight the text in the editor by finding the char of the line number we're on
			text = WowLua.indent.coloredGetText(WowLuaFrameEditBox)

			local curLine,start = 1,1
			while curLine < lineNum do
				local s,e = text:find("\n", start)
				start = e + 1
				curLine = curLine + 1
			end

			local nextLine = select(2, text:find("\n", start))
			
			WowLuaFrameEditBox:SetFocus()
			WowLuaFrameEditBox:SetCursorPosition(start - 1)
		else
			queueAction(text)
		end
	end
end

Last edited by Tifi : 11-01-2008 at 08:07 AM.
Tifi is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Post A Reply



Category Jump:




The Network:
EQInterface | EQ2Interface | LoTROInterface | MMOInterface | War.MMOUI | WoWInterface | VGInterface | Allakhazam | Thottbot | Wowhead | Zam


©2009 MMOUI / ZAM Network
vBulletin - Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.