Original Post
Hello all. I got some questions about integrating Lua and Java with (surprise) LuaJava. I think I kind of got how it works theoretically, but I might be doing things wrong, feel free to point me to the right way. I think my questions are not bounded by Java, so feel free to answer if you're using C++ or something, I'll be able to translate :). First of all, I have the idea that the scripting should allow for lots of modification, but it should be hard to break the game by changing the scripting. Thus, I have implemented most of the important stuff (init, game loop, ...) in Java. Am I right in that decision? The problem I'm facing now is on how to share stuff towards Lua. Let's say, when I start a new level, I want to call a Lua script to generate that level. How do I pass in the necessary objects from Java? I've been looking at the stack, but I don't really see how to access it in Lua (I feel like some sort of important point about Lua is swooshing far over my head, though). Or should I make sure to construct the Java objects in Lua - moving most of the code to Lua instead of Java, and making my program prone to breakage from inexperienced level developers? Or should I use loads of static methods (like with factories and singletons) - those seem easy to call from Lua, but it kind of defeats the purpose of having an object oriented design. Perhaps I'm just searching for all sorts of advice you people can give me about Lua, I don't really know. I feel a bit lost :). All the guides and tutorials and manuals seem to do the basic stuff, and I really don't have an overview of how it all works together... I hope someone can help me move a bit onward. Thanks! -Amarth