VS Code: Debugger for mLua

# Course Introduction

Let's try debugging a world that's being created from VS Code by installing mLua Debugger VS Code Extension.

##### Reference Guide

  * [Script Debug](/docs?postId=202)
  * [LocalWorkspace](/docs?postId=1165)
  * [mLua VS Code Extension](/docs/?postId=1209)



# Debugger for mLua Extension

Debugger for mLua is an expansion program that supports debugging an mLua file from VS Code for a world that uses a local workspace. The Debugger for mLua can be used if the mLua Extension is installed and MapleStory World's LocalWorkspace link function is activated.

# Debugger for mLua Extension Installation

  1. Select Extensions and search for and install Debugger for mLua.

  2. Check if the world's local folder has the `.vscode` folder and the `launch.json` file.

  3. Open the `launch.json` file and enter the following. Configurations must be written as shown below in order to activate the Run and Debug tab for VS Code.
         
         @Component
         script PendingBehavior extends Component
         end
         



    
    
    # Debugging
    
    Debugger for mLua is a method that links VS Code Debugger to MSW.
    Therefore, debug play must be executed before linking and using VS Code Debugger. You can check the debug link status from the maker's Console.
    
    1. Open the world that will be debugged.
    2. Play by pressing the Start Debugging button rom maker.
        [png](1752493246769c727f80f4b834db49badc10dfa1d87ae)
    3. Select **Run and Debug** from VS Code.
        [png](1752493465533de5e5b193b0a4b64918698ba153abef7)
    4. Select the name of previously defined composed information and press Execute.
        [png](1752491257751ada9a353952a4373a9a58c419aabec9f)
    5. When VS Code Debugger is linked, it can be confirmed from maker's Console.
        [png](175249314149585250a3fb9e242ae91545127d221d059)
    
    # Run and Debug
    
    ## Stopping Point
    The Stopping Point is when the debugging can be paused. It can be set at multiple points and freely removed. You can view files with Stopping Points and lines from **BREAKPOINTS**.
    
    #### Setting and Removing Stopping Points
    There are two ways to set or remove Stopping Points.
    
    1. Select the line where a Stopping Point will be set and press 'F9' to set or remove them.
    2. Press the code line area to add or remove them.
    
    [png](1752491279590042be7bd2233426b8df2b4ff76b99d7e)
    
    #### VARIABLES
    View the variable info based on Scope.
    [png](17524936153840d09d5ea89904d80ae2099bb38b014ec)
    
    #### WATCH
    You can directly write and view the value of Expression.
    [png](1752557620746239370f899b8440d963337db331828e9)
    #### CALL STACK
    You can view the call stack.
    [png](17525480355440cc7b232d4fa498881987f2cb470a7f5)
    #### BREAKPOINTS
    You can view the path and line of the file with Stopping Points. Select a Stopping Point from the list to move to that specific Stopping Point.
    [png](1752491237685ab378074ca044f6e98ee50bc36320133)
    
    #### ENVIRONMENT
    View the current execution space.
    [png](175249399198781822bddc5f947eca0d193fcc7905448)
    
    #### Confirm Delegated Value to Symbol
    The delegated value to a symbol can be viewed via the tooltip that displays when hovering the mouse cursor over a symbol.
    
    # Debug Toolbar
    
    Upon starting a debug, the toolbar will display abvove VS Code. When play stops at a Stopping Point while executing, a world debug will activate the execution buttons for the toolbar. If you wish to continue to execute the code for debugging purposes, you can do so by pressing a button.
    You can find and solve problems in the world by identifying code status or flow in units of procedure by executing code.
    
    [png](17524912237671bfee3141dde43fb80b778e12dfef002)
    
    | Number | Function | Description |
    | --- | --- | --- |
    | ![\[object Object\]](https://mod-file.dn.nexoncdn.co.kr/storage/numbers/NO_01.jpg) | Continue Execution | Execute from the current Stopping Point until the code line with the next Stopping Point. |
    | ![\[object Object\]](https://mod-file.dn.nexoncdn.co.kr/storage/numbers/NO_02.jpg) | Execute in Units of Procedure | Execute code one line at a time. When the focused line has a function, it treats it as if the function was executed and moved onto the next line. |
    | ![\[object Object\]](https://mod-file.dn.nexoncdn.co.kr/storage/numbers/NO_03.jpg) | Run Code Below | When the focused line has a function, it enters the function and executes the code inside of the function one line at a time. |
    | ![\[object Object\]](https://mod-file.dn.nexoncdn.co.kr/storage/numbers/NO_04.jpg) | Run Code Above | Completes the curren function call that's being executed and moves to the location where the target function was called to. |
    | ![\[object Object\]](https://mod-file.dn.nexoncdn.co.kr/storage/numbers/NO_05.jpg) | Restart | Halt the current debugging and return to the start of the debugging and restart the process. |
    | ![\[object Object\]](https://mod-file.dn.nexoncdn.co.kr/storage/numbers/NO_05.jpg) | Stop | Stop the debugging process. |