Script crashes Gmod

For some reason my script is crashing Garry’s Mod whenever it loads, no errors.:
[lua]
–[[
–Name: Resource Smart
–Author: Helix Nebula
–Version: 2.0
–]]

include( “downloads.lua” )
include( “parts.lua” )
TABLES
ResourceSmart = {}
ResourceSmart.DownloadList = {}
ResourceSmart.Commandlist = {}
ResourceSmart.VersionURL = “http://www.colzdragon.net/resourcesmart_ver.txt
ResourceSmart.Version = 2
ResourceSmart.Prefix = “rs_”
ResourceSmart.ToggleDownloadList = CreateConVar( ResourceSmart.Prefix … “commands”, 1, FCVAR_NOTIFY )
ResourceSmart.Toggled = CreateConVar( ResourceSmart.Prefix … “toggle”, 1, FCVAR_NOTIFY )
ResourceSmart.PCSToggled = CreateConVar( ResourceSmart.Prefix … “toggle_pc_sound”, 1, FCVAR_NOTIFY )
ResourceSmart.PCMToggled = CreateConVar( ResourceSmart.Prefix … “toggle_pc_model”, 1, FCVAR_NOTIFY )

if ResourceSmart.Toggled:GetBool() then
for k, v in pairs( ResourceSmart.DownloadList ) do
local f = ResourceSmart.CreateFile( v )
f:AddFile()
f:Precache( PreCacheModels, PreCacheSounds )
end
end

function ResourceSmart.Downloads( ply )
if not ResourceSmart.Toggled:GetBool() then
ply:ChatPrint( HUD_PRINTCONSOLE, “>>> ResourceSmart[ Core ] >> is disabled” )
return
end
ply:ChatPrint( HUD_PRINTCONSOLE, string.format( “%s%s%s are being precached” ),
(ResourceSmart.PCSToggled:GetBool()) and “Sounds” or “”,
(ResourceSmart.PCSToggled:GetBool() and ResourceSmart.PCMToggled:GetBool()) and “/” or “”,
(ResourceSmart.PCMToggled:GetBool()) and “Models” or “” )
for k, v in pairs( DownloadList ) do
local f = ResourceSmart.CreateFile( v )
if f:IsSound() then
ply:ChatPrint( HUD_PRINTCONSOLE, “>>” … k … “<< | " … v … " | >>Sound<<” )
elseif f:IsMaterial() then
ply:ChatPrint( HUD_PRINTCONSOLE, “>>” … k … “<< | " … v … " | >>Material<<” )
elseif f:IsModel() then
ply:ChatPrint( HUD_PRINTCONSOLE, “>>” … k … “<< | " … v … " | >>Model<<” )
elseif f:IsFont() then
ply:ChatPrint( HUD_PRINTCONSOLE, “>>” … k … “<< | " … v … " | >>Font<<” )
elseif f:IsParticle() then
ply:ChatPrint( HUD_PRINTCONSOLE, “>>” … k … “<< | " … v … " | >>Particle<<” )
else
ply:ChatPrint( HUD_PRINTCONSOLE, “>>” … k … “<< | " … v … " | >>UNKNOWN<<” )
end
end
end
concommand.Add( ResourceSmart.Prefix … “downloads”, ResourceSmart.Downloads )

function ResourceSmart.CommandList( ply )
if ResourceSmart.ToggleDownloadList:GetBool() then
ply:PrintMessage( HUD_PRINTCONSOLE, “>>> ResourceSmart[ Core ] >> List of Commands” )
for k, v in pairs( CommandList ) do
ply:ChatPrint( HUD_PRINTCONSOLE, “>>” … k … "<< | " … ResourceSmart.Prefix … v )
end
return
else
ply:ChatPrint( HUD_PRINTCONSOLE, “>>> ResourceSmart[ Core ] >> Command Listing is Disabled!” )
end
end
concommand.Add( ResourceSmart.Prefix … “commands”, ResourceSmart.CommandList )

function ResourceSmart.VersionCheck( ply )
if ResourceSmart.GetLatestVersion() == true then
ply:ChatPrint( HUD_PRINTCONSOLE, ">>> ResourceSmart[ VersionChecker ] >> Up to date with version " … ResourceSmart.Version )
else
ply:ChatPrint( HUD_PRINTCONSOLE, ">>> ResourceSmart[ VersionChecker ] >> Not up to date, Current Version: " … ResourceSmart.Version … " | Up To Date Version: " … ResourceSmart.GetLatestVersion() )
end
end
concommand.Add( ResourceSmart.Prefix … “versioncheck”, ResourceSmart.VersionCheck )
[/lua]

I suggest commenting lines and functions out to find the cause of the crash because no one wants to debug someone elses code

I already attempted to debug this.

Maybe the problem is in one of the includes… I suggest you debug those instead

http://wiki.garrysmod.com/?title=Resource.AddFile :wink:

[lua]resouce.AddFile(f) [/lua]

If that doesn’t work then, disable the include for your downloads.lua and parts.lua make sure it’s this file causing the error.

That’s not it. I just didn’t show my metatables.

How can we fix if we don’t know the problem.

The problem was his game crashed when he ran it…

That solves alot.

can someone tell me what include does i have looked every where but cant find it. i know that it has something to do with loading files but dont know how to apply it. would i use it in init.lua to load another file under lua folder. or files in sub folders…

Instead of bumping an old thread for a totally unrelated question you could just make a new thread.

include loads the file at the specified location

For example: include(“derp.lua”) would load derp.lua in the same folder as the file you call it from (or the lua/ folder if it doesnt exist there)