Skip to content

Matter.Engine.update() crashes in Lua projects (Matter loads correctly, but update() throws internal JS errors) #246

@pozabil

Description

@pozabil

Summary

In a Lua project with Matter.js enabled, Matter.Engine.create() successfully returns a valid engine object, and its fields such as engine.timing.timestamp are correct, but Matter.Engine.update() trows TypeError

Minimal Reproduction Case

engine = nil

init = function()
  print("init()")
  print("Matter = " .. tostring(Matter))

  engine = Matter.Engine.create()
  print("engine = " .. tostring(engine))
  print("engine.timing = " .. tostring(engine.timing))
  print("engine.timing.timestamp = " .. engine.timing.timestamp)
end

update = function()
  Matter.Engine.update(engine, 1000/60)
end

draw = function()
end

Console Log

init()
Matter = [object Object]
engine = [object Object]
engine.timing = [object Object]
engine.timing.timestamp = 0.0
TypeError: Cannot read properties of undefined (reading 'timestamp')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions