- Documentation
- Client functions
- evaluateBrowserJavascript
Function
evaluateBrowserJavascript
Runs JavaScript on a local page and returns its result to Lua. If the code returns a Promise, the function waits for it.
Syntax
bool evaluateBrowserJavascript(browser webBrowser, string code, function callback)Arguments
webBrowserbrowser- A local browser.
codestring- JavaScript code.
callbackfunction- A
function(ok, result)callback:oksays whether it worked,resultis the result or the error message.
Returns
true if the code was sent.
Example
evaluateBrowserJavascript(browser, "document.querySelectorAll('li').length", function(ok, count)
if ok then
outputChatBox("Na liście jest " .. count .. " pozycji")
end
end)