Skip to content

userdata and symbol are not real types - #28

Merged
JohnnyMorganz merged 1 commit into
JohnnyMorganz:mainfrom
tapple:userdata-symbol
May 8, 2026
Merged

userdata and symbol are not real types#28
JohnnyMorganz merged 1 commit into
JohnnyMorganz:mainfrom
tapple:userdata-symbol

Conversation

@tapple

@tapple tapple commented May 8, 2026

Copy link
Copy Markdown
Contributor
$ ./luau/luau-analyze typetest.luau 
./typetest.luau(6,11): TypeError: Unknown type 'userdata'
./typetest.luau(7,11): TypeError: Unknown type 'symbol'
$ cat typetest.luau 
local _a: nil
local _b: string
local _c: number
local _d: boolean
local _e: thread
local _f: userdata
local _g: symbol
local _h: vector
local _i: buffer
local _j: unknown
local _k: never
local _l: any

@tapple

tapple commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

"userdata" is a string that type() can return, but it isn't a type in the typechecker. The typechecker type is what's returned by typeof():

In secondlife luau:

> type(ZERO_ROTATION)
userdata
> typeof(ZERO_ROTATION)
quaternion

In Roblox studio:

  11:21:19.830  > print(type(Enum.Axis.X))  -  Studio
  11:21:19.839  userdata  -  Edit
  11:21:25.663  > print(typeof(Enum.Axis.X))  -  Studio
  11:21:25.672  EnumItem  -  Edit

I've no idea where symbol came from

@JohnnyMorganz

Copy link
Copy Markdown
Owner

I've no idea where symbol came from

The original source of these definitions is https://github.com/NightrainsRbx/RobloxLsp/blob/master/syntaxes/lua.tmLanguage.json, Roblox LSP might've had its own symbol type

@JohnnyMorganz JohnnyMorganz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@JohnnyMorganz
JohnnyMorganz merged commit 1986f6f into JohnnyMorganz:main May 8, 2026
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants