Page 2 of 3

Re: love.maker (automated distribution + minification)

Posted: Sun Feb 14, 2021 8:04 pm
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

Re: love.maker (automated distribution + minification)

Posted: Sun Feb 14, 2021 8:14 pm
by borr
thanks, I'll try this solution

Re: love.maker (automated distribution + minification)

Posted: Sun Feb 14, 2021 9:18 pm
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'

Re: love.maker (automated distribution + minification)

Posted: Sun Feb 14, 2021 9:40 pm
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.

Re: love.maker (automated distribution + minification)

Posted: Mon Feb 15, 2021 5:41 am
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

Re: love.maker (automated distribution + minification)

Posted: Mon Feb 15, 2021 9:27 am
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

Re: love.maker (automated distribution + minification)

Posted: Tue Feb 16, 2021 6:23 pm
by borr
thanks, I'll take a look

Re: love.maker (automated distribution + minification)

Posted: Tue Feb 16, 2021 6:59 pm
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'

Re: love.maker (automated distribution + minification)

Posted: Tue Feb 16, 2021 10:04 pm
by pgimeno
FWIW \x is a LuaJIT extension backported from Lua 5.2. http://luajit.org/extensions.html#lua52

Re: love.maker (automated distribution + minification)

Posted: Wed Feb 17, 2021 7:18 am
by ivan
Thanks! I have added the \x escape sequence to the minifier.