microstudio icon indicating copy to clipboard operation
microstudio copied to clipboard

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

Open pozabil opened this issue 2 months ago • 0 comments

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')

pozabil avatar Dec 10 '25 20:12 pozabil