1
0
Fork 0
mirror of https://github.com/Reuh/language-candran.git synced 2025-10-28 20:59:31 +00:00
language-candran/snippets/language-lua.cson
FireZenk f2945d7f88 Removed non valid snippets and improved Readme
Removed non valid snippets for table functions and improved Readme with
all snippet triggers
2014-03-02 15:11:06 +01:00

85 lines
2.8 KiB
Text

'.source.lua':
'multiline comment':
'prefix': '-['
'body': '--[[ ${0:comment...}]'
'nested multiline comment':
'prefix': '=['
'body': '--[=[ ${0:comment...}]='
'function':
'prefix': 'fun'
'body': 'function ${1:FunctionName} (${2:args})\n\t${0:-- body...}\nend'
'anon function':
'prefix': 'afun'
'body': '${1:FunctionName} = function (${2:args})\n\t${0:-- body...}\nend'
'while loop':
'prefix': 'while'
'body': 'while ${1:condition} do\n\t${0:-- body...}\nend'
'while loop shortcut':
'prefix': 'whi'
'body': 'while ${1:condition} do\n\t${0:-- body...}\nend'
'repeat loop':
'prefix': 'repeat'
'body': 'repeat\n\t${0:-- body...}\nuntil ${1:condition}'
'repeat loop shortcut':
'prefix': 'rep'
'body': 'repeat\n\t${0:-- body...}\nuntil ${1:condition}'
'for i,v in ipairs()':
'prefix': 'fori'
'body': 'for ${1:i},${2:v} in ipairs(${3:table_name}) do\n\t${0:-- body...}\nend'
'for i=1,10':
'prefix': 'for'
'body': 'for ${1:i}=${2:1},${3:10} do\n\t${0:-- body...}\nend'
'for k,v in pairs()':
'prefix': 'forp'
'body': 'for ${1:k},${2:v} in pairs(${3:table_name}) do\n\t${0:-- body...}\nend'
'local variable definition':
'prefix': 'local'
'body': 'local ${1:x} = ${0:1}'
'local variable definition shortcut':
'prefix': 'loc'
'body': 'local ${1:x} = ${0:1}'
'local table definition':
'prefix': 'ltab'
'body': 'local ${0:name} = {}'
'return definition':
'prefix': 'return'
'body': 'return ${0:value}'
'return definition shortcut':
'prefix': 'ret'
'body': 'return ${0:value}'
'log':
'prefix': 'log'
'body': 'print("${0:logging}")'
'require':
'prefix': 'require'
'body': 'local ${0:name} = require "${1:module}"'
'require shortcut':
'prefix': 'req'
'body': 'local ${0:name} = require "${1:module}"'
'if conditional':
'prefix': 'if',
'body': 'if ${1:value} then\n\t${0:--body...}\nend'
'if else conditional':
'prefix': 'ife',
'body': 'if ${1:value} then\n\t${0:--body...}\nelse\n\t${1:--body...}\nend'
'if not conditional':
'prefix': 'ifn',
'body': 'if not ${1:value} then\n\t${0:--body...}\nend'
'if not else conditional':
'prefix': 'ifne',
'body': 'if not ${1:value} then\n\t${0:--body...}\nelse\n\t${1:--body...}\nend'
'table definition':
'prefix': 'tab'
'body': '${0:name} = {}'
'table.insert':
'prefix': 'tabi',
'body': 'table.insert(${0:tableName},${1:data})'
'table.foreach':
'prefix': 'tabf',
'body': 'table.foreach(${0:tableName},${1:function})'
'table.concat':
'prefix': 'tabc'
'body': 'table.concat(${1:tableName}${2:, " "}${3:, start_index}${4:, end_index})'
'table.sort':
'prefix': 'tabs',
'body': 'table.sort(${1:tableName}${2:, sortfunction})'