tabletopsimulator-lua-vscode icon indicating copy to clipboard operation
tabletopsimulator-lua-vscode copied to clipboard

luabundle can't handle file names with german umlauts (ä, ö, ü,)

Open AIIucard opened this issue 2 years ago • 1 comments

In TTS I have an object with a name which includes a german umlaut. The object also has a .lua script which includes a module which is located in another .ttslua file. If I get the script for the object from TTS in VS Code I get the code with the bundled module combined in one file:

-- Bundled by luabundle {"rootModuleName":"Liturgie- Ritualkenntnisse & Ausrüstung.e0daf2.lua","version":"1.6.0"}
local __bundle_require, __bundle_loaded, __bundle_register, __bundle_modules = (function(superRequire)
	local loadingPlaceholder = {[{}] = true}

	local register
	local modules = {}

	local require
	local loaded = {}

	register = function(name, body)
		if not modules[name] then
			modules[name] = body
		end
	end

	require = function(name)
		local loadedModule = loaded[name]

		if loadedModule then
			if loadedModule == loadingPlaceholder then
				return nil
			end
		else
			if not modules[name] then
				if not superRequire then
					local identifier = type(name) == 'string' and '\"' .. name .. '\"' or tostring(name)
					error('Tried to require ' .. identifier .. ', but no such module has been registered')
				else
					return superRequire(name)
				end
			end

			loaded[name] = loadingPlaceholder
			loadedModule = modules[name](require, loaded, register, modules)
			loaded[name] = loadedModule
		end

		return loadedModule
	end

	return require, loaded, register, modules
end)(nil)
__bundle_register("Liturgie- Ritualkenntnisse & Ausrüstung.e0daf2.lua", function(require, _LOADED, __bundle_register, __bundle_modules)
    local DataTableManager = require("DataTableManager")
    function onload(savedData)
        print("Hello World!")
    end
end)
__bundle_register("DataTableManager", function(require, _LOADED, __bundle_register, __bundle_modules)
    local Module = {}
    return Module
end)
return __bundle_require("Liturgie- Ritualkenntnisse & Ausrüstung.e0daf2.lua")

If I change the name to a name without an umlaut my .lua file for the object just contains

local DataTableManager = require("DataTableManager")
function onload(savedData)
    print("Hello World!")
end

If you know what's the issue it is very easy to avoid. But for my other fellow germans who are not knowing this, I guess it's a very annoying problem. I hope you can fix this and please keep up the awesome work on this extension. I have a huge project with 65.000+ lines of code and I don't know what I would do without your extension 😊

AIIucard avatar Mar 01 '23 00:03 AIIucard

Fixed in 2.0 when this PR for (new) dependency is merged.

rolandostar avatar Feb 15 '24 19:02 rolandostar