erland;541707 Wrote:
> You need to change the function to something like this:
>
See attached, should be OK.
> If you like to avoid the _p* references, you can used tagged parameters
> instead and use:
> >
Code:
--------------------
> >
> my $macroString = $request->getParam('format');
> my $period = $request->getParam('period');
>
--------------------
> >
>
> And the user will have to specify the parameters as:
> >
Code:
--------------------
> >
> sdtMacroString format:Temp%H period:-1
>
--------------------
> >
>
> This makes the function logic a bit less sensitive to which order the
> caller passes the parameters.
>
> However, note that if you haven't used tagged parameters before and
> starts to use it, all clients using the old interface has to be
> changed so they specify the parameter names as shown above.
For the life of me, I can't figure out how to make this work - I added
a dispatch in the Perl:
Code:
--------------------
Slim::Control::Request::addDispatch(['sdtMacroString', '_format', '_period'],
[1, 1, 1, \¯oString]);
--------------------
and this is the request from LUA:
Code:
--------------------
{ 'sdtMacroString', text, '0'}
reads *%v and 0*
{ 'sdtMacroString', "format:"..text, 'period:0'}
reads *format:%v and period:0*
or
{ 'sdtMacroString', "_format:"..text, '_period:0'}
reads *_format:%v and _period:0*
or
{ 'sdtMacroString', {'format', text}, 'period:0'}
reads *ARRAY x848918 and period:0*
--------------------
I can't find one example in the acutal SlimServer code where they use
tagged parameters, they're all positional (there's even a note saying
that most users won't ever use the AddParam command, so assume you
don't have to manually parse it on the Perl side.. confused? yes. I'm
OK with positional for the moment, but would love to know the answer.
I've seen examples in the LUA code where they use tagged parameters
using just inline colons. Like here in SlimBrowserApplet.lua,
requestStatus:
Code:
--------------------
{ 'status', from, qty, 'menu:menu', 'useContextMenu:1' }
--------------------
-Dan
+-------------------------------------------------------------------+
|Filename: SuperDateTime_plugin_beta.zip |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=9779|
+-------------------------------------------------------------------+
--
plympton
------------------------------------------------------------------------
plympton's Profile: http://forums.slimdevices.com/member.php?userid=12955
View this thread: http://forums.slimdevices.com/showthread.php?t=77864
_______________________________________________
jive mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive