On 13 April 2012 13:45, Tim Starling <tstarl...@wikimedia.org> wrote:

> At the moment, in the Lua support extension we have been developing,
> wikitext is output to the wiki via the return value of a function. For
> example in wikitext you would have:
>
> {{#invoke:MyModule|myFunction}}
>
> Then in [[Module:MyModule]]:
>
> local p = {}
> function p.myFunction()
>   return 'Hello, world!'
> end
> return p

..


> Does anyone have any thoughts on return versus print generally? Are
> there other reasons we would choose one over the other?
>
> -- Tim Starling


Functions that return a value are chain-able.  I suppose this is true in
LUA too.

$int = function($txt){
  return parseInt($txt,10);
};

$hats = function($numHats){
 return " We have $numHats excellents hats! ";
};

echo $hats(  $int("4123,234")  );

Perhaps this make functions that return a string slightly better.

-- 
--
ℱin del ℳensaje.
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to