alternative to lua

Discussion in 'Java' started by ridpiska@hotmail.com, Mar 29, 2007.

  1. Guest

    Hi

    I'm looking for an alternative to lua.

    My problem is that I need to send scripts to multiple clients, where
    some are developed in c++ and some in Java. I would like to find an
    off-the-shelf scripts interpretator that I can use for both clients.
    I first though LuaJava would do the trick, but since LuaJava needs the
    native calls to the lua c library, I can't use it for my Java clients.
    I can distribute the c native lua to my c++ clients, but my Java
    clients need to run "pure java".

    Anyone got any ideas, or directions where to point me?

    regards
    Jonas
    , Mar 29, 2007
    #1
    1. Advertising

  2. On Mar 29, 11:33 pm, wrote:
    ...
    > I'm looking for an alternative to lua.


    Never heard of it. Do you mean this?
    <http://www.keplerproject.org/luajava/>

    > I first though LuaJava would do the trick, but since LuaJava needs the
    > native calls to the lua c library, I can't use it for my Java clients.


    Why not?

    > I can distribute the c native lua to my c++ clients, but my Java
    > clients need to run "pure java".


    Why?

    Andrew T.
    Andrew Thompson, Mar 29, 2007
    #2
    1. Advertising

  3. Oliver Wong Guest

    "Andrew Thompson" <> wrote in message
    news:...
    > On Mar 29, 11:33 pm, wrote:
    > ..
    >> I'm looking for an alternative to lua.

    >
    > Never heard of it. Do you mean this?
    > <http://www.keplerproject.org/luajava/>


    Lua is a scripting language like Python. I'd never heard of LuaJava
    before, but I suspect it's an implementation of Lua in Java, much like
    Jython is a Python implementation in Java.

    >
    >> I first though LuaJava would do the trick, but since LuaJava needs the
    >> native calls to the lua c library, I can't use it for my Java clients.

    [...]
    >> I can distribute the c native lua to my c++ clients, but my Java
    >> clients need to run "pure java".


    How about Jython?

    http://www.jython.org/Project/index.html
    <quote>
    Jython is an implementation of the high-level, dynamic, object-oriented
    language Python written in 100% Pure Java, and seamlessly integrated with
    the Java platform. It thus allows you to run Python on any Java platform.
    </quote>

    There's also JRuby, and probably a couple of .NET -> JVM bridges.

    - Oliver
    Oliver Wong, Mar 29, 2007
    #3
  4. Chris Uppal Guest

    wrote:

    > My problem is that I need to send scripts to multiple clients, where
    > some are developed in c++ and some in Java. I would like to find an
    > off-the-shelf scripts interpretator that I can use for both clients.
    > I first though LuaJava would do the trick, but since LuaJava needs the
    > native calls to the lua c library, I can't use it for my Java clients.
    > I can distribute the c native lua to my c++ clients, but my Java
    > clients need to run "pure java".


    Oliver has already mentioned Python, which has a Java-only variant in JPython.
    (I'm not sure how easy it is to use the standard Python implementation as an
    embedded scripting language, but it is certainly very possible to use JPython).

    JavaScript/ECMAScript has widely used C and Java implementations in
    SpiderMonkey and Rhino respectively. (The last time I looked -- several years
    ago -- the SpiderMonkey code wasn't completely thread-safe, but it wasn't
    difficult to make it so.) Apparently Java 1.6 comes with a cut-down Rhino in
    the box[*].

    If you want to use a language from the Lisp family, then you'll have little
    difficulty finding embeddable versions for both implementation languages. I
    don't know whether you'll be able to find two packages which implement
    sufficiently similar dialects, but it isn't obviously unlikely (depending on
    what you want to do).

    If you /really/ need the two languages to be identical in both incarnations,
    then you could consider using JNI to embed a Java-based implementation into the
    C version of your applications. (You say that your Java application needs to
    be "pure Java", but I don't know whether the reverse is also true).

    -- chris

    [*] A sentence that not everyone gets the chance to use...
    Chris Uppal, Mar 30, 2007
    #4
  5. Guest

    Hi

    Thank you all for very interesting answers. I'll take a closer look at
    Jython, but from my first glance at their documentation I'm afraid it
    won't quite fit.

    As a browse through different script languages I realise more what I
    need:
    I need to be able to send script to my clients that call methods
    within my clients, and the scripts should be able to receive the
    results and act upon it (the same script must be able to run on both
    the c++ client and the Java client).
    I'm stuck with Java 1.5, and I cannot use jni (in any direction), but
    it was a good thought Chris.

    The more I read the more I'm staring to think of implementing an
    script interpretator by myself (one in the c++ client, and one in the
    java client).

    I'm sorry I cannot provide you with more details of my clients.

    thank you for your helpful answers
    cheers
    / jonas

    On 30 Mar, 07:15, "Chris Uppal" <-
    THIS.org> wrote:
    > wrote:
    > > My problem is that I need to send scripts to multiple clients, where
    > > some are developed in c++ and some in Java. I would like to find an
    > > off-the-shelf scripts interpretator that I can use for both clients.
    > > I first though LuaJava would do the trick, but since LuaJava needs the
    > > native calls to the lua c library, I can't use it for my Java clients.
    > > I can distribute the c native lua to my c++ clients, but my Java
    > > clients need to run "pure java".

    >
    > Oliver has already mentioned Python, which has a Java-only variant in JPython.
    > (I'm not sure how easy it is to use the standard Python implementation as an
    > embedded scripting language, but it is certainly very possible to use JPython).
    >
    > JavaScript/ECMAScript has widely used C and Java implementations in
    > SpiderMonkey and Rhino respectively. (The last time I looked -- several years
    > ago -- the SpiderMonkey code wasn't completely thread-safe, but it wasn't
    > difficult to make it so.) Apparently Java 1.6 comes with a cut-down Rhino in
    > the box[*].
    >
    > If you want to use a language from the Lisp family, then you'll have little
    > difficulty finding embeddable versions for both implementation languages. I
    > don't know whether you'll be able to find two packages which implement
    > sufficiently similar dialects, but it isn't obviously unlikely (depending on
    > what you want to do).
    >
    > If you /really/ need the two languages to be identical in both incarnations,
    > then you could consider using JNI to embed a Java-based implementation into the
    > C version of your applications. (You say that your Java application needs to
    > be "pure Java", but I don't know whether the reverse is also true).
    >
    > -- chris
    >
    > [*] A sentence that not everyone gets the chance to use...
    , Mar 30, 2007
    #5
  6. Oliver Wong Guest

    <> wrote in message
    news:...
    >
    > I'm stuck with Java 1.5, and I cannot use jni (in any direction), but
    > it was a good thought Chris.


    I believe JNI is available in Java 1.5 (i.e. it isn't a feature that
    was newly introduced in 1.6 or anything like that).

    >
    > The more I read the more I'm staring to think of implementing an
    > script interpretator by myself (one in the c++ client, and one in the
    > java client).


    Good luck.

    - Oliver
    Oliver Wong, Apr 2, 2007
    #6
  7. Oliver Wong wrote:
    > <> wrote in message
    > news:...
    >> I'm stuck with Java 1.5, and I cannot use jni (in any direction), but
    >> it was a good thought Chris.

    >
    > I believe JNI is available in Java 1.5 (i.e. it isn't a feature that
    > was newly introduced in 1.6 or anything like that).


    It is, and 1.4, and 1.3...


    --
    Steve Wampler --
    The gods that smiled on your birth are now laughing out loud.
    Steve Wampler, Apr 2, 2007
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roman Fordinal

    binding lua (newbie)

    Roman Fordinal, Oct 13, 2004, in forum: C++
    Replies:
    4
    Views:
    3,718
  2. John Benson

    Lua, Lunatic and Python

    John Benson, Dec 13, 2003, in forum: Python
    Replies:
    0
    Views:
    312
    John Benson
    Dec 13, 2003
  3. Gustavo Niemeyer

    Re: Lua, Lunatic and Python

    Gustavo Niemeyer, Dec 13, 2003, in forum: Python
    Replies:
    28
    Views:
    871
    Stephen J. Bevan
    Dec 19, 2003
  4. John Benson
    Replies:
    4
    Views:
    338
    Frank Bechmann
    Jan 2, 2004
  5. John Benson
    Replies:
    4
    Views:
    715
    David M. Cooke
    Jan 9, 2004
Loading...

Share This Page