self:eval
Client
Evaluates a JavaScript expression inside the webview
Syntax
local status = self:eval(
input
)Parameters
| Type | Name | Description |
|---|---|---|
string | input | JavaScript code to evaluate inside the webview |
Returns
| Type | Name | Description |
|---|---|---|
bool | status | true on successful execution, or false on failure |
Examples
local wv = webview.create()
-- Change the page background color
wv:eval("document.body.style.background = 'red'")
-- Post a message back to Lua
wv:eval("window.ipc.postMessage('hello from JS')")