Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add t.buffer, t.vector #115

Merged
merged 2 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lib/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ end
**--]]
t.boolean = t.typeof("boolean")

--[[**
ensures Lua primitive buffer type

@param value The value to check against

@returns True iff the condition is satisfied, false otherwise
**--]]
t.buffer = t.typeof("buffer")

--[[**
ensures Lua primitive thread type

Expand Down Expand Up @@ -106,6 +115,15 @@ t.table = t.typeof("table")
**--]]
t.userdata = t.type("userdata")

--[[**
ensures Lua primitive vector type

@param value The value to check against

@returns True iff the condition is satisfied, false otherwise
**--]]
t.vector = t.type("vector")

--[[**
ensures value is a number and non-NaN

Expand Down
4 changes: 4 additions & 0 deletions lib/t.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ interface t {
any: t.check<defined>;
/** checks to see if `value` is a boolean */
boolean: t.check<boolean>;
/** checks to see if `value` is a buffer */
buffer: t.check<buffer>;
/** checks to see if `value` is a thread */
thread: t.check<thread>;
/** checks to see if `value` is a function */
Expand All @@ -32,6 +34,8 @@ interface t {
table: t.check<object>;
/** checks to see if `value` is a userdata */
userdata: t.check<object>;
/** checks to see if `value` is a vector (Vector3 in Roblox) */
vector: t.check<Vector3>;

// roblox types
/** checks to see if `value` is an Axes */
Expand Down
18 changes: 18 additions & 0 deletions lib/ts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ end
**--]]
t.boolean = t.typeof("boolean")

--[[**
ensures Lua primitive buffer type

@param value The value to check against

@returns True iff the condition is satisfied, false otherwise
**--]]
t.buffer = t.typeof("buffer")

--[[**
ensures Lua primitive thread type

Expand Down Expand Up @@ -106,6 +115,15 @@ t.table = t.typeof("table")
**--]]
t.userdata = t.type("userdata")

--[[**
ensures Lua primitive vector type

@param value The value to check against

@returns True iff the condition is satisfied, false otherwise
**--]]
t.vector = t.type("vector")

--[[**
ensures value is a number and non-NaN

Expand Down
Loading