Hey SLJ,
Ok, Gorth or Robjoy, please correct me if I'm wrong, but here goes.
BFE is whats called a game engine. It is not a programming language in itself, it is an ...uhm ...extension if you will.
It extends the basic lua language to be able to perform game-related stuff. It does this by calling certain .lua files which define the extension's functions.
I am just going by example here, I don't have the actual files in front of me but if you call for example
tts.init()
You are calling the init function of the tts library. Where exactly this library can be found and if it can be read I do not know.
I think LUA was chosen for this because it is very compatible with other, existing languages. You can easily interface with c++, c, and all sort of other languages using lua function calls.
This essentially means you can write a very complex function in c++ (or have someone write it) and call it using an easy lua function call, like:
game.MakeAGraphicDanceAroundTheScreen()
LUA , in that case, is sort of a glue to glue components from other languages together. That explanation is stolen from the 'programming lua' book recommended in the hatchling guide.
So, to answer your questions:
- Do I need to learn lua first? Yes, you do. You can do some simple stuff with just the dfe functions though. Code like:
tts.init()
dfe.sleep(1000)
tts.say("hello!")
dfe.sleep(1000)
dfe.exit()
is rough but should work, barring any syntax errors I made.
But for example if you want to build a sidescroller, which is pretty easy to do in this language, you need to know about loops and arrays, which are basic building blocks of the lua language ...and pretty much any other language I can think of actually.
- what to put in the lua files? ... That depends on your coding styles. The way I understand it, and keep in mind i'm a DFE newbie but have worked with other languages , is .lua files are sort of header files. You put function definitions in those files, for example you could have a file gun.lua which handles everything to do with guns, and then you need to specify the name of gun.lua in your main source file. This allows you to call the functions in gun.lua from your source file. This seems counter-intuitive at first, but makes your code far more readable. If you wouldn't use this practice, which you don't have to do, you would get one huge code file which makes searching for stuff a nightmare and I think performance will be affected slightly as well.
What do I need to run a lua script? ...Since you use DFE, you can just use dfe.exe as your interpreter. To compile the script is not possible yet at this time.
If you really get stuck at learning to code, don't hesitate to contact me. I am starting a computer science course next year and I wouldn't mind giving you a hand. I believe you have my msn, but if not, its
[email protected]
Good luck,
Balliol