Where to learn to create a graphic framework for Lua?

Started by
3 comments, last by Alberth 8 years, 4 months ago

Hello,

I was interested in creating a game with the Lua embedded language, I have read that Lua has a stand-alone interpreter and of a graphic framework for creating games called LÖVE. After learning Lua a long time ago, I used Java to create a game engine using JFrame for window creation and editing. However, this time, for the learning experience and creating a very familiar framework for creating games, I would like to create my own framework, and to do so maybe interpret other graphic frameworks. I only really need to be able to create a non-decorated window with Lua of any resolution or launch a full-screen application on any screen, and be able to edit every pixel of the window's raster. I admit I do not know much about graphic frameworks and perhaps some of the background knowledge needed to be able to understand and/or create them. I'd prefer to minimally have to utilize / create external software to be able to give Lua the ability to display a window, though I'll do anything it takes. So I have come to ask, does anyone know where I can learn to do this? Any type or form of help greatly appreciated.

Kind Regards,
Kreative

Advertisement
Lua is fairly easy to extend and embed. To extend, you can write a library of code and wrap it up into a specially structured DLL that can be loaded from the pre-built Lua interpreter using loadlib(). To embed, you use the C API provided with the Lua source to create bindings between Lua and the functions of your library code. It is simple enough to create bindings for a window creation library (say, SDL) to enable the functionality you desire. In fact, if I remember correctly, SDL is exactly the library that Love2D itself uses.

I recommend reading through the Programming in Lua text (second link above) for more information.

I mainly work with programming and am very eager to learn more deep relationships between programming languages, compilers and hardware. Therefore, I prefer to only have to do the Lua programming part of the framework with least external manipulation such as wrapping a specially structured DLL and using the C API. That's not to say that I refuse to learn it and do it, though I am quite lost on your answer... I am going a bit too deep than I am confident with as I never actually received any formal education in computer science, but rather self-taught to program well. I mean the best I could do is install Love2D and Lua using installers since I barely understood a video for manual installation of Lua, yet the main reason I am asking this question is really to see if anyone could link me to a tutorial of this part of computer science, preferably specialized in creating a graphic framework for Lua. Like you have tutorials for making games in Java, which can easily be used by people who barely know Java which can be considered a pre-requisite for creating games in the language. I will look at the two links that you provided and perhaps search as best as I can on google to learn how to.

Like the main reason I am doing this is that even for a popular language such as Java I only know of a library called batik that allows svg loading, manipulation and drawing, to which there is not many tutorials, and for a embedded language like Lua which is less popular I am surprised a library like Love2D even exists, but it doesn't support vector graphics. Therefore, I thought I would aim, possibly too high, to learn of graphic frameworks and create my own simple one for vector graphics in Lua.

I feel like my response is very poorly structured yet I do not know what to alter, it's just that I find it difficult to express my deep confusion in this part of computer science, which is exactly why I asked this question and so if anyone needs any clarification please please let me know.

Kind Regards,
Kreative

I mainly work with programming and am very eager to learn more deep relationships between programming languages, compilers and hardware. Therefore, I prefer to only have to do the Lua programming part of the framework with least external manipulation such as wrapping a specially structured DLL and using the C API.


The problem is that Lua CAN'T do any of what you want (window management, etc...) without being bound to other code, usually written in C or C++. Out of the box, Lua only offers the basic language constructs and a few utility libraries (table, string, math, etc...) which, themselves, are written as C modules bound and exposed to Lua. That is what libraries such as Love2D offer: utility code, useful for games, that is already bound and exposed to Lua.

That's not to say that I refuse to learn it and do it, though I am quite lost on your answer... I am going a bit too deep than I am confident with as I never actually received any formal education in computer science, but rather self-taught to program well. I mean the best I could do is install Love2D and Lua using installers since I barely understood a video for manual installation of Lua, yet the main reason I am asking this question is really to see if anyone could link me to a tutorial of this part of computer science, preferably specialized in creating a graphic framework for Lua.


There probably isn't a specialized tutorial for creating graphic libraries specifically for Lua, since it's actually 2 questions: 1) creating a graphic library, and 2) binding it to Lua. Really, with enough work, just about any graphical library can be bound to Lua.

Like the main reason I am doing this is that even for a popular language such as Java I only know of a library called batik that allows svg loading, manipulation and drawing, to which there is not many tutorials, and for a embedded language like Lua which is less popular I am surprised a library like Love2D even exists, but it doesn't support vector graphics. Therefore, I thought I would aim, possibly too high, to learn of graphic frameworks and create my own simple one for vector graphics in Lua.


Read the Programming in Lua text. It talks specifically about binding external libraries to Lua. Additionally, there are third-party tools and resources that can make the job easier, though many of them have slipped away into obsolescence. But before you go confusing yourself too much more, just read PIL. Seriously, it's useful.

link me to a tutorial of this part of computer science, preferably specialized in creating a graphic framework for Lua.
You may want to look into CorsixTH, a game using SDL2, implementing its own windowing system (although imho, it can be improved).

I don't think tutorials like that exist, basically, you use the SDL2 primitives to draw things, except you add a Lua layer on top, so you can write in Lua what SDL should do.

It's a combination of knowing SDL2 and Lua/C thus.

This topic is closed to new replies.

Advertisement