bug: Broken basalt.update() #56

Closed
opened 2023-05-04 07:13:01 +08:00 by Damianu · 1 comment
Damianu commented 2023-05-04 07:13:01 +08:00 (Migrated from github.com)

Describe the bug

basal.autoUpdate() works fine for me, however basalt.update() seems to be messing up events

To Reproduce

Steps to reproduce the behavior:

  1. Swap basalt.autoUpdate() for
while true do basalt.update(os.pullEventRaw())

Expected behavior

Given code being equivalent of autoUpdate (without drawFrames)

Additional context

I think it's due to xpcall not passing parameters in computercraft's lua version.
https://github.com/Pyroxenium/Basalt/blob/master/Basalt/main.lua#L409
Swapped my update for:

    update = function(event, ...)
        local args = {...}
        local function f()
            basaltUpdateEvent(event, table.unpack(args))
        end

       local ok, err = xpcall(f, debug.traceback)
        if not(ok)then
            basaltError(err)
            return
        end
    end,

and it works fine now

Checklist

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

**Describe the bug** basal.autoUpdate() works fine for me, however basalt.update() seems to be messing up events **To Reproduce** Steps to reproduce the behavior: 1. Swap basalt.autoUpdate() for ``` while true do basalt.update(os.pullEventRaw()) ``` **Expected behavior** Given code being equivalent of autoUpdate (without drawFrames) **Additional context** I think it's due to xpcall not passing parameters in computercraft's lua version. https://github.com/Pyroxenium/Basalt/blob/master/Basalt/main.lua#L409 Swapped my update for: ``` update = function(event, ...) local args = {...} local function f() basaltUpdateEvent(event, table.unpack(args)) end local ok, err = xpcall(f, debug.traceback) if not(ok)then basaltError(err) return end end, ``` and it works fine now **Checklist** [ ] I am running the latest version. Tick the box if you are running the latest version!
NoryiE commented 2023-05-05 00:21:00 +08:00 (Migrated from github.com)

Hallo, thank you! I fixed the issue here: a97254d

Hallo, thank you! I fixed the issue here: [a97254d](https://github.com/Pyroxenium/Basalt/commit/a97254ddf781a96fadd7cf7f26efc5e8076fd8b3)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GitHub/Basalt#56
No description provided.