Skip to content

Instantly share code, notes, and snippets.

@x5lcfd
Last active November 16, 2016 09:39
Show Gist options
  • Select an option

  • Save x5lcfd/2c6e2b3aeb198d8074ac751f3e5a413e to your computer and use it in GitHub Desktop.

Select an option

Save x5lcfd/2c6e2b3aeb198d8074ac751f3e5a413e to your computer and use it in GitHub Desktop.
Lua Snippet for VSCode.
{
"Define a Component": {
"prefix": "defcomp",
"body":[
"local $1 = Lplus.Extend(require \"game/JOWBaseComponent\",\"$1\")",
"local def = $1.define",
"\n",
"def.override().OnInit = function (self)",
"end",
"\n",
"def.override(\"dynamic\").OnShow = function (self,obj)",
"end",
"\n",
"def.override().OnHide = function (self)",
"end",
"\n",
"def.override().OnUpdate = function (self)",
"end",
"\n",
"def.override().OnDispose = function (self)",
"end",
"\n",
"def.override(\"=>\",\"string\").GetName = function (self)",
" return \"$1\"",
"end",
"\n",
"$1.Commit()",
"return $1"
],
"description": "Define a Component"
},
"Define a view": {
"prefix": "defview",
"body":[
"local $1 = Lplus.Extend(require \"game/JOWBaseUI\",\"$1\")",
"local def = $1.define",
"\n",
"def.override().OnInit = function (self)",
"end",
"\n",
"def.override().OnDispose = function (self)",
"end",
"\n",
"def.override(\"dynamic\").OnShow = function (self, obj)",
"end",
"\n",
"def.override().OnHide = function (self)",
"end",
"\n",
"def.override(\"=>\",\"string\").GetName = function (self)",
" return \"$1\"",
"end",
"\n",
"$1.Commit()",
"return $1"
],
"description": "Define a View"
},
"Define a variable": {
"prefix": "defvar",
"body": [
"def.field(\"userdata\").$1 = nil",
"end"
],
"description": "Define a Variable"
},
"Define a method": {
"prefix": "defmet",
"body": [
"def.method($1).$2 = function(self, $3)",
"end"
],
"description": "Define a Method"
},
"Define a static function": {
"prefix": "defunc",
"body":[
"$1.$2 = function($3)",
"end"
],
"description": "Define a Static Function"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment