Skip to content

Lua Code Parser Fails with Empty Lines in Code #4

@Czompi

Description

@Czompi

The current Lua code parser has an issue where it fails to parse or execute scripts that contain empty lines. This limitation restricts developers from writing clean and readable Lua code within XMDL files, as empty lines are commonly used for improving code clarity and separation of logic.

Steps to Reproduce:

  1. Write an XMDL file with a Lua script containing empty lines.
    @lua{>
    local a = 10
    
    local b = 20
    local sum = a + b
    
    document.insertMarkdown("Sum: " .. sum)
    <}
    
  2. Render the XMDL file in CwATE.
  3. Observe that the Lua code fails to execute.

Expected Behavior:
The Lua code parser should handle empty lines gracefully and execute the script without errors.

Actual Behavior:
The Lua code parser fails to execute the script if there are empty lines, leading to unexpected behavior or errors.

Proposed Solution:

  • Update the Lua code parser to properly ignore or skip over empty lines while parsing the script.
  • Add test cases to ensure the parser handles scripts with empty lines correctly.

Impact:
This issue affects the readability and maintainability of Lua scripts in XMDL files, as developers are forced to write compact code without empty lines.

Additional Notes:
Addressing this issue will improve developer experience and allow for better scripting practices within the CwATE platform.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions