Solved [HELP] Simple UI is not working

I tried creating a simple custom UI to try things out following the tutorial here : https://docs.veniceunleashed.net/modding/custom-ui/

My Mod folder structure :

/vu-welcome-screen
    /ext
        /client
            __init__.lua
    /mod.json
    /ui.vuic

Contents of __ init __.lua

    Events:Subscribe('Extension:Loaded', function()
        WebUI:Init()
    end)

Contents of mod.json

    {
      "Name": "vu-welcome-screen",
      "Description": "Displays a welcome screen for joining player, with markdown",
      "Version": "0.0.5",
      "HasVeniceEXT": true,
      "HasWebUI": true,
      "Authors": [ "turbopasi", "Ch33s3" ],
      "Dependencies": {
        "veniceext": "^1.0.0"
      },
      "Tags": ["welcome-screen"]
    }

Contents of index.html (which was compiled using vuicc.exe into a ui.vuic file)

    <!DOCTYPE html>
    <html>
       <body>
         <h1 style="color:white;">Hello world!</h1>
         <h1 style="color:black;">Hello world!</h1>
       </body>
    </html>

Problem

Looking at the server console, it seems the mod loads without errors :

[VeniceEXT] Loading VeniceEXT module 'vu-welcome-screen'
[VeniceEXT] [vu-welcome-screen] Compiling client module ...
[VeniceEXT] [vu-welcome-screen] Compiling client script '__init__.lua'
[VeniceEXT] Successfully loaded VeniceEXT module 'vu-welcome-screen

but when I join the server, I don’t see anything from that custom UI anywhere.

I tried using the web debugger (vu.exe -dwebui) at localhost:8884, but the mod doesn’t even show up in the UIs list. However, when looking at the client consolen (ingame) it shows me the following error

[vu-welcome-screen] Failed to load VeniceEXT client script: __init__.lua. Error: [string "__init__.lua"]:1: sol: no matching function call takes this number of arguments and the specified types
stack traceback:
[C]: in field 'Subscribe'
[string "__init__.lua"]:1: in main chunk

Any ideas ?

1 Like

Found it !

There might be something odd with the LUA sol compiler (or at least I don’t know about it). When I put the code at the top of the file it doesn’t work , like this :

1    Events:Subscribe('Extension:Loaded', function()
2       WebUI:Init()
3    end)

But when I put at least one empty line at the top, it does work ! Like this :

1
2    Events:Subscribe('Extension:Loaded', function()
3       WebUI:Init()
4    end)

I am new to LUA, does anyone has an explanation for this ?
Thanks

That doesn’t make much sense. Both of the snippets you shared should be exactly the same, regardless of any whitespace. Maybe your text / code editor is saving the file in a weird encoding or something like that?

1 Like

Yes , it doesn’t make much sense at all, but I don’t think that VS Code does anything funny with the file.
Anyway, maybe it was just a coincidence and I probably misspelled Events:Subscribe with Events.Subscribe - but didn’t notice or similar.

Still , Thanks for taking a look @NoFaTe !