Skip to main content
GameDev.net gamedev.net
🔒 Locked

Troubles with Scripting

Started by ConorH Feb 28, 2007 at 3:20 PM 5 replies 1.1k views
Original Post
ConorH
ConorH
Im looking for a script language to embed in my SDL project so I can basically: -Load config files (vars mainly) -Use for more complex situations like AI, Levels etc Mainly I want to use it to change the scripts rather than recompile, and keep a fairly decent speed as it is. I've searched for a while now and came across Lua, Python, GMonkey and some others. Mainly, Iv tried with Lua, but Im a beginner with C++, so it's fairly complicated. If someone could point me to a real simple tut on Lua, or to a lang thats easier to embed. The main concern is getting it to work tbh. sigh Cheers anyway
Zorbfish
Zorbfish
If you are a beginner why not try using a SDL package for the [scripting] language instead? Instead of worrying about binding code to run scripts from C++ just use the [scripting] language itself. You'll see results faster and probably have more fun along the way. Then with that practice and experience under your programming belt you can come back to this (if you still want to at that point ;)).

I really recommend you give pygame a shot.
ConorH
ConorH
Do you mean like using one of the SDL_[script name here] that people have developed for SDL? If so, I've already looked. With regards to PyGame, from what I understand thats in Python (?). I'd prefer to program in c++ for now.

Thanks anyway
Zorbfish
Zorbfish
Alright, fair enough.

As to your original question (which I forgot to address, sorry) why not go right to Lua's homepage? The Programming in Lua book is available online on their site and it has a section on the embedding process. Also the luausers wiki has a few sections on embedding. Lastly there's quite a few wrappers you can find there for using C++ and Lua together either on the wiki or on LuaForge if you don't feel like doing it manually.
Simian Man
Simian Man
From what I've tried, Lua was the easiest to get up and running. These tutorials were pretty easy to understand.
rip-off
rip-off
Quote:
Original post by Simian Man
From what I've tried, Lua was the easiest to get up and running. These tutorials were pretty easy to understand.


I second lua, Its really good.
EmrldDrgn
EmrldDrgn
This thread just recently went through the process of embedding Lua into C++ using this article (it kinda jumps in the middle though, so if you have questions, ask).

Issues that I can recall from the article/thread:
1) lua_open(0) -> lua_open()
2) #include -> #include
3) Make sure you link in the static libraries.


As you may have figured out by now... I recommend Lua :). It's really simple to embed and use (luaL_dofile rules), and luabind is an excellent helper for you (think boost::python for lua). Give it a try.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~I program in C++, on MSVC++ '05 Express, and on Windows. Most of my programs are also for windows.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.