Lua from Other Languages: Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Emess No edit summary |
>Ozzypig No edit summary |
||
Line 5: | Line 5: | ||
__TOC__ | __TOC__ | ||
==Lua from C== | ==Lua from C, C++ and C#== | ||
===Similarities=== | ===Similarities=== | ||
* Lua uses very similar control structures (such as if, else, while, for, repeat, break, return and function). <!-- any more? --> | |||
* 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=== | ===Differences=== | ||
* '''null''' is known as '''nil'''. | |||
* 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 | ==Lua from Python== | ||
===Similarities=== | ===Similarities=== | ||
===Differences=== | ===Differences=== | ||
<!-- | ==Lua from Haskell== | ||
===Similarities=== | |||
* Lua is dynamically typed as well. <!-- Haskell is too? --> | |||
===Differences=== | |||
* Lua is not a function based language, although functions are a big part of it. Most function calling requires parenthesis. | |||
[[Category:Scripting Tutorials]] | [[Category:Scripting Tutorials]] |
Revision as of 20:05, 23 December 2010
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.
- 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 Python
Similarities
Differences
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.