Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempt to index '(string)' with '"gsub"' #106

Open
Zash opened this issue Nov 16, 2016 · 2 comments
Open

attempt to index '(string)' with '"gsub"' #106

Zash opened this issue Nov 16, 2016 · 2 comments

Comments

@Zash
Copy link

Zash commented Nov 16, 2016

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.

@Veltas
Copy link
Contributor

Veltas commented Nov 16, 2016

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")

@Veltas
Copy link
Contributor

Veltas commented Nov 16, 2016

This is a completely nonsense report, something is clearly broken here:

("a"):gsub("a", "b"):lower()
attempt to index '(string, integer)' with '"lower"'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants