Page 2 of 2

Re: Hi!Good!Everyone!!

Posted: Wed Oct 06, 2010 12:25 pm
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:

Re: Hi!Good!Everyone!!

Posted: Wed Oct 06, 2010 12:29 pm
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.

Re: Hi!Good!Everyone!!

Posted: Wed Oct 06, 2010 12:35 pm
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.

Re: Hi!Good!Everyone!!

Posted: Wed Oct 06, 2010 12:36 pm
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. :/

Re: Hi!Good!Everyone!!

Posted: Wed Oct 06, 2010 12:42 pm
by zac352
*remembers about Google pulling out of China* Uh... :roll:

Re: Hi!Good!Everyone!!

Posted: Wed Oct 06, 2010 2:21 pm
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.

Re: Hi!Good!Everyone!!

Posted: Wed Oct 06, 2010 8:03 pm
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. :)