Skip to content

Latest commit

 

History

History
49 lines (38 loc) · 1.23 KB

README.md

File metadata and controls

49 lines (38 loc) · 1.23 KB

Moonsharp Types

Typescript definitions for the Moonsharp Lua interpreter made with types-lua

Installation

  1. Get npm package
yarn add -D https://github.com/tts-community/types-moonsharp
# or
npm install -D https://github.com/tts-community/types-moonsharp

# And if we publish it:
yarn add -D @types/moonsharp
  1. Configure tsconfig.json

Typescript will not automatically load typescript definitions unless they are a @types module

{
  "compilerOptions": {
    "types": ["types-lua"]
  }
}

Loading only a subset of features

Some Lua environments are sandboxed and don't have some globals declared, like io, os and debug. To avoid registering these globals you should look at the version-specific file at the root of this package and loaded each of it's dependencies separately. For example

{
  "compilerOptions": {
    "types": [
      "types-moonsharp/core/coroutine",
      "types-moonsharp/core/global",
      "types-moonsharp/core/math",
      "types-moonsharp/core/metatable",
      "types-moonsharp/core/modules",
      "types-moonsharp/core/string",
      "types-moonsharp/core/table",
      "types-moonsharp/patches"
    ]
  }
}