--As requested by Spoco here is the LCD Demo for GMod
--Load GMX for our table loading and saving shite
if gmx==nil then _OpenScript("lib/gmx/init.lua") end
--Declare our table of pixels
Pixel = {}
--Add sizes
WIDTH = 15
HEIGHT = 15
function initPixels()
for x=1,HEIGHT do
Pixel[x] = {}
for y=1,WIDTH do
Pixel[x].y = {}
Pixel[x].y.r = 1
Pixel[x].y.g = 1
Pixel[x].y.b = 1
Pixel[x].y.a = 255
end
end
copyToWorld()
end
initPixels()
function copyToWorld()
for x=1,HEIGHT do
Pixel[x] = {}
for y=1,WIDTH do
local colorString=Pixel[x][y].r .. " "..Pixel[x][y].g.." "..Pixel[x][y].b.." " .. Pixel[x][y].a
local entid = _EntGetByName("pixel"..x"x"..y)
_EntFire(entid,"color",colorString,0)
end
end
end
function savePattern(userid,name)
gmx.saveTable(Pixel,"lcdpatterns/"..name..".lcd")
end
function loadPattern(userid,name)
gmx.loadTable("lcdpatterns/"..name..".lcd")
copyToWorld()
end
CONCOMMAND("savelcd",savePattern)
CONCOMMAND("loadlcd",loadPattern)