LUA module creation

Hi. 
I write my own lua module. It should have a web page.
And I need to send some info between module and page.
Generally I want to dispatch some events from page in module (migth be some calcs, printer requests or smth else) and show the results on the page.
I saw API functions on your site and firmware module example in RS install folder. But I still have questions.
I'm hardware developer and have pure expirience with frontend. Do you have some helloworld module example or a little bit detailed instruction about module creation?

Comments

  • We only have the documentation you see online. A good example would be to look at the firmware uploader module. That module does exactly what you need. E.g.

    server:registerAction("firmware_boards", firmwareGetBoards)
    registers a callback used in javascript.
    It also adds a javascript and css file to server frontend:

    server:registerFrontendCSS("/mod/firmware/firmware.css")
    server:registerFrontendJS("/mod/firmware/firmware.js")
    and that even registers a menu entry in printer context to open an additional tab.
    I think that should get you started.

  • Yeah, this is it.

    I have tried to access to the module web page through http://address:3344/mod/firmware/firmware.php and it looked ugly (of course). But when to do this in a correct way (through menu entry) all is fine. My test module is also works i this way.

    Thanx for quick responce and have a nice day.
Sign In or Register to comment.