Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1004668 // bwImageToLua

JavaX fragment (include)

static LuaValue bwImageToLua(final BWImage img) {
  new LuaTable l;
  l.set("w", Lua.value(img.getWidth()));
  l.set("h", Lua.value(img.getHeight()));
  l.set("getBrightness", new TwoArgFunction {
    BWImage theimg = img; // << queryable by reflection
    
    public LuaValue call(LuaValue x, LuaValue y) {
      ret LuaValue.valueOf(img.getPixel(x.toint(), y.toint()));
    }
  });
  ret l;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004668
Snippet name: bwImageToLua
Eternal ID of this version: #1004668/1
Text MD5: 5de10a0dc62b0e087671b12ebc63dc08
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-25 18:54:48
Source code size: 407 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 523 / 501
Referenced in: [show references]