Skip to content

Instantly share code, notes, and snippets.

require 'bench' --https://github.com/SuperiorServers/dash/blob/master/lua/dash/libraries/bench.lua
function table.Select (tblMaster, bfuncCheck)
local tblLocal = {}
for k, v in pairs (tblMaster) do
if bfuncCheck (v) then
if type (k) != "number" then
tblLocal[k] = v
else
tblLocal[#tblLocal + 1] = v
@aStonedPenguin
aStonedPenguin / outline.lua
Created March 3, 2016 08:43 — forked from meepen/outline.lua
Outliner
local matrices = {}
local len = 0.1
local step = 0.2
for x = -len, len, step do
for y = -len, len, step do
for z = -len, len, step do
matrices[#matrices + 1] = Matrix()
@aStonedPenguin
aStonedPenguin / loopsbench.lua
Last active February 29, 2016 08:36
Loops comparison
require 'xbench' -- https://github.com/SuperiorServers/plib_v2/blob/master/lua/plib/libraries/xbench.lua
local t = {}
for i = 1, 128 do
t[i] = Entity(1)
end
xbench.Compare({
Pairs = function()
for k, v in pairs(t) do
require 'pbench' --https://github.com/SuperiorServers/plib_v2/blob/master/lua/plib/libraries/pbench.lua
local players = {}
for i =1, 100 do
players[i] = Entity(1)
players[i].GetUserGroup = function()
return (i > 50)
end
end