Any idea what this error means.

I get this error [ERROR] addons/ulx/lua/ulx/modules/sh/custom.lua:5: ‘<name>’ expected near ‘(’

  1. unknown - addons/ulx/lua/ulx/modules/sh/custom.lua:0
    randomly some times the custom ulx works and other times it chooses not to, usually after i add something but even if i remove it, it will still not work.

CATEGORY_NAME = "Custom"

------------------------------Spam Notify -------------------------
function ulx.spamnotify(calling_ply, target_ply, amount, message)
	for (i = 1, amount) do
		target_ply:Notify(message, 0, 5)
	end
end

local spamnotify = ulx.command(CATEGORY_NAME, "ulx spamnotify", ulx.spamnotify, "!spamnotify", true)
spamnotify:addParam{ type=ULib.cmds.PlayerArg }
spamnotify:defaultAccess(ULib.ACCESS_SUPERADMIN)
spamnotify:help("Notifys the player according to the specified amount of times.")

You can’t wrap for loop arguments like that

Well it works sometimes and sometimes the ULX breaks, its a ulx issue the code works fine it was working until i tried adding something to the category then i removed that thing and i still get the error.

I don’t know if you understood my post, this isn’t a ulx issue, this just isn’t allowed by the Lua syntax.

Then why was it working perfectly earlier.



for i = foo, bar do


is completely valid



for (i = foo, bar) do


is not and will cause a syntax error, the exact same one you’re getting.

[editline]1st November 2017[/editline]

Post the code where it was working then, as this will always raise a syntax error.

I am sorry i was being a dick, i am tired and fustrated you were correct and I have no idea why it was working fine earlier thank you.

[editline]1st November 2017[/editline]

and its the same code, i have no idea how it was working but it was.