• robertmuench

    The SO answer applies to Linux not to Windows.

    Since mingw is used, I'm not sure if the limitation you see comes from this. Have you tried to use MVCS or Intel compilers?

    posted in General Discussion read more
  • robertmuench

    What's the exact problem? Since from the function thread.new(...) it should be possible.

    posted in General Discussion read more
  • robertmuench

    Which doesn't imply that this is necessary for own created stuff. Maybe better to make it totally clear and explicit:

    ""Bundle assumes luapower's toolchain and directory layout. You have to place your own code in the luapower directory."

    posted in General Discussion read more
  • robertmuench

    In the case the image data is loaded from a string. If you omit it, you have a CDATA type.

    posted in General Discussion read more
  • robertmuench

    This works:
    ./mgit bundle -a "..." -m "... main.lua" -M main -o myapp.exe

    This doesn't:
    ./mgit bundle -a "..." -m "... ./mycode/main.lua" -M main -o myapp.exe

    Seems the loader can't handle paths etc. correctly or assume paths or whatever. Haven't tracked it down. It falls back to LuaJIT command line without any error message. Will take a look to:

    1. Handle paths
    2. Print a error message, what's missing, not found etc.

    posted in General Discussion read more
  • robertmuench

    Bug found:

    Line 156 in libpng.lua is wrong, which handles embedded assets:

    New: local ok, err = pcall(buffered_read, dbuf, tonumber(dsz))
    Old: local ok, err = pcall(buffered_read, dbuf, dsz)

    I will create a PR.

    posted in General Discussion read more
  • robertmuench

    @FrozenEye cairo_mask is type string after it was loaded as embedded asset. Not sure if I need to load binary data differently.

    posted in General Discussion read more
  • robertmuench

    If I do this, I get a seg fault 11 on OSX:

    local cairo_mask = bundle.load("cairo_mask.png")
    local cmi = libpng.load(cairo_mask)

    posted in General Discussion read more
  • robertmuench

    Ok, fixed this one too. What is needed is this:

    1. You load a PNG file (which results in a bitmap)
    2. You need to check if the format fits some Cairo formats. If not, you need to bitmap.copy(...) into a supported format

    -- load PNG file via libpng
    local cmi = libpng.load("cairo_mask.png") -- gives an image
    print(inspect(cmi))
    print("PNG loaded")
    cmi = bitmap.copy(cmi, "bgra8")

    So, this works now when loading from a file, but still not when loading from an embedded string.

    posted in General Discussion read more
  • robertmuench

    Investigating further I just loaded the PNG with libpng to see what's happening:

    -- load PNG file via libpng
    local cmi = libpng.load("cairo_mask.png") -- gives an image
    print(inspect(cmi))
    print("PNG loaded")
    print(cairo.cairo_format(cmi.format))

    local cms = cairo.image_surface(cmi) -- create a surface from image
    print(inspect(cms))
    print("Surface created")
    local cmsp = cairo.surface_pattern(cms) -- create a suferface pattern from surface

    gives:

    {
    data = <cdata 1>,
    file = {
    bgcolor = <cdata 2>,
    bpc = 8,
    channels = "rgba",
    format = "rgba8",
    h = 300,
    interlaced = false,
    paletted = false,
    passes = 1,
    w = 300
    },
    format = "rgba8",
    h = 300,
    size = 360000,
    stride = 1200,
    w = 300
    }
    PNG loaded
    nil
    /luapower/bin/osx64/luajit-bin: ./cairo.lua:980: invalid enum value for CAIRO_FORMAT_

    So, I'm wondering why I get the "rgba8" format which can't be translated into a Cairo format (that's the NIL)...

    posted in General Discussion read more
  • robertmuench

    I have this code:

    -- load assets
    11: local cairo_mask = {string = bundle.load("cairo_mask.png")}
    12: print("PNG loaded, type = ", type(cairo_mask))
    13: local bu = libpng.load(cairo_mask)
    14: print("PNG created")

    and

    ./luapower-playground/saph_nw_test: ./luapower-playground/saph_nw_test.lua:13: libpng.lua:120: libpng.lua:51: bad argument #1 to 'min' (number expected, got cdata)
    stack traceback:
    glue.lua:430: in function <glue.lua:427>
    [C]: in function 'error'
    libpng.lua:120: in function <libpng.lua:119>
    [C]: in function 'png_error'
    libpng.lua:156: in function <libpng.lua:154>
    [C]: in function 'png_read_info'
    libpng.lua:196: in function <libpng.lua:93>
    [C]: in function 'xpcall'
    glue.lua:438: in function 'fpcall'
    glue.lua:451: in function 'load'

    I'm wondering why this boms inside of libpng.read(...)

    posted in General Discussion read more
  • robertmuench

    Take a look at: winapi_demo.lua

    This should get you started. You need to "import" the stuff with REQUIRE.

    posted in General Discussion read more
  • robertmuench

    Ok, found it out. The problem was that the main module given after the -M switch (without .lua extension), needs to be included in the -m list of Lua modules (with .lua extension) that get compiled into the EXE.

    posted in General Discussion read more
  • robertmuench

    Saw that the terra stuff is included: https://luapower.com/terra

    Cool!

    posted in General Discussion read more
  • robertmuench

    Trying to get a better understanding how all things work together I tried this:

    D:\develop\Lua\luapower> ./luapower check
    undocumented packages (10)
    --------------------------
    blur
    hash_benchmark
    libogg
    libsodium
    libssh2
    libvorbis
    luapower-repos
    openssl
    sg
    unit
    
    module load errors (4)
    ----------------------
    bundle               .\bundle.lua:10: attempt to index global 'arg' (a nil value)
    videoinput           .\videoinput.lua:16: module 'videoinput_dshow' not found
    videoinput_cocoa     .\videoinput_cocoa.lua:7: .\objc_dispatch.lua:144: cannot resolve symbol '_dispatch_data_empty': The specified procedure could not be found.
    winapi.dsound        .\winapi\dsound.lua:373: Undefined winapi global FLT_MIN
    
    .\winapi\cairosgpanel.lua:24: attempt to index field 'cache' (a nil value)
    stack traceback:
            .\winapi\cairosgpanel.lua:24: in function 'handler'
            .\winapi\basewindowclass.lua:470: in function <.\winapi\basewindowclass.lua:457>
            [C]: in function 'xpcall'
            .\winapi\basewindowclass.lua:81: in function <.\winapi\basewindowclass.lua:80>
            [C]: in function 'DestroyWindow'
            .\winapi\window.lua:118: in function <.\winapi\window.lua:116>
    

    What does it exactly does? Note, I'm a Lua novice so might not get all subtle information...

    posted in General Discussion read more
  • robertmuench

    I'm still having problems as it looks. When I create an exe and let it run it works if luapower folder is below the EXE:

    nw_demo.exe
    luapower/...
    

    Same for winapi_demo.lua I used this line to bundle it:

    ./mgit bundle -v -a 'dasm_x86 z png freetype pixman cairo' -m 'nw.lua nw_winapi.lua glue.lua bo
    x2d.lua time.lua pp.lua ffi_reflect.lua cbframe.lua cbframe_x86.dasl cbframe_x86_h.lua dynasm.lua dasm.lua dasm_mm.lua b
    itmap.lua winapi.lua winapi/*.lua cairo.lua cairo_h.lua' -M ../winapi_demo -o ../winapi_demo.exe
    

    But when I copy the EXE to some other place and run it, I get:

    C:\Users\robby\Desktop> .\winapi_demo.exe
    LuaJIT 2.1.0-beta2 -- Copyright (C) 2005-2016 Mike Pall. http://luajit.org/
    JIT: ON SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse
    >
    

    It looks like there are some files loaded when the EXE is run, but I don't know wich ones.

    posted in General Discussion read more
  • robertmuench

    Nice catch.

    What kind of wrapper do you wanted to build? As cairo is available in luapower it shouldn't be hard to get the lib linked and create a small higher level Lua interface.

    posted in General Discussion read more
  • robertmuench

    Playing around with the ./luapower command. So I started the RPC server with:

    D:\develop\Lua\luapower> ./luapower server -v
    listening on *:19994

    and then tried to run some command against it:

    D:\develop\Lua\luapower> ./luapower -p 19994 version nw
    D:\develop\Lua\luapower\bin\mingw64\luajit.exe: .\socketloop.lua:55: .\luapower.lua:1750: invalid ip or platform
    stack traceback:
    .\glue.lua:396: in function <.\glue.lua:395>
    [C]: in function 'assert'
    .\luapower.lua:1750: in function 'connect'
    luapower_cli.lua:534: in function <luapower_cli.lua:533>
    [C]: in function 'pcall'
    .\socketloop.lua:182: in function <.\socketloop.lua:181>
    stack traceback:
    [C]: in function 'error'
    .\socketloop.lua:184: in function <.\socketloop.lua:181>
    stack traceback:
    [C]: in function 'error'
    .\socketloop.lua:12: in function 'assert_resume'
    .\socketloop.lua:61: in function 'resume'
    .\socketloop.lua:55: in function 'newthread'
    luapower_cli.lua:533: in main chunk
    [C]: at 0x00401f80
    D:\develop\Lua\luapower>

    However, I managed to crash the luapower RPC server as well. But maybe I'm using all this totally wrong. Are there are any examples? I have the feeling it would be a good tool to find dependencies which need to be used with ./mgit bundle

    posted in General Discussion read more
  • robertmuench

    Hi, I'm thinking how to best do DSL in Lua (as I have a specific use-case for a descriptive GUI system in mind). There comes Meta-Lua to mind and the Terra-Lang stuff.

    Since Terra-Lang seems to use LuaJIT as well, I'm wondering if it can be used with the luapower stack as well.

    Has anyone any experience with the Terra-Lang stuff and luapower?

    -- Robert

    posted in General Discussion read more
  • robertmuench

    @cosmin said:

    1. -b is for including binaries that you then load via the bundle module. You won't be able to just require() those.

    Ok. Not sure that I understand everything but I now used -b and it seems to work as well.

    1. .lua modules (added with -m) are compiled so you can't get their source code (but you can -m them and also -b them to get the source code).

    I don't get the part in (...) So, when I use -m AND -b for *.lua files, the code is included?

    posted in General Discussion read more
Internal error.

Oops! Looks like something went wrong!