Error "cannot convert the string" when testing table type


Why does this fail at runtime?
local x = {“temp”: 1};
assert(typeof(x) == “table”); // Runtime error on this line: “cannot convert the string”

The following test succeeds:
if (typeof(x) == “table”)
{ server.log(“it’s a table!”); } // displays “it’s a table!”

Is this a bug?

(There is a similar assertion in the tempbug code: assert(typeof(data == “table”)); However, I think that line has the parentheses in the wrong place. But I still don’t understand why this assert doesn’t fail - for some reason ‘data’ must equal “table” I suppose.)


Does this help?

local x = {"temp": 1}; server.log(typeof(x)); // "table" server.log(x == "table"); // false server.log(typeof(false)); // bool assert(typeof(false)); // PASSES

Yes, the parens are in the wrong place.

assert(typeof(x) == "table");

…passes for me; you must have something else you’re not showing.