Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Instance.new() in table values #836

Closed
danaetroupe opened this issue Nov 13, 2024 · 3 comments
Closed

Support for Instance.new() in table values #836

danaetroupe opened this issue Nov 13, 2024 · 3 comments

Comments

@danaetroupe
Copy link

image
Luau-lsp currently does not update type based on instance.new type. Type is given in the string. When used in a new variable it works, but not when updating a table value.

@danaetroupe
Copy link
Author

image
I think in general when values are added to a table key, the program does not take that into consideration.

@JohnnyMorganz
Copy link
Owner

Can you show the error you are experiencing, and create a minimal example that I can test with?

But, this is looking like it might be a Luau issue. Do you also experience this in Roblox Studio? If so, I would recommend you report it to the Luau team directly

@danaetroupe
Copy link
Author

danaetroupe commented Nov 18, 2024

Checked in Roblox Studio, and am getting a TypeError there as well. In Studio it appears as a warning, however, whereas in Luau LSP it appears as an error. Will raise the issue with the Luau team, thanks for your help.

--!strict

type TestObj = {
	model : Model?
}

local object : TestObj = {
	model = nil
}

object.model = Instance.new("Model")
object.model.Parent = workspace

Included the code if you're interested in taking a look.

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

No branches or pull requests

2 participants