Having some strange error [lua_run:1] '=' expected near '<eof>'

So now, no matter what script I try to run, it gives out the following
] lua_openscript_cl worldtolocal.lua
Running script worldtolocal.lua…
] lua_run worldtolocal.lua
> worldtolocal.lua…
[lua_run:1] ‘=’ expected near ‘<eof>’

Take a look at the code, but I am sure that’s not a code problem. The same error appears for all scripts.


function Nigtrace()
local ply = FindPlayer( ply )
local tr = util.GetPlayerTrace ( ply )
tr = util.TraceLine ( tr )
if tr.Entity:IsValid() then
MsgN ( tr.Entity:WorldToLocal( Vector( 0, 0, 0 ) ) )
MsgN ( tr.Entity:WorldToLocal( Angles( 0, 0, 0 ) ) )
else return end
end
concommand.Add( "getposangle", Nigtrace )

Did you attempt to run it through the console?

That’s not how lua_run works. lua_run emulates a lua row in the console. lua_openscript runs the whole file you provide. So after you’ve done the openscript, you should be able to just do “getposangle” in console.

So no one thought of telling him that he hasnt even defined ply (player)

Yeah thanks, already found it all out. Now I have other problems :slight_smile: