LUA to Hollywood Convert, Possible?

Discuss any general programming issues here
Post Reply
User avatar
1Mouse
Posts: 63
Joined: Sat Sep 11, 2010 9:27 pm

LUA to Hollywood Convert, Possible?

Post by 1Mouse »

Hi,

I recently asked if AmiBlitz to Hollywood Convert was possible?

I have looked at some LUA code and it seems to strongly resemble Hollywood code.

So is it possible to convert LUA to Hollywood or is there a command comparison table available?

Please keep in mind I didn't look at LUA too indepth, I just read something about LUA and checked out some code.

If it's not possible then let me know and this post can die.

Thank you.

User avatar
airsoftsoftwair
Posts: 4254
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: LUA to Hollywood Convert, Possible?

Post by airsoftsoftwair »

It's basically possible but there are lots of differences that you need to take care of. Here are some that come to my mind:

- syntax is different, e.g. lua always uses "end" to close all kinds of scopes (I don't find that very readable)
- Hollywood uses zero indices while lua starts at 1 (which is totally ugly IMHO)
- lua is case sensitive, Hollywood is not
- lua requires you to declare variables, Hollywood does not
- Hollywood doesn't have the coroutine feature of lua
- lua has a much stricter handling of nil
- lua has a special boolean variable type; in Hollywood a boolean is just a number
- not all calls of the lua standard libraries are available in Hollywood but the most important are there
- Hollywood has all kinds of extensions to the lua language that were necessary to keep compatibility with Hollywood 1.x or that were just vanity changes because I didn't like the lua implementation :)

Keep in mind that Hollywood 1.x didn't use lua but my own VM. Thus, the challenge for Hollywood 2.0 was to replace the VM and keep compatibility with all old scripts. That's the reason why Hollywood's flavor of lua is quite different from lua.

User avatar
airsoftsoftwair
Posts: 4254
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: LUA to Hollywood Convert, Possible?

Post by airsoftsoftwair »

Also, lua allows you to leave out the function parentheses if the function takes a string or table. So the following lua code

Code: Select all

myfunc{x = 1, y = 2}
myfunc"hello"
maps to

Code: Select all

myfunc({x = 1, y = 2})
myfunc("hello")
in Hollywood.

Post Reply