🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

where to get Lua tutorials

Started by
11 comments, last by Katta 20 years ago
Hi, where can I get some online lua tutorials?
Advertisement
The actual docs, I guess. You could also buy Programming in Lua, which is an excellent book. But I don't think there are too many good online tutorials (or so goes the lament I tend to hear concerning them [grin]).

Jesus saves ... the rest of you take 2d4 fire damage.

ok I'll re-read the docs for a bit.
btw, am I in the wrong forum? This post did not appear on the
news section?
The state of documentation for lua is a very sorry state. The manual is very concise in defining the Lua langugage and C API. There are a few good samples in the Lua WIKI, too. But beyond that, you're pretty much on your own.
"If I have seen farther than other men, it is because I have stood on the shoulders of giants." -- sir Isaac Newton
What kind of tutoirals are you looking for that aren't covered in the wiki?

I wouldn't mind writing a couple if there is a demand for them.

Dwiel.

Oh, there is a good article about calling Lua functions from C and visa-versa, I can't find it at the moment, but if that is what you are looking for, I can try a little harder.

Hope I've helped!

Dwiel
Quote: Original post by Tazzel3D
Oh, there is a good article about calling Lua functions from C and visa-versa, I can't find it at the moment, but if that is what you are looking for, I can try a little harder.

Well, for calling Lua from C? Let's see. In Lua, make a function like this:

function func(x, y)
-- do stuff with x and y
return x + y; -- just for fun
end


In C:

lua_getglobal(L, "func");
lua_pushnumber(L, 5);
lua_pushnumber(L, 10);
lua_call(L, 2, 1);

// result will equal 15
int result = (int)lua_tonumber(L, -1);
lua_pop(L, 1);


All off the top of my head, but I think that's right. Calling C from Lua is about the same; you just have to register the C functions with Lua first. Check the docs for info on all those functions. Or just Google all the functions and you're sure to find a more in-depth tutorial.

Meanwhile, should I be moving this to Programming?

Jesus saves ... the rest of you take 2d4 fire damage.

If anything, I would say move it to the scripting forum.

ok
I found the articles I was think of which I thought explained things well:

Part 1
Part 2
Part 3

Hope that helps. Also, like I said before, if you find that the existing tutorials cover enough topics, let me know what you think should be covered, and I'll try my best.

Dwiel
Quote: Original post by Tazzel3D
If anything, I would say move it to the scripting forum.

I'd forgotten about that one. :)

Moved ...

Jesus saves ... the rest of you take 2d4 fire damage.

The lounge is a scripting forum?

Edit Oh, the thread is now in both places at once. Interesting. . .
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
yay buggy buggy.

This topic is closed to new replies.

Advertisement