sm64coopdx/docs/lua/vs-code-setup.md

1.6 KiB

Lua Reference

Setting up Visual Studio Code will allow you to have all of the modern benefits of IDEs like autocomplete.


  1. Install the Lua extension by sumneko in VS Code:

extension


  1. Goto settings (ctrl+,) and type diagnostics disable in the settings search bar:

diagnostics


  1. Add a new item called lowercase-global and click ok

lowercase-global


  1. Type workspace library in the settings search bar:

workspace-library


  1. Add a new item containing the location of <your repro>/autogen/lua_definitions

lua-definitions


  1. Open a lua mod file be amazed at autocompletion and all of that good stuff autocompletion

Note: For your custom functions you will need to provide type definitions to get autocomplete.

For instance, this will not autocomplete for the mario struct:

function mario_update(m)
    -- code here
end

But this will autocomplete for the mario struct:

--- @param m MarioState
function mario_update(m)
    -- code here
end