[ERROR] LuaCmd:1: - What is this error?

I’m working on a Radio Entity. Pressing E on it, will start music. Pressing E on it again will turn the music off.
If you remove the entity, you get this error.
[ERROR] LuaCmd:1: ‘)’ expected near ‘re’

  1. unknown - LuaCmd:0[/lua]

My remove code.
function ENT:OnRemove()
for k,v in pairs(player.GetAll()) do
I don’t know the problem, but seeming how small the error is I hoping someone can lend me a hand.
I would be happy to show more code if requested, I don’t what to show because I don’t understand the error.

I used to get this error all the time with LuaCMD, I just thought it was broken.

Guessing you never found the solution? :rolleyes:

Is this error on the server or the client?

If it is on the client, are you using BroadcastLua or SendLua anywhere?

Well all my main code is in my init.lua file.
I am not using BroadcastLua or SendLua anywhere.
When I play in a local server and singleplayer, I get this error both ways.

Check for errors in Lua that’s ran dynamically (BroadcastLua, SendLua, RunString). LuaCmd is the default path for scripts that don’t have a path.

You should look for those 3 functions in ‘EntityRemoved’ hooks and in code that was used to delete the entity.

Don’t run a listen-server ( local server started within gmod ) to test code. Both CLIENT and SERVER code executes, and client vars can be overwritten by server vars if named the same and global, etc… Tons of issues can arise if they aren’t all taken into consideration.

Creating a local SRCDS for dev work is highly recommended and super simple ( I even include the .bat files required to do it ): https://dl.dropboxusercontent.com/u/26074909/tutoring/server_srcds_steamcmd/setting_up_a_server_with_steamcmd.lua.html

The reason you get that error is because you’re running Lua virtually ( not “tied” to a file, but executed on the fly, therefore the errors are harder to track down if one of the RunString commands are used in many places ); as oubliette says, RunString, BroadcastLua, SendLua, etc… will be the source…

Thanks for the detaile response, I will have to look into this when given the time.