require("MWidget")
Gauge = MWidget.Load("Gauge")
g = Gauge.new(100, 50) – width, height
g:SetEffect(Gauge.effects.meter, 0x0000FF, 0xFF0000)
v = g:GetView() – Create a physical location to display the gauge in
v:Refresh() – Update the contents
g:Value(50) – set the gauge to 50%
v:Refresh()
Error number: 0
Event: Run-time error
Description: [string "Script file"]:2: module 'MWidget' not found:
no field package.preload['MWidget']
no file '.\MWidget.lua'
no file 'D:\Programs\MUSHclient\lua\MWidget.lua'
no file 'D:\Programs\MUSHclient\lua\MWidget\init.lua'
no file 'D:\Programs\MUSHclient\MWidget.lua'
no file 'D:\Programs\MUSHclient\MWidget\init.lua'
stack traceback:
[C]: in function 'require'
[string "Script file"]:2: in main chunk
Called by: Immediate execution
(MUSHclient root)/
|
+- lua/
|
+- MWidget/
|
+- Libraries/
|
+- Widgets/
|
+- init.lua
For the past couple weeks I've been working on a widget framework based on MUSHclient's minwindow functionality, with the goal of making it easier to add miniwindows to your plugins. I've already created two relatively simple widgets, a CharacterGrid and a Gauge, with more on the way. I've also created a demo TicTacToe plugin to showcase the CharacterGrid's functionality.
You can find the framework here. Click the Download link to the right of the project title, and unzip into (MUSHclient root)\lua. Rename the resulting folder to 'MWidget'. To use the framework, simply require() the widget(s) you want to use. For example:
A single global table is created as well, called MWidget, which contains all of the currently-imported widget definitions, and is required for widget hotspots to work at all. Basically, don't mess with the MWidget table and you'll be fine.
I'd appreciate any feedback (or assistance!) with the framework!
[link=file]2728[/link]