Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't read from a context in input subscription #24

Open
IsometricShahil opened this issue Nov 10, 2021 · 0 comments
Open

Can't read from a context in input subscription #24

IsometricShahil opened this issue Nov 10, 2021 · 0 comments

Comments

@IsometricShahil
Copy link

IsometricShahil commented Nov 10, 2021

In a child element, a context can't be read from in a input sub though writing to it is perfectly valid.
Sample elements to reproduce:-

local ChildFactory = helium(function(param, view)
	local ctx = context.get("ctx")
	input("clicked", function()
		local c = ctx.value -- FAILS
	end)
	return function()
		love.graphics.print(ctx.value, 20, 20)
	end
end)

local ParentFactory = helium(function(param, view)
	local ctx = context.use("ctx", {value = "Lorem ipsum"})
	local c = ChildFactory({}, 100, 100)
	return function()
		c:draw()
	end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant