Sign in to follow this  
Pirulax

Simple question

Recommended Posts

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?

 

Share this post


Link to post
2 minutes ago, Jayceon said:

Yes, it's possible.

Yeah, a friend of mine already told me. Nice to meet ya' btw Jay.[Im hungarian, just to give you idea why i said this.]

@Jayceon

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.