From f97ec132048834b7a988c61ac52921bb179e4958 Mon Sep 17 00:00:00 2001 From: Fernando-A-Rocha Date: Thu, 1 Aug 2024 12:07:46 +0100 Subject: [PATCH] improve IS_IMPORTED --- newmodels_reborn/core/shared_exported.lua | 5 ++++- newmodels_reborn/core/shared_importfunc.lua | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/newmodels_reborn/core/shared_exported.lua b/newmodels_reborn/core/shared_exported.lua index 874fa08..626e63a 100644 --- a/newmodels_reborn/core/shared_exported.lua +++ b/newmodels_reborn/core/shared_exported.lua @@ -1,5 +1,8 @@ -- !! THIS SCRIPT IS ENTIRELY EXPORTED !! --- Variable IS_IMPORTED will be true if this script is imported by another resource + +-- Variable IS_IMPORTED will be replaced to true +-- when this script is imported by another resource using the import() function +IS_IMPORTED = false local isClientsideScript = localPlayer ~= nil diff --git a/newmodels_reborn/core/shared_importfunc.lua b/newmodels_reborn/core/shared_importfunc.lua index f5fd793..8a02604 100644 --- a/newmodels_reborn/core/shared_importfunc.lua +++ b/newmodels_reborn/core/shared_importfunc.lua @@ -15,7 +15,7 @@ function import() if not exportScriptString or exportScriptString == "" then return error("Failed to read file.") end - exportScriptString = "IS_IMPORTED = true\n\n" .. exportScriptString + exportScriptString = exportScriptString:gsub("IS_IMPORTED = false", "IS_IMPORTED = true") end return exportScriptString end