summaryrefslogtreecommitdiffhomepage
path: root/ko-kr/lua-kr.html.markdown
diff options
context:
space:
mode:
authorwikibook <dylee@wikibook.kr>2013-08-13 15:42:33 +0900
committerwikibook <dylee@wikibook.kr>2013-08-13 15:42:33 +0900
commit04c0b273b03b9417c895f687bcd67e7e58d71a38 (patch)
tree405a0226b497c71b1209ac0a6a7a1667d7f4c49f /ko-kr/lua-kr.html.markdown
parentbd48b7062c51aff7d27114326f64fde505cea49c (diff)
korean version of javascript and lua tutorials added
Diffstat (limited to 'ko-kr/lua-kr.html.markdown')
-rw-r--r--ko-kr/lua-kr.html.markdown423
1 files changed, 423 insertions, 0 deletions
diff --git a/ko-kr/lua-kr.html.markdown b/ko-kr/lua-kr.html.markdown
new file mode 100644
index 00000000..50458f88
--- /dev/null
+++ b/ko-kr/lua-kr.html.markdown
@@ -0,0 +1,423 @@
+---
+language: lua
+category: language
+contributors:
+ - ["Tyler Neylon", "http://tylerneylon.com/"]
+translators:
+ - ["wikibook", "http://wikibook.co.kr"]
+lang: ko-kr
+---
+
+```lua
+-- ´ë½Ã µÎ °³´Â ÇÑ ÁÙÂ¥¸® ÁÖ¼®À» ÀǹÌÇÕ´Ï´Ù.
+
+--[[
+ [¿Í ]¸¦ µÎ °³¾¿ Ãß°¡ÇÏ¸é ¿©·¯ ÁÙ ÁÖ¼®ÀÌ µË´Ï´Ù.
+--]]
+
+----------------------------------------------------
+-- 1. º¯¼ö¿Í È帧 Á¦¾î
+----------------------------------------------------
+
+num = 42 -- ¸ðµç ¼ýÀÚ´Â doubleÀÔ´Ï´Ù.
+-- ³î¶ö ÇÊ¿ä´Â ¾ø½À´Ï´Ù. 64ºñÆ® doubleÀº
+-- Á¤È®ÇÑ int °ªÀ» ÀúÀåÇϱâ À§ÇØ 52ºñÆ®·Î ±¸¼ºµÅ
+-- ÀÖ½À´Ï´Ù. 52ºñÆ® ÀÌÇÏÀÇ int °ª¿¡ ´ëÇؼ­´Â
+-- Àåºñ Á¤¹Ðµµ¿Í °ü·ÃµÈ ¹®Á¦°¡ »ý±âÁö ¾Ê½À´Ï´Ù.
+
+s = 'walternate' -- ÆÄÀ̽ã°ú °°Àº ºÒº¯ ¹®ÀÚ¿­
+t = "Å«µû¿ÈÇ¥¸¦ ½áµµ µË´Ï´Ù"
+u = [[ ÀÌÁß ´ë°ýÈ£´Â
+ ¿©·¯ ÁÙ ¹®ÀÚ¿­À»
+ ³ªÅ¸³À´Ï´Ù.]]
+t = nil -- ¹ÌÁ¤ÀÇ t. ·ç¾Æ´Â °¡ºñÁö Ä÷º¼ÇÀ» Áö¿øÇÕ´Ï´Ù.
+
+-- ºí·ÏÀº do/end¿Í °°Àº Å°¿öµå·Î ³ªÅ¸³À´Ï´Ù:
+while num < 50 do
+ num = num + 1 -- ++³ª += À¯ÇüÀÇ ¿¬»êÀÚ´Â ¾µ ¼ö ¾ø½À´Ï´Ù.
+end
+
+-- If Àý:
+if num > 40 then
+ print('40 ÀÌ»ó')
+elseif s ~= 'walternate' then -- ~=Àº '°°Áö ¾Ê´Ù'ÀÔ´Ï´Ù.
+ -- µ¿Àϼº °Ë»ç´Â ÆÄÀ̽ã°ú ¸¶Âù°¡Áö·Î ==ÀÔ´Ï´Ù.
+ -- ¹®ÀÚ¿­¿¡µµ ¾µ ¼ö ÀÖ½À´Ï´Ù.
+ io.write('not over 40\n') -- ±âº»ÀûÀ¸·Î stdout¿¡ ¾¹´Ï´Ù.
+else
+ -- º¯¼ö´Â ±âº»ÀûÀ¸·Î Àü¿ª º¯¼öÀÔ´Ï´Ù.
+ thisIsGlobal = 5 -- ³«Å¸ Ç¥±â¹ýÀÌ ÀϹÝÀûÀÔ´Ï´Ù.
+
+ -- º¯¼ö¸¦ Áö¿ª º¯¼ö·Î ¸¸µå´Â ¹æ¹ýÀº ´ÙÀ½°ú °°½À´Ï´Ù:
+ local line = io.read() -- ´ÙÀ½ stdin ÁÙÀ» ÀнÀ´Ï´Ù
+
+ -- ¹®ÀÚ¿­ ¿¬°á¿¡´Â .. ¿¬»êÀÚ¸¦ ¾¹´Ï´Ù:
+ print('°Ü¿ïÀÌ ¿À°í ÀÖ½À´Ï´Ù, ' .. line)
+end
+
+-- ¹ÌÁ¤ÀÇ º¯¼ö´Â nilÀ» ¹ÝȯÇÕ´Ï´Ù.
+-- ´ÙÀ½ Äڵ带 ½ÇÇàÇصµ ¿À·ù°¡ ³ªÁö ¾Ê½À´Ï´Ù:
+foo = anUnknownVariable -- ÀÌÁ¦ foo´Â nilÀÔ´Ï´Ù.
+
+aBoolValue = false
+
+-- nil°ú false¸¸ÀÌ °ÅÁþ°ªÀÔ´Ï´Ù; 0°ú ''Àº ÂüÀÔ´Ï´Ù!
+if not aBoolValue then print('twas false') end
+
+-- 'or'¿Í 'and'´Â ´ÜÃà Æò°¡(short-circuit)µË´Ï´Ù.
+-- ´ÙÀ½ ÄÚµå´Â C/ÀÚ¹Ù½ºÅ©¸³Æ®ÀÇ a?b:c ¿¬»êÀÚ¿Í ºñ½ÁÇÕ´Ï´Ù:
+ans = aBoolValue and 'yes' or 'no' --> 'no'
+
+karlSum = 0
+for i = 1, 100 do -- ¹üÀ§¿¡´Â ¸¶Áö¸· ¿ä¼Òµµ Æ÷ÇԵ˴ϴÙ.
+ karlSum = karlSum + i
+end
+
+-- Ä«¿îÆ® ´Ù¿îÀ» ÇÒ ¶§´Â "100, 1, -1"À» ¹üÀ§·Î ¾¹´Ï´Ù.
+fredSum = 0
+for j = 100, 1, -1 do fredSum = fredSum + j end
+
+-- ÀϹÝÀûÀ¸·Î ¹üÀ§´Â begin, end[, step]ÀÔ´Ï´Ù.
+
+-- ¶Ç ´Ù¸¥ ¹Ýº¹¹® ±¸¹®Àº ´ÙÀ½°ú °°½À´Ï´Ù:
+repeat
+ print('¹Ì·¡ÀÇ ¹æ½Ä')
+ num = num - 1
+until num == 0
+
+
+----------------------------------------------------
+-- 2. ÇÔ¼ö
+----------------------------------------------------
+
+function fib(n)
+ if n < 2 then return n end
+ return fib(n - 2) + fib(n - 1)
+end
+
+-- Ŭ·ÎÀú¿Í À͸í ÇÔ¼öµµ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù:
+function adder(x)
+ -- ¹ÝȯµÈ ÇÔ¼ö´Â adder°¡ È£ÃâµÉ ¶§ »ý¼ºµÇ°í xÀÇ
+ -- °ªÀÌ À¯ÁöµË´Ï´Ù:
+ return function (y) return x + y end
+end
+a1 = adder(9)
+a2 = adder(36)
+print(a1(16)) --> 25
+print(a2(64)) --> 100
+
+-- ¹Ýȯ¹®, ÇÔ¼ö È£Ãâ, ÇÒ´ç¹®Àº ±æÀÌ°¡ ´Ù¸¥
+-- °ªÀÇ ¸®½ºÆ®¿¡ ´ëÇؼ­µµ ¸ðµÎ µ¿ÀÛÇÕ´Ï´Ù.
+-- ¸®½ºÆ®¿¡ °ªÀÌ ´õ ÀûÀ» ¶§´Â nilÀÌ ÇÒ´ç/¹ÝȯµÇ°í
+-- ¸®½ºÆ®¿¡ °ªÀÌ ´õ ¸¹À» ¶§´Â ³ª¸ÓÁö °ªÀº ¹ö·ÁÁý´Ï´Ù.
+
+x, y, z = 1, 2, 3, 4
+-- ÀÌÁ¦ x = 1, y = 2, z = 3ÀÌ°í 4´Â ¹ö·ÁÁý´Ï´Ù.
+
+function bar(a, b, c)
+ print(a, b, c)
+ return 4, 8, 15, 16, 23, 42
+end
+
+x, y = bar('zaphod') --> "zaphod nil nil"°¡ Ãâ·Â
+-- ÀÌÁ¦ x = 4, y = 8ÀÌ°í 15~42ÀÇ °ªÀº ¹ö·ÁÁý´Ï´Ù.
+
+-- ÇÔ¼ö´Â ÀÏ±Þ °´Ã¼ÀÌ°í, Áö¿ª/Àü¿ª À¯È¿¹üÀ§¸¦ °¡Áú
+-- ¼ö ÀÖ½À´Ï´Ù. ¾Æ·¡ÀÇ µÎ ÇÔ¼ö´Â °°½À´Ï´Ù:
+function f(x) return x * x end
+f = function (x) return x * x end
+
+-- ±×¸®°í ¾Æ·¡ÀÇ µÎ ÇÔ¼öµµ ¸¶Âù°¡ÁöÀÔ´Ï´Ù:
+local function g(x) return math.sin(x) end
+local g; g = function (x) return math.sin(x) end
+-- 'local g'¶ó°í ¼±¾ðÇϸé g¸¦ Áö¿ª ÇÔ¼ö·Î ¸¸µì´Ï´Ù.
+
+-- ±×³ªÀú³ª »ï°¢ ÇÔ¼ö´Â ¶óµð¾È ´ÜÀ§·Î µ¿ÀÛÇÕ´Ï´Ù.
+
+-- ÇÔ¼ö¸¦ È£ÃâÇÒ ¶§ ¹®ÀÚ¿­ ¸Å°³º¯¼ö¸¦ Çϳª¸¸ Àü´ÞÇÑ´Ù¸é
+-- °ýÈ£¸¦ ¾²Áö ¾Ê¾Æµµ µË´Ï´Ù:
+print 'hello' -- Àß µ¿ÀÛÇÕ´Ï´Ù.
+
+
+----------------------------------------------------
+-- 3. Å×À̺í
+----------------------------------------------------
+
+-- Å×À̺í = ·ç¾ÆÀÇ À¯ÀÏÇÑ º¹ÇÕ ÀڷᱸÁ¶·Î¼­, ¿¬°ü ¹è¿­ÀÔ´Ï´Ù.
+-- PHPÀÇ ¹è¿­À̳ª ÀÚ¹Ù½ºÅ©¸³Æ®ÀÇ °´Ã¼¿Í ºñ½ÁÇϸç,
+-- ¸®½ºÆ®·Îµµ »ç¿ëÇÒ ¼ö ÀÖ´Â Çؽà ±â¹ÝÀÇ µñ¼Å³Ê¸®ÀÔ´Ï´Ù.
+
+-- Å×À̺íÀ» µñ¼Å³Ê¸®/¸ÊÀ¸·Î »ç¿ëÇϱâ:
+
+-- µñ¼Å³Ê¸® ¸®ÅÍ·²Àº ±âº»ÀûÀ¸·Î ¹®ÀÚ¿­ Å°¸¦ °¡Áý´Ï´Ù:
+t = {key1 = 'value1', key2 = false}
+
+-- ¹®ÀÚ¿­ Å°¿¡´Â ÀÚ¹Ù½ºÅ©¸³Æ®¿Í À¯»çÇÑ Á¡ Ç¥±â¹ýÀ» ¾µ ¼ö ÀÖ½À´Ï´Ù:
+print(t.key1) -- 'value1'À» Ãâ·Â.
+t.newKey = {} -- »õ Å°/°ª ½ÖÀ» Ãß°¡.
+t.key2 = nil -- Å×ÀÌºí¿¡¼­ key2¸¦ Á¦°Å.
+
+-- (nilÀÌ ¾Æ´Ñ) °ªÀ» Å°·Î »ç¿ëÇÏ´Â ¸®ÅÍ·² Ç¥±â¹ý:
+u = {['@!#'] = 'qbert', [{}] = 1729, [6.28] = 'tau'}
+print(u[6.28]) -- "tau"°¡ Ãâ·Â
+
+-- Å° ¸ÅĪÀº ±âº»ÀûÀ¸·Î ¼ýÀÚ¿Í ¹®ÀÚ¿­¿¡ ´ëÇؼ­´Â °ªÀ¸·Î ÇÏÁö¸¸
+-- Å×ÀÌºí¿¡ ´ëÇؼ­´Â ½Äº°ÀÚ·Î ÇÕ´Ï´Ù.
+a = u['@!#'] -- Now a = 'qbert'.
+b = u[{}] -- We might expect 1729, but it's nil:
+a = u['@!#'] -- ÀÌÁ¦ a´Â 'qbert'ÀÔ´Ï´Ù.
+b = u[{}] -- 1729¸¦ ¿¹»óÇß°ÚÁö¸¸ nilÀÔ´Ï´Ù:
+-- Ž»öÀÌ ½ÇÆÐÇϱ⠶§¹®¿¡ b´Â nilÀÔ´Ï´Ù. Ž»öÀÌ ½ÇÆÐÇÏ´Â ÀÌÀ¯´Â
+-- »ç¿ëµÈ Å°°¡ ¿øº» °ªÀ» ÀúÀåÇÒ ¶§ »ç¿ëÇÑ Å°¿Í µ¿ÀÏÇÑ °´Ã¼°¡ ¾Æ´Ï±â
+-- ¶§¹®ÀÔ´Ï´Ù. µû¶ó¼­ ¹®ÀÚ¿­ ¹× ¼ýÀÚ°¡ Á» ´õ À̽ļº ÀÖ´Â Å°ÀÔ´Ï´Ù.
+
+-- Å×À̺í Çϳª¸¦ ¸Å°³º¯¼ö·Î ÃëÇÏ´Â ÇÔ¼ö¸¦ È£ÃâÇÒ ¶§´Â °ýÈ£°¡ ÇÊ¿äÇÏÁö ¾Ê½À´Ï´Ù:
+function h(x) print(x.key1) end
+h{key1 = 'Sonmi~451'} -- 'Sonmi~451'¸¦ Ãâ·Â.
+
+for key, val in pairs(u) do -- Å×ÀÌºí ¼øȸ
+ print(key, val)
+end
+
+-- _G´Â ¸ðµç Àü¿ª ¸â¹ö¿¡ ´ëÇÑ Æ¯º°ÇÑ Å×À̺íÀÔ´Ï´Ù.
+print(_G['_G'] == _G) -- 'true'°¡ Ãâ·Â
+
+-- Å×À̺íÀ» ¸®½ºÆ®/¹è¿­·Î »ç¿ëÇϱâ:
+
+-- ¸®½ºÆ® ¸®ÅÍ·²Àº ¾Ï¹¬ÀûÀ¸·Î int Å°·Î ¼³Á¤µË´Ï´Ù:
+v = {'value1', 'value2', 1.21, 'gigawatts'}
+for i = 1, #v do -- #v´Â ¸®½ºÆ® vÀÇ Å©±âÀÔ´Ï´Ù.
+ print(v[i]) -- À妽º°¡ 1¿¡¼­ ½ÃÀÛÇÕ´Ï´Ù!! Á¦Á¤½ÅÀÌ ¾Æ´Õ´Ï´Ù!
+end
+-- 'list'´Â ½ÇÁ¦ ŸÀÔÀÌ ¾Æ´Õ´Ï´Ù. v´Â ¿¬¼ÓµÈ Á¤¼öÇü Å°°¡ Æ÷ÇÔµÈ
+-- Å×À̺íÀÌ°í ¸®½ºÆ®·Î Ãë±ÞµÉ »ÓÀÔ´Ï´Ù.
+
+----------------------------------------------------
+-- 3.1 ¸ÞŸÅ×À̺í°ú ¸ÞŸ¸Þ¼­µå
+----------------------------------------------------
+
+-- Å×À̺íÀº Å×ÀÌºí¿¡ ¿¬»êÀÚ ¿À¹ö·ÎµùÀ» °¡´ÉÇÏ°Ô ÇÏ´Â ¸ÞŸÅ×À̺íÀ»
+-- °¡Áú ¼ö ÀÖ½À´Ï´Ù. ³ªÁß¿¡ ¸ÞŸÅ×À̺íÀÌ ¾î¶»°Ô ÀÚ¹Ù½ºÅ©¸³Æ®
+-- ÇÁ·ÎÅäŸÀÔ°ú °°Àº ÇàÀ§¸¦ Áö¿øÇÏ´ÂÁö »ìÆ캸°Ú½À´Ï´Ù.
+
+f1 = {a = 1, b = 2} -- ºÐ¼ö a/b¸¦ Ç¥Çö
+f2 = {a = 2, b = 3}
+
+-- ´ÙÀ½ ÄÚµå´Â ½ÇÆÐÇÕ´Ï´Ù:
+-- s = f1 + f2
+
+metafraction = {}
+function metafraction.__add(f1, f2)
+ sum = {}
+ sum.b = f1.b * f2.b
+ sum.a = f1.a * f2.b + f2.a * f1.b
+ return sum
+end
+
+setmetatable(f1, metafraction)
+setmetatable(f2, metafraction)
+
+s = f1 + f2 -- f1ÀÇ ¸ÞŸÅ×À̺íÀ» ´ë»óÀ¸·Î __add(f1, f2)¸¦ È£Ãâ
+
+-- f1°ú f2´Â ÀÚ¹Ù½ºÅ©¸³Æ®ÀÇ ÇÁ·ÎÅäŸÀÔ°ú ´Þ¸® °¢ ¸ÞŸÅ×ÀÌºí¿¡ ´ëÇÑ
+-- Å°°¡ ¾ø¾î¼­ getmetatable(f1)°ú °°ÀÌ ¹Þ¾Æ¿Í¾ß ÇÕ´Ï´Ù.
+-- ¸ÞŸÅ×À̺íÀº __add °°Àº ·ç¾Æ°¡ ¾Ë°í ÀÖ´Â Å°°¡ ÁöÁ¤µÈ ÀÏ¹Ý Å×À̺íÀÔ´Ï´Ù.
+
+-- ±×·¸Áö¸¸ ´ÙÀ½ ÁÙÀº s°¡ ¸ÞŸÅ×À̺íÀ» °¡Áö°í ÀÖÁö ¾Ê±â ¶§¹®¿¡ ½ÇÆÐÇÕ´Ï´Ù.
+-- t = s + s
+-- ¾Æ·¡¿Í °°ÀÌ Å¬·¡½º¿Í À¯»çÇÑ ÆÐÅÏÀº ÀÌ·¯ÇÑ ¹®Á¦°¡ ¹ß»ýÇÏÁö ¾Ê½À´Ï´Ù.
+
+-- ¸ÞŸÅ×ÀÌºí¿¡ ´ëÇÑ __index´Â Á¡À» ÀÌ¿ëÇÑ Å½»öÀ» ¿À¹ö·ÎµåÇÕ´Ï´Ù:
+defaultFavs = {animal = 'gru', food = 'donuts'}
+myFavs = {food = 'pizza'}
+setmetatable(myFavs, {__index = defaultFavs})
+eatenBy = myFavs.animal -- µ¿ÀÛÇÕ´Ï´Ù! °í¸¶¿ö¿ä, ¸ÞŸÅ×À̺í!
+
+-- Á÷Á¢ÀûÀÎ ¸ÞŸÅ×À̺í Ž»öÀÌ ½ÇÆÐÇÒ °æ¿ì ¸ÞŸÅ×À̺íÀÇ __index °ªÀ» ÀÌ¿ëÇØ
+-- Àç½ÃµµÇÏ°í, ÀÌ·± °úÁ¤ÀÌ ¹Ýº¹µË´Ï´Ù.
+
+-- __index °ªÀº Á» ´õ ¼¼ºÐÈ­µÈ Ž»öÀ» À§ÇØ function(tbl, key)°¡
+-- µÉ ¼öµµ ÀÖ½À´Ï´Ù.
+
+-- __index, __add, ...ÀÇ °ªÀ» ¸ÞŸ¸Þ¼­µå¶ó°í ÇÕ´Ï´Ù.
+-- ´ÙÀ½Àº ¸ÞŸ¸Þ¼­µå¸¦ °¡Áø Å×À̺íÀÇ Àüü ¸ñ·ÏÀÔ´Ï´Ù.
+
+-- __add(a, b) for a + b
+-- __sub(a, b) for a - b
+-- __mul(a, b) for a * b
+-- __div(a, b) for a / b
+-- __mod(a, b) for a % b
+-- __pow(a, b) for a ^ b
+-- __unm(a) for -a
+-- __concat(a, b) for a .. b
+-- __len(a) for #a
+-- __eq(a, b) for a == b
+-- __lt(a, b) for a < b
+-- __le(a, b) for a <= b
+-- __index(a, b) <fnÀ̳ª Å×À̺í> for a.b
+-- __newindex(a, b, c) for a.b = c
+-- __call(a, ...) for a(...)
+
+----------------------------------------------------
+-- 3.2 Ŭ·¡½º ÇüÅÂÀÇ Å×À̺í°ú »ó¼Ó
+----------------------------------------------------
+
+-- ·ç¾Æ¿¡´Â Ŭ·¡½º°¡ ³»ÀåµÅ ÀÖÁö ¾ÊÀ¸¸ç, Å×À̺í°ú ¸ÞŸÅ×À̺íÀ»
+-- ÀÌ¿ëÇØ Å¬·¡½º¸¦ ¸¸µå´Â ´Ù¾çÇÑ ¹æ¹ýÀÌ ÀÖ½À´Ï´Ù.
+
+-- ´ÙÀ½ ¿¹Á¦¿¡ ´ëÇÑ ¼³¸íÀº ÇÏ´ÜÀ» ÂüÁ¶ÇÕ´Ï´Ù.
+
+Dog = {} -- 1.
+
+function Dog:new() -- 2.
+ newObj = {sound = 'woof'} -- 3.
+ self.__index = self -- 4.
+ return setmetatable(newObj, self) -- 5.
+end
+
+function Dog:makeSound() -- 6.
+ print('I say ' .. self.sound)
+end
+
+mrDog = Dog:new() -- 7.
+mrDog:makeSound() -- 'I say woof' -- 8.
+
+-- 1. Dog´Â Ŭ·¡½ºÃ³·³ µ¿ÀÛÇÕ´Ï´Ù. ½ÇÁ¦·Î´Â Å×À̺íÀÔ´Ï´Ù.
+-- 2. function Å×À̺í¸í:fn(...)Àº
+-- function Å×À̺í¸í.fn(self, ...)°ú °°½À´Ï´Ù.
+-- :´Â self¶ó´Â ù ¹ø° ÀÎÀÚ¸¦ Ãß°¡ÇÒ »ÓÀÔ´Ï´Ù.
+-- self°¡ °ªÀ» ¾î¶»°Ô ¾ò´ÂÁö ±Ã±ÝÇÏ´Ù¸é ¾Æ·¡ÀÇ 7°ú 8À» Àо¼¼¿ä.
+-- 3. newObj´Â Dog Ŭ·¡½ºÀÇ ÀνºÅϽº°¡ µË´Ï´Ù.
+-- 4. self = ÀνºÅϽºÈ­µÇ´Â Ŭ·¡½º.
+-- ÁÖ·Î self = DogÀÌÁö¸¸ »ó¼ÓÀ» ÀÌ¿ëÇϸé ÀÌ°ÍÀ» ¹Ù²Ü ¼ö ÀÖ½À´Ï´Ù.
+-- newObjÀÇ ¸ÞŸÅ×À̺í°ú selfÀÇ __index¸¦ ¸ðµÎ self¿¡ ¼³Á¤Çϸé
+-- newObj°¡ selfÀÇ ÇÔ¼ö¸¦ °®°Ô µË´Ï´Ù.
+-- 5. Âü°í: setmetatableÀº ù ¹ø° ÀÎÀÚ¸¦ ¹ÝȯÇÕ´Ï´Ù.
+-- 6. :´Â 2¿¡¼­ ¼³¸íÇÑ °Í°ú °°ÀÌ µ¿ÀÛÇÏÁö¸¸ À̹ø¿¡´Â self°¡
+-- Ŭ·¡½º°¡ ¾Æ´Ñ ÀνºÅϽº¶ó°í ¿¹»óÇÒ ¼ö ÀÖ½À´Ï´Ù.
+-- 7. Dog.new(Dog)°ú °°À¸¹Ç·Î new()¿¡¼­´Â self = DogÀÔ´Ï´Ù.
+-- 8. mrDog.makeSound(mrDog)°ú °°À¸¹Ç·Î self = mrDogÀÔ´Ï´Ù.
+
+----------------------------------------------------
+
+-- »ó¼Ó ¿¹Á¦:
+
+LoudDog = Dog:new() -- 1.
+
+function LoudDog:makeSound()
+ s = self.sound .. ' ' -- 2.
+ print(s .. s .. s)
+end
+
+seymour = LoudDog:new() -- 3.
+seymour:makeSound() -- 'woof woof woof' -- 4.
+
+-- 1. LoudDogÀº DogÀÇ ¸Þ¼­µå¿Í º¯¼ö¸¦ °®°Ô µË´Ï´Ù.
+-- 2. self´Â new()¿¡¼­ 'sound' Å°¸¦ °¡Áý´Ï´Ù. 3À» Âü°íÇϼ¼¿ä.
+-- 3. LoudDog.new(LoudDog)°ú °°°í, LoudDogÀº 'new' Å°°¡ ¾øÁö¸¸
+-- ¸ÞŸÅ×ÀÌºí¿¡¼­ __index = DogÀ̱⠶§¹®¿¡ Dog.new(LoudDog)À¸·Î
+-- º¯È¯µË´Ï´Ù.
+-- °á°ú: seymourÀÇ ¸ÞŸÅ×À̺íÀº LoudDogÀÌ°í LoudDog.__index´Â
+-- LoudDogÀÔ´Ï´Ù. µû¶ó¼­ seymour.key´Â seymour.key,
+-- LoudDog.key, Dog.key¿Í °°À» °ÍÀ̸ç, ÁöÁ¤ÇÑ Å°¿¡ ¾î¶² Å×À̺íÀÌ
+-- ¿Àµç »ó°ü¾øÀ» °ÍÀÔ´Ï´Ù.
+-- 4. 'makeSound' Å°´Â LoudDog¿¡¼­ ¹ß°ßÇÒ ¼ö ÀÖ½À´Ï´Ù.
+-- ÀÌ°ÍÀº LoudDog.makeSound(seymour)¿Í °°½À´Ï´Ù.
+
+-- ÇÊ¿äÇÒ °æ¿ì, ÇÏÀ§ Ŭ·¡½ºÀÇ new()´Â ±â¹Ý Ŭ·¡½ºÀÇ new()¿Í À¯»çÇÕ´Ï´Ù.
+function LoudDog:new()
+ newObj = {}
+ -- set up newObj
+ self.__index = self
+ return setmetatable(newObj, self)
+end
+
+----------------------------------------------------
+-- 4. ¸ðµâ
+----------------------------------------------------
+
+
+--[[ ¿©±â¼­ ÁÖ¼®À» Á¦°ÅÇϸé ÀÌ ½ºÅ©¸³Æ®ÀÇ ³ª¸ÓÁö ºÎºÐÀº
+-- ½ÇÇà °¡´ÉÇÑ »óÅ°¡ µË´Ï´Ù.
+```
+
+```lua
+-- mod.lua ÆÄÀÏÀÇ ³»¿ëÀÌ ´ÙÀ½°ú °°´Ù°í °¡Á¤ÇØ º¾½Ã´Ù.
+local M = {}
+
+local function sayMyName()
+ print('À̼ҷæ')
+end
+
+function M.sayHello()
+ print('¾È³çÇϼ¼¿ä')
+ sayMyName()
+end
+
+return M
+
+-- ¶Ç ´Ù¸¥ ÆÄÀÏ¿¡¼­´Â mod.luaÀÇ ±â´ÉÀ» ÀÌ¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.
+local mod = require('mod') -- mod.lua ÆÄÀÏÀ» ½ÇÇà
+
+-- require´Â ¸ðµâÀ» Æ÷ÇÔ½ÃÅ°´Â Ç¥ÁØÈ­µÈ ¹æ¹ýÀÔ´Ï´Ù.
+-- require´Â ´ÙÀ½°ú °°ÀÌ µ¿ÀÛÇÕ´Ï´Ù: (ij½ÌµÅ ÀÖÁö ¾ÊÀ» °æ¿ì. ÇÏ´Ü ÂüÁ¶)
+local mod = (function ()
+ <mod.luaÀÇ ³»¿ë>
+end)()
+-- mod.lua°¡ ÇÔ¼öÀÇ º»¹®Ã³·³ µÇ¹Ç·Î mod.lua ¾ÈÀÇ Áö¿ª ¸â¹ö´Â
+-- ¹Û¿¡¼­ º¼ ¼ö ¾ø½À´Ï´Ù.
+
+-- ´ÙÀ½ Äڵ尡 µ¿ÀÛÇÏ´Â °ÍÀº mod°¡ mod.luaÀÇ M°ú °°±â ¶§¹®ÀÔ´Ï´Ù.
+mod.sayHello() -- ÀÌ¼Ò·æ ¾¾¿¡°Ô Àλ縦 °Ç³Ü´Ï´Ù.
+
+-- ´ÙÀ½ Äڵ带 ½ÇÇàÇÏ¸é ¿À·ù°¡ ¹ß»ýÇÕ´Ï´Ù.
+-- sayMyName´Â mod.lua ¾È¿¡¼­¸¸ Á¸ÀçÇϱ⠶§¹®ÀÔ´Ï´Ù:
+mod.sayMyName() -- ¿À·ù
+
+-- requireÀÇ ¹Ýȯ°ªÀº ij½ÌµÇ¹Ç·Î require¸¦ ¿©·¯ ¹ø ½ÇÇàÇصµ
+-- ÆÄÀÏÀº ÃÖ´ë ÇÑ ¹ø¸¸ ½ÇÇàµË´Ï´Ù.
+
+-- mod2.lua¿¡ "print('Hi')"°¡ µé¾î ÀÖ´Ù°í °¡Á¤ÇØ º¾½Ã´Ù.
+local a = require('mod2') -- Hi!¸¦ Ãâ·Â
+local b = require('mod2') -- print¸¦ ½ÇÇàÇÏÁö ¾ÊÀ½. a=b
+
+-- dofileÀº require¿Í ºñ½ÁÇÏÁö¸¸ ij½ÌÀ» ÇÏÁö ¾Ê½À´Ï´Ù:
+dofile('mod2') --> Hi!
+dofile('mod2') --> Hi! (require¿Í ´Þ¸® ´Ù½Ã Çѹø ½ÇÇàµÊ)
+
+-- loadfileÀº ·ç¾Æ ÆÄÀÏÀ» ÀоîµéÀÌÁö¸¸ ½ÇÇàÇÏÁö´Â ¾Ê½À´Ï´Ù
+f = loadfile('mod2') -- f()¸¦ È£ÃâÇØ¾ß mod2.lua°¡ ½ÇÇàµË´Ï´Ù.
+
+-- loadstringÀº ¹®ÀÚ¿­¿¡ ´ëÇÑ loadfileÀÔ´Ï´Ù.
+g = loadstring('print(343)') -- ÇÔ¼ö¸¦ ¹ÝȯÇÕ´Ï´Ù.
+g() -- 343ÀÌ Ãâ·ÂµË´Ï´Ù. ±×Àü±îÁö´Â ¾Æ¹«°Íµµ Ãâ·ÂµÇÁö ¾Ê½À´Ï´Ù.
+
+--]]
+
+```
+## Âü°íÀÚ·á
+
+·ç¾Æ¸¦ ¹è¿ì´Â ÀÏÀÌ Èï¹ÌÁøÁøÇß´ø ÀÌÀ¯´Â <a href="http://love2d.org/">Love 2D °ÔÀÓ ¿£Áø</a>À» ÀÌ¿ëÇØ
+°ÔÀÓÀ» ¸¸µé ¼ö ÀÖ¾ú±â ¶§¹®ÀÔ´Ï´Ù. ÀÌ°ÍÀÌ Á¦°¡ ·ç¾Æ¸¦ ¹è¿î ÀÌÀ¯ÀÔ´Ï´Ù.
+
+Àú´Â <a href="http://nova-fusion.com/2012/08/27/lua-for-programmers-part-1/">BlackBulletIVÀÇ "ÇÁ·Î±×·¡¸Ó¸¦ À§ÇÑ ·ç¾Æ"</a>·Î
+½ÃÀÛÇß½À´Ï´Ù. ±×´ÙÀ½À¸·Î °ø½Ä <a href="http://www.lua.org/pil/contents.html">"ÇÁ·Î±×·¡¹Ö ·ç¾Æ"</a> Ã¥À» Àоú½À´Ï´Ù.
+±×·¸°Ô ·ç¾Æ¸¦ ¹è¿ü½À´Ï´Ù.
+
+lua-users.org¿¡ ÀÖ´Â <a href="http://lua-users.org/files/wiki_insecure/users/thomasl/luarefv51.pdf">ªÀº ·ç¾Æ ·¹ÆÛ·±½º</a>¸¦
+ÀоîµÎ¸é µµ¿òµÉÁöµµ ¸ð¸£°Ú½À´Ï´Ù.
+
+¿©±â¼­´Â Ç¥ÁØ ¶óÀ̺귯¸®¿¡ °üÇؼ­´Â ´Ù·çÁö ¾Ê¾Ò½À´Ï´Ù.
+
+* <a href="http://lua-users.org/wiki/StringLibraryTutorial">string ¶óÀ̺귯¸®</a>
+* <a href="http://lua-users.org/wiki/TableLibraryTutorial">table ¶óÀ̺귯¸®</a>
+* <a href="http://lua-users.org/wiki/MathLibraryTutorial">math ¶óÀ̺귯¸®</a>
+* <a href="http://lua-users.org/wiki/IoLibraryTutorial">io ¶óÀ̺귯¸®</a>
+* <a href="http://lua-users.org/wiki/OsLibraryTutorial">os ¶óÀ̺귯¸®</a>
+
+±×³ªÀú³ª ÀÌ ÆÄÀÏ Àüü´Â À¯È¿ÇÑ ·ç¾Æ ÇÁ·Î±×·¥ÀÔ´Ï´Ù. ÀÌ ÆÄÀÏÀ»
+learn.lua·Î ÀúÀåÇÑ ÈÄ "lua learn.lua"¸¦ ½ÇÇàÇØ º¸¼¼¿ä!
+
+ÀÌ ±ÛÀº tylerneylon.com¿¡ óÀ½À¸·Î ½áº» ±ÛÀ̸ç,
+<a href="https://gist.github.com/tylerneylon/5853042">GithubÀÇ Gist</a>¿¡¼­µµ È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.
+·ç¾Æ·Î Áñ°Å¿î ½Ã°£À» º¸³»¼¼¿ä! \ No newline at end of file