Indexing Instance argument with brackets causes warning

This will incorrectly warn with “Expected type table, got ‘Instance’ instead”.

local function execute(object: Instance, name: string)
	print(object[name])
end

This won’t occur if the object is explicitly specified, so this will correctly not warn.

local function execute(name: string)
	print(workspace[name])
end
1 Like

If I understand the problem correctly, you should rename this to “Indexing Instance property with brackets causes warning”.

I have been able to reproduce this issue on the latest build of Roblox Studio (0.525.0.5250378) on Windows 10.

Hey!

Coming back to this, the issue should be fixed now!

Closing the thread, if you still encounter the issue, let me know!

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.