//C++ Pseducode
CSprite Alien(60,50,30, "alien.bmp");
Alien.x = something;
Alien.y = somethingelse;
if(Alien.attack == 0)
{
Alien.dead = 0;
}
The Abilities of Lua?
Ok me and a couple of friends want to work on an old school RPG. I am incharge of working on the engine. I have most of the engine done(the rendering part of it) but its all in pieces and I need to fit it togeather. Now most of the guys I am working with don't know anything about programming and I don't want to deal with any of the content programming(thats what designers are for right?). Ok I am going to design a scripting system for my engine that will be easy to use. Basicly I will have 2 scripting systems. One that handles engine functions(Which I hope to write in Lua so my scripter can use it) and the other will be integrated into my level design tools which will use XML.
I just want to use Lua to handle character creation, and map loading, scripted sequences, etc. I will use my XML system for character design and map settings and simple things like that(the designer will not have to know any XML I am working on a tool written in Visual Basic that creates XML documents based on the designers input)
This is where my question comes in. My engine uses class objects for pretty much everything(Every sprite on the game is an object, the map, and even the game itself is an objects). I hear Lua is not OOP. Will it be possible to for example call something like this in Lua:
I am considering Lua because it is small, and it is relativly simple to embed. I looked at Python but its just overkill for my project. Will Lua be able to do the job or is there another simple, small scripting language I can use(That will be relativly easy to learn)?
"Go on get out last words are for fools who have not said enough already." -- Karl Marx
Lua can do just about anything an OOP language can using tables.
Its prototype based so you just create a table then assign properties to it.
obj = {}
obj.x = 100
obj.y = 200
obj.dead = false;
in your example the Alien object would be a function returning a table with the appropriate properties in it.
Its prototype based so you just create a table then assign properties to it.
obj = {}
obj.x = 100
obj.y = 200
obj.dead = false;
in your example the Alien object would be a function returning a table with the appropriate properties in it.
function Alien( x, y, z, filename ) result= {} result.x = x result.y = y result.dead = false result.mesh = LoadMesh(filename) result.display = function(this) ... end return resultend
lua can be oo but it is complicated and i dont think ur team will want to learn how to make lua oo
July 16, 2004 05:12 PM
You can export your existing C++ classes to Lua, too.
Check out toLua.
Check out toLua.
Sorry if this is a little off-topic but, it may even be a pertenent question for the original poster also.
I've seen a lot of articles that cover a lot of usage of Lua and capabilities, but are there any good articles that cover actual integration of Lua and C/C++? Looking at Lua code for someone who's done interlanguage stuff before I'm sure it's pretty simple, but I'm working on an old-school RPG of my own with some friends and I've never integrated any scripting languages before. I would assume that there are functions that have to be linked to particular objects and functions that bridge the Lua language to your program and you basically indirectly call them.
I downloaded the Lua code and tried to sift through some of the examples and and the source... and it's quite confusing at times.
Anyone know of any articles or some good examples of how to integrate the two languages?
Thanks.
I've seen a lot of articles that cover a lot of usage of Lua and capabilities, but are there any good articles that cover actual integration of Lua and C/C++? Looking at Lua code for someone who's done interlanguage stuff before I'm sure it's pretty simple, but I'm working on an old-school RPG of my own with some friends and I've never integrated any scripting languages before. I would assume that there are functions that have to be linked to particular objects and functions that bridge the Lua language to your program and you basically indirectly call them.
I downloaded the Lua code and tried to sift through some of the examples and and the source... and it's quite confusing at times.
Anyone know of any articles or some good examples of how to integrate the two languages?
Thanks.
I know only that which I know, but I do not know what I know.
The LuaBind documentation is fairly good at explaining how to use LuaBind to link Lua stuff to C++ stuff. It makes OO stuff very easy. You should check it out.
I would recomend the excelent luabind (http://luabind.sf.net) to integrate c++ and lua. I did a short writeup on the topic for NeoEngine: http://emedia.nmmn.net/neoengine/modules.php?op=modload&name=Sections&file=index&req=viewarticle&artid=8&page=1
I'd have to also vote luabind.
It's a bit daunting but once you get the build environment working, it's really very straightforward.
Mark
It's a bit daunting but once you get the build environment working, it's really very straightforward.
Mark
Ok I will give LuaBind a try then thanks for your help.
EDIT: BTW Could anyone quickly explain to me how this MIT License works. I suck at understanding legal documents.
EDIT2: Wow I have a lot of reading ahead of me this is a bit harder than I thought. Oh well it will be worth the work.
[Edited by - QzarBaron on July 16, 2004 8:19:00 PM]
EDIT: BTW Could anyone quickly explain to me how this MIT License works. I suck at understanding legal documents.
EDIT2: Wow I have a lot of reading ahead of me this is a bit harder than I thought. Oh well it will be worth the work.
[Edited by - QzarBaron on July 16, 2004 8:19:00 PM]
"Go on get out last words are for fools who have not said enough already." -- Karl Marx
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement