How to "execute" a lua file

I’m making a “DFrame” with 5 “DButtons” on it. I would like each button to execute a lua file that is specified by a directory path.

any ideas?

[EDITLINE]9:42 PM[/EDITLINE]
By that i meant i will have another .lua, and when i push button 1, it opens that lua file. So if button 1 is meant to open a different derma menu, when i push button one it closes the original DFrame and opens the derma that Button 1 was meant to open. Might be a little confusing. sorry =X

include()

[lua]
local MAIN = vgui.Create( “DFrame” ) – Your DFrame.

local BUTTON = vgui.Create( “DButton”, MAIN ) – Your button parented to the frame.
function BUTTON:DoClick() – Define the function that is run on click.
MAIN:Close() – Close the frame.
RunConsoleCommand( “lua_openscript_cl”, “directory/to/thefile.lua” ) – The directory starts in lua so if it’s in autorun/client you would do “autorun/client/file.lua”
end
[/lua]

One problem - lua_openscript_cl is blocked via RunConsoleCommand().

Yeah, the file is included…but

[lua]
Button1.DoClick = function()
–Any command to execute the other file here?
end
[/lua]

Fuuuuu-

[lua]
local MAIN = vgui.Create( “DFrame” ) – Your DFrame.

local BUTTON = vgui.Create( “DButton”, MAIN ) – Your button parented to the frame.
function BUTTON:DoClick() – Define the function that is run on click.
MAIN:Close() – Close the frame.
include( “directory/to/file.lua” ) – The directory starts in lua so if it’s in autorun/client you would do “autorun/client/file.lua”
end
[/lua]

You shouldn’t be executing files like that. include() them at the beginning and then call a function from that file in your DoClick.

That’s what i figured also
[lua]
button1.DoCLick = function()
DFrame:Close()
include( “directory” )
end
[/lua]