Skip to content

Instantly share code, notes, and snippets.

View Sleitnick's full-sized avatar

Stephen Leitnick Sleitnick

View GitHub Profile
@Sleitnick
Sleitnick / bloxport_airlines.json
Last active August 29, 2015 14:18
Random airline names for Bloxport. Leave a comment of name suggestions!
{
"prefix": [
"Air"
],
"name": [
"ROBLOX",
"ROBLOXia",
"ROBLOXian",
"Blox",
"Robo",
@Sleitnick
Sleitnick / Hexagon.lua
Last active August 29, 2015 14:18
Create and union Hexagon from ROBLOX Studio command line
--[[
Instructions:
1) Set 'radius' and 'height' to non-zero positive numbers (x > 0)
2) Copy & Paste this code into Command Bar
3) Press Enter
--]]
local radius = 4
@Sleitnick
Sleitnick / rbxLinkTest.lua
Last active September 9, 2015 01:59
RbxLinkTest
local version = "1.0.0"
local plugin = PluginManager():CreatePlugin()
local toolbar = plugin:CreateToolbar("RbxLink")
local button = toolbar:CreateButton("RbxLink", "RbxLink Plugin", "")
local http = game:GetService("HttpService")
local endpoint = "http://localhost:8080/StudioLink"
local tbl = {...}
for i,v in pairs(tbl) do
-- Loop
end
function pairs(tbl)
return next, tbl, nil
end
local tbl = {...}
for i = 1,#tbl do
local v = tbl[i]
end
local data = {}
for i = 1,1000000 do
data[i] = 1
end
function Benchmark(title, iterations, func)
print("Running " .. title .. "...")
local start = tick() -- Start time
for i = 1,iterations do
func()
end
local duration = (tick() - start)
print(title .. " duration: " .. duration)
end
-- Generic for loop:
Benchmark("Generic", 40, function()
for i,v in pairs(data) do
-- Foobar
end
end)
-- Numeric for loop:
Benchmark("Numeric", 40, function()
for i = 1,#data do
local mixedTbl = {
"test", "hello", "hi",
kills = 32,
deaths = 16
}
-- This table has both numeric indices and hashed indices.
-- e.g. 'mixedTbl[1]' and 'mixedTbl.kills'