Lua Versus Python

lua-users home


Python [1] is a popular programming language. Both Python and Lua are commonly embedded in applications to provide scripting support.

Scripting is more frequently being used in games. There are many factors to take into account when choosing a scripting language. It may be a simple decision based on the architecture of the target platform like whether you are on a PC or game console. Assuming you have the luxury of a fast CPU, virtual memory, and hard disk storage, the vast library resources of Python could help get your project completed sooner. If you don't have those luxuries, Python is not an option as it is quite large.

General Comparison

The following is a simple comparison, with advantages of both Python and Lua over each other listed:



Object Orientation

Comparison based on OO models will follow here:



On the fence


User opinion

Please let's not start a flamewar here. Please feel free to make a simple objective statement about your experience.

Doesn't exist anymore. Search "lua -w" (in quotes) in . See DetectingUndefinedVariables instead. --DavidManura

A strange point to base your entire decision upon. Python's generators are the same as the upcoming Lua's limited coroutines. See LuaList:2002-07/msg00174.html.
They're related, but not the same. Lua's coroutines are much more general. Also, we didn't base the entire decision upon this point; it was just the issue that tipped the balance.
Python generators historically were not "the same" as coroutines: see for recent changes to Python to support coroutines.
Very good coroutine support is available for Python, without going down the full blown Stackless route, by using greenlets from the Codespeak library (Debian package python-codespeak-lib). --SeanHoldsworth
But does that really help with recursive generators? See LuaCoroutinesVersusPythonGenerators
i will be adding a note about python's pointer attitude, and how i have not found; well lua does "references" which are...strange, in python one can still quite easily copy variables

Since then I have continued to use Python, of course. I find Python--because of its huge set of libraries--to be a more suited to general-purpose scripting and RAD work. I'm also very comfortable with Python's syntax, quirks and all, so find that my fingers just naturally do things The Python Way. (The number of times I've been burned by using '.' instead of ':' as a method accessor in Lua would make most people choke with laughter.) I laugh, however, at even a hint of the slightest possibility of using Python for anything embedded. Lua is my tool of choice there. -- MichaelRichter

See Also

RecentChanges · preferences
edit · history
Last edited April 14, 2014 6:16 pm GMT (diff)