Sending params from JS to LUA

edited July 2017 in Repetier-Server
Hi, 
sorry for this stupid topic but I need some help.
Is this possible to send some param(s) from js-file to lua module using "registerAction"? Or maybe with "registerDynRequest"?
Which way is correct?
I have no problem with receiving data from lua module but I can't receive any param inside of lua module.
With RSCom.send(...) in js-file I can access to "slug"-field in "data" struct inside of callback function in lua-file. 
Ex.
------------------------------------------------------------
function some_foo( data, result )
       local printer = rs.printerBySlug( data.slug )
       printer:injectManualCommand("M107")
       return nil
end

server:registerAction("some_foo", some_foo)
------------------------------------------------------------
What other fields "data" struct may contain?
I have found example in firmware folder but its not enough.
Thanx.

Comments

  • edited July 2017
    Ok, there is param(key,default) function in ServerRequest category of API.
    This function doing all what I need.
    Is it possible to realize sending params in other way?
  • Your action function is configured wrong. It should
    function some_foo(printer, data, result)

    Then you see that your data was in reality the printer definition, which is why have slug there. data is the object you attached in javascript in RSCom.send as second parameter.

Sign In or Register to comment.