gamesys / moonshine

A lightweight Lua VM for the browser
http://moonshinejs.org
MIT License
502 stars 35 forks source link

Incorrect behaviour when dividing by zero. #21

Closed CerfurMark closed 10 years ago

CerfurMark commented 10 years ago

I started this bug report because I thought xpcall() wasn't working, but everything is actually working perfectly. Since I don't see how to delete a bug once it's opened, so I'll leave this code as an example of how to figure out if a browser supports touch() events. If myfunction() works, then the device supports touch().

function myfunction() window.document:createEvent("TouchEvent") end

function errHandler() print("err") end

local status = xpcall(myfunction, errHandler) print(status)

paulcuth commented 10 years ago

Hi Mark,

Actually, your original post did highlight one valid issue: Moonshine does not throw an error when dividing by nil, rather it incorrectly returns nan.

I'll leave this open until I get it fixed.

Cheers., Paul.

paulcuth commented 10 years ago

Title updated to reflect outstanding issue.

paulcuth commented 10 years ago

Fixed in e1dc12eac7cfc4d380bf24ea1ef1dbbee48408e0.