Skip to content

Instantly share code, notes, and snippets.

@Nimblz
Created February 8, 2020 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nimblz/d262075733d9b29e31ce9f363f9fff38 to your computer and use it in GitHub Desktop.
Save Nimblz/d262075733d9b29e31ce9f363f9fff38 to your computer and use it in GitHub Desktop.
my current snippets for roblox development
{
// Place your snippets for lua here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Create a path variable": {
"prefix": "p",
"body": [
"local ${1:pathname} = ${2:basepath}.${1}"
]
},
"Require a library from a variable": {
"prefix": "rv",
"body": [
"local ${1:ModuleName} = require(${2:variable})"
]
},
"Require a library from a path": {
"prefix": "r",
"body": [
"local ${1:ModuleName} = require(${2:path}.${1})"
]
},
"Globals used by most scripts": {
"prefix": "g",
"body": [
"local ReplicatedStorage = game:GetService(\"ReplicatedStorage\")",
"",
"local common = ReplicatedStorage.common",
"local lib = ReplicatedStorage.lib",
"",
]
},
"Players service": {
"prefix": "ps",
"body": [
"local Players = game:GetService(\"Players\")",
"",
]
},
"LocalPlayer": {
"prefix": "lp",
"body": [
"local LocalPlayer = Players.LocalPlayer",
"",
]
},
":WaitForChild(...)": {
"prefix": "wfc",
"body": [
":WaitForChild(\"${1:child}\")"
]
},
":FindFirstChild(...)": {
"prefix": "ffc",
"body": [
":FindFirstChild(\"${1:child}\")"
]
},
"Create a new instance variable with :WaitForChild": {
"prefix": "iwfc",
"body": [
"local ${1:identifier} = ${2:basepath}:WaitForChild(\"${3:child}\")"
]
},
"Create a new instance variable with :FindFirstChild": {
"prefix": "iffc",
"body": [
"local ${1:identifier} = ${2:basepath}:FindFirstChild(\"${3:child}\")"
]
},
"Require Roact": {
"prefix": "rct",
"body": [
"local Roact = require(lib.Roact)",
"",
]
},
"Require Rodux": {
"prefix": "rdx",
"body": [
"local Rodux = require(lib.Rodux)",
"",
]
},
"Require RoactRodux": {
"prefix": "rctrdx",
"body": [
"local RoactRodux = require(lib.RoactRodux)",
"",
]
},
"Create stateful component": {
"prefix": "rcc",
"body": [
"local ${1:MyComponent} = Roact.Component:extend(\"${1}\")",
"",
"function ${1}:init()",
"end",
"",
"function ${1}:didMount()",
"end",
"",
"function ${1}:render()",
"\t$0",
"end",
"",
"return ${1}"
]
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment