mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 14:51:55 +00:00
shared types prototyping
metatables
This commit is contained in:
11
src/shared/types/class.lua
Normal file
11
src/shared/types/class.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
-- type AccountImpl = {
|
||||
-- __index: AccountImpl,
|
||||
-- new: (name: string, balance: number) -> Account,
|
||||
-- deposit: (self: Account, credit: number) -> (),
|
||||
-- withdraw: (self: Account, debit: number) -> (),
|
||||
-- }
|
||||
|
||||
-- type Account = typeof(setmetatable({} :: { name: string, balance: number }, {} :: AccountImpl))
|
||||
|
||||
type hself<T,U> = {__index: T} & U
|
||||
export type constructor<T,U> = typeof(setmetatable({} :: T & hself<T,U>, {} :: U))
|
||||
Reference in New Issue
Block a user