-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3316c04
commit 6287db6
Showing
6 changed files
with
68 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- Exports the entire shared script to the importing resource, so it can be loaded there | ||
|
||
local exportScriptString = nil | ||
function import() | ||
if not sourceResource or sourceResource == resource then | ||
return error("This function can only be called from another resource.") | ||
end | ||
if not exportScriptString then | ||
local f = fileOpen("core/shared_exported.lua", true) | ||
if not f then | ||
return error("Failed to open file.") | ||
end | ||
exportScriptString = fileRead(f, fileGetSize(f)) | ||
fileClose(f) | ||
if not exportScriptString or exportScriptString == "" then | ||
return error("Failed to read file.") | ||
end | ||
exportScriptString = "IS_IMPORTED = true\n\n" .. exportScriptString | ||
end | ||
return exportScriptString | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
-- Shared custom models table: | ||
customModels = {} | ||
|
||
function getCustomModels() | ||
return customModels | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
newmodels_reborn/optional/compatibility/shared_importfunc.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- Backwards compatibility with newmodels 3.3.0 | ||
|
||
-- Rewrite the import feature to include the shared_exported.lua file | ||
|
||
local exportScriptString = nil | ||
_import = import | ||
function import() | ||
local str = _import() | ||
if not exportScriptString then | ||
local f = fileOpen("optional/compatibility/shared_exported.lua", true) | ||
if not f then | ||
return error("Failed to open file.") | ||
end | ||
exportScriptString = fileRead(f, fileGetSize(f)) | ||
fileClose(f) | ||
if not exportScriptString or exportScriptString == "" then | ||
return error("Failed to read file.") | ||
end | ||
end | ||
return str .. "\n" .. exportScriptString | ||
end |