aboutsummaryrefslogtreecommitdiff
path: root/modules/lua/snippets.lua
blob: 068903d81b0e4e88eb29ffc9d41fa9c51ffd7fcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- Copyright 2007-2010 Mitchell mitchell<att>caladbolg.net. See LICENSE.

---
-- Snippets for the lua module.
module('_m.lua.snippets', package.seeall)

local snippets = _G.snippets

if type(snippets) == 'table' then
  snippets.lua = {
    l = "local %1(expr)%2( = %3(value))",
    p = "print(%0)",
    f = "function %1(name)(%2(args))\n\t%0\nend",
    ['for'] = "for i=%1(1), %2(10)%3(, -1) do\n\t%0\nend",
    fori = "for %1(i), %2(val) in ipairs(%3(table)) do\n\t%0\nend",
    forp = "for %1(k), %2(v) in pairs(%3(table)) do\n\t%0\nend",
  }
end