From 244e0e3be6451cf43fb7e45990c2702aad8ba063 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Sun, 3 May 2015 20:18:59 +0200 Subject: [PATCH] Replaced calls for IntLlib's global variable At the beginning of the files, when the mod looks for intllibs, it does it by looking for a variable defined by the library, but when the intllib mod isn't loaded, it ends up calling for a global variable. Here is a more clean way to check whether or not the variable exists using a lua function instead of a call for this variable. --- food_basic/ingredients.lua | 2 +- food_basic/init.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/food_basic/ingredients.lua b/food_basic/ingredients.lua index cd33fb3..27c5feb 100644 --- a/food_basic/ingredients.lua +++ b/food_basic/ingredients.lua @@ -8,7 +8,7 @@ -- Boilerplate to support localized strings if intllib mod is installed. local S = 0 -if (intllib) then +if rawget(_G, "intllib") then dofile(minetest.get_modpath("intllib").."/intllib.lua") S = intllib.Getter(minetest.get_current_modname()) else diff --git a/food_basic/init.lua b/food_basic/init.lua index 5e84fd4..9f035d4 100644 --- a/food_basic/init.lua +++ b/food_basic/init.lua @@ -13,7 +13,7 @@ dofile(minetest.get_modpath("food_basic").."/ingredients.lua") -- Boilerplate to support localized strings if intllib mod is installed. local S = 0 -if (intllib) then +if rawget(_G, "intllib") then dofile(minetest.get_modpath("intllib").."/intllib.lua") S = intllib.Getter(minetest.get_current_modname()) else