🎉 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!

LUA, C++ and SDL ?

Started by
9 comments, last by Temuz 20 years, 8 months ago
So, I''m writing a game in C++, using LUA as a scripting language for the actual game and keeping the deeper engine stuff hard-coded. The problem steps in, when I want to use SDL and LUA (for example in-game keyboard events controlling). There is libluaSDL (or something like that), but it seems to be used only, when running lua scripts under the script-parser program ''lua'', not under my own C++ program. (Do you still get, what I''m meaning, huh?). So do I have to write millions of glue functions for SDL stuff (in other words, make my own library for using SDL&LUA under C++) or is there already a library for this? Shit, I can write really as undenstandable text as my code is.
Kekkonen, Kekkonen, Kekkonen.
Advertisement
Oh, yeah, and I''m using LUA 5.0
Kekkonen, Kekkonen, Kekkonen.
The library you mention will work just fine with embedded lua scripts. Check out this, and this for how to use it.

How appropriate. You fight like a cow.
Well, I can't find a way to use loadmodule with Lua 5.0 and Linux. There is a patch for 5.0-beta in the bottom of the page, but it seems to be unworkable for me.

EDIT: Oh yeah, and Luacheia seems not to have any c/c++ libraries.
Am I retard or what?

[edited by - Temuz on October 19, 2003 4:59:25 PM]
Kekkonen, Kekkonen, Kekkonen.
You don''t need a patch. It''s built into 5.0.

LuaCheia is a standalone distribution of Lua; it isn''t really intended for embedding.

How appropriate. You fight like a cow.
Whaa?
quote: Original post by Anonymous Poster
Whaa?


I mean, there''s loadlib() but no loadmodule() (or I can''t find a way to use it), and if I use loadlib() I still can''t use the SDL functions (the script parser doesn''t recognize ''em).
Well, this is how I now do the init

loadlib("./libluaSDL.so", "SDL_Init"(SDL_INIT_VIDEO)

It seems to work. But how do I access the other functions? The same way? (BLAH?)

Oh fuck, it''s good to be an intelligent coder.
Err, don''t mind the smiley.
Please, I can''t get this to work...

Using

loadlib ("./libluaSDL.so", "tolua_SDL_open" ()

gives a message

"attempt to index a function value"

And I think that is the only function I can init the library with.

This topic is closed to new replies.

Advertisement