This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local mem = LocalPlayer():GetEyeTrace().Entity | |
if mem then | |
mem = mem.Memory1 | |
end | |
if not mem then | |
print("either there is no entity or the entity has no memory") | |
return | |
end | |
local width = mem[1048573] or 0 | |
local height = mem[1048572] or 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@shared | |
local setfenv = setfenv or debug.setfenv | |
assert(setfenv, "incompatible version of lua") | |
local prefix = BRANCH and (SERVER and "GLUA SERVER" or CLIENT and "GLUA CLIENT") or (SERVER and "SF SERVER" or CLIENT and "SF CLIENT") or "LUA" | |
prefix = prefix..": " | |
local i = 0 | |
local j = 0 | |
local k = 7 | |
local function test(cond, msg) | |
j = j+1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@name Quake LMP renderer | |
--@client | |
local p = file.read("quakefall/gfx/palette.lmp") | |
local d = file.read("quakefall/gfx/mainmenu.lmp") | |
d = bit.stringstream(d) | |
local threshold = quotaMax()*0.7 | |
local function yield(rt) | |
if math.max(quotaUsed(), quotaAverage()) >= threshold then | |
coroutine.yield() | |
if rt then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@server | |
wire.adjustInputs({"Console"}, {"Wirelink"}) | |
local con = wire.ports.Console | |
con[2041] = 0 | |
local function writeString(str, i) | |
for j=1, #str do | |
local k = (i+j-1)*2 | |
con[k] = str:sub(j, j):byte() | |
con[k+1] = 0000999 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@client | |
local function init() | |
-- Your code here (placeholder code follows) | |
hook.add("render", "render", function() | |
local w, h = render.getResolution() | |
render.setFont("DermaLarge") | |
render.drawSimpleText(w/2, h/2, "Success!", 1, 1) | |
end) | |
-- Your code here (placeholder code precedes) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env luajit | |
local files = { | |
"ChatScheme.res", | |
"ClientScheme.res", | |
"GameMenu.res", | |
"LoadingDialogNoBanner.res", | |
"LoadingDialogNoBannerSingle.res", | |
"LoadingDialogVAC.res", | |
"mdlpicker.res", | |
"mdlpickerrender.res", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@name Minesweeper | |
--@author x4fx77x4f | |
--@client | |
local hook_add = hook.add | |
local hook_remove = hook.remove | |
local IN_KEY_USE = IN_KEY.USE | |
local IN_KEY_ATTACK = IN_KEY.ATTACK | |
local IN_KEY_ATTACK2 = IN_KEY.ATTACK2 | |
local material_create = material.create | |
local math_floor = math.floor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--@client | |
--@include libs/fh_lube.lua | |
require("libs/fh_lube.lua")(function() | |
local math_cos = math.cos | |
local math_sin = math.sin | |
local mesh_advanceVertex = mesh.advanceVertex | |
local mesh_generate = mesh.generate | |
local mesh_writeColor = mesh.writeColor | |
local mesh_writePosition = mesh.writePosition | |
local mesh_writeUV = mesh.writeUV |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env luajit | |
local input = arg[1] and io.open(arg[1], 'r') or io.stdin | |
local output = arg[2] and io.open(arg[2], 'w+') or io.stdout | |
local inbrace = false | |
local firstbrace = false | |
for line in input:lines() do | |
if line:find('^[ \t]*//') or line == '' then | |
-- skip | |
elseif inbrace then | |
local o = line:find('}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CFGINVADERS | |
// HOW TO PLAY: | |
// Preprocess this file with cfgpp.lua (in another gist, or use the already prepreprocessed one below) | |
// Run 'map cs_assault' (or any other map) | |
// Run 'exec invaders2' (or wherever you put the processed file) | |
// Unpause the game and look in the top-left corner | |
// Numpad 4 and 6 to move, numpad 8 to shoot | |
// aliens state | |
alias a_1_1 a_t |
OlderNewer