How include works

I don’t understand something.

I’m trying to make RTV for TTT, where the voting system is wiox’s gmod-mapvote, and I made the RTV system.
With wiox’s mapvote you start a mapvote using:


MapVote.Start( settings.Length, settings.AllowCurrent, settings.Limit, settings.Prefix )

Ofc I can just replace those with the corrosponding numbers, but something weird happened with “include”.

I thought if I add a line saying


include( "mapvote/sv_rtv.lua" )

It will be like taking the entire code and pasting it instead of that line, but when I did that exactly (Deleted sv_rtv.lua and pasted the content into autorun/server/ttt_mapvote.lua) it worked.
When I used include I got this error:


[ERROR] addons/gmod-mapvote-master/lua/mapvote/sv_rtv.lua:118: attempt to index global 'settings' (a nil value)
  1. StartVote - addons/gmod-mapvote-master/lua/mapvote/sv_rtv.lua:118
   2. Vote - addons/gmod-mapvote-master/lua/mapvote/sv_rtv.lua:40
    3. fn - addons/gmod-mapvote-master/lua/mapvote/sv_rtv.lua:46
     4. unknown - addons/ulib/lua/ulib/shared/hook.lua:183


Oh ye start of autorun/server/ttt_mapvote.lua


local settings = {
	Length = 20, -- Vote lasts 20 seconds
	AllowCurrent = false, -- Don't allow current map to be re-voted
	Limit = 10, -- Only allow the choice of 10 maps
	Prefix = {"ttt_"}, -- Only allow maps beginning with ttt_
}

Because your “settings” thing is declared as local. Include is simply a RunString on contents of a file you specified so it won’t see local variables from other files.

Ahh ok.
Thanks