Advertisement
LuaWeaver

Example of simple wiring class usage

Aug 9th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. class "Button" "BaseInput" {
  2.     new=function(self,part)
  3.         assert(part~=nil,"Button requires part in constructor")
  4.         local connection
  5.         connection=part.Touched:connect(function(hit)
  6.             if hit.Parent:FindFirstChild("Humanoid") then
  7.                 self:setState(1)
  8.                 connection:disconnect()
  9.             end
  10.         end)
  11.     end
  12. }
  13.  
  14. class "Lamp" "BaseOutput" {
  15.     new=function(self,part)
  16.         assert(part~=nil,"Lamp requires part in constructor")
  17.         self.lampLight=Instance.new("PointLight",part)
  18.         self.lampLight.Enabled=false
  19.     end,
  20.     output=function(self)
  21.         self.lampLight.Enabled=true
  22.     end,
  23.     stopOutput=function(self)
  24.         self.lampLight.Enabled=false
  25.     end
  26. }
  27.  
  28. Button(workspace.Button):connect(Lamp(workspace.Lamp.LampPart))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement