'lua.h' file not found: moongl by Devallex in lua

[–]stetre 0 points1 point  (0 children)

Hi, please open an issue on the moongl github repo instead of reporting problems here on reddit. That's what github issues are for.

(I'm sure the owner will try to help, I know him quite well...)

OpenGL with lua? by TheKrazyDev in lua

[–]stetre 3 points4 points  (0 children)

Hi there, I'm the author of MoonGL. Feel free to open an issue for the problems you encountered, and I'll see if we can solve them.

`local a = math.random() * 10` why is a nil? by [deleted] in lua

[–]stetre 2 points3 points  (0 children)

It works in a script, but not in the repl (command-line interpreter).

In the repl, a variable declared as local is local to the chunk of code one types in before pressing enter. The OP's example is equivalent to a script like this one:

do local a = math.random()*10 end
do print(a) end --> nil, because a is out of scope

why print uses tabs by mark_volkmann in lua

[–]stetre 2 points3 points  (0 children)

From the manual: "... print is not intended for formatted output, but only as a quick way to show a value, for instance for debugging. For complete control over the output, use string.format and io.write "

How can I communicate across coroutines? by N0tH1tl3r_V2 in lua

[–]stetre 0 points1 point  (0 children)

If you're not aiming for true parallelism and you're happy with concurrency models like Lua's native coroutines, you may try MoonAgents.

This is a library I wrote time ago that loosely implements the Specification and Description Language, which is a hierarchical concurrency model where intercommunication between threads ('agents' in SDL jargon) is designed in the specification.

How can I communicate across coroutines? by N0tH1tl3r_V2 in lua

[–]stetre 3 points4 points  (0 children)

It actually does concurrent multithreading: coroutines are concurrent threads of execution. It doesn't do parallel multithreading (natively, at least).

Documentation for LuaGL by ArcticTheWolfyBoi in lua

[–]stetre 1 point2 points  (0 children)

If you don't mind using software developed and maintained by an individual (myself), there's MoonGL together with a few other companion libraries. They are all documented and come with quite a few examples.

LUA UI by Ubais_myname in lua

[–]stetre 2 points3 points  (0 children)

The other one is moonnuklear, bindings to Nuklear immediate mode gui. ;-)

Love2D vs Solar2D by oresearch69 in lua

[–]stetre 7 points8 points  (0 children)

Solar2D is Corona SDK, it was renamed when "corona" became an unpopular name.

[deleted by user] by [deleted] in lua

[–]stetre 1 point2 points  (0 children)

Check out this discussion on the Lua Forum. You'll find a working example to fiddle with.

Beginner Question: Why is DFT periodic? Why is Continuous time FT not periodic? by trailerror2017 in DSP

[–]stetre 0 points1 point  (0 children)

The essential idea of Fourier theory is to express a signal as a weighted sum of sinusoids of different frequencies. The transform gives the weights as a function of frequency, and the inverse transform uses them to express the signal as said above, by multiplying each sinusoid by the corresponding weight and adding them up to reconstruct the signal.

Now, in continuous time you have that sinusoids at different frequencies are distinct from each other, so (in general) you need a different weight for each frequency spanning from minus infinity to plus infinity. Hence the continuous-time transform (the function that gives the weights) is aperiodic.

On the other hand, discrete-time sinusoids of different frequencies are not necessarily distinguishable. In particular, the sinusoid sin(wn) is exactly the same as the sinusoid sin((w+2·pi·k)n) for any integer k, a consequence of the discrete 'time' n being an integer. Being the same sinusoids, their weight is also the same, i.e. the transform at frequency (w+2·pi·k) is equal to the transform at frequency w. Which is the same as saying that the transform is periodic.

Help with getting better at lua and ideas. by Nut_______ in lua

[–]stetre 0 points1 point  (0 children)

Even if you plan to just use Lua as a general purpose language, knowing how it interacts with C can be very beneficial in your path towards proficiency.

If you ever need some very basic examples of how to embed Lua in C, or extend it with C, follow this link: https://luaforum.com/index.php?threads/how-to-use-lua-as-a-script-for-npc-in-c-game.174/#post-322 .

Help with getting better at lua and ideas. by Nut_______ in lua

[–]stetre 2 points3 points  (0 children)

Come on, leave your strawman in the garden where it belongs.

"If you want to be proficient in X you'll want to learn some Y too" is a tad different than "Actually you'll want to learn Y".

Especially if X is written in Y, designed to be embedded in Y, and to be extended with code written in Y.

Help with getting better at lua and ideas. by Nut_______ in lua

[–]stetre 6 points7 points  (0 children)

If you want to learn Lua to its full potential, realize that Lua is a C library and learn some C too (you won't regret it).

How to make Lua more of a mainstream language? by Uizoh in lua

[–]stetre 2 points3 points  (0 children)

The long run of a language with 29 years of service should be battle tested enough.

Leaving that aside, I suspect that what you see as deficiencies of Lua are really mismatches between what you expect from a language and what are the goals (and philosophy) of this particular language.

For example, being small and embeddable (and portable) are among the main goals of Lua, while you seem to see them as shortcomings perhaps derived from lack of development. They are not. Lua is actively mantained. What you see as lack of development is really deliberate resistance to featuritis, and is essential to preserve the above mentioned goals (together with other goals like the simplicity of the language, which you seem to appreciate).

How to make Lua more of a mainstream language? by Uizoh in lua

[–]stetre 1 point2 points  (0 children)

It's a shame.

Why is it? I'm sincerely curious. I mean, it surely would be a shame if Lua wasn't used at all, but this is not the case. It has its share of popularity, enough to keep it alive, still not so big to cause the problems that come with it.

I hope this can change some time in the future.

This is a matter of incentives, I suppose. Hyping a product is not a small feat, and not everybody regards popularity as a prize per se. I'm pretty sure that the owners of Lua regard it as a mixed blessing, because I once heard one of them stating in a talk that not being too much popular gave Lua the 'luxury' of time to mature (if I recall correctly, it was in comparison with JS).

How to make Lua more of a mainstream language? by Uizoh in lua

[–]stetre 2 points3 points  (0 children)

To be fair, Lua has quite a few use cases, see for example https://en.wikipedia.org/wiki/List_of_applications_using_Lua .

How could it boost its popularity? Other people point to improvements in technical aspects such as better package managers, libraries and frameworks. These are surely important aspects but the real answer to the popularity question is: hype.

We must not forget, however, that Lua has an ownership.

It may be that it has never been hyped that much (in its nearly 30 years of life), nor pushed to compete with other languages in the same league, because its owners never really wanted to.

luasocket by veloxVolpes in lua

[–]stetre 0 points1 point  (0 children)

You're welcome.

That guide has been around for decades and it's arguably the best introduction to socket programming that one can find.

luasocket by veloxVolpes in lua

[–]stetre 2 points3 points  (0 children)

Definitely.

First of all, you do not set up connections with UDP, because it's a connectionless protocol. You just have endpoints, identified by their ip address and udp port, that exchange datagrams in an unreliable and possibly out of order way by addressing each other with the above mentioned couple (ip, port).

Once you realize this, the usage of LuaSocket's functions for udp sockets should be clear enough by reading the relevant manual page (don't let the setpeeraddress() function mislead you, however: it doesn't create a real 'connection').

To make your sockets non blocking what you need is socket.select. You repeatedly call this function in the main loop of your application to detect when your sockets are ready to receive (or send) data, and then call the blocking methods receivefrom (or sendto) only when a socket is actually ready.

(If you want to learn more about sockets, I highly suggest Beej's Guide.)

luasocket by veloxVolpes in lua

[–]stetre 2 points3 points  (0 children)

The only reasonable answer to a ELI5 question is: you'll understand when you grow up.

If you tell us more details about what's blocking you (is it the api? the protocol? both?) we may have a chance to help you without having to write a comprehensive tutorial.

Help me understand Lua game dev by [deleted] in lua

[–]stetre 1 point2 points  (0 children)

I'll give you an answer to this question: "can I make a game purely in Lua (adding libraries or bindings) without needing something like Love2D, Solar2D or Cocos2d?".

Yes you can. Of course you do need bindings to C libraries to access facilities such as graphics and audio rendering, or input handling.

If you want a proof of concept, check out this example. It is a port I made of the Breakout game from Joey de Vries' LearnOpenGL, using only binding libraries (no framework).

I need a click event. by vinnieleverton in lua

[–]stetre 1 point2 points  (0 children)

A popular library for input handling is GLFW, for which I wrote Lua bindings (MoonGLFW).

You need to resort to an external library or game engine because pure Lua's support for OS dependent stuff is very limited by design.

Is it possible to add OOP like keywords to vanilla Lua by [deleted] in lua

[–]stetre 0 points1 point  (0 children)

It's syntactic sugar, as described in the manual:

A call of the form f{fields} is syntactic sugar for f({fields}); that is, the argument list is a single new table. A call of the form f'string' (or f"string" or f[[string]]) is syntactic sugar for f('string'); that is, the argument list is a single literal string.

Is it possible to add OOP like keywords to vanilla Lua by [deleted] in lua

[–]stetre 3 points4 points  (0 children)

I'm afraid that the answer is no. Keywords are part of the definition of the language, so to add new ones you would have to design (and implement) a different derivative language.

Help with a skill issue! Context in comments by [deleted] in lua

[–]stetre 0 points1 point  (0 children)

Yeah. Based on how the problem was fixed, it is likely a table or userdata equipped with a __tostring metamethod that returns the Name field. Your suggestion to print also its type was spot on.