▲ 12 r/lua

I made a statemachine out of boredom

local traffic_light = StateMachine {
  green = State {
    on_enter = function()
      print("BEGAN")
    end,
    on_flash = function(_,_,state_machine)
      print("GREEN")
      state_machine:set_state("yellow")
    end
  },
  yellow = State {
    on_flash = function(_,_,state_machine)
      print("YELLOW")
      state_machine:set_state("red")
    end
  },
  red = State {
    on_flash = function(_,_,state_machine)
      print("RED")
      state_machine:set_state("green")
    end,
    on_exit = function()
      print("DONE")
    end
  },
}

traffic_light:set_state("green")
traffic_light:flash()
traffic_light:flash()
traffic_light:flash()
traffic_light:flash()

It outputs

BEGAN
GREEN
YELLOW
RED
DONE
BEGAN
GREEN

I don't think there's much point in sharing the source code since it's a very basic state machine with an attempt at a somewhat clean api (Also I'm 99% sure it's not very cleanly wrote, I might have to rewrite it to be more readable)

(Sorry mods)

reddit.com
u/DotGlobal8483 — 18 days ago

I feel like Natsuo did actually forgive endeavor in his own way

(This is very infodumpy and not well written)

One thing I notice is how some fans seem to assume that natuso never forgave endeavor and was meant to represent people who never forgive. But to me, that's not really what his Arc is about. I personally find Endeavor's children to represent the differing forms of forgiveness. With Fuyumi's being about a quick form of forgiveness, to have everyone be happier, Shoto somewhat learning to trust his father again and see if his father means that he's changed, Touya in the lack of and Natsuo (imo) of somber forgiveness and a permanently broken trust. (I will confess I can't remember seasons 5-6)

So, some 2 lines I'm going to pull from the anime ( I've not read the manga ) is

"This is where we part ways, my feelings haven't changed. I want nothing to do with you. I'm proposing to my girlfriend, there won't be a wedding, you won't meet her" Said noticibly uncomfortably. This doesn't automatically mean that natsuo hasn't forgiven endeavor. I find it more means that he just wants to move on with his life, and wouldn't feel comfortable withe endeavor. Forgiveness isn't actually excusing someone of their actions, it more means that you're letting theperson who did the action, and yourself, move on from what happened. Which doens't actually necessitate a lack of trust or sudden return, this is natuso's way of staying comfortable, but it's more respectful then angry

"To behonest I think we've done our duty and faced our punishment, is that not enough?"

This line obviously, is what I think really shows what natuso thinks. Despite his older feelings to endeavor. He thinks they've suffered enough (obviously he's talking to the whole family). That endeavor's atoned enough, but endeavor's response, that he'll take the blowback. Is clearly not one he's expecting. Personally I think this may actually showcase that Natsuo's understanding of forgiveness is potentially flawed and more naive, that dabi's actions should go away eventually, when most people (especially the people who dabi burned) will hold it for the rest of their lives.

"Why did you have to say that, it's the first time I ever thought you were cool, Dad." I think this is actually really important, because mainly, it shows natsuo has clearly seen endeavor's change, at a point in which Endeavor is far from being a hero, he thinks Endeavor's personal character is something good or atleast, in a way, something he wishes he could do. Very obvious acknowledgement that he thinks endeavor has changed reaffirming that natsuo thinks way higher of endeavor then beforehand

I think all in all, Natsuo did actually somewhat forgive endeavor in his own way. Showing that his forgiveness can actually respect his own limits, but also that he can move on, with out risking more harm. It's an uncomfortable forgiveness, because the bridge will pretty much always be burned because the damage will have alwayus been done but it's Natsuo's choice ot make.

TLDR: Youtube comments people seem to think natsuo didnt' forgive endeavor, when I think they more exist in a grey area of forgiveness, without becoming friends again.

This is probably a horrendous misunderstanding of his character but I wanted to share my opinion on it!

reddit.com
u/DotGlobal8483 — 22 days ago

Pokemon plat case looks a little off

Bought pokemon platinum and the case looks a little faded so I'm worried it might be fake

u/DotGlobal8483 — 1 month ago
▲ 9 r/lua

your*

Only know of these ways but kinda curious if there's more

Proceedural(?)

function make\_vector(x,y)
  return {
    x = x or 0,
    y = y or x or 0
  }
end

function print\_vector(vector)
  print( "X: ".. vector.x .. " Y: " .. vector.y)
end

local pos1 = make\_vector(10,15)
print\_vector(pos1)
pos1.x = 0
print\_vector(pos1)

No metatables

local Vector = {}

function Vector.new(x,y)
  local self = {}

  self.x = x or 0
  self.y = y or self.x

  function self.print()
    print("X: " .. self.x .. " Y: " .. self.y)
  end

  return self
end

local pos1 = Vector.new(10,15)
pos1.print()
pos1.x = 0
pos1.print()

metatables

local Vector = {}
Vector.__index = Vector

function Vector.new(x,y)
  local self = setmetatable({},Vector)

  self.x = x or 0
  self.y = y or self.x

  return self
end

function Vector:print()
  print("X: " .. self.x .. " Y: " .. self.y)
end

local pos1 = Vector.new(10,15)
pos1:print()
pos1.x = 0
pos1:print()
reddit.com
u/DotGlobal8483 — 1 month ago