History of Lua aside... note about game usage!

classic Classic list List threaded Threaded
59 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: t-shirts

Nils Svangaard
Since I got my office back, I am trying to find some spare time to handle
the task. I still don't know how to get the payments. I was
thinking about
geting Amazon gift certificates. Is that too stupid?

Why not www.kagi.com? They take care of handling creditcard and mail orders for things like shareware and stuff like that.

--
Nils Svangård, Catchy Software
http://www.catchysoftware.com

Reply | Threaded
Open this post in threaded view
|

Re: t-shirts [was Re: History of Lua aside... note about game usage!]

Roberto Ierusalimschy
In reply to this post by Luc Van den Borre-2
> You could consider http://www.cafepress.com/

That seems a quite acceptable solution! (or not?)

The base price for a Tshirt would be around $18.50 = $13.99 (their base 
price) + $4.30 (their shipping). It is a little more than I expected, but 
it is much simpler for us (as they do all the work!). Moreover, they can 
offer a larger selection than us ;-) (long sleeves, sweatshirt, etc.) 

Does anyone know about this "store"? Is a "100% cotton, white Hanes® 
Beefy-T-Shirt" a reasonable shirt? 

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: t-shirts [was Re: History of Lua aside... note about game usage!]

Siome Klein Goldenstein
Hanes T-Shirts are the equivalent of the Brazilian Hering T-Shirts.

I've peeked at their web site,  they also have mugs!! :-)

BTW,  
The lua T-Shirts looks great,  last january when
I was in Rio I've picked up two T-shirts from lhf.

Siome


On Wed, May 16, 2001 at 02:08:17PM -0300, Roberto Ierusalimschy wrote:
> > You could consider http://www.cafepress.com/
> 
> That seems a quite acceptable solution! (or not?)
> 
> The base price for a Tshirt would be around $18.50 = $13.99 (their base 
> price) + $4.30 (their shipping). It is a little more than I expected, but 
> it is much simpler for us (as they do all the work!). Moreover, they can 
> offer a larger selection than us ;-) (long sleeves, sweatshirt, etc.) 
> 
> Does anyone know about this "store"? Is a "100% cotton, white Hanes® 
> Beefy-T-Shirt" a reasonable shirt? 
> 
> -- Roberto

-- 
----------------------------
Siome Klein Goldenstein
[hidden email]
http://www.cis.upenn.edu/~siome

Reply | Threaded
Open this post in threaded view
|

RE: History of Lua aside... note about game usage!

Falko Poiker
In reply to this post by Bret Mogilefsky-4
We here at Relic are using lua for both our projects now: Sigma and
Homeworld 2.   Sigma moved from Python to lua a few months ago.  I can't
speak for the Sigma project, but Homeworld 2 uses lua for the following
tasks: simple configuration of tweakable modules in the game (camera,
weapons, races, formations, construction, ship stats, sound and more),
defining mission flow and events (i.e. movies that get played in the single
player game), defining winning/losing conditions (using lua function
callbacks) and for ship classifications (using various lua tables).   By far
the most impactful use of lua will be our AI - we've adapted our in house
state machine language (KAS - Kick Ass Scripting) to be a thin layer on top
of lua. 

I wrote an article on GameSpy's developer's corner about
scripting/modability that mentions lua
http://www.gamespy.com/devcorner/january01/poiker/
This article was meant primarily for our fans, of whom there are quite a few
people interested in modifying our game, but may not understand what a
scripting language is or how it works in a game like ours.  The article
doesn't go into any considerable depth, though.  

In addition, I talked to many Artificial Intelligence people (both game
company types, and academics) about lua at a recent AAAI Symposium at
Stanford University, so awareness may be growing on that front as well.

Anyway, thanks for a great language!

Falko Poiker
Programmer/Designer
Homeworld 2
Relic Entertainment Inc.



-----Original Message-----
From: Luiz Henrique de Figueiredo [[hidden email]]
Sent: Tuesday, May 15, 2001 5:24 PM
To: Multiple recipients of list
Subject: Re: History of Lua aside... note about game usage!


I wrote this last week:

 We have this problem: we *feel* that Lua is being used in many places
 but we don't *know* any other than the 50 or so listed in our site.

 Is it just a feeling or what? How widely would you say that Lua is used?

This appeared yesterday in comp.games.development:

 Of course, the most popular extension languages (Lua, Python, Tcl)
 are licensed without such strings attached.

So, at least to this person, Lua rates among the "most popular" languages!
(With Lua listed first, but he may have sorted the names...)

This kind of statement is not infrequent in usenet messages that mention Lua
(see "Lua usenet citations" in http://www.lua.org/links.html ); Lua is
mentioned as a language that people are (or should be) familiar with.
Despite this, we still only know those 50 or so uses listed in our site.

What is your experience? Do people around you know Lua? How did they know
about
it? Did you tell them yourself or was it the other way around? Do you know
other people that are using Lua but who are not in lua-l? Would you rate Lua
as a "popular" language? Do you see its popularity increasing?

We'd really like to know a realistic estimate of the impact of Lua.

Thanks for any info.
--lhf

Reply | Threaded
Open this post in threaded view
|

Re: t-shirts [was Re: History of Lua aside... note about game usage!]

Steve Dekorte-4
In reply to this post by Roberto Ierusalimschy

Roberto Ierusalimschy wrote:
Does anyone know about this "store"? Is a "100% cotton, white Hanes®
Beefy-T-Shirt" a reasonable shirt?

I think those are the best t-shirts around.

Steve

Reply | Threaded
Open this post in threaded view
|

RE: Lua Strengths/Weaknesses and usage info

KELLEHER
In reply to this post by David Jeske-3
There are two ways that I know of to informally measure the diffusion of
Lua.

The first is to search the job listings on www.dice.com for "lua".
Unfortunately,
there is only one listing at the moment.  Consider, though, that  if you
search 
for "rebol", another new language, there are no listings at all.

The second thing is to search Google for links to the Lua home page:
http://www.google.com/search?q=link:www.tecgraf.puc-rio.br/lua/

Kevin Kelleher    (916) 785-9628


Reply | Threaded
Open this post in threaded view
|

Re: Lua Strengths/Weaknesses and usage info

J. Perkins-2
In reply to this post by David Jeske-3
David Jeske wrote:

On Tue, May 15, 2001 at 09:23:31PM -0300, Luiz Henrique de Figueiredo wrote:

What is your experience?


I'll summarize at the top and save people time. This isn't all
positive towards Lua, but it's all good information. Of course this is
all in my humble personal opinion.

Lua's biggest strengths are:

- ease of integration (the lua C api is simple and powerful)
- execution speed     (the lua VM is very fast)

The biggest troubles I've had using Lua are:

- using my add-in class machinery is very error prone because the syntax is all based on tables and functions.

  (anyone have any good syntax for classes??)

- combination of add-in class machinery and weak typing makes
  my Lua code hard to understand and makes errors hard to
  report about and thus hard to track down.

I (obviously) wouldn't have either of those problems if I were using
Lua for some simple configuration and simple scripting like it's
sort-of intended.


Well I agree with all of that, though I would add a few more strengths

- it's a very flexible language. I've got some nice features in my component system that would be difficult in other languages, namely on-the-fly loading of components and the ability to use the same language for scripting and data files. That said, it would still be
   nice to have a cleaner "class" structure.

 - it's small. For anyone considering a console game, a big win.

- it's portable. I'm running on Win32, Linux, BeOS, and soon MacOS. I haven't tried
   this with Java, but from what I've heard it's a nightmare.


We're YAGCS (yet another game company startup) and Lua is an integral part of our engine architecture. Not just for scripting, but also for most of the game data. I haven't put it on The List as we're basically an unknown company working on an unknown product, and I always hate it when I see products trumpeting their success by referencing projects that may well never see the light of day. Flexibility, speed, and
size -- in that order -- are what I like about Lua.


Do people around you know Lua?
People? What people? ;) No, but if I find some people I'll be sure to tell them all
about it.


Jason
379




Reply | Threaded
Open this post in threaded view
|

Re: History of Lua aside... note about game usage!

Michael Casaday
In reply to this post by Luiz Henrique de Figueiredo
I'm involved with an independent, amateur game project code-named "Gilbert".
I first heard about Lua from an update about it at flipcode.com.  I brought
Lua to the programmers' attention when the subject of a scripting language
came up.  They were going to go ahead and roll their own language, but the
complexity of that non-trivial task swung them toward Lua.  So I'll probably
be able to write Lua scripts for our game and enter Lua statements into the
game's console sometime soon.  From my own - admittedly superficial -
investigations, none of the other languages I looked at really attempt to
make application integration particularly easy.  By contrast, Lua is
surprisingly simple to integrate.  Also, some of the other languages seem a
bit bloated for our relatively simple needs.  Python and Tcl, for instance,
are very cool languages, but they do far too much for a game like ours,
which requires only simple scripting capabilities.  Yes, it is probably not
too difficult to strip out what you don't need from those languages, but why
not just use something that doesn't need to be slimmed down in the first
place?  I looked at Small and I glanced at SimKin, but it seemed like the
former wasn't really a scripting language since it required compilation into
byte codes (someone correct me if I'm wrong), and the XML-oriented approach
that the latter took just rubbed me the wrong way.

I think you did a great job on the language.  I'd love to add our project to
The List <tm> when we are finished.

_________________________
mike casaday



Reply | Threaded
Open this post in threaded view
|

Re: t-shirts [was Re: History of Lua aside... note about game usage!]

Stephen Adam
In reply to this post by Roberto Ierusalimschy
> Since I got my office back, I am trying to find some spare time to handle
> the task. I still don't know how to get the payments. I was thinking about
> geting Amazon gift certificates. Is that too stupid?

    Have a look at www.paypal.com

    I don't know if I'd trust them with thousands of dollars, but they could
be perfect for T-Shirt sales.  Also, they had a scheme of opening your
account with $10 in it if another paypal user recommended the service,
and they'd pay the existing user $10 too.  If they're still doing that then
paypal might subsidise all of our T-Shirts. hehehe



Reply | Threaded
Open this post in threaded view
|

Lua in astronomical image processing

Nicolas Devillard
In reply to this post by Michael Casaday
The project I am working on is an image processing library for
astronomers. The main development is a C library providing low-level
functionalities. We have a need for a high-level language to script this
library into useful astronomical applications.

Python is cool, but there are several things getting in the way:
- Python is BIG. Something like 10 times the size of our own code.
  In the end I do not know if I am adding Python as a scripting
  language to my library, or making my library a Python extension!
- The C bindings are too hard to write by hand, especially for many
  functions. SWIG is great but does not handle type conversions too
  well, some handwork is still needed there. Not a showstopper but
  an additional task nonetheless.
- Our package must be used by non computer experts. I do not want to
  become a Python installation helpdesk.

So Lua fits the bill quite well: small, as easy to program (probably less
powerful than Python but for our purpose it's just right), small to
download, easy to install, easy to interface to C, we can distribute it
with our code without exploding the tarball size. Great. Only thing is:
coming up to users with yet another language to learn is a non-trivial
persuasion task. Even if you can convince them that the language is
simple, they do not want to hear about it.

So right now we are in the phase of offering both Python and Lua to
interested programmers. We will see which one wins, where the interest
goes. If nobody wants to use Lua, we will keep it for internal use only.
Internally, we use Lua a lot to help us generate C code, e.g.
you can store a data structure as a tree of Lua tables and have them
generate themselves into a static struct which you can #include in your
library. Very handy, much easier to maintain, and you can completely
re-organize your data structure without messing the handling C code.

Cheers
-- 
Nicolas


Reply | Threaded
Open this post in threaded view
|

Re: t-shirts [was Re: History of Lua aside... note about game usage!]

Terence Martin-2
In reply to this post by Stephen Adam
Paypal might not be a good idea.. last I checked (about a month ago) it was
a real trial to do anything with them if you didn't have a credit card,
unless you live in the states. They seem to be pretty credit card fixated,
unless you live in the US, in which case they can access your bank account
directly. Of course, they may have fixed things up so people outside the US
can do stuff without a credit card, you'd have to check...

----- Original Message -----
From: "Stephen Adam" <[hidden email]>
To: "Multiple recipients of list" <[hidden email]>
Sent: Thursday, May 17, 2001 12:39 AM
Subject: Re: t-shirts [was Re: History of Lua aside... note about game
usage!]


> > Since I got my office back, I am trying to find some spare time to
handle
> > the task. I still don't know how to get the payments. I was thinking
about
> > geting Amazon gift certificates. Is that too stupid?
>
>     Have a look at www.paypal.com
>
>     I don't know if I'd trust them with thousands of dollars, but they
could
> be perfect for T-Shirt sales.  Also, they had a scheme of opening your
> account with $10 in it if another paypal user recommended the service,
> and they'd pay the existing user $10 too.  If they're still doing that
then
> paypal might subsidise all of our T-Shirts. hehehe
>
>


Reply | Threaded
Open this post in threaded view
|

Re: t-shirts [was Re: History of Lua aside... note about game usage!]

Stephen Adam
----- Original Message -----
From: "Terence Martin" <[hidden email]>
To: "Multiple recipients of list" <[hidden email]>
Sent: Friday, May 18, 2001 12:47 PM
Subject: Re: t-shirts [was Re: History of Lua aside... note about game
usage!]


> Paypal might not be a good idea.. last I checked (about a month ago) it
was
> a real trial to do anything with them if you didn't have a credit card,
> unless you live in the states. They seem to be pretty credit card fixated,
> unless you live in the US, in which case they can access your bank account
> directly. Of course, they may have fixed things up so people outside the
US
> can do stuff without a credit card, you'd have to check...

    Ah, thanks.  I was wondering what their servcie was really like.
Since they are a service company, it seems strange that they make
things difficult for their customers.



Reply | Threaded
Open this post in threaded view
|

Re: Lua in astronomical image processing

John Belmonte-2
In reply to this post by Nicolas Devillard
Nicolas Devillard wrote:

> Internally, we use Lua a lot to help us generate C code, e.g.
> you can store a data structure as a tree of Lua tables and have them
> generate themselves into a static struct which you can #include in your
> library. Very handy, much easier to maintain, and you can completely
> re-organize your data structure without messing the handling C code.

This sounds like a good idea, is it for constant data or variables?  Would
you offer any more details, such as an example structure in Lua and the
resulting C code?

Thanks,
-John



Reply | Threaded
Open this post in threaded view
|

Re: Lua in astronomical image processing (long)

Nicolas Devillard
> This sounds like a good idea, is it for constant data or variables?
> Would you offer any more details, such as an example structure in Lua
> and the resulting C code?

The problem is to maintain a list of strings and associated arbitrary
integer labels, something like:

typedef enum _color_ {
    color_unknown=0,

    red  = 1,
    green = 2,
    blue = 3,

    end_of_colors
} color ;

static struct {
    color   c ;
    char  * name ;
} color_list[] = {

    {red, "RED label"},
    {green, "GREEN label"},
    {blue, "BLUE label"},

    {end_of_colors, NULL}
} ;

The nice thing about declaring something static like that, is that you can
write code once for all that iterates over all colors or all color strings
without having to know about the contents of the labels or the strings.
You can also write simple generic functions that will make the association
between the string and the integer without knowing about the struct
contents.

Something like:

char * color_get_name(color c)
{
    int i=0 ;
    while (color_list[i].c != end_of_colors) {
        if (color_list[i].c == c) {
            return color_list[i].name ;
        }
        i++ ;
    }
    return NULL ;
}
(NB: the reverse problem is simpler solved by hashing the string)

Problem now is maintaining the label name declaration in
two places. Sucks.

A solution is to use a Lua table like:

color = {
    red = "RED label",
    green = "GREEN label",
    blue = "BLUE label"
}

And then write a simple Lua script that will generate the above code
for you. Now adding/modifying one label involves only one line of code.

This trick can become even more interesting with hierarchically defined
labels, like:
    countries = {
        europe = {
            portugal = "P",
            uk = "UK"
        },
        america = {
            us = "US",
            brazil = "BR"
        }
    }

The generated labels would be something like:
    europe_portugal, "P"
    europe_uk, "uk"
    america_us, "US"
    america_brazil, "BR"

Now say you want to re-organize the country declaration into something
different, you only have to shuffle around your Lua tree. The Lua script
that parses the tree and generates the C code stays the same, and the
functions that handle the struct are also untouched. By modifying your
tree
you can now have something like:
    countries = {
        portuguese = {
            portugal = "P",
            brazil = "BR"
        },
        english = {
            uk = "UK",
            us = "US"
        }
    }
The generated labels are now:
    portuguese_portugal, "P"
    portuguese_brazil, "BR"
    english_uk, "UK"
    english_us, "US"

And you have only modified one source file, the Lua tree. The Lua
generation code and the C code handling the struct are still intact.

Going further: we usually store more than just an associated string,
making it possible to link together many more elements (e.g. the hash of
the associated string). Since we are controlling the Lua code that
generates the C, we also use special numbers in the enum to allow
deriving properties from the int itself. Example: enum that convert to an
odd int have property 1, enums that convert to an even int have property
2.

The idea behind all that is that you have a bunch of static data that you
want to convert to C code, making it easy to maintain and avoiding
re-programming of all the handling functions every time you modify the
data. This is one possible solution. There is nothing specific to Lua,
only that the table declaration syntax is simple to read, maintain, can be
written by anybody. The script generating the C code from the Lua table is
also quite simple (omitted here).

Cheers
-- 
Nicolas


Reply | Threaded
Open this post in threaded view
|

Re: Lua Strengths/Weaknesses and usage info

Christian Vogler-2
In reply to this post by David Jeske-3
On Tue, May 15, 2001 at 11:44:09PM -0700, David Jeske wrote:
>  - using my add-in class machinery is very error prone because 
>    the syntax is all based on tables and functions.
> 
>    (anyone have any good syntax for classes??)
> 
>  - combination of add-in class machinery and weak typing makes
>    my Lua code hard to understand and makes errors hard to
>    report about and thus hard to track down.

I disagree with that part. IMHO the tolua framework for classes is
quite nice, and easy to use and to understand. You can use it even
when you do not define C++ classes. Its biggest drawbacks are that
when you bind C++ classes you have to mess with ownership issues, and
that there is currently no way to override virtual functions from
lua. 

However, the first issue was easy to fix with some tag method magic.
Likewise, the second issue should be, from what I know about how tolua
works, fairly easy to implement in the tolua code generation module.

I am inclined to agree, though, that the weak typing can be a
problem. It makes it hard to track down errors when you pass the wrong
class to a function.

I like the metamechanisms in lua very much. They make the language
very powerful, and you can do some surprising and useful things with
them that make the overall project easier to use.

My biggest gripe with lua is the lack of libraries that make
general-purpose scripting hard and verbose.

We use lua in a framework for tracking deformable models with computer
vision methods. It functions both as a language for configuration
files and as a general-purpose scripting language. As a configuration
file language, it has by far exceeded our expectations. For example,
we have to describe the topology and shape of 3D polygonal models. lua
allows us to compute the shape mathematically on the fly, which makes
it so much easier to write these files.

As a general purpose scripting language, we primarily use it to
control the visualization frontends, and setup and flow of the
tracker. Even there it has shown to be amazingly powerful in that tag
methods allow us to observe when the contents of a table change,
wihout the function making the change having to be aware of the
observation. This makes for a very clean decoupling of the GUI and
program flow logic, and allows us to reuse components for different
frontends without any fuss at all.

On the other hand, this is also an area where we have had to come up
with some ugly hacks to compensate for the lack of library
functions. For example, we have a directory full of images that are
named like this:

image.0001.pgm
image.0002.pgm
...
image.0500.pgm

>From this directory we need to find out how many images are there and
what the first and last frames are. From lua, this turned out to be
surprisingly hard to do. We eventually settled on a combination of
system("ls") and the string pattern functions, but the result is
neither robust (we end up with broken pipes frequently), nor easy to
understand.

>    The troubles with Lua in this project have been: (a) It's weak typed,
>    and debugging is somewhat difficult in the context of a game where 
>    I've not built an interactive Lua debugger.

We've partially gotten around the problem by giving access to an
interactive lua interpreter from the main program. This lets us
inspect and modify code and variables at run time.

> (b) It's hard for others to
>    understand the Lua code, both because it's weak typed, and because 
>    (like all class-ish lua) I had to build my own inheritence mechanism and 
>    the weird syntax makes the code more confusing. 

How does weak typing make code harder to understand? Or do you mean
the difference between static and dynamic typing? If it is the latter,
I would argue that it is a matter of taste. Both static and dynamic
typing have their advantages and drawback. One nice thing about
dynamic typing is that writing generic code comes naturally, without
having to resort to e.g. C++'s nasty template syntax. In such cases I
would argue that the code is actually easier to understand than the
statically typed version.

- Christian

Reply | Threaded
Open this post in threaded view
|

Re: Lua Strengths/Weaknesses and usage info

Nahuel Greco
> > (b) It's hard for others to
> >    understand the Lua code, both because it's weak typed, and because 
> >    (like all class-ish lua) I had to build my own inheritence mechanism and 
> >    the weird syntax makes the code more confusing. 
> 
> How does weak typing make code harder to understand? Or do you mean
> the difference between static and dynamic typing? If it is the latter,
> I would argue that it is a matter of taste. Both static and dynamic

I think that will be cool to add a static option to lua, i mean, to 
be capable of declare the type of a variable or the args to a function.
that.. if the static way doesnt slow the system (i like speed :).. well..
maybe the static types will be faster?, there are plans to add optional
static typing to lua?



- Nahuel Greco                 Web Development - Open Source - 
- http://www.codelarvs.com.ar  Game Programming - Research   -
- Freelance coding / sysadmin  Networking. The answer is 42. -



Reply | Threaded
Open this post in threaded view
|

Re: Lua Strengths/Weaknesses and usage info

Steve Dekorte-4
In reply to this post by David Jeske-3

David Jeske wrote:
Although for most of my projects I'm really starting to want a
static-typed scripting environment. Unfortunatly, there dosn't seem to
be one readily available. Java comes close but isn't easy to
integrate, Pike dosn't have enough static type checking (yet?) despite
all it's static declarations. Something like UnrealScript would be
pretty great, too bad that's not freely available.

Static typing has it's advantages, but also it's costs. How one weights the two depends on the individual. You might try EiC(http://www.kd- dev.com/~eic/) if you're looking for a scripting language based on C's syntax.

Steve



Reply | Threaded
Open this post in threaded view
|

Re: Lua Strengths/Weaknesses and usage info

David Jeske-3
In reply to this post by Christian Vogler-2
On Fri, May 18, 2001 at 01:27:45PM -0400, Christian Vogler wrote:
> >    The troubles with Lua in this project have been: (a) It's weak typed,
> >    and debugging is somewhat difficult in the context of a game where 
> >    I've not built an interactive Lua debugger.
> 
> We've partially gotten around the problem by giving access to an
> interactive lua interpreter from the main program. This lets us
> inspect and modify code and variables at run time.

I clearly need to do this.

> > (b) It's hard for others to
> >    understand the Lua code, both because it's weak typed, and because 
> >    (like all class-ish lua) I had to build my own inheritence mechanism and 
> >    the weird syntax makes the code more confusing. 
> 
> How does weak typing make code harder to understand? 

It makes it harder to understand because when someone's looking at an
event callback in my game, it looks like:

ge_collision = function(self,x,y,whoIhit)
      local xpos,ypos;

      xpos,ypos = whoIhit:getPos();
      xpos = xpos + 5;

      whoIhit:setPos(xpos,ypos);
end

When trying to figure this out, one needs to know what type of object
"whoiIhit" is, and get a list of the methods and properties available
in that object. In Lua, this is only possible if I build an
interactive debugger environment, and actually stop the script code
right when one of these event handlers is called. However, once the
code is changed, it's going to have to reset and reload alot of stuff
to be able to run his the code.

If I could specify types, this would be simple, it would say:

ge_collision = function(self,number x,number y,Sprite whoIhit)
      local xpos,ypos;

      xpos,ypos = whoIhit:getPos();
      xpos = xpos + 5;

      whoIhit:setPos(xpos,ypos);
end

...and now everyone knows exactly what object type "whoIhit" is.

This isn't so much a problem in built-in event callbacks, because my
sprite documentation explains them. However, when looking at someone's
arbitrary script code for an object, it's hard to track down what
method arguments (or object properties) are of what type.

> Or do you mean the difference between static and dynamic typing?

No. I'm taking about the difference between strong and weak typing. I
just want the ability to provide strong type checks in places where
types are known.

If I wanted the Sprite code in a static typed language, I would have
just left it in C++. 

[ stuff about static vs dynamic type ]

> In such cases I would argue that the code is actually easier to
> understand than the statically typed version.

I agree that dynamic typed code can normally be much more brief. I
like using languages which have nice robust datatypes, garbage
collection, and have some level of dynamic typing. However, there are
lots of things in all software which simply are not dynamic, and it's
annoying to me when the program will happily load lots of invalid code
just because everyone who seems to like dynamic typing seems to equate
it with weak typing.

[[steve: That's why I'm not using something like EiC. Because it's
basically pointer-safe C, with no GC, and no abstract datatypes like
lists and hash tables. ]]

The closest thing I've seen is "Pike". It is a dynamic scripting
language like Lua, Python, and the rest, with garbage collection,
abstract datatypes such as lists/hashes, etc. However, I tried it out
and even though it allows you to (optionally) declare static types all
over, right now it does not check most (a) arguments to
functions/methods, (b) names of methods against object types to see if
the method exists. So it's not useful enough to justify switching from
Lua.

-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + [hidden email]

Reply | Threaded
Open this post in threaded view
|

toLua causing runtime error/exit

Eric Ries
In reply to this post by Steve Dekorte-4
Greetings. I am running lua as part of a project with many C++ header files
exposed to Lua via toLua 4.0a

This setup has been working extremely well, but I've just hit a strange bug
that I have not been able to track down. To initialize my lua state, I call
a long series of tolua_*_open functions. Once this list gets sufficiently
large, I get the error "error: attempt to index a nil value" in the very
first call to tolua_function() in about the 30th tolua_*_open() call.

The error happens during the following code snippet in tolua_function():

  lua_getglobal(L,parent);
  lua_pushstring(L,name);
  lua_pushcfunction(L,func);
  lua_settable(L,-3);

Clearly, the relevant global for parent is not being set, but I cannot see
why this is so. For my class (which is called PiGuiElementText, btw), I can
step through the corresponding call to
tolua_usertype(tolua_S,"PiGuiElementText"); which seems to work correctly.

I don't really know what to try next. Are there some limited resources in
toLua that I am running out of?

Any help is much appreciated...

Eric


Reply | Threaded
Open this post in threaded view
|

Re: Lua Strengths/Weaknesses and usage info

Steve Dekorte-4
In reply to this post by David Jeske-3

David Jeske wrote:
ge_collision = function(self,number x,number y,Sprite whoIhit)...

...and now everyone knows exactly what object type "whoIhit" is.

You might try using a naming convention when the type isn't clear:

ge_collision = function(self, x, y,whoIhitSprite)

Or better yet:

function ge_collisionAtX_Y_with_(self, x, y, aSprite)

This way a developer who looks at the method's use doesn't has to look at it's declaration to determine what the args are for.

Steve


123