On the dev branch of basalt os.pullEvent in threads doesn't support filters #34

Closed
opened 2022-10-20 11:37:18 +08:00 by ShreksHellraiser · 2 comments
ShreksHellraiser commented 2022-10-20 11:37:18 +08:00 (Migrated from github.com)

Describe the bug

When you use os.pullEvent in a thread the filter is ignored.

To Reproduce

local basalt = require("basalt")

local main = basalt.createFrame():setTheme({FrameBG = colors.lightGray, FrameFG = colors.black})
local thread = main:addThread()
thread:start(function()
  while true do
    print(textutils.serialize({os.pullEvent("key_up")}))
  -- Now I'm not sure if this code would work
  -- Just because the basalt event handler isn't running when I try to start this thread
  -- but my point still stands
  -- if it does work, this will error. It will instead catch one of the basalt events, one that has functions in the table returned therefor crashing the program.
  end
end)

basalt.autoUpdate()

Expected behavior

The example above wouldn't crash, because it would only ever resume on "key_up" events

Screenshots
N/A

Additional context
N/A

Checklist

[ ] I am running the latest version.
Tick the box if you are running the latest version!

I am running the DEV branch, from when you told me to update it

**Describe the bug** When you use os.pullEvent in a thread the filter is ignored. **To Reproduce** ```lua local basalt = require("basalt") local main = basalt.createFrame():setTheme({FrameBG = colors.lightGray, FrameFG = colors.black}) local thread = main:addThread() thread:start(function() while true do print(textutils.serialize({os.pullEvent("key_up")})) -- Now I'm not sure if this code would work -- Just because the basalt event handler isn't running when I try to start this thread -- but my point still stands -- if it does work, this will error. It will instead catch one of the basalt events, one that has functions in the table returned therefor crashing the program. end end) basalt.autoUpdate() ``` **Expected behavior** The example above wouldn't crash, because it would only ever resume on "key_up" events **Screenshots** N/A **Additional context** N/A **Checklist** [ ] I am running the latest version. Tick the box if you are running the latest version! I am running the DEV branch, from when you told me to update it
NoryiE commented 2022-10-20 12:32:40 +08:00 (Migrated from github.com)

Thank you, i actually really forgot to add filters for threads, i will implement it this weekend.

Thank you, i actually really forgot to add filters for threads, i will implement it this weekend.
NoryiE commented 2022-10-21 02:07:13 +08:00 (Migrated from github.com)

Hello the missing filters for threads got added in 153f082 - currently only available in the dev branch.

Hello the missing filters for threads got added in [153f082](https://github.com/Pyroxenium/Basalt/commit/153f08244c2486a51e179d5dcb42830498ec414d) - currently only available in the dev branch.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GitHub/Basalt#34
No description provided.