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

MoonSharp clobber syntex error details during require #121

Closed
fgretief opened this issue Jan 8, 2016 · 2 comments
Closed

MoonSharp clobber syntex error details during require #121

fgretief opened this issue Jan 8, 2016 · 2 comments

Comments

@fgretief
Copy link
Contributor

fgretief commented Jan 8, 2016

Calling the require function on a file with an syntax error in it, MoonSharp print the point where the required is called, and not the place were the syntax error occurred.

In MoonSharp the following is given:

> require "test1"
libfunc_require:(12,1-44): unexpected symbol near '/'

I traced the issue to the FillDebugData call on line 249 in the Processor_InstructionLoop.cs file. This method overwrite the Decorative message of the SyntaxErrorException that already contain the correct Decorative message. If I add an if statement to not write the decorative message for SyntaxErrorExceptions in FillDebugData method, then the result is as follows:

> require 'test1'
test1.lua:(5,1-2): unexpected symbol near '/'

This makes it easier to understand where the error comes from.

In Lua 5.3 the error message is much more consistent:

> require "test1"
error loading module 'test1' from file 'W:\workspace\lua\test1.lua':
        W:\workspace\lua\test1.lua:5: unexpected symbol near '/'
stack traceback:
        [C]: in ?
        [C]: in function 'require'
        stdin:1: in main chunk
        [C]: in ?
@mkonstapel
Copy link

I'm running into the same issue and it makes it nearly impossible to write/debug multi-module Lua code. I'm using the DLL in Unity, so I don't have a full .NET environment set up. Any chance of a quick fix? Otherwise I'll try installing Visual Studio and creating a pull request.

@xanathar
Copy link
Member

xanathar commented Oct 3, 2016

Fixed in upcoming 1.7.0.0

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

3 participants