Skip to content

Commit

Permalink
Merge pull request #115 from osyrisrblx/Add-t.buffer,-t.vector
Browse files Browse the repository at this point in the history
Add `t.buffer`, `t.vector`
  • Loading branch information
osyrisrblx authored Feb 4, 2024
2 parents a95c017 + 7ddc273 commit eb5e676
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
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

0 comments on commit eb5e676

Please sign in to comment.