love.maker (automated distribution + minification)

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: love.maker (automated distribution + minification)

Post by ivan »

Good question. Personally I use the command line arguments. You can check these when your game starts in main.lua

Code: Select all

for k,v in pairs(arg) do
  if v == "--build" then
    require("build")
  end
end
Then run your game from the cmd
love mygamefolder --console --build
borr
Prole
Posts: 42
Joined: Wed Oct 16, 2019 7:39 pm

Re: love.maker (automated distribution + minification)

Post by borr »

thanks, I'll try this solution
borr
Prole
Posts: 42
Joined: Wed Oct 16, 2019 7:39 pm

Re: love.maker (automated distribution + minification)

Post by borr »

minifie makes mistake on file
<String `"ffi"`> at: 1:21
Error: maker/minify.lua:212: /classes/brushes/box.lua<108:36>: 1:21: Unexpected symbol
stack traceback:
[string "boot.lua"]:777: in function <[string "boot.lua"]:773>
[C]: in function 'error'
maker/minify.lua:212: in function 'perror'
maker/minify.lua:574: in function 'prefixexpr'
maker/minify.lua:776: in function 'primaryexpr'
maker/minify.lua:978: in function 'exprstat'
maker/minify.lua:1318: in function 'statement'
maker/minify.lua:1330: in function 'CreateLuaParser'
maker/minify.lua:3213: in function 'minify'
maker/main.lua:58: in function 'save'
Attachments
box.lua
(4.86 KiB) Downloaded 247 times
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: love.maker (automated distribution + minification)

Post by ivan »

Looks like the minifier library doesn't support function calls without the parens:

Code: Select all

require "ffi" -- doesn't work
Versus:

Code: Select all

require ("ffi") -- works
Thanks, I will look into this.
Also you could use "dump" instead of "minify" and that's guaranteed to work.
borr
Prole
Posts: 42
Joined: Wed Oct 16, 2019 7:39 pm

Re: love.maker (automated distribution + minification)

Post by borr »

with minify next stop at

Code: Select all

ffi.cdef[[
	typedef struct _BoxBrush {
		BoxCollider;
		Brush;
	} BoxBrush;
]]
do you use this script for minification? https://github.com/stravant/lua-minify
have you tried something else? for example this https://github.com/stravant/LuaMinify
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: love.maker (automated distribution + minification)

Post by ivan »

Thanks, I have pushed an update on Bitbucket and it seems to be working now:
https://github.com/2dengine/love.maker

Yes, I am using stravant's library with several modifications:
- vararg issue fixed
- no renaming for globals
- ffi hex numbers ending in ULL
- several other small improvements
Last edited by ivan on Sat Dec 11, 2021 8:17 am, edited 1 time in total.
borr
Prole
Posts: 42
Joined: Wed Oct 16, 2019 7:39 pm

Re: love.maker (automated distribution + minification)

Post by borr »

thanks, I'll take a look
borr
Prole
Posts: 42
Joined: Wed Oct 16, 2019 7:39 pm

Re: love.maker (automated distribution + minification)

Post by borr »

not work with minify

1:
Error: maker/minify.lua:949: attempt to index a nil value
stack traceback:
[string "boot.lua"]:777: in function '__index'
maker/minify.lua:949: in function 'expr'
maker/minify.lua:751: in function 'functionargs'
maker/minify.lua:833: in function 'simpleexpr'
maker/minify.lua:944: in function 'subexpr'
maker/minify.lua:951: in function 'expr'
maker/minify.lua:1004: in function 'exprstat'
maker/minify.lua:1318: in function 'statement'
maker/minify.lua:1330: in function 'block'
...
maker/minify.lua:3213: in function 'minify'
maker/main.lua:58: in function 'save'
2:
stop at

Code: Select all

local reset = "\x1B[m"
Error: maker/minify.lua:212: /logutility.lua<1:19>: Invalid Escape Sequence `x`.
stack traceback:
[string "boot.lua"]:777: in function <[string "boot.lua"]:773>
[C]: in function 'error'
maker/minify.lua:212: in function 'perror'
maker/minify.lua:336: in function 'CreateLuaTokenStream'
maker/minify.lua:434: in function 'CreateLuaParser'
maker/minify.lua:3213: in function 'minify'
maker/main.lua:58: in function 'save'
User avatar
pgimeno
Party member
Posts: 3541
Joined: Sun Oct 18, 2015 2:58 pm

Re: love.maker (automated distribution + minification)

Post by pgimeno »

FWIW \x is a LuaJIT extension backported from Lua 5.2. http://luajit.org/extensions.html#lua52
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: love.maker (automated distribution + minification)

Post by ivan »

Thanks! I have added the \x escape sequence to the minifier.
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests