Error parsing script (Lua syntax error)
The file is not valid Lua, so the whole script fails to load. Often habits from JavaScript or C#.
The error
Error parsing script @my_script/server.lua: unexpected symbol near '!'Common mistakes
!=instead of~=//comments instead of--&&and||instead ofandandor- A missing
then,doorend - A missing comma between table entries
Example
Lua
-- Wrong
if job != 'police' && onDuty {
// notify
}
-- Right
if job ~= 'police' and onDuty then
-- notify
end
How to fix it
- Go to the line in the error. The real mistake is often one or two lines above it.
- Use an editor with Lua support (VS Code with the Lua extension) to see errors while you type.
- If you use Lua 5.4 features such as
<const>, addlua54 'yes'to the manifest.