List of helpful shortcuts for faster coding
If you have any other helpful shortcuts, feel free to add in the comments of this gist :)
| --[[ | |
| MIT License | |
| Copyright (c) 2021 EgoMoose | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is |
| --[[ | |
| MIT License | |
| Copyright (c) 2021 EgoMoose | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is |
| --[[ | |
| ========================================================================== | |
| == API == | |
| Differences from the original: | |
| Using metatables instead of a function returning a table. | |
| Added Vector3, Color3, Vector2, and UDim2 support. | |
| Deprecated BrickColors. | |
| Changed the creation method from BitBuffer.Create to BitBuffer.new. |
| -- Elliptic Curve Cryptography in Computercraft | |
| local byteTableMT = { | |
| __tostring = function(a) return string.char(unpack(a)) end, | |
| __index = { | |
| toHex = function(self, s) return ("%02x"):rep(#self):format(unpack(self)) end, | |
| isEqual = function(self, t) | |
| if type(t) ~= "table" then return false end | |
| if #self ~= #t then return false end | |
| local ret = 0 |
| ------------------------------------------------------------------------------------------------------------------ | |
| -- CFrameSerializer.lua | |
| -- Written by CloneTrooper1019 | |
| -- @ 3/7/2019 | |
| ------------------------------------------------------------------------------------------------------------------ | |
| -- Usage | |
| -- string CFrameSerializer:EncodeCFrame(CFrame cf) < Compresses a CFrame into a JSON string. | |
| -- CFrame CFrameSerializer:DecodeCFrame(string cf) < Decompresses a JSON CFrame string. | |
| ------------------------------------------------------------------------------------------------------------------ | |
| -- Utility Functions |
| ------------------------------------------------------------------------ | |
| -- Freecam | |
| -- Cinematic free camera for spectating and video production. | |
| ------------------------------------------------------------------------ | |
| local pi = math.pi | |
| local abs = math.abs | |
| local clamp = math.clamp | |
| local exp = math.exp | |
| local rad = math.rad |
| local CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~`!@#$%^&*()-_=+[{]}\\|;:'\",<.>/?" | |
| local RandomLib = Random.new(os.clock() % 1 * 1E7) | |
| local function RandomString(Length) | |
| local String = "" | |
| for _ = Length, 0, -1 do | |
| local Index = RandomLib:NextInteger(1, 94) | |
| String ..= string.sub(CHARACTERS, Index, Index) | |
| end |
| local Functions = {} | |
| local random = math.random | |
| math.randomseed(tick() % 1 * 1E7) | |
| Functions["local"] = function() | |
| return random() | |
| end | |
| Functions["global"] = function() | |
| return math.random() |
player is better than plr.wasCalled is better than hasBeenCalled. notify is better than doNotification.isFirstRun is better than firstRun.increment is better than plusOne. unzip is better than filesFromZip.onClick is better than click.isFlying instead of isNotFlying. late intead of notOnTime.if not something then ... else ... end.missingValue instead of not hasValue.