wasmoon icon indicating copy to clipboard operation
wasmoon copied to clipboard

call function with new keyword when calling classes

Open leso-kn opened this issue 9 months ago • 1 comments

This PR adds support for calling constructors!

It triggers when calling a javascript class from lua. Classes are distinguished from generic functions by the .constructor-field.

Syntax:

local ws = window.WebSocket("https://example.org")

-- ws is a new instance of WebSocket
ws.send 'hello example.org!'

leso-kn avatar May 28 '25 19:05 leso-kn

@ceifa @RodrigoDornelles Linter warnings should be fixed :)

(verified here: leso-kn:wasmoon run#15605367128)

leso-kn avatar Jun 12 '25 08:06 leso-kn