Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > alternative to lua

Reply
Thread Tools

alternative to lua

 
 
ridpiska@hotmail.com
Guest
Posts: n/a
 
      03-29-2007
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

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      03-29-2007
On Mar 29, 11:33 pm, (E-Mail Removed) 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.

 
Reply With Quote
 
 
 
 
Oliver Wong
Guest
Posts: n/a
 
      03-29-2007

"Andrew Thompson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> On Mar 29, 11:33 pm, (E-Mail Removed) 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


 
Reply With Quote
 
Chris Uppal
Guest
Posts: n/a
 
      03-30-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) 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...




 
Reply With Quote
 
ridpiska@hotmail.com
Guest
Posts: n/a
 
      03-30-2007
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" <(E-Mail Removed)-
THIS.org> wrote:
> (E-Mail Removed) 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...



 
Reply With Quote
 
Oliver Wong
Guest
Posts: n/a
 
      04-02-2007
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
>
> 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


 
Reply With Quote
 
Steve Wampler
Guest
Posts: n/a
 
      04-02-2007
Oliver Wong wrote:
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) ups.com...
>> 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 -- (E-Mail Removed)
The gods that smiled on your birth are now laughing out loud.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
binding lua (newbie) Roman Fordinal C++ 4 10-15-2004 07:14 AM
Lua: further investigation and comparisons with Python and Forth John Benson Python 4 01-09-2004 08:19 PM
question: Python or Lua for rejuvenation of old PCs? John Benson Python 4 01-02-2004 03:32 PM
Re: Lua, Lunatic and Python Gustavo Niemeyer Python 28 12-19-2003 02:20 AM
Lua, Lunatic and Python John Benson Python 0 12-13-2003 08:34 PM



Advertisments