在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):jirutka/luasrcdiet开源软件地址(OpenSource Url):https://github.com/jirutka/luasrcdiet开源编程语言(OpenSource Language):Lua 95.5%开源软件介绍(OpenSource Introduction):LuaSrcDietCompresses Lua source code by removing unnecessary characters. This is revival of LuaSrcDiet originally written by Kein-Hong Man. Table of ContentsIntroductionLuaSrcDiet is a utility written in Lua for the purpose of turning Lua 5.1+ source code like this: local function calc_indent(s)
local col = 0
for i = 1, #s do
local c = sub(s, i, i)
col = col + 1
if c == "\t" then -- tab
while col % 8 > 0 do col = col + 1 end
end
end--for
return math.floor(col / 8)
end into a more compact or “squeezed” form (minus a lot of unnecessary characters) like this: local function _(l)local e=0
for o=1,#l do
local n=n(l,o,o)e=e+1
if n=="\t"then
while e%8>0 do e=e+1 end
end
end
return r.floor(e/8)end and still be able to run normally under standard Lua 5.1+ or LuaJIT 2.0+. LuaSrcDiet reduces the size of Lua 5.1+ source files by aggressively removing all unnecessary whitespace and comments, optimizing constant tokens, and renaming local variables to shorter names. For example, LuaSrcDiet squeezes its own sources from 156 kiB down to 42 kiB. Further bzip2 or lzma compression can bring the file size further down to under 13 kiB. That’s 12× reduction in size, if you don’t mind the decompression and compilation time. LuaSrcDiet is broadly similar to Luiz’s lstrip (tar.gz) for Lua 5.1, which can be found on Luiz’s Libraries and tools for Lua page. LuaSrcDiet with its modified Lua source code lexer and parser allows most optimization options to be enabled or disabled separately, and can do a bit more like renaming local variable names. There is also Matthew Wild’s squish, which incorporates LuaSrcDiet and offers more code compression options. Squish goes beyond what LuaSrcDiet does, as the latter (as a matter of policy) only sticks to source code readable by standard Lua binaries. LuaSrcDiet and ObfuscationOwing to the use of LuaSrcDiet among certain things like WoW add-ons, the following is a clarification of this author’s intentions:
Changes in This Fork
InstallationNote: If you want to bootstrap development environment for running tests, read the next section. Using LuaRocksYou can install luasrcdiet using LuaRocks (the Lua package manager):
or to get the latest development version:
Set Up Development Environment
DocumentationAcknowledgements
LicenseThis project is licensed under MIT License. For the full text of the license, see the COPYRIGHT file. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论