• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
最速の言語Lua ~Python Hack-a-thon #3~
 

最速の言語Lua ~Python Hack-a-thon #3~

on

  • 11,240 views

Python Hack-a-thon #3でLuaについて発表したときの資料です

Python Hack-a-thon #3でLuaについて発表したときの資料です

Statistics

Views

Total Views
11,240
Views on SlideShare
7,270
Embed Views
3,970

Actions

Likes
12
Downloads
51
Comments
0

14 Embeds 3,970

http://yamayatakeshi.jp 2908
http://d.hatena.ne.jp 742
http://isoparametric.hatenablog.com 232
http://isoparametric.net 17
http://www.slideshare.net 17
http://s.deeeki.com 15
https://twimg0-a.akamaihd.net 10
https://twitter.com 8
http://webcache.googleusercontent.com 7
http://www.google.co.jp 6
https://www.google.co.jp 4
http://twitter.com 2
http://translate.googleusercontent.com 1
http://a0.twimg.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

最速の言語Lua ~Python Hack-a-thon #3~ 最速の言語Lua ~Python Hack-a-thon #3~ Presentation Transcript

  • Lua ~ ~ 2010 1 23
  • Name: Isoparametric Blog: http://d.hatena.ne.jp/Isoparametric/ 2010 1 23
  • by Python 2010 1 23
  • Lua Lua TeCGraf Lua C Lua VM MIT License Lua Lua Pascal Lua Python Ruby Lua Lua Lua5.0 GC Lua5.1 GC Python Ruby GC GC Lua Lua C++ tolua++ Luabind MIT License 2010 1 23
  • Lua Lua TeCGraf Lua C Lua VM W MIT License Lua iki Lua pe dia Pascal Lua Python Ruby Lua Lua Lua5.0 GC Lua5.1 GC Python Ruby GC GC Lua Lua C++ tolua++ Luabind MIT License 2010 1 23
  • 1993 Tecgraf Tecgraf Lua C -> Lua -> C 2010 1 23
  • Python 2010 1 23
  • Python LL C C LL ANCI C C GC JavaScript prototype Lua 2010 1 23
  • 2010 1 23
  • Lua Lua Lua Lua Lua Lua Lua MIT license 2010 1 23
  • Lua http://www.schulze-mueller.de/download/lua-poster-090207.pdf 2010 1 23
  • Lua http://www.schulze-mueller.de/download/lua-poster-090207.pdf 2010 1 23
  • byPython 2010 1 23
  • 2010 1 23
  • 2010 1 23
  • 2010 1 23
  • 2010 1 23
  • Web Adobe's Photoshop Lightroom Ginga middleware World of Warcraft 2010 1 23
  • 2010 1 23
  • 2010 1 23
  • Perl Ruby Python Lua Python Maya Inkscape Python Lua 2010 1 23
  • Py(ry Py(ry 2.6: and as assert break class continue def del elif else except exec finally for from global if import in is lambda not or pass print raise return try while with yield Lua 5.1: and break do else elseif end false for function if in local nil not or repeat return then true until while 31 vs 21 2010 1 23
  • Lua VM VM GC 2010 1 23
  • JavaVM .NET VM VM Perl6 Lua VM 2010 1 23
  • Lua Lua Lua C 2010 1 23
  • Lua 2010 1 23
  • …… print(“Hello World”) % lua hello.lua 2010 1 23
  • -- function fact (n) if n == 0 then return 1 else return n * fact(n-1) end end print("enter a number:") a = io.read("*number") print(fact(a)) 2010 1 23
  • 2010 1 23
  • 2010 1 23
  • -- 2010 1 23
  • -- --[[ ]] 2010 1 23
  • -- --[[ print("Hello!!") --[[ --]] ↓ ]] ----[[ print("Hello!!") --]] 2010 1 23
  • -- --[[ print("Hello!!") --[[ --]] ↓ ]] ----[[ print("Hello!!") --]] --[=[ ... ]=] [[ ]] = [[ ]] 2010 1 23
  • nil number boolean string table function userdata thread 2010 1 23
  • nil nil nil ==nil GC nil 2010 1 23
  • nil false 0 true 2010 1 23
  • Patch …… float long 2010 1 23
  • “ ” ‘ ’ -- Lua 0 immutable 2010 1 23
  • .. a = "1" + "1" 2 b = "a" + "b" b = “a” .. “b” 2010 1 23
  • Lua 2010 1 23
  • == 2010 1 23
  • Lua 2010 1 23
  • 1 0 # 2010 1 23
  • 1 0 # 2010 1 23
  • Lua key value “x” 9.2 nil Header value 100 200 1 300 nil 2010 1 23
  • Lua C C 2010 1 23
  • nil ... 2010 1 23
  • C Lua 2010 1 23
  • local do~end Lua local do -- do~end local a = 1 print(a) -- end print(a) -- 2010 1 23
  • + - * / ^ % - < > <= >= == ~= and or not 2010 1 23
  • if while repeat for 2010 1 23
  • if 2010 1 23
  • if op == “+” then r=a+b if elseif op == “-” then r=a-b elseif op == “*” then r=a*b elseif op == “/” then r=a/b else error(“invalid operation”) end 2010 1 23
  • while 2010 1 23
  • while local i = 1 while t[i] do print(t[i]) i=i+1 end 2010 1 23
  • repeat 2010 1 23
  • repeat -- repeat line = io.read() untile line ~= “” print(line) -- local local sqr = x/2 repeat sqr = (sqr + x/sqr)/2 local err = math.abs(sqr^2 - x) untile err < x/10000 -- err 2010 1 23
  • for 2010 1 23
  • -- for for i=10,1,-1 do -- for print(i) end -- for for i,v in ipairs(array) do print(v) end -- for ipairs 2010 1 23
  • break return switch continue break return continue Patch 5.2 2010 1 23
  • 2010 1 23
  • 2010 1 23
  • (co-routine) 2010 1 23
  • 2010 1 23
  • 2010 1 23
  • co- 2010 1 23
  • co-routine 2010 1 23
  • 2010 1 23
  • …… CAPI coroutine.create coroutine.resume coroutine.running coroutine.status coroutine.wrap coroutine.yield Lua 2010 1 23
  • coroutine.status suspended running dead normal 2010 1 23
  • co = coroutine.create( function () print("start") coroutine.yield() -- print("resume") end ) -- co type thread coroutine.resume(co) -- coroutine.resume(co) -- --> start --> resume 2010 1 23
  • co = coroutine.create( function () co = coroutine.create( print("start") function () local c = coroutine.create( print("start") function () coroutine.yield() -- print("nest coroutine start") print("resume") coroutine.yield() end print("nest coroutine resume") ) end -- co type thread ) coroutine.resume(co) -- coroutine.resume(c) coroutine.resume(c) coroutine.resume(co) -- coroutine.yield() print("resume") end --> start ) --> resume coroutine.resume(co) -- coroutine.resume(co) -- 2010 1 23
  • croutine.create croutine.resume croutine.yield 2010 1 23
  • 1 1 1 …… 2010 1 23
  • C Lua 2010 1 23
  • Lua C Lua 2010 1 23
  • C Lua C Lua 2010 1 23
  • Lua C C Lua 2010 1 23
  • Lua C C Lua 2010 1 23
  • Lua C Lua 2010 1 23
  • Lua 20 C 2010 1 23
  • 2010 1 23
  • malloc/free/realloc 2010 1 23
  • KByte C → LTR (Lua Tiny RAM) Patch 2010 1 23
  • dlmalloc 2010 1 23
  • tolua++ luabind tolua++ Lua C++ 2010 1 23
  • printf Windows 2010 1 23
  • 2010 1 23
  • 2010 1 23
  • C Lua C Lua t = lua_newthread(L); GC Lua GC 2010 1 23
  • GC GC GC GC 2010 1 23
  • __add, __sub, __mul, __div, __unm ,__mod ,__pow __eq ,__lt ,__le tostring __tostring __index __newindex 2010 1 23
  • mt = {} mt.__add = function (lhs, rhs) print(lhs, rhs, "mt._add") return lhs end hoge = {} foo = {} setmetatable(hoge, mt) -- hoge = hoge + foo -- 2010 1 23
  • Lua __mode ”k” ”v” 2010 1 23
  • weak = {} mt = {__mode="k"} -- setmetatable(weak,mt) -- key = {} -- weak[key] = 1 key = {} -- weak[key] = 2 -- collectgarbage() -- for k, v in pairs(weak) do print(v) end --> 2 2010 1 23
  • _G a = “b” _G[“a”] = “b” a[“b”] a.b _G 2010 1 23
  • t:hoge() t.hoge(t) 2010 1 23
  • Hoge = {value = 0} function Hoge:new(c) h:setValue(100) c = c or {} setmetatable(c, self) self.__index = self h.setValue(h,100) return c end function Hoge:setValue(v) self.value = v end h = Hoge:new() print(h.value) h:setValue(100) h print(h.value) Hoge --> 0 --> 100 2010 1 23
  • 2010 1 23
  • I/O OS 2010 1 23
  • Lua Lua 5.1.4 (2008-8-22) Lua 5.2 (work2) (2010-1-13) 5.2 Lua! Patch …… 2010 1 23
  • Lua 2010 1 23
  • 2010 1 23