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

13
LINES

< > BotCompany Repo | #1004668 // bwImageToLua

JavaX fragment (include)

1  
static LuaValue bwImageToLua(final BWImage img) {
2  
  new LuaTable l;
3  
  l.set("w", Lua.value(img.getWidth()));
4  
  l.set("h", Lua.value(img.getHeight()));
5  
  l.set("getBrightness", new TwoArgFunction {
6  
    BWImage theimg = img; // << queryable by reflection
7  
    
8  
    public LuaValue call(LuaValue x, LuaValue y) {
9  
      ret LuaValue.valueOf(img.getPixel(x.toint(), y.toint()));
10  
    }
11  
  });
12  
  ret l;
13  
}

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: 529 / 507
Referenced in: [show references]