V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
jiyinyiyong
V2EX  ›  编程

Lua 中文社区觉得好冷清啊

  •  
  •   jiyinyiyong · 2012-10-03 21:02:10 +08:00 · 5580 次点击
    这是一个创建于 4231 天前的主题,其中的信息可能已经有所发展或是发生改变。
    就算 Lisp.. 豆瓣和邮件列表上常常有人聊, 虽然说方言比较多是真的,
    Lua 我看了都去年前年更新的帖子了,, 好冷啊.
    另外在云风的博客上看到很多 Lua 的笔记, 然后微博上也遇到点,
    最近学 JS 学的烦起来了于是去看相似的 Lua
    看到 __index 和 setmetadata 觉得有点重复于是想问问题来着..
    连中文社区的都没有来着...
    Lua 在国内都是用来做什么的来着, 有那么小众啊?
    8 条回复    1970-01-01 08:00:00 +08:00
    marvinII
        1
    marvinII  
       2012-10-03 23:25:31 +08:00
    是setmetatable 不是 meta data

    5.1 manual 里有实现:

    function gettable_event (table, key)
    local h
    if type(table) == "table" then
    local v = rawget(table, key)
    if v ~= nil then return v end
    h = metatable(table).__index
    if h == nil then return nil end
    else
    h = metatable(table).__index
    if h == nil then
    error(···)
    end
    end
    if type(h) == "function" then
    return (h(table, key)) -- call the handler
    else return h[key] -- or repeat operation on it
    end
    end

    __index的作用就很清楚了。

    Lua的问题都在mail list里讨论,可以订阅。另外,lua user wiki很好,很全面,可以参考。
    bugcoder
        2
    bugcoder  
       2012-10-04 09:05:35 +08:00
    我感觉 LUA的兴起是从 暴雪公司的 魔兽世界开始的吧, 主要用来给该游戏开发插件....
    kran
        3
    kran  
       2012-10-04 09:21:11 +08:00
    pil一本书足够入门了,lua毕竟是特性比较少的语言。
    index只是元表的其中一个特性,你迷惑可能是因为很多时候会直接把元表的index赋值为自身。
    jiyinyiyong
        4
    jiyinyiyong  
    OP
       2012-10-04 09:55:48 +08:00
    @marvinII 没缩进给跪了.. 其实我写的还是 MoonScript 然后转的 Lua,
    那个邮件列表能给链接么?
    marvinII
        5
    marvinII  
       2012-10-04 10:23:38 +08:00
    @jiyinyiyong http://www.lua.org/lua-l.html

    @bugcoder 应用很广的, 包括Lego MindStorm NXT, Creative ZEN, SciTE (http://www.lua.org/uses.html), 只是国内的宣传方式决定了只有魔兽最显眼. 其实只要习惯/倾向于 mixed language programming 就到处都可以用了.
    hpyhacking
        6
    hpyhacking  
       2012-10-04 16:05:19 +08:00
    国内比较小众的语言都是比较冷清的,Erlang也如此,就算是Ruby在国内的ruby-china上也不是很火爆,蛋逼的比讨论技术的多。
    weakfox
        7
    weakfox  
       2012-10-04 16:24:38 +08:00
    lua不是在游戏行业应用挺普遍的?
    amtb
        8
    amtb  
       2013-02-05 18:24:07 +08:00
    nginx+lua,性能神器,参考openresty
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   971 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:43 · PVG 07:43 · LAX 16:43 · JFK 19:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.