Lua from Other Languages: Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>TheDarkFireDragon Commented out a blank comparison to Python |
>TheDarkFireDragon Commented out a blank comparison to Python |
(No difference)
|
Revision as of 13:55, 9 July 2011
If you have experience in other programming or scripting languages, you can easily take the shortcut to learning the similarities and differences of the two programming or scripting languages.
Lua from C, C++ and C#
Similarities
- Lua uses very similar control structures (such as if, else, while, for, repeat, break, return and function).
- Lua uses statements and expressions.
- Lua can overload operators with the use of metatables.
- Lua can overload functions, but you don't have to restate the entire function.
- Lua does not have a class system, but using metatables you can get a very similar effect.
Differences
- null is known as nil.
- else if is combined into one keyword elseif
- Lua is dynamically typed (rather than statically), so you do not need to declare the type of variable before you can use it. You can change variables from being tables to numbers.
- Lua uses different arrays that are known as tables. Tables have numerical, string and table indexes. Strings in Lua are not tables.
- Lua has no headers, and there is no function to start the code. It all begins from the top and ends at the bottom.
- Lua is embedded into host/parent applications. The compilation process is done on-the-fly, and you cannot get stand-alone executables from Lua.
- Lua does not use braces for opening and closing blocks of code. It uses the end statement.
Lua from Haskell
Similarities
- Lua is dynamically typed as well.
Differences
- Lua is not a function based language, although functions are a big part of it. Most function calling requires parenthesis.