Skip to content

Fix: world.addEventHandler() takes Lua table, not a function#15

Merged
YoloWingPixie merged 3 commits into
mainfrom
13-worldaddeventhandler-is-incorrect
May 24, 2025
Merged

Fix: world.addEventHandler() takes Lua table, not a function#15
YoloWingPixie merged 3 commits into
mainfrom
13-worldaddeventhandler-is-incorrect

Conversation

@YoloWingPixie
Copy link
Copy Markdown
Owner

… (#13)

  • Add EventHandlerTable type to define the expected table structure with onEvent method
  • Update world.addEventHandler() to accept EventHandlerTable instead of function
  • Update world.removeEventHandler() to accept EventHandlerTable instead of function
  • Fix function descriptions to accurately reflect DCS World API behavior

The functions now correctly expect a table containing an onEvent method rather than a direct function parameter.

…#13)

- Add EventHandlerTable type to define the expected table structure with onEvent method
- Update world.addEventHandler() to accept EventHandlerTable instead of function
- Update world.removeEventHandler() to accept EventHandlerTable instead of function
- Fix function descriptions to accurately reflect DCS World API behavior

The functions now correctly expect a table containing an onEvent method rather than a direct function parameter.
Copilot AI review requested due to automatic review settings May 24, 2025 23:00
@YoloWingPixie YoloWingPixie linked an issue May 24, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the world event handler API to require an EventHandlerTable with an onEvent method instead of a bare function to align with the DCS World API behavior.

  • Introduces the EventHandlerTable type in the Event.types.yaml file.
  • Updates the parameter types and descriptions in world.singleton.yaml for addEventHandler and removeEventHandler.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
dcs-world-schema/types/Event.types.yaml Adds a new EventHandlerTable record type with an onEvent field.
dcs-world-schema/globals/world.singleton.yaml Updates event handler function parameters to use EventHandlerTable.

@github-actions
Copy link
Copy Markdown

DCS Schema Stats

Metric Count
Types 1
Globals 1
Total Size 418083 bytes

✅ All validation checks passed!

@github-actions
Copy link
Copy Markdown

DCS Schema Stats

Metric Count
Types 1
Globals 1
Total Size 418083 bytes

✅ All validation checks passed!

@YoloWingPixie YoloWingPixie merged commit b834bf0 into main May 24, 2025
1 check passed
@YoloWingPixie YoloWingPixie deleted the 13-worldaddeventhandler-is-incorrect branch May 24, 2025 23:07
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

Successfully merging this pull request may close these issues.

world.addEventHandler() is incorrect

2 participants