Jump to content

Simple question


Pirulax

Recommended Posts

  • Discord Moderators

Hello, so im here with a simple question.

So we have a function called 'executeBrowserJavascript', and i have a question with using this function.So, i have scripts[js] linked to a html file, which is loaded by a browser, the question is: Can i use the functions definited inside these  scripts?

Ex.:

--> A browser is created, and a local page is loaded in it, the index.html has the following content:
<!DOCTYPE html>
<html>
  <body>
    <h1 id="playername">Your name</h1>
    <script type="text/javascript" src="assets/js/script.js"></script>
  </body>
</html>

and the script has the following function:

function setname(name){
    document.getElementById("playername").innerHTML = name; 
}

and i want to call this function from lua like this:

executeBrowserJavascript(browser, "setname('"..getPlayerName(localPlayer).."')"

 Is it possible?If not, is there any way to do such things?

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...