Potentially Inaccurate Feedback From Roblox's Intellisense

Hello. I have a function that I would like to accept both ProximityPrompt objects and strings with. The editor, however, pushes a very annoying warning after confirming whether the variable is a string or not:image
image

As we all know, code can index tables with strings for behavior similar to that of dictionaries. I don’t see the problem here, unless my lack of sleep is getting to me.

Is there any way to work around this without changing the functionality of the code?

1 Like

I think the issue is with int.entries. Can you hover over it and see the type information?

Thanks for the reply. It is instantiated as follows and remains this way until a string - table pair is added.
image
I am not sure what all this type information stuff is (I’m aware it’s a new update to Roblox’s own take on Lua), so I’ll just tell you that the table can store any value (?).
image

I assume that the table.create function returns an “array”, which can only be indexed with numbers (at least according to the type checker). I’m not sure why you’re using table.create to allocate the memory for a 0-sized table, so just use:

entries = {}
1 Like

I was actually told a while ago that table.create(0) is very very very slightly less intensive than {}, so I began using it regularly. Apart from the strange type mismatch, it seems to have no difference. I’ll begin using {} from now on for one-time table instantiation since it’s pretty much pointless to worry about optimization unless I’m creating them in bulk.