Yield across metamethod workaround?

I feel like this is making the task more complicated than it needs to be. It’s just much cleaner using standard getters/setters IMHO:

local Board = {}
Board.__index = Board

function Board.new()
	local self = setmetatable({}, Board)
	return self
end


function Board:GetName()
	-- Fetch the name
	if (not self.Name) then
		self.Name = -- Whatever you need to do to fetch the name via HTTP
	end
	return self.Name
end


function Board:SetName(name)
	-- Set the name
	self.Name = name
	-- Then push the name via HTTP
end

Obviously though the above code is not “thread-safe” per-se, since self.Name might be in an in-between state where the HTTP service is fetching or setting the name.

1 Like

After a lot of thinking, I concluded the same thing you did.
I’ll just have to give up on metamethods.

1 Like