Skip to content

Instantly share code, notes, and snippets.

View starwing's full-sized avatar

Xavier Wang starwing

  • Chengdu
View GitHub Profile
@starwing
starwing / slnuinco_5.2_compat.patch
Created May 16, 2012 09:07
Patch to makes slnunico compatible with Lua 5.2
diff --git a/slnunico.c b/slnunico.c
index bc1124b..22efb00 100644
--- a/slnunico.c
+++ b/slnunico.c
@@ -94,6 +94,9 @@ http://www.unicode.org/Public/UNIDATA/PropList.txt
# define SLN_UNICODENAME "unicode"
#endif
+#if LUA_VERSION_NUM < 502
+# define luaL_setfuncs(L,l,nup) luaI_openlib(L,NULL,l,nup)
@starwing
starwing / strip.lua
Created January 6, 2012 19:25
a module using lpeg to strip comments and spaces in Lua code.
--[[
= ABOUT
This module uses Roberto Ierusalimschy's powerful new pattern matching library
LPeg[1] to tokenize Lua source-code in to a table of tokens. I think it handles
all of Lua's syntax, but if you find anything missing I would appreciate a mail
at [email protected]. This lexer is based on the BNF[2] from the Lua manual.
= USAGE
I've saved my copy of this module under [$LUA_PATH/lexers/lua.lua] which means