shithub: slug

Download patch

ref: 476f6ebc9a88727fadb2cb5d18634008f814d401
parent: 264809a02a09aa38e5d565d4872622cba8d45d7e
author: phil9 <telephil9@gmail.com>
date: Fri Dec 2 04:31:30 EST 2022

lua interpreter fine-tuning

--- a/slug.c
+++ b/slug.c
@@ -12,6 +12,9 @@
 	int r;
 
 	L = luaL_newstate();
+	lua_gc(L, LUA_GCGEN, 0, 0);	
+	lua_pushboolean(L, 1);
+	lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
 	luaL_openlibs(L);
 	r = luaL_dofile(L, argc > 1 ? argv[1] : NULL);
 	if(r != LUA_OK){
@@ -118,6 +121,7 @@
 	alts[0].c = mc->c;
 	alts[1].c = mc->resizec;
 	alts[2].c = kc->c;
+	setfcr(getfcr() & ~(FPZDIV | FPOVFL | FPINVAL));	
 	L = linit(argc, argv);
 	registerapi(L);
 	initstate(L);