shithub: lua9

Download patch

ref: 8db3ff18d12a303370d95948e176723c062668ea
parent: e2ad29c5863708b6c2438257123dd474eb307126
author: telephil9 <[email protected]>
date: Sun Oct 25 05:20:33 EDT 2020

Added color module to export color constants to lua

--- a/ldraw.h
+++ b/ldraw.h
@@ -28,5 +28,6 @@
 /* libs */
 int openlibdraw(lua_State *L);
 int openlibkey(lua_State *L);
+int openlibcolor(lua_State *L);
 
 #endif
--- a/lua9.c
+++ b/lua9.c
@@ -222,6 +222,7 @@
 static const luaL_Reg libs[] = {
 	{ "draw", openlibdraw },
 	{ "key",  openlibkey },
+	{ "color", openlibcolor },
 	{ NULL, NULL },
 };
 
--- a/mkfile
+++ b/mkfile
@@ -11,6 +11,7 @@
 	image.$O \
 	geometry.$O \
 	key.$O \
+	color.$O \
 	utils.$O \
 	lua9.$O
 
--- a/sample.lua
+++ b/sample.lua
@@ -24,7 +24,7 @@
 
 draw.initdraw('lua sample')
 draw.einit(draw.Emouse|draw.Ekeyboard)
-red = draw.allocimage(display, rect(0,0,1,1), screen.chan, 1, 0xFF0000FF)
+red = draw.allocimage(display, rect(0,0,1,1), screen.chan, 1, color.RED)
 eresized()
 while true do
 	local e, ev = draw.event()