Announcement

Collapse
No announcement yet.

[How To] Call a lua function out of an HTML File with JS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [How To] Call a lua function out of an HTML File with JS

    Hello Onset(tlers),

    Here is a simple Codesnipped to call a lua function with a simple HTML Page.


    HTML Code:
    <html>
    <head>
    <script type="text/javascript">
    function addChat(text)
    {
    CallEvent("addChatLUA",text);
    }
    </script>
    </head>
    <body>
    <button onclick="addChat('Hello World')">Click me to say Hello World in the chat</button>
    </body>
    </html>
    LUA(Client)-File:
    Code:
    AddEvent("addChatLUA", function(text)
        AddPlayerChat(text)
    
    end)

    It's a simple example but I think it is enough to understand it.

    #2
    Simple, and yet very useful

    Comment

    Working...
    X