lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> A couple of other examples; I could think of more if pressed:

In my case, I use tables to indicate a series of keyframe times
and values for an animation curve:

ColourCorrector1.Hue = Bezier{ [0] = 1.0, [10] = 25.0, [12.5] = 99.5 }

These keyframes can occur at any time; frequently they are at frame
times (ie integer), but in many cases, especially if doing video field
processing, they will be at .5 intervals. They can validly be at
any floating point time offset.

> Part of what makes lua so simple and extensible is the concept
> of one single data structure that can hold *anything*.  Even
> though it's more efficient to limit the language to integer-based
> arrays, that seems to me to be hobbling the power of the language
> for the sake of an implementation.

Absolutely.  Lets keep Lua flexible in this regard, rather than
arbitrarily limiting things.

Love, Light and Peace,

- Peter Loveday
Director of Development, eyeon Software

----- Original Message ----- 
From: "Jordan, Chuck" <>
To: "Multiple recipients of list" <>
Sent: Wednesday, June 19, 2002 4:02 PM
Subject: RE: Lua hash algorithm

> > However, I cannot fathom why anyone would want to use 
> > floating point keys in a hash table. Integer indexes and
> > string indexes make sense, but what is ` x[1.5] = "foo" ' 
> > supposed to express?
> In my case, it means that at 1:30 AM, a simulator in my game should have value "foo".  (It maps a response curve based on time).
> x[0.5] = "foo" -- there's a 50% chance of picking "foo"
> x[0.5] = "one half" -- translate common floats to human-readable forms
> Chuck