typedlua
typedlua copied to clipboard
attempt to index '(string)' with '"gsub"'
local function a(s:string):string
return (s:lower():gsub("a","b"));
end
should be equivalent to string.gsub(s:lower(), "a", "b") and string.gsub(string.lower(s), "a", "b") but gives a type error.
You're right; there appears to be a bug in the compiler for the : operator.
As a workaround, it works when you wrap the first member-call in brackets (although this should make no difference to Lua):
(s:lower()):gsub("a", "b")
This is a completely nonsense report, something is clearly broken here:
("a"):gsub("a", "b"):lower()
attempt to index '(string, integer)' with '"lower"'