trim() undefined
polski-g opened this issue ยท 2 comments
Getting following error when I type /lsf
1x LFGSpamFilter\LFGSpamFilter-0.1.2.lua:155: attempt to call global 'trim' (a nil value)
[string "@LFGSpamFilter\LFGSpamFilter-0.1.2.lua"]:155: in function `?'
[string "@FrameXML\ChatFrame.lua"]:5093: in function `ChatEdit_ParseText'
[string "@FrameXML\ChatFrame.lua"]:4757: in function `ChatEdit_SendText'
[string "@FrameXML\ChatFrame.lua"]:4793: in function <FrameXML\ChatFrame.lua:4789>
[string "=[C]"]: in function `ChatEdit_OnEnterPressed'
[string "*:OnEnterPressed"]:1: in function <[string "*:OnEnterPressed"]:1>
Fixed it by adding this to the top of the .lua file:
local function trim(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end