lua now runs on sub editor, added Game.GetEnabledContentPackages back for compatibility and printerror
This commit is contained in:
@@ -51,8 +51,11 @@ local function runFolder(folder, rootFolder, package)
|
||||
local s = search[i]:gsub("\\", "/")
|
||||
|
||||
if endsWith(s, ".lua") then
|
||||
executeProtected(s, rootFolder)
|
||||
print(string.format("%s: Executing %s", package.Name, getFileName(s)))
|
||||
local ok, result = pcall(executeProtected, s, rootFolder)
|
||||
if not ok then
|
||||
printerror(result)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -103,7 +106,6 @@ for package in allPackages do
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
setmodulepaths(modulePaths)
|
||||
|
||||
Hook.Add("stop", "luaSetup.stop", function ()
|
||||
|
||||
@@ -211,6 +211,11 @@ namespace Barotrauma
|
||||
return error;
|
||||
}
|
||||
|
||||
public static ContentPackage[] GetEnabledContentPackages()
|
||||
{
|
||||
return ContentPackageManager.EnabledPackages.All.ToArray();
|
||||
}
|
||||
|
||||
public static ItemPrefab GetItemPrefab(string itemNameOrId)
|
||||
{
|
||||
ItemPrefab itemPrefab =
|
||||
|
||||
@@ -282,6 +282,8 @@ namespace Barotrauma
|
||||
UserData.RegisterType<LuaUserData>();
|
||||
UserData.RegisterType<IUserDataDescriptor>();
|
||||
|
||||
lua.Globals["printerror"] = (Action<object>)PrintError;
|
||||
|
||||
lua.Globals["setmodulepaths"] = (Action<string[]>)SetModulePaths;
|
||||
|
||||
lua.Globals["dofile"] = (Func<string, Table, string, DynValue>)DoFile;
|
||||
|
||||
Reference in New Issue
Block a user