While I did not downvote you nor do I know the mind of the person who did, I kinda agree with the vote.
Your advise feels like bad advise. RAII is so fundamental to working in C++, if you do not have a solid grasp on it you should strive to remedy that situation as soon as possible. The reason for not using RAII should be <well-reasoned rationale> not 'nah, never had to use it before'.
This has nothing to do with the Lua registry. Or even Lua.
A member function (that is, a non-static function in a class or struct) is fundamentally different from a free function. A free function (often called a C function) can interact very simply with C code. A member function cannot.
Lua is written in C and thus cannot interact interact with C++ (there is no well-defined C++ ABI and as such 'calling a member function' is an unsolvable problem because different C++ compilers have very different idea what exactly that means and how to do that).
The link ApochPiQ posted will certainly help with part of your problem ('how do I write glue code to deal with that'). It does not seem to go into much detail beyond that and it opens a whole can of worms about 'why do I have to do that at all?' (for a few basic keywords to start your search, see above) as well as where to store the this-pointer as well as questions about the lifetime and ownership of this between C++ and Lua from then on.
It would have been a better idea to post this in For Beginners since that would have obligated people to be a bit more verbose in their answers (I don't have the time now, though). I would also advise you to take a step back from Lua for the moment and deal with the issues raised here in a pure C++ world for now. It's not horribly difficult but you will need to spend some time there to get a feeling for the area and Lua just adds additional complications on top of that.
Based on your question, I think you should step back and evaluate your ability to complete this project.
Honestly, you are building a space shuttle and you've just asked about spray painting the NASA logo on the side.
The OP is (according to their profile) thirteen. Personally, for that age group I find it advisable to just give them the information desired and let the empirical values of something deceptively simple-sounding become a huge problem be a first-hand experience. We get a lot of older people who really should have learned that lesson earlier.
It's not even wasted time (especially at that age). You will be gaining skill points all over the place while working on it even with the originally intended goal not achievable.
Executables on Windows follow the PE Format. Note that to run Windows executables you not only have to interpret the data format correctly you will also have to emulate a considerable part of the Windows runtime environment. Wine might be a good starting point for that.
Also note that it is generally an extremely horrible idea to put two completely different questions into the same thread.
There are plenty of solutions. I had a look at both lua-intf and integral in the past and they seemed to offer a lot of convenience and ease of use. Note you might also want to look at less general and more domain-specific solutions for your scripting. That will almost certainly require some work of your own but you can squeeze out a few drops more of performance and support scripting semantics which will be more difficult with a general solution. You will also learn a lot of the nitty gritty details of interaction with Lua.
As you can see I have no idea what I'm doing. I'm taking lines of code of random websites and pasting them into my program, then when it doesn't compile I move parts around so that stuff is (I hope) in the scope it's meant to be in. This is the technique I used to learn Blitz Max, and it works, because I can use Blitz today and instantly make a program which uses OOP, even though I haven't used Blitz since 2006
This is not a method I would recommend to learn any language, least of all C++ where a lot of things can "appear to work" very easily while blowing up in your face later (sometimes much later, as in weeks or months).
Your problems are not really related to OOP though but essential bits of the language, like scoping.
This might be actually a disservice to you, but:
Thing(int a, int b)
ThingRec.x = x;
ThingRec.y = y;
ThingRec.w = (x + 32);
ThingRec.h = (y + 32);
void drawMe(SDL_Surface* pic, SDL_Surface* vid) const
SDL_BlitSurface(pic, 0, vid, &ThingRec);
int main(int argc, char* argv)
for (const Thing& thing : myList)
thing.drawMe(/* whatever */);
On a sidenote, when I see "using namespace std;" in a file I have the urgent need to punch the author.
Edit: Mhm. Apparently the darn forum editor does not even allow me to preserve spaces anymore. Apparently not a week can go by without it becoming ever slightly more broken...
Yes, I suspect that "abstract class" is a term one uses when there is an abstract class, with inheritance used for sub-classes - hence, the original class (not actually used directly) is called the abstract class. I'll edit my file now and add the proper terms
You suspect wrongly. An abstract class is a class which contains one or more pure virtual member functions. An abstract class cannot be instantiated because the compile prevents you from doing that. A lot of base classes are not abstract even when they are seldom or never intended to be instantiated.
One of the reasons Yegor mentions is the dependency of clients connected to the object. Say, we suddenly want to know who withdrawn something from the object? I am not understanding why his "idea" would help us in any way. We still have to change the withdraw method and all clients using this withdraw method need to be changed. I guess I still have no clue what he is talking about.
If you can only withdraw money by calling 'withdraw' you can just add a new parameter to withdraw and your compiler will scream at you until all places where money is withdrawn supply that information. If you just manually decreased amount everywhere you have to find all uses of 'amount' manually in the code, identify which are actually withdraw operations and add the withdrawer information manually (help the compiler can be to you in that case: zero).
This eventually results in long constructors since all the final properties that are allowed to mutate (yes it sounds crazy) need to be set in the constructor.
If your constructor becomes so complicated you have to pass so many parameters you probably have a class which just tries to do far too much. Look into the Single Responsibility Principle (https://en.wikipedia.org/wiki/Single_responsibility_principle). Having immutable classes where reasonably possible certainly simplifies a lot of problems, but especially in the context of game programming it is not always doable. Spending a few moment to ponder "Do I actually need that to be mutable?" for a new class is not a bad idea though.