Pyroxenium / Basalt

A UI Framework for CC:Tweaked
MIT License
164 stars 28 forks source link

bug: Broken basalt.update() #56

Closed Damianu closed 1 year ago

Damianu commented 1 year ago

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 1 year ago

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