Minor LUA issue

So to start off with, yes I am fairly new to Lua and I’m trying to learn it by looking at existing scripts and modifying them and then merging ideas together. It’s what works for more more efficently.

Anyway, for my problem, I am trying to make it so that when the admin presses the button within the menu, they are prompted with a box that says ‘Write here…’ and then whatever they write in their gets displayed on all current players’ screens as the @@@ chat function does. However when I am using the code I have written, what happens is instead of the output being


it becomes

@@@" "Test

I’ve tried modifying it as much as I can to my knowledge, so instead I’ve come to these forums. This is the code that is responsible for the output.

function makeAnnouncement()

		local dp = vgui.Create("DFrame")
		dp:SetTitle("Write your announcement")

		local dte = vgui.Create("DTextEntry",dp)
		dte:SetValue("Write here...")
		dte.OnEnter = function(self)
			reason = self:GetValue()
			RunConsoleCommand("say"," @@@", reason)


You need to concatenate the strings using ‘…’.

print("This" .. " is " .. "concatenation")

RunConsoleCommand takes variadic arguments. If you concatenate them, it doesn’t work.

It does that to separate arguments, considering say only takes one argument, he needs to concatenate them.

Edit: Also that space in front of @@@ can be removed.

I thought “say” was protected by FCVAR_SERVER_CAN_EXECUTE

Yeah I got it confused with ply:ConCommand.

Fixed! :slight_smile:

Incase anyone is wondering here’s what I did instead


Thanks alot