Skip to content

Luau type fixes for luau-lsp#57

Merged
Rider-Linden merged 3 commits intosecondlife:developfrom
tapple:type-fixes
Jan 23, 2026
Merged

Luau type fixes for luau-lsp#57
Rider-Linden merged 3 commits intosecondlife:developfrom
tapple:type-fixes

Conversation

@tapple
Copy link
Contributor

@tapple tapple commented Jan 13, 2026

Part of a set of PR's improving the definitions and keywords files in lsl and slua:


I significantly improved the luau types of most functions, so that luau-lsp gives less errors

Here's the diff for the generated slua-default.d.luau:

I added several fields to the definition file:

  • luaType: for when lua has a different or more-specific typing than lsl
  • luaReturn: same thing, but for return values
  • typeParameters: function generic<TYPE, PARAMETERS>()

I'm aware the plugin isn't the master source of lua typings. I can convert this PR to xml and submit a new PR in one of or more of these places, if desired:

@tapple tapple changed the title Type-fixes Luau type fixes for luau-lsp Jan 13, 2026
@tapple
Copy link
Contributor Author

tapple commented Jan 13, 2026

I tried merging this and #51 into the same branch, and there are only 3 trivial merge conflicts. I recommend merging #51 before this PR

@marchcat
Copy link

Pre-commit fails due to trailing whitespaces in src/shared/luadefsgenerator.ts and EOF in data/syntax_def_default.json.

@WolfGangS
Copy link
Contributor

WolfGangS commented Jan 20, 2026

The trailing whitespace is fixed in #50. It's a problem in the repo itself not this pr.

@marchcat marchcat requested a review from Rider-Linden January 22, 2026 17:21
Copy link
Collaborator

@Rider-Linden Rider-Linden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple places where the luaType is set to numberic but I think it should be boolean...

"tooltip": "Boolean, If TRUE allows anyone to drop inventory on prim, FALSE revokes.",
"type": "integer"
"type": "integer",
"luaType": "numeric"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be boolean?

Copy link
Contributor

@WolfGangS WolfGangS Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All lsl functions exposed through ll.* that accept integer in lsl, accept boolean|number in slua.

For instance

ll.SetColor(vector(1,0,0),true)

The choice could be made to say we want to mark it as a boolean, but that would cause either

  • linters to choke on code that saves and runs perfectly fine
  • linter definition generation to do extra interpreting to figure out if it accepts something other than boolean

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confused number with numeric didn't I...

@Rider-Linden Rider-Linden merged commit 251f9b8 into secondlife:develop Jan 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type-check fails on valid statement (Vector multiplied by Number)

4 participants