Skip to content

Instantly share code, notes, and snippets.

@spotco
spotco / un_spdecal.lua
Last active November 26, 2021 08:03
un_spdecal.lua
local function get_spdecal(cur)
local child_spdecal = cur:FindFirstChild("SPDecal")
if child_spdecal == nil then
return false, ""
end
return true, child_spdecal.Value
end
local function r_itr(cur)
for _,child in pairs(cur:GetChildren()) do
@spotco
spotco / resource_id_unique.py
Created December 3, 2019 21:16
resource_id_unique.py
import sys
import os
file_lines = open(sys.argv[1],'r').read().split("\n")
prefix_to_keys = {}
for line in file_lines:
tokens = line.split(" ")
key = tokens[1]
prefix = key[0:3]
if not prefix in prefix_to_keys:
@spotco
spotco / texture_convert.lua
Created April 29, 2019 05:31
texture_convert.lua
local convert_table = {
["rbxassetid://2587811489"] = "rbxgameasset://Images/WClub_BigWalls-2";
["rbxassetid://2587680553"] = "rbxgameasset://Images/WClub_SpeakerFront-Side-2";
["rbxassetid://2587754419"] = "rbxgameasset://Images/WClub_DJSet-Front-2";
["rbxassetid://2954514453"] = "rbxgameasset://Images/WClub_DJ-Set";
["rbxassetid://2587679730"] = "rbxgameasset://Images/WClub_SpeakerFront-Front-4";
["rbxassetid://2954480673"] = "rbxgameasset://Images/WClub_Tunnel-Texture";
["rbxassetid://2587785664"] = "rbxgameasset://Images/WClub_SideSpeaker-2";
["rbxassetid://2587802664"] = "rbxgameasset://Images/WClub_TV-Front-2";
["rbxassetid://2583869929"] = "rbxgameasset://Images/WClub_Speaker-1";
@spotco
spotco / texture_usage_count.lua
Created April 29, 2019 05:31
texture_usage_count.lua
local textures = {}
local function r_itr(cur)
for _,child in pairs(cur:GetChildren()) do
r_itr(child)
end
if cur.ClassName == "Decal" or cur.ClassName == "Texture" then
if textures[cur.Texture] == nil then
textures[cur.Texture] = 0
end
@spotco
spotco / simplify_anim.lua
Last active March 23, 2019 22:22
simplify_anim.lua
local KEYFRAME_EVERY = 0.25
local target_anim = game.Selection:Get()[1]
local selected_anim = target_anim:Clone()
selected_anim.Parent = target_anim.Parent
selected_anim.Name = selected_anim.Name .. "_Simplified(" .. tostring(KEYFRAME_EVERY) .. ")"
if selected_anim == nil then error("Must have KeyframeSequence selected") end
if selected_anim.ClassName ~= "KeyframeSequence" then error("Must have KeyframeSequence selected") end
local keyframes = {}
for _,child in pairs(selected_anim:GetChildren()) do
if child.ClassName == "Keyframe" then
@spotco
spotco / locals.lua
Created March 17, 2019 01:33
locals.lua
return function()
local rtv = {}
local level = 1
while true do
local level_table = {}
local ln, lv = debug.getlocal(2, level)
if ln ~= nil then
level_table[ln] = lv
else
break
@spotco
spotco / inspect.lua
Created March 17, 2019 01:33
inspect.lua
local inspect ={
_VERSION = 'inspect.lua 3.1.0',
_URL = 'http://github.com/kikito/inspect.lua',
_DESCRIPTION = 'human-readable representations of tables',
_LICENSE = [[
MIT LICENSE
Copyright (c) 2013 Enrique García Cota
Permission is hereby granted, free of charge, to any person obtaining a
@spotco
spotco / unpack.lua
Created March 17, 2019 01:33
unpack.lua
-- lua.reformat
return table.unpack
@spotco
spotco / LCFrameOpt.ModuleScript.lua
Created February 2, 2019 09:56
LCFrameOpt.ModuleScript.lua
-- dependancies
local LVector3 = require(game.ReplicatedStorage.Shared.LVector3)
-- CFrame class
local TYPE_LCFRAME = "LCFrame"
local LCFrame = {
__type = TYPE_LCFRAME,
TYPE_LCFRAME = TYPE_LCFRAME
@spotco
spotco / LVector3Opt.ModuleScript.lua
Created February 2, 2019 09:55
LVector3Opt.ModuleScript.lua
-- LVector3 class
local TYPE_LVECTOR3 = "LVector3"
local LVector3 = {
__type = TYPE_LVECTOR3,
TYPE_LVECTOR3 = TYPE_LVECTOR3
};
local mt = {__index = LVector3};
-- built-in functions