shithub: lu9-lua

Download patch

ref: 1ad2d84575ea270cd150f6ed29a98b14464ffa44
parent: e3416eb824cd27301c3f8a432efd52b77c10abf1
author: kvik <kvik@a-b.xyz>
date: Sun Feb 21 16:39:40 EST 2021

os9lib: handle no argument case of os.setlocale

--- a/los9lib.c
+++ b/los9lib.c
@@ -346,7 +346,8 @@
 static int
 os_setlocale(lua_State *L)
 {
-	if(lua_isnil(L, 1) || strcmp(luaL_checkstring(L, 1), "C") == 0)
+	if(lua_gettop(L) == 0 || lua_isnil(L, 1)
+	|| strcmp(luaL_checkstring(L, 1), "C") == 0)
 		lua_pushstring(L, "C");
 	else
 		luaL_pushfail(L);