Please excuse the ugliness, I didn't even want to do this so I was all hacky and shit with it. But it had to be done because I was sick of functions not being highlighted when I wanted them to be. :)
[b]Notepadpp.lua:[/b] [url]http://troll.ws/paste/6f9a7978[/url] (Now has 'continue')!
[b]GModLua.xml:[/b] [url]http://troll.ws/paste/e0e20611[/url] (Now has 'continue')!
Prepare for the great wall of china, lua 'continue' edition:
[lua]debug.sethook( );
local t_Output = {
["Libraries"] = {},
["LibraryFunctions"] = {},
["GlobalVariables"] = {},
["GlobalFunctions"] = {},
["ScriptedVariables"] = {},
["ScriptedFunctions"] = {},
["ObjectFunctions"] = {},
["Flags"] = {};
};
local t_Ignores = {
"mathx", "stringx", "_G", "_R", "_E", "GAMEMODE", "g_SBoxObjects", "tablex", "color_black",
"color_white", "color_transparent", "utilx", "_LOADLIB", "_LOADED", "func", "DOF_Ents",
"Morph", "_ENT", "IsString", "IsNumber", "IsTable", "IsBoolean", "IsFunction",
};
local function TableSingle( t_Table, t_Variable )
if ( !table.HasValue( t_Table, t_Variable ) ) then
table.insert( t_Table, t_Variable );
end
end
local function Capitalize( t_String )
return string.upper( string.ToTable( t_String )[ 1 ] ) .. string.sub( t_String, 2 );
end
for _, t_Type in pairs( {"string", "number", "table", "boolean", "function"} ) do
local t_Name = Capitalize( t_Type );
getfenv()["Is" .. t_Name] = function( t_In )
return type( t_In ) == t_Type;
end
end
local function GetFunctions( t_Table, t_Sort )
local t_Functions = {};
local t_Constants = {};
local t_ConstantFilter = { "string", "number", "boolean" };
for t_Key, t_Value in pairs( t_Table ) do
if ( type( t_Value ) == "function" ) then
table.insert( t_Functions, t_Key );
elseif ( table.HasValue( t_ConstantFilter, type( t_Value ) ) ) then
table.insert( t_Constants, t_Key );
end
end
if ( t_Sort ) then
table.sort( t_Functions );
table.sort( t_Constants );
end
return t_Functions, t_Constants;
end
local function GetDerma()
local t_Controls = {};
for _, t_Derma in pairs( derma.GetControlList() ) do
table.insert( t_Controls, t_Derma.ClassName );
end
for _, t_Key in pairs( t_Controls ) do
for _, t_Function in pairs( GetFunctions( _G[ t_Key ] ) ) do
TableSingle( t_Output["GlobalFunctions"], t_Function );
end
end
end
local function GetGlobal( )
for t_Key, t_Value in pairs( _G ) do
if ( IsString( t_Key ) ) then
if ( !table.HasValue( t_Ignores, t_Key ) ) then
if ( IsTable( t_Value ) ) then
TableSingle( t_Output["Libraries"], t_Key );
for _, t_Function in pairs( GetFunctions( t_Value ) ) do
if ( string.sub( t_Function, 1, 2 ) == "__" ) then
TableSingle( t_Output["Flags"], t_Function );
else
TableSingle( t_Output["LibraryFunctions"], t_Key .. "." .. t_Function );
end
end
elseif ( IsFunction( t_Value ) ) then
TableSingle( t_Output["GlobalFunctions"], t_Key );
else
TableSingle( t_Output["GlobalVariables"], t_Key );
end
end
end
end
end
local function GetMeta( )
for t_Key, t_Value in pairs( _R ) do
if ( IsString( t_Key ) ) then
if ( !table.HasValue( t_Ignores, t_Key ) ) then
if ( IsTable( t_Value ) ) then
TableSingle( t_Output["Libraries"], t_Key );
for _, t_Function in pairs( GetFunctions( t_Value ) ) do
if ( string.sub( t_Function, 1, 2 ) == "__" ) then
TableSingle( t_Output["Flags"], t_Function );
else
TableSingle( t_Output["ObjectFunctions"], t_Function );
end
end
end
end
end
end
end
local function GetWeapon( )
for t_Key, t_Value in pairs( weapons.Get( "weapon_base" ) ) do
if ( IsString( t_Key ) ) then
if ( IsFunction( t_Value ) ) then
for _, t_Prefix in pairs({ "self", "SWEP" }) do
TableSingle( t_Output["ScriptedFunctions"], t_Prefix .. "." .. t_Key );
TableSingle( t_Output["ScriptedFunctions"], t_Prefix .. ":" .. t_Key );
end
elseif ( IsString( t_Value ) || IsNumber( t_Value ) || IsBoolean( t_Value ) ) then
TableSingle( t_Output["ScriptedVariables"], "self." .. t_Key );
TableSingle( t_Output["ScriptedVariables"], "SWEP." .. t_Key );
end
end
end
end
local function GetEntity( )
local t_Types = { "base_ai", "base_anim", "base_gmodentity", "base_entity" };
if ( SERVER ) then
table.Merge( t_Types, { "base_brush", "base_point" } );
end
for _, t_Type in pairs( t_Types ) do
for t_Key, t_Value in pairs( scripted_ents.Get( t_Type ) ) do
if ( IsString( t_Key ) ) then
if ( IsFunction( t_Value ) ) then
for _, t_Prefix in pairs({ "self", "ENT" }) do
TableSingle( t_Output["ScriptedFunctions"], t_Prefix .. "." .. t_Key );
TableSingle( t_Output["ScriptedFunctions"], t_Prefix .. ":" .. t_Key );
end
elseif ( IsString( t_Value ) || IsNumber( t_Value ) || IsBoolean( t_Value ) ) then
TableSingle( t_Output["ScriptedVariables"], "self." .. t_Key );
TableSingle( t_Output["ScriptedVariables"], "ENT." .. t_Key );
end
end
end
end
end
local function GetTool( )
local t_ToolFunctions = {};
local t_ToolConstants = {};
local TOOL = {};
TOOL.Functions = {"Deploy", "DrawHUD", "DrawToolScreen", "FreezeMovement", "Holster", "LeftClick", "Reload", "RightClick", "Think", "Deploy"}
TOOL.Constants = {"BuildCPanel", "AddToMenu", "AllowedCVar", "Category", "ClientConVar", "ConfigName", "FaceTimer", "LastMessage", "LeftClickAutomatic", "Message", "Mode", "Model", "Name", "Objects", "RequiresTraceHit", "RightClickAutomatic", "ServerConVar", "Stage", "Stored"}
for t_Key, t_Value in pairs( weapons.Get( "gmod_tool" ) ) do
if ( IsFunction( t_Value ) ) then
TableSingle( t_ToolFunctions, t_Key );
else
TableSingle( t_ToolConstants, t_Key );
end
end
for t_Key, t_Table in pairs( TOOL ) do
for _, t_Value in pairs( t_Table ) do
if ( t_Key == "Functions" ) then
TableSingle( t_Output[ "ScriptedFunctions" ], "self: " .. t_Value );
TableSingle( t_Output[ "ScriptedFunctions" ], "TOOL: " .. t_Value );
else
TableSingle( t_Output[ "ScriptedFunctions" ], "self. " .. t_Value );
TableSingle( t_Output[ "ScriptedFunctions" ], "TOOL. " .. t_Value );
end
end
end
end
local function GetGamemode( )
for t_Key, t_Value in pairs( GAMEMODE.BaseClass ) do
if ( IsString( t_Key ) ) then
if ( IsFunction( t_Value ) ) then
for _, t_Prefix in pairs({ "self.", "self:", "GM.", "GM:", "GAMEMODE.", "GAMEMODE:" }) do
TableSingle( t_Output[ "ScriptedFunctions" ], t_Prefix .. t_Key );
end
else
for _, t_Prefix in pairs({ "self.", "GM.", "GAMEMODE." }) do
TableSingle( t_Output[ "ScriptedVariables" ], t_Prefix .. t_Key );
end
end
end
end
end
local function GetEffect( )
for _, t_Hook in pairs({ "Init", "Think", "Render" }) do
for _, t_Prefix in pairs({ "self", "EFFECT" }) do
TableSingle( t_Output[ "ScriptedFunctions" ], t_Prefix .. "." .. t_Hook );
TableSingle( t_Output[ "ScriptedFunctions" ], t_Prefix .. ":" .. t_Hook );
end
end
end
local function GetFlags( )
for _, t_Value in pairs({"__add", "__sub", "__mul", "__div", "__pow", "__unm", "__concat", "__eq", "__lt", "__le", "__index", "__newindex", "__call", "__tostring", "__gc", "__mode", "__metatable"}) do
TableSingle( t_Output["Flags"], t_Value );
end
end
local function GetExtra( )
for _, t_Value in pairs({ "Entity", "Owner", "Weapon" }) do
TableSingle( t_Output["ScriptedVariables"], "self." .. t_Value );
end
for _, t_Value in pairs({"_G", "_E", "_R", "_ENT"}) do
TableSingle( t_Output["GlobalFunctions"], t_Value );
end
for _, t_Value in pairs({"color_black", "color_white", "color_transparent"}) do
TableSingle( t_Output["GlobalVariables"], t_Value );
end
for _, t_Value in pairs({"RestoreNetworkVars", "GetNetworkVars", "NetworkVar", "DTVar", "SetWeaponHoldType", "GetHeight", "GetWidth", "Size"}) do
TableSingle( t_Output["ObjectFunctions"], t_Value );
end
for _, t_Value in pairs({"math.huge", "team.Random", "DTextE
why does everyone forget the 'continue' keyword?
also excellent work :D i tried to do this a while back and... well it wasnt the best waste of time XD
Shiiiiii I fucking knew I was suppose to put continue in there, but I forgot right after I finished it. lol guess people can do that later themselves.
:D
haha its not like its going to break because you left it out XD
but i got confused when i very first learnt about the continue keyword and because np++ didnt highlight it im like "oh great, lua doesnt support it"
Ahaha wow dude I had the same exact situation!
Until I saw someone use it in their c0d3s and I was like, you know how many times this could've been useful for me? D:
haha im just like "eh ill give it a go" and it worked so :P
alot of my earlier understanding of lua was "ok does this work? no? ok let me try it this way"
but ye definately would have saved those painful hours of trial and error
[QUOTE=G4MB!T;37893346]haha im just like "eh ill give it a go" and it worked so :P
alot of my earlier understanding of lua was "ok does this work? no? ok let me try it this way"
but ye definately would have saved those painful hours of trial and error[/QUOTE]
I still code that way.... Q_Q
i think everyone does in a way.. i mean im not saying that there arent people who can code for 3 hours straight without errors but you know.. noones perfect :P
...I feel stupid not knowing how to do this.
I tried userDefineLang, but that's formatted differently and didn't work. I tried extracting the file's sections into its' respective places (lang.xml and stylers.xml), but that didn't work either.
How do I used language.
I used to have this working now it doesn't work for me either. Could be the notepad++ doomsday edition's fault
I actually found out after like a full two years that I was using a version from that time period. I was using the discontinued ANSI version (whereas only the Unicode version is supported now).
Please tell me where should I put it.
same, need some help here!
[QUOTE=VertisticINC;39483320]same, need some help here![/QUOTE]
It seems broken I guess. I don't think this will be fixed. You can't expect any help.
There is a working one in the plug-in manager, but it's old.
Yeah, I Might Even Pay Someone To Do This For Me :P But I'll post On The Lua Hire Thread For That!
[editline]5th February 2013[/editline]
wish supersnail would take up the project like he fucking took up everything i did -_-
[QUOTE=VertisticINC;39489744]See, I'm Not The Only One Lebo, Now Fuck Off And Say Something Relative To The Topic!
[b](User was banned for this post ("Dumb trolling, missed the help thread, type properly already." - postal))[/b][/QUOTE]
Good job, buddy.
I wonder if I could make one of these? I'll take a look at how to make UDLs later.
please do!
I apologize for my ignorance and the thread necromancy, but how do I use this?
It's for GM12 at least. (I think)
As mentioned there's one in the Plugin Manager
[QUOTE=Milkshaker;41919211]It's for GM12 at least. (I think)[/QUOTE]
I think the GM13 in the thread title indicates that it's for GMod 13.
[QUOTE=Milkshaker;41919211] As mentioned there's one in the Plugin Manager[/QUOTE]
I was hoping the GM13 one would work.
What are the new things highlighted ? I am using Seagull version that has multiple things highlighted and not sure if you just did the same thing he did.
Oh shit, I totally forgot to do what I said I was.
Sorry, you need to Log In to post a reply to this thread.