Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
What is to be gained from embedding lua inside a perl script?

You can offer the users of your program a domain specific language (DSL); Lua is best know to provide support for this in particular. You mention Nmap and Snort, but mysqlproxy also uses it. It's used extensively to extend complex programs written in complex languages, e.g. C++ (WoW?). Redis is getting increasing support for Lua.

Do lua coroutines provide anything useful when used in a dominantly Perl context? (Useful could be something to gain in maintainability, performance, scalability...)

Sure, it can provide you with a way to manage many contexts by which you are doing work. Don't confuse this with multi-threading, but it can provide you with a cheap mechanism (i.e., context switching) to manage lots of unrelated blocks of work in the same execution thread. From what I've seen, I don't think Lua supports actual threads. http://www.qore.org is embeddable and supports threading, but I don't think it's as nice as Lua for this purpose.

Why isn't perl embedded in applications as often as lua is (especially since TinyPerl is the same size)?

Lua evolved to fit this explicit purpose. Perl is too heavy and doesn't provide the clean ways of binding a host program to the underlying Lua interpreter that make it a nice choice for building a DSL into your program.

Update - you mention FFI::Platypus, but that's primarily for creating wrappers around shared libraries. It might help you avoid writing an XS module directly, but it's not going give you the solid platform for a DSL like Lua.

PS: good reading on the history of Lua - http://www.lua.org/history.html


In reply to Re: it's scripts all the way down! by perlfan
in thread it's scripts all the way down! by QuillMeantTen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (2)
    As of 2020-07-16 03:16 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?