"Expected type table, got any | false instead"

Hiya, I have no clue what this error really means and it wasn’t there a couple of days ago. Must have been a bug, and not matter what I change it just errors.

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I have written a module for playing elements of a cutscene/movie (Ex. Camera, Dialogue, Loading In/Out Sets)

  2. What is the issue? Screenshots:
    Before What its always been like. That error is new…

After I changed to code, according to the error.

  1. What solutions have you tried so far? I’ve tried rewriting the code, but it persists.

I’ll explain & add some more context regarding this. In the code above sets is a table of data, and I am just trying to see if the table of data sets is nil or false then don’t run the code in the statement. There weren’t any errors a couple of days ago, and I’m really confused about how to fix this.

if not sets then

lua conditional statement is weird sometimes

if sets ~= false or sets ~= nil then

may also works if you like it that way

Thanks. I didn’t realise how weird lua statements are. Lols, thanks.

It’s not that it’s weird, it’s probably because you’re not using it correctly

Your first if statement,

if not sets == false or nil then

Translates to:

if ((not sets) == false) or nil then

To which the linter is just warning you of potential unwanted behavior since that’s a pretty common mistake with Lua precedence.

The second if statement is just Luau warning you about type refinement because of your suspicious expression accepting sets as anything but a false boolean which isn’t always going to be a table, to which, you’re still indexing it as such with no additional safeguards.