Code Monkey home page Code Monkey logo

lim's Introduction


Last release License

LUA version Tic80 API

General vision

Lua Library Compactor is a small terminal program, created for to easily the compaction of Lua libraries in a format nicknamed of Local Package.

  In summary, Lim create a copy of the file used like argument and accomplish a serie of abbreviations and remotions of characters, trying not break the code logic. Its objective is not become the code more fast, but yes minor in relation to the characters size (and as a consequence in bytes)

  Lim can be used in practically all type of program that use Lua, but its main finality is assist in the build of small libraries to the Tic80 Tiny Computer, like the libraries natives of the project TinyLibrary.

  For obtain more informations about Lim, in relation to the rules, good pratices and others informations, click here.

Useful links
    LUA

    • Site
    • GitHub
    Tic80

    • API
    • Site
    • GitHub

Example

Original

--[[
		Simple example
]]

local seed = math.random(math.random(0, 65536))
_G.__CUR_MAP = 0 -- CURrent MAP

local function LIB_collision(ent1, ent2) -- ENTity
	-- reference
	local errorMsg = "Table not specified. Argument #"

	-- check arguments type
	assert(type(ent1) == "table", "1"..errorMsg)
	assert(type(ent2) == "table", "2"..errorMsg)

	-- collision between squares/rectangles
	return math.max(ent1.x, ent2.x) < math.min(ent1.x + ent1.width,  ent2.x + ent2.width ) &&
		   math.max(ent1.y, ent2.y) < math.min(ent1.y + ent1.height, ent2.y + ent2.height)
end

Compacted

local LIB={}
do local MR19,A0,T21,MM12,MM14=math.random,assert,type,math.max,math.min local seed=MR19(MR19(0,65536))__CUR_MAP=0 LIB.collision=function(a,b)local c="Table not specified. Argument #" A0(T21(a)=="table","1"..c)A0(T21(b)=="table","2"..c)return MM12(a.x,b.x)<MM14(a.x+a.width,b.x+b.width)&&MM12(a.y,b.y)<MM14(a.y+a.height,b.y+b.height)end end
--local reference=LIB

Local package

Structure
~    +--> Table that will be store the library functions
~    |
~ +---------+
1 local TL={}
~
2 do local MA0=math.abs TL.abs=function(a) return MA0(a) end end
~ ++ +----------------+ +----------------------------------+ +-+
~  |    |                                           |         |
~  |    +--> References to LUA functions            |         |
~  |                                                |         |
~  |                     Function of the library <--+         |
~  +----------------------------------------------------------+
~                 |
3 local lib=TL    +--> Contention to the library environment
~ +----------+
~      |
~      +--> Reference to the library

lim's People

Contributors

duckafire avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.