1
0
Fork 0
mirror of https://github.com/Reuh/language-candran.git synced 2025-10-27 20:29:31 +00:00
language-candran/snippets/language-lua.cson
FireZenk bb0f007168 Added math functions snippets
Added math functions snippets also fixed some Readme errors
2014-03-02 17:40:24 +01:00

178 lines
4.9 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}'
'print':
'prefix': 'print'
'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})'
'table.remove':
'prefix': 'tabr',
'body': 'table.remove(${1:tableName}${2:, position})'
'table.maxn':
'prefix': 'tabm',
'body': 'table.maxn(${1:tableName})'
'math.abs':
'prefix': 'abs',
'body': 'math.abs(${0:x})'
'math.acos':
'prefix': 'acos',
'body': 'math.acos(${0:x})'
'math.asin':
'prefix': 'asin',
'body': 'math.asin(${0:x})'
'math.atan':
'prefix': 'atan',
'body': 'math.atan(${0:x})'
'math.atan2':
'prefix': 'atan2',
'body': 'math.atan2(${0:y}, ${1:x})'
'math.ceil':
'prefix': 'ceil',
'body': 'math.ceil(${0:x})'
'math.cos':
'prefix': 'cos',
'body': 'math.cos(${0:x})'
'math.cosh':
'prefix': 'cosh',
'body': 'math.cosh(${0:x})'
'math.deg':
'prefix': 'deg',
'body': 'math.deg(${0:x})'
'math.exp':
'prefix': 'exp',
'body': 'math.exp(${0:x})'
'math.floor':
'prefix': 'floor',
'body': 'math.floor(${0:x})'
'math.fmod':
'prefix': 'fmod',
'body': 'math.fmod(${0:x}, ${1:y})'
'math.frexp':
'prefix': 'frexp',
'body': 'math.frexp(${0:x})'
'math.huge':
'prefix': 'huge',
'body': 'math.huge'
'math.ldexp':
'prefix': 'ldexp',
'body': 'math.ldexp(${0:m}, ${1:e})'
'math.log':
'prefix': 'log',
'body': 'math.log(${0:x})'
'math.log10':
'prefix': 'log10',
'body': 'math.log10(${0:x})'
'math.max':
'prefix': 'max',
'body': 'math.max(${0:x}, ${1:...})'
'math.min':
'prefix': 'min',
'body': 'math.min(${0:x}, ${1:...})'
'math.pi':
'prefix': 'pi',
'body': 'math.pi'
'math.pow':
'prefix': 'pow',
'body': 'math.pow(${0:x}, ${1:y})'
'math.rad':
'prefix': 'rad',
'body': 'math.rad(${0:x})'
'math.random':
'prefix': 'random',
'body': 'math.random(${0:m}, ${1:n})'
'math.randomseed':
'prefix': 'randomseed',
'body': 'math.randomseed(${0:x})'
'math.sin':
'prefix': 'sin',
'body': 'math.sin(${0:x})'
'math.sinh':
'prefix': 'sinh',
'body': 'math.sinh(${0:x})'
'math.sqrt':
'prefix': 'sqrt',
'body': 'math.sqrt(${0:x})'
'math.tan':
'prefix': 'tan',
'body': 'math.tan(${0:x})'
'math.tanh':
'prefix': 'tanh',
'body': 'math.tanh(${0:x})'