Yeah, this may seem a bit weird and complex as I'm going far into the concepts of OOP, but here me out. I have 3 objects: a GameBoard Object, a Card Object, and an Effect Object.
GameBoard has-a Card, and Card has-a Effect.
If I wanted Effect to provide instructions for GameBoard to modify its descendants, how would I do so? I was wondering if I could simply have a high order class like GameBoard read a function in from Effect, but I'd assume the variables of that function and all of its effects wouldn't be understood as they don't exist within Effect. Maybe even loadstring()()? I've been pondering this for months now and I wonder how I should revise my thinking.
My best shot at this is to pass a reference to the GameBoard itself to Effect.
Let's say you have a method of Effect - fire(), which reads the desired function. Make fire() take the parameter of GameBoard, so that Effect can use a reference to GameBoard
It would look like
Card.Effect:read(self)