Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

Aether

Members
  • Content Count

    12
  • Joined

  • Last visited

  • Days Won

    2

Reputation Activity

  1. Upvote
    Aether reacted to Molinko in (Proof of concept) Working/toggleable button   
    Aha. I see you're hard at work on your very own solution! Allow me to give a tip or 5
     
    Today we'll talk a little about OOP or Object Oriented Programming. Now, in lua, OOP is a little different than in other more popular OOP languages such as JAVA.
    So for you guys out there who would say lua doesnt have oop... You probably know better than me. With that said lets learn some stuff about simulating OOP in lua.
     
    First off there are tables. myTable = {}. In lua tables are used as objects because every table created is unique. Not table references though. i.e. myTableA = myTable, this is referencing myTable.
     
    With this in mind we can create objects with behavior relevant to that object. Still following? Example:
     
    If you notice the Bob object has specific fields, name and age, that identify him. The fields arent so unique but the Bob object is.
    Bob isnt very flexible as an object though. This brings me to Classes. Classes are Objects. But, they are not the same as lets say Bob.
    Bob is an instance of a Class. We usually wont interact with a class like we would an instance of a class. For example:
     
    Now for my main point.. Buttons. Buttons are a class. We want uniqueness and specified behavior.
     
    I hope this will help you understand the power of OOP like design and some of the more basic ways to use it
    As usual any questions or elaborations by others are welcome. If someone else can explain better please do! lua is my first language!
  2. Upvote
    Aether reacted to Dustpuppy in My gui (Now with visual editor)   
    I've updated the pastebin download.
     
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.