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

Detailed argument errors #31

Open
SquidDev opened this issue Jan 21, 2020 · 0 comments
Open

Detailed argument errors #31

SquidDev opened this issue Jan 21, 2020 · 0 comments

Comments

@SquidDev
Copy link
Member

Compare Cobalt:

> string.sub(false)
stdin:1: bad argument: number expected, got boolean

with PUC Lua:

> string.sub(false)
stdin:1: bad argument #1 to 'sub' (string expected, got boolean)

The latter is obviously much more descriptive and useful. There's two things we should be doing here:

  • Keeping argument indexes in the error message.
  • Include error messages. See luaL_argerror for how it's done by Lua, but it's not entirely clear this is correct in the presence of tailcalls - we may need some additional sanity checks.

Also worth thinking about how, if at all, we can expose this to CC.

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

No branches or pull requests

1 participant