alternative to lua

R

ridpiska

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
 
A

Andrew Thompson

On Mar 29, 11:33 pm, (e-mail address removed) wrote:
...
I'm looking for an alternative to lua.

Never heard of it. Do you mean this?
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.
 
O

Oliver Wong

Andrew Thompson said:
On Mar 29, 11:33 pm, (e-mail address removed) wrote:
..

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
 
C

Chris Uppal

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...
 
R

ridpiska

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

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...
 
O

Oliver Wong

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
 
S

Steve Wampler

Oliver said:
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...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top