summaryrefslogtreecommitdiff
path: root/apps/plugins/lua
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua')
-rw-r--r--apps/plugins/lua/include_lua/draw_poly.lua13
-rw-r--r--apps/plugins/lua/lapi.c5
-rw-r--r--apps/plugins/lua/luaconf.h3
3 files changed, 13 insertions, 8 deletions
diff --git a/apps/plugins/lua/include_lua/draw_poly.lua b/apps/plugins/lua/include_lua/draw_poly.lua
index 23e02d0955..d5bc83ae39 100644
--- a/apps/plugins/lua/include_lua/draw_poly.lua
+++ b/apps/plugins/lua/include_lua/draw_poly.lua
@@ -46,7 +46,9 @@ local _poly = {} do
46 local flood_fill 46 local flood_fill
47 47
48 -- draws a non-filled figure based on points in t-points 48 -- draws a non-filled figure based on points in t-points
49 local function polyline(img, x, y, t_pts, color, bClosed, bClip, scale_x, scale_y) 49 local function polyline(img, x, y, t_pts, color, bClosed, bClip, scale_x, scale_y, b_size_only)
50 local draw_fn = _line
51 if b_size_only == true then draw_fn = function() end end
50 scale_x = scale_x or 1 52 scale_x = scale_x or 1
51 scale_y = scale_y or 1 53 scale_y = scale_y or 1
52 54
@@ -69,8 +71,7 @@ local _poly = {} do
69 else 71 else
70 pt2 = {t_pts[i] * scale_x, t_pts[i + 1] * scale_y} 72 pt2 = {t_pts[i] * scale_x, t_pts[i + 1] * scale_y}
71 end-- first and last point 73 end-- first and last point
72 74 draw_fn(img, pt1[1] + x, pt1[2] + y, pt2[1] + x, pt2[2] + y, color, bClip)
73 _line(img, pt1[1] + x, pt1[2] + y, pt2[1] + x, pt2[2] + y, color, bClip)
74 if pt1[1] > max_x then max_x = pt1[1] end 75 if pt1[1] > max_x then max_x = pt1[1] end
75 if pt1[2] > max_y then max_y = pt1[2] end 76 if pt1[2] > max_y then max_y = pt1[2] end
76 end 77 end
@@ -80,12 +81,12 @@ local _poly = {} do
80 end 81 end
81 82
82 -- draws a closed figure based on points in t_pts 83 -- draws a closed figure based on points in t_pts
83 _poly.polygon = function(img, x, y, t_pts, color, fillcolor, bClip, scale_x, scale_y) 84 _poly.polygon = function(img, x, y, t_pts, color, fillcolor, bClip, scale_x, scale_y, b_size_only)
84 scale_x = scale_x or 1 85 scale_x = scale_x or 1
85 scale_y = scale_y or 1 86 scale_y = scale_y or 1
86 if #t_pts < 2 then error("not enough points", 3) end 87 if #t_pts < 2 then error("not enough points", 3) end
87 88
88 if fillcolor then 89 if fillcolor and b_size_only ~= true then
89 flood_fill = flood_fill or require("draw_floodfill") 90 flood_fill = flood_fill or require("draw_floodfill")
90 local x_min, x_max = 0, 0 91 local x_min, x_max = 0, 0
91 local y_min, y_max = 0, 0 92 local y_min, y_max = 0, 0
@@ -119,7 +120,7 @@ local _poly = {} do
119 _NIL, _NIL, _NIL, _NIL, bClip, BSAND, fillcolor) 120 _NIL, _NIL, _NIL, _NIL, bClip, BSAND, fillcolor)
120 end 121 end
121 122
122 polyline(img, x, y, t_pts, color, true, bClip, scale_x, scale_y) 123 return polyline(img, x, y, t_pts, color, true, bClip, scale_x, scale_y, b_size_only)
123 end 124 end
124 125
125 -- expose internal functions to the outside through _poly table 126 -- expose internal functions to the outside through _poly table
diff --git a/apps/plugins/lua/lapi.c b/apps/plugins/lua/lapi.c
index 6426cd94a9..120f8c8313 100644
--- a/apps/plugins/lua/lapi.c
+++ b/apps/plugins/lua/lapi.c
@@ -1057,8 +1057,11 @@ static const char *aux_upvalue (StkId fi, int n, TValue **val) {
1057 } 1057 }
1058 else { 1058 else {
1059 Proto *p = f->l.p; 1059 Proto *p = f->l.p;
1060 if (!(1 <= n && n <= p->sizeupvalues)) return NULL; 1060 if (!(1 <= n && n <= p->nups)) // not a valid upvalue
1061 return NULL;
1061 *val = f->l.upvals[n-1]->v; 1062 *val = f->l.upvals[n-1]->v;
1063 if (!(1 <= n && n <= p->sizeupvalues)) // don't have a name for this upvalue
1064 return "";
1062 return getstr(p->upvalues[n-1]); 1065 return getstr(p->upvalues[n-1]);
1063 } 1066 }
1064} 1067}
diff --git a/apps/plugins/lua/luaconf.h b/apps/plugins/lua/luaconf.h
index f7dd99b19e..77d4057118 100644
--- a/apps/plugins/lua/luaconf.h
+++ b/apps/plugins/lua/luaconf.h
@@ -818,6 +818,7 @@ extern long rb_pow(long, long);
818/*else*/ 818/*else*/
819#define LUA_USER_H "lua_user.h" 819#define LUA_USER_H "lua_user.h"
820#define LUA_DISABLE_BYTECODE 820#define LUA_DISABLE_BYTECODE
821#ifndef SIMULATOR
821#define LUA_OPTIMIZE_DEBUG 2 /* Lua Compact Debug -- Terry Ellison 2015 */ 822#define LUA_OPTIMIZE_DEBUG 2 /* Lua Compact Debug -- Terry Ellison 2015 */
822 823#endif
823#endif 824#endif