ref: e4254ca19f3d361a97a4082bc7442e84dcd19254
parent: 9dc192ff25b54550a4cdb092d30c8be55475af5f
author: phil9 <[email protected]>
date: Fri Dec 2 04:47:48 EST 2022
implement radians() to convert from degrees to radians
--- a/api.c
+++ b/api.c
@@ -419,6 +419,16 @@
return 0;
}
+int
+cradians(lua_State *L)
+{
+ int a;
+
+ a = luaL_checkinteger(L, 1);
+ lua_pushnumber(L, a*PI/180.0);
+ return 1;
+}
+
void
registerfunc(lua_State *L, const char *name, int(*f)(lua_State*))
{
@@ -457,5 +467,6 @@
registerfunc(L, "quad", cquad);
registerfunc(L, "transpose", ctranspose);
registerfunc(L, "rotate", crotate);
+ registerfunc(L, "radians", cradians);
}