jiyinyiyong
V2EX  ›  编程

Lua 中文社区觉得好冷清啊

  •  
  •   jiyinyiyong · Oct 3, 2012 · 6576 views
    This topic created in 5152 days ago, the information mentioned may be changed or developed.
    就算 Lisp.. 豆瓣和邮件列表上常常有人聊, 虽然说方言比较多是真的,
    Lua 我看了都去年前年更新的帖子了,, 好冷啊.
    另外在云风的博客上看到很多 Lua 的笔记, 然后微博上也遇到点,
    最近学 JS 学的烦起来了于是去看相似的 Lua
    看到 __index 和 setmetadata 觉得有点重复于是想问问题来着..
    连中文社区的都没有来着...
    Lua 在国内都是用来做什么的来着, 有那么小众啊?
    8 replies  •  1970-01-01 08:00:00 +08:00
    marvinII
    marvinII
    Oct 3, 2012
    1
    是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
    bugcoder
    Oct 4, 2012
    2
    我感觉 LUA的兴起是从 暴雪公司的 魔兽世界开始的吧, 主要用来给该游戏开发插件....
    kran
    kran
    Oct 4, 2012
    3
    pil一本书足够入门了,lua毕竟是特性比较少的语言。
    index只是元表的其中一个特性,你迷惑可能是因为很多时候会直接把元表的index赋值为自身。
    jiyinyiyong
    jiyinyiyong
    OP
    Oct 4, 2012
    4
    @marvinII 没缩进给跪了.. 其实我写的还是 MoonScript 然后转的 Lua,
    那个邮件列表能给链接么?
    marvinII
    marvinII
    Oct 4, 2012
    5
    @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
    hpyhacking
    Oct 4, 2012
    6
    国内比较小众的语言都是比较冷清的,Erlang也如此,就算是Ruby在国内的ruby-china上也不是很火爆,蛋逼的比讨论技术的多。
    weakfox
    weakfox
    Oct 4, 2012
    7
    lua不是在游戏行业应用挺普遍的?
    amtb
    amtb
    Feb 5, 2013
    8
    nginx+lua,性能神器,参考openresty
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1442 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 16:43 · PVG 00:43 · LAX 08:43 · JFK 11:43
    ♥ Do have faith in what you're doing.