Python or Lua? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Python or Lua?

I have been looking at the features of both but I want to hear your reasons why I should pick one

27th Sep 2018, 3:09 PM
BraveHornet
BraveHornet - avatar
5 Answers
+ 2
snake vs moon, who wins?
27th Sep 2018, 4:18 PM
Kuyondo
Kuyondo - avatar
+ 2
I have learned both before. So let me tell my opinion. Python has more useful functions than lua. Also python support OOP while lua doesnt(we have to use metatables and metamethods to implement OOP - which is a complex task). Lua is more readable than python (- but we have to write more. )So I recommend lua for veryyy beginners. This is a sample code from both languages which do the same thing. Lua: --note unlike other languages, lua start from 1 to count instead of 0. tbl = [1,2,3,4,5,6] sum = 0 function func() for i = 1,#tbl,1 do if tbl[i]%2==0 then sum = sum +tbl[i] end end return sum end Python: tbl = [1,2,3,4,5,6] sum = 0 def func(): for i in range(len(tbl)): if tbl[i]%2 == 0: sum += tbl[i] return sum
28th Sep 2018, 1:43 PM
Seniru
Seniru - avatar
0
while were on the subject lets add Go to the list, because Google chose it over python.
28th Sep 2018, 3:40 PM
Logomonic Learning
Logomonic Learning - avatar
- 1
Every language is good.
28th Sep 2018, 6:37 AM
Mr. MinyUkho
Mr. MinyUkho - avatar