lua-users home
lua-l archive

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


Thanks to everyone. Sorry for being slow and for the mistakes I've made.

Best,
Luke

On Wed, 7 Nov 2018 at 03:11, Erutuon <arboreous.philologist@gmail.com> wrote:
Apparently, 1e-4 (it shouldn't have any spaces) is a numerical literal
in Lua 5.3, where it is close to 1 * 10^-4, though at least in my Lua
1e-4 is not quite equal to 1 * 10^-4, because the former is roughly
0.000100000000000000004792173602 and the latter is roughly
0.000100000000000000045449755071 .

It is apparently not a valid number in Lua 5.1 though, where I get a
syntax error "unexpected symbol near 1e-4". So maybe you're using Lua
5.1, not 5.3?

1e - 4 (with spaces around the hyphen) is invalid syntax in both Lua
5.3 and 5.1: "malformed number near '1e' ".

— Gabriel

On Sun, Nov 4, 2018 at 11:43 PM Luke <lemmett81@gmail.com> wrote:
>
> Hi,
>
> I'm not getting some of the examples in the slides
>
>       t = table.pack(1, nil, 3)
>       for i = 1, t.n do
>       print(t[i])
>       end
>
> Does t.n give the value of' 3?
>
>      for k, v in pairs(tab) do
>
> What does in do in this line of code?
>
>       function derivative(f, dx)
>       dx = dx or 1e - 4
>       return
>       function (x)
>       return(f(x + dx) - f(x)) / dx
>       end
>       end
>
> I get an error message running this, from the lecture'"more on function".
>
> Do resources like this mean I might one day use CSound in lua
> interpreted by C++ without knowing C?
>
> github.com/csound/csoundAPI_examples/tree/master/lua
>
> Cheers,
> Luke
>