sm64coopdx/docs/lua/guides/vs-code-setup.md
Emily♥ 29b67a3ef0 Pass "interaction" to HOOK_ALLOW_PVP_ATTACK and HOOK_ON_PVP_ATTACK + Fix broken links (#566)
* Pass "interaction" to HOOK_ALLOW_PVP_ATTACK and HOOK_ON_PVP_ATTACK

This let's you test for the kind of attack in the hook; for example, you can do `interaction & INT_KICK ~= 0` to test if the attack is a kick.

* Fix broken links in wiki

Have to go up one directory
2024-03-25 18:47:27 -04:00

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