/*histogram,total=get_live_histo()returns a histogram of Y values from the viewport buffer (downsampled by HISTO_STEP_SIZE)histogram[Y value] = count, so it is zero based unlike a normal lua arraytotal is the total number of pixels, may vary depending on viewport size*/static int luaCB_get_live_histo( lua_State* L ){ unsigned short *h = malloc(256*sizeof(short)); if(!h) { return luaL_error(L,"malloc fail"); } int total=live_histogram_read_y(h); lua_createtable(L, 0, 256); int i; for(i=0;i<256;i++) { lua_pushnumber(L,h[i]); lua_rawseti(L,-2,i); } free(h); lua_pushnumber(L,total); return 2;}
I had it in my head that that array was not zero based.
Started by pigeonhill General Discussion and Assistance
Started by pigeonhill General Help and Assistance on using CHDK stable releases