Can I just use Lua?

Hello!

I’m very new to Urho3D and I’d like to start using it as my main game engine/framework for now on.But first I need to know if I can only use Lua whitout c++.Or only use C++ if I need something to be implemented.Can I do that and still make games/apps for android with only lua?Where can I download some Lua examples? :slight_smile:

Yes, you could use Urho with Lua only (eg, look at Bin/Data/LuaScripts, you will see all the samples are available in Lua), you could also use AngelScript and C++ as almost all samples are available in each for demonstration.

Make sure you enable lua when compiling Urho3D because is isn’t enabled by default. See here: http://urho3d.github.io/documentation/1.32/_building.html This might be useful too if you are less clear on how to compile: http://urho3d.wikia.com/wiki/Build_Urho3D_on_Windows_%28MinGW%29

Here is the lua documentation: http://urho3d.github.io/documentation/1.32/_lua_scripting.html :wink:

EDIT: You will probably want this too: http://urho3d.github.io/documentation/1.32/_running.html

@hdunderscore,

You mention that ‘Yes, you could’ but should you?

When does using a scripting language become advantageous?

If I wanted to design a game with many levels is this where a scripting language would shine?

Or when multiple versions were released, would a script be more beneficial if no new features were introduced?

1 Like

Lua is just another language. The main benefit it offers is essentially in allowing you to skip the compilation step, which can mean faster iteration time during design/prototyping. There is nothing keeping you from mixing C++ and Lua as needed. I’ve found it beneficial to use Lua for things such as AI script components, while implementing performance-critical stuff in C++.

Note that there are still issues regarding garbage collection if you generate lots of garbage at one time, without interleaved GC sweeps in Lua. It can be mitigated by explicitly calling the GC when you are doing garbage-heavy things like iterating all the pixels of an Image or things of that nature, but it’s something to be aware of. Anything that returns an Urho3D object by value is a potential pain point here, so things like procedural generation of various things might better be implemented in C++.

2 Likes