Skip to content

Instantly share code, notes, and snippets.

View Python1320's full-sized avatar

Python1320 Python1320

  • M.Sc. (Tech.) Project Researcher
  • Finland
View GitHub Profile
@Python1320
Python1320 / coroutinefun.lua
Last active September 5, 2026 21:17
Garry's Mod Lua (glua, luajit) coroutine fun (testing version)
--setfenv(1,_G)
local meta={}
local co=setmetatable({},meta)
_G.co=co
-- todo
-- error handler wrapper?
-- select() polling support (epoll() please :c)
-- co.make steal parameters
-- ?
@Python1320
Python1320 / opwhitelist.lua
Created July 28, 2014 09:24
luajit opcode whitelist for Garry's Mod
local bcnames = "ISLT ISGE ISLE ISGT ISEQV ISNEV ISEQS ISNES ISEQN ISNEN ISEQP ISNEP ISTC ISFC IST ISF MOV NOT UNM LEN ADDVN SUBVN MULVN DIVVN MODVN ADDNV SUBNV MULNV DIVNV MODNV ADDVV SUBVV MULVV DIVVV MODVV POW CAT KSTR KCDATAKSHORTKNUM KPRI KNIL UGET USETV USETS USETN USETP UCLO FNEW TNEW TDUP GGET GSET TGETV TGETS TGETB TSETV TSETS TSETB TSETM CALLM CALL CALLMTCALLT ITERC ITERN VARG ISNEXTRETM RET RET0 RET1 FORI JFORI FORL IFORL JFORL ITERL IITERLJITERLLOOP ILOOP JLOOP JMP FUNCF IFUNCFJFUNCFFUNCV IFUNCVJFUNCVFUNCC FUNCCW"
local jit = jit or require("jit")
assert(jit.version_num == 20003, "LuaJIT version mismatch")
local jutil = jit.util or require'jit.util'
local band = bit.band
local t = {}
@Python1320
Python1320 / gluasc
Created June 18, 2014 23:26
Gmod Lua Syntax Checker for SVNs
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <stdlib.h>
#include <stdio.h>
static const char *getF(lua_State *L, void *ud, size_t *size)
{
FILE *f=(FILE *)ud;