Opening the menu to Lua - Your contribution needed

A few of you might have already seen my new video, others don’t - here is it again:
[hd]http://www.youtube.com/watch?v=pTA9Ry_Q9Fg&fmt=37[/hd]

Media:

My goal is to make everything in the menu environment with pure lua.
In the video you see something called LuaMenu which includes already five tabs (Console, Error, Luapad, Chat, Irc) but I need some community input to extend this as far as possbile.

A basic Plugin looks like this:
[lua]-- Sample Plugin for LuaMenu
PANEL = {}
PANEL.Name = “Chat”
PANEL.Desc = “Chat”
PANEL.TabIcon = “gui/silkicons/comments”

function PANEL:Init()
self:SetMouseInputEnabled(true)
self:SetKeyboardInputEnabled(true)

self.Output = vgui.Create("DListView",self)
self.Output:AddColumn("TimeStamp"):SetFixedWidth(60)
self.Output:AddColumn("Name"):SetFixedWidth(200)
self.Output:AddColumn("Message")
self.Output:SetDataHeight(16)

function ChatPrint(str,name)
	local pnl = GetError().Output:AddLine(tostring(os.date("%I:%M:%S")),name,str:gsub("

“,” "))
pnl.FullText = str
end
function GetChat()
return self
end

hook.Add("ChatText","Shoop",function(str,clr,name)
	local pnl = GetChat().Output:AddLine(tostring(os.date("%I:%M:%S")),name,str:gsub("

“,” "))
pnl.FullText = str
end)
end

function PANEL:PerformLayout()
self:StretchToParent(4,27,4,4)
self.Output:StretchToParent(0,0,0,0)
end

function PANEL:Paint()
end
[/lua]

If you’ve seen the taskbar in the video, there is a lot of stuff that could be changed/improved.
You might have a nice idea howto draw the items or the bar itself? Post it here and i’ll see if it fits.

If you click on the GMod Icon this is what pops up, it’s ugly code atm, no custom paint or anything. If you want to improove it please go ahead :eng101:
[lua]
local menu = DermaMenu()
menu:SetMinimumWidth(200)
menu:SetDrawBorder(false)
menu.OpenSubMenu = function(self,item,menu)
– Do we already have a menu open?
local openmenu = self:GetOpenSubMenu()
if (openmenu) then
– Don’t open it again!
if ( menu and openmenu == menu ) then return end
– Close it!
self:CloseSubMenu( openmenu )
end
if (!menu) then return end
local x,y = item:LocalToScreen( self:GetWide(), 0 )
menu:Open(x-1,y-36,false,item)
self:SetOpenSubMenu(menu)
end[/lua]

You might have also seen the SteamServer Frame on which I also need some help.
I think about swithing to PcWiz’ Server Query API (http://www.facepunch.com/showthread.php?t=894952) but there would be also TheLinx’ (http://github.com/TheLinx/steam-condenser/blob/master/lua/steam/init.lua)

Help is appreciated. That’s all what I have to say at the moment.
I hope that you’ll bring up some cool ideas to make this project epic.

If you want to test your plugins/tabs do this:
[ul]
[li]Copy the code below to lua/vgui/luaconsole.lua
[/li][li]Create a folder called luaconsole in vgui (lua/vgui/luaconsole/)
[/li][li]Name your file tab_
.lua so it’ll get loaded properly
[/li][/ul]


Some Ideas:

[ul]
[li]Itunes/WinAmp Interace
[/li][li]Web browser
[/li][/ul]


Download / SVN:

http://luastoned.googlecode.com/svn/trunk/luamenu/

Howto install:
Create a new folder in /addons/ preferably named LuaMenu and make a checkout :slight_smile:

Awesome.

:buddy:

[lua]
local menu = DermaMenu()
menu:SetMinimumWidth(200)
menu:SetDrawBorder(false)

function menu:OpenSubMenu(item, menu)
–why can menu be nil anyway? Just don’t call this callback if it’s nil
if not menu then return end
local openMenu = self:GetOpenSubMenu()
if openMenu and openMenu ~= menu then
self:CloseSubMenu(openMenu)
else
local x, y = item:LocalToScreen(self:GetWide(), 0)
menu:Open(x - 1, y - 36, false, item)
self:SetOpenSubMenu(menu)
end
end
[/lua]

Your function is a mess, so it’s a bit difficult to read its purpose, but would this do?

edit

os.date with a format string (that isn’t “*t”) will return a string to begin with, by the way.

http://dl.dropbox.com/u/3659637/LMenu.png

Am I doing it right?

I loled.

Currently working on something like a AppStore, get plugins/snippets from the web.

Autor? Haha.

German ~

Do you reckon you could get Alan hooked into the normal gmod chat? I’ve been wanting to do that for ages…

Post sum plugins plox.

Do I still need to slave over fucking with my lua query api shit for you :3

Please free me from this oh shit stained unthreaded query api and give me threaded sockets PLEASE

This looks like it has potential.

I want a mini-IDE so I can code simple stuff without switching between notepad++
Is that what luapad is? can’t really see what’s going on, even in the 1080p vid

It’s from Alan the fairy by me and deco, you can find the source for it here:

it requires luasocket (I think I did some modifications to it to get it working, if you can’t get it working with your luasocket try changing the way you require or try this: http://dl.dropbox.com/u/244444/luasocketgmod.rar)

Sorry if this isn’t on-topic at all, but how do I make an SVN?

I will post pics of the luapad when I’m back home :slight_smile:

Epique!

Is that what you want? :smiley:

I want your babies.

Is that LuaPad?(from gmod.org)

[editline]02:18PM[/editline]

gay’d

[editline]02:18PM[/editline]

at dave