Lua from Other Languages: Difference between revisions

no edit summary
>Emess
(New page: 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 langua...)
>TheDarkFireDragon
No edit summary
 
(13 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{CatUp|Tutorials}}
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.
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==
__TOC__
 
==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'''.
* '''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 C++==
<!--
==Lua from Python==
===Similarities===
===Similarities===
===Differences===
===Differences===
 
More info at http://lua-users.org/wiki/LuaVersusPython
<!--You could do the rest.-->
-->
==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]]
Anonymous user