Hi!Good!Everyone!!

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: Hi!Good!Everyone!!

Post by zac352 »

dreamtrek wrote:
zac352 wrote:
dreamtrek wrote:
Hi~~I think lua is a good language of OOP. I every love lua.But I cannot say English.Can you say Chinese?
Lua has metatables, but it's kind of laborious for OOP. :huh:
what the word "laborious " mean? Can you say Chinese?
勤劳意味着需要很长的时间和大量的工作。
Google translate ftw. :awesome:
Hello, I am not dead.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Hi!Good!Everyone!!

Post by kikito »

Hi Dreamtek,

Welcome.

I was in China last summer, but I don't speak Chinese. Your country is great.

If you are interested in OOP in lua, you can have a look at MiddleClass.
When I write def I mean function.
dreamtrek
Prole
Posts: 5
Joined: Wed Oct 06, 2010 12:06 pm

Re: Hi!Good!Everyone!!

Post by dreamtrek »

kikito wrote:Hi Dreamtek,

Welcome.

I was in China last summer, but I don't speak Chinese. Your country is great.

If you are interested in OOP in lua, you can have a look at MiddleClass.
Thanks for you help.and your English is very easy to understand.
I used Ruby in a year. So I used be OOP.(我用过Ruby一年,所以我习惯OOP)
But I am a 初学者 of luaer.So I dont know too much.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: Hi!Good!Everyone!!

Post by zac352 »

dreamtrek wrote:
kikito wrote:Hi Dreamtek,

Welcome.

I was in China last summer, but I don't speak Chinese. Your country is great.

If you are interested in OOP in lua, you can have a look at MiddleClass.
Thanks for you help.and your English is very easy to understand.
I used Ruby in a year. So I used be OOP.(我用过Ruby一年,所以我习惯OOP)
But I am a 初学者 of luaer.So I dont know too much.
I wish my school had language classes other than Spanish. :/
Hello, I am not dead.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: Hi!Good!Everyone!!

Post by zac352 »

*remembers about Google pulling out of China* Uh... :roll:
Hello, I am not dead.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Hi!Good!Everyone!!

Post by kikito »

dreamtrek wrote: Thanks for you help.and your English is very easy to understand.
I used Ruby for a year. So I'm used to OOP.
But I am a of lua beginner.So I dont know too much.
(I've translated the missing chinese bits with google translator. I don't think google translator is available in China)

I'm also a ruby programmer.

Lua is simpler than Ruby.

There are no classes. Only "tables".

In lua, tables are Arrays and Hashes.

Code: Select all

 -- this is a comment
local array = { 'one', 'two', 'three' }
local hash = { a = 1, b = 2, c = 3 }

print(array[1]) -- prints 'one'
print(hash['a']) -- prints '1'
print(hash.a) -- this also prints '1'

-- functions can be defined like this:
function foo(bar)
  print(bar)
end

-- and they can be used as variables
hash[d] = foo -- this is the function!

hash.d('this looks like a method!') -- invoking the function
Tables in lua can something similar to ruby's method_missing for classes. For lua, it is named __index. __index is a metamethod. Metamethods are (a bit) complicated.

On MiddleClass, I created a special table called Object, and a function called class. You can use them to create classes without having to worry about metamethods.
When I write def I mean function.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Hi!Good!Everyone!!

Post by Robin »

If your English is this bad (no offense), maybe you could try finding someone else who speaks Chinese and English and is also interested in LÖVE?

Not that you can't communicate like this, but it's going to be slow and tough, so you might not like that. :)
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 5 guests