+ 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
5 odpowiedzi
+ 2
snake vs moon, who wins?
+ 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
0
while were on the subject lets add Go to the list, because Google chose it over python.
- 1
Every language is good.