Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Basic class example
Account = {} Account.__index = Account -- Makes a new account function Account:new(balance) local self = setmetatable({}, Account) self.balance = balance return self end -- Account member functions function Account:deposit(amount) self.balance = self.balance + amount end function Account:withdraw(amount) self.balance = self.balance - amount end -- Make some new Account objects MyACC = Account:new(100) print(MyACC.balance) MyACC:withdraw(10) print(MyACC.balance) YourACC = Account:new(2) print(YourACC.balance)
run
|
edit
|
history
|
help
0
фыв
Enums in Lua (library)
ok
Non-Lua core for new scripting languages (Beta)
dd
Lua stuff
Code golf - ASCII art #1
finding volume of pyramids (for me, but feel free to use)
VERSION
Creating habits v2, Lua (WIP)