summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lgmp.lua17
-rw-r--r--src/plugin-luagmp.cc1
2 files changed, 11 insertions, 7 deletions
diff --git a/src/lgmp.lua b/src/lgmp.lua
index 2a09639..98bc6af 100644
--- a/src/lgmp.lua
+++ b/src/lgmp.lua
@@ -97,8 +97,8 @@ local function checkfopt(obj)
assert(obj == nil or isf(obj), "gmp floating point expected")
end
-local dtoz = prv.mpz_init_set_d
-local dtof = prv.mpf_init_set_d
+local dtoz
+local dtof
function z(value, base)
if value == nil then
@@ -1281,8 +1281,6 @@ function fmeta:get_d_2exp()
return prv.mpf_get_d_2exp(self)
end
-get_default_prec = prv.mpf_get_default_prec
-
function fmeta:get_prec()
checkf(self)
return prv.mpf_get_prec(self)
@@ -1625,15 +1623,20 @@ function fmeta:format(fmt, p)
end
function lgmp_lua_init(l_prv, l_aux)
+ prv = l_prv
+ aux = l_aux
+
aux.randmeta = randmeta
aux.zmeta = zmeta
aux.fmeta = fmeta
- prv = l_prv
- aux = l_aux
-
lgmpversion = prv.version
+ dtoz = prv.mpz_init_set_d
+ dtof = prv.mpf_init_set_d
+
+ get_default_prec = prv.mpf_get_default_prec
+
lgmp_init = nil
end
diff --git a/src/plugin-luagmp.cc b/src/plugin-luagmp.cc
index 82c917f..354c48c 100644
--- a/src/plugin-luagmp.cc
+++ b/src/plugin-luagmp.cc
@@ -2503,6 +2503,7 @@ extern unsigned char lgmp[];
static int _init_plugin(Lua *L)
{
+ while (L->gettop()) L->remove(1);
L->newtable(); // [1] = prv
L->newtable(); // [2] = aux
L->wrap_open(lgmp_initialize);