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

Hooks #1

Closed
Yevano opened this issue Oct 7, 2013 · 1 comment
Closed

Hooks #1

Yevano opened this issue Oct 7, 2013 · 1 comment

Comments

@Yevano
Copy link
Owner

Yevano commented Oct 7, 2013

The current hook system isn't all that intuitive. May be entirely removed in favor of something similar to the old event system. Perhaps like

--@import see.event.Events
--@import me.event.RegisteredEvent

function MyProgram.main()
    Events.register("registered_event", RegisteredEvent)

    while true do
        -- Automatically casts to particular event object for
        -- standard events. For non-registered custom events,
        -- use Event.args.
        local event = Events.pull(
            "char", "key", "modem_message",
            "custom_event", "registered_event")

        if event.type == "char" then
            System.print(event.char)
        elseif event.type == "key" then
            System.print(event.key)
        elseif event.type == "modem_message" then
            System.print(event.message)
        elseif event.type == "custom_event" then
            System.print(event.args)
        elseif event.type == "registered_event" then
            System.print(event.customField)
        end
    end
end
@Yevano
Copy link
Owner Author

Yevano commented Oct 10, 2013

Merged into master as of commit 50.

Yevano pushed a commit that referenced this issue Feb 17, 2014
fixed native events..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant