tabletopsimulator-lua-vscode
tabletopsimulator-lua-vscode copied to clipboard
Require and Path
I have an existing mod from a github repo (https://github.com/jotakami/warroom) which i would like to edit. I placed a copy of the repo in c:/users/<MyUser>/Tabletop Simulator/warroom-tts. The Global.-1.lua from my custom savefile only contains the lines:
--[[ Lua code. See documentation: https://api.tabletopsimulator.com/ --]]
require("warroom-tts/global")
--[[ The onLoad event is called after the game save finishes loading. --]]
function onLoad()
--[[ print('onLoad!') --]]
end
--[[ The onUpdate event is called once per frame. --]]
function onUpdate()
--[[ print('onUpdate loop!') --]]
end
in order to embed the games global file.
Upon using Save and Play i get the errors
Error in Script (Global): libfunc_require:(12,1-44): module 'warroom-tts/global' not found
Failed to bundle resolved module warroom-tts/global
Is the problem here a misunderstanding of tts concepts or is my setup not compatible with the way the vscode extension is supposed to work? (Looking at https://github.com/rolandostar/tabletopsimulator-lua-vscode/issues/11 it seems a bit fiddly) I also tried absolute paths. Interestingly the TTS Includes section in VSCode lists all the game files
I'm having a similar issue. My project lives on my PC under a GitHub folder (GitHub Desktop), so I added that path to the extension's list of "Include Other Files". My Global.-1.lua looks like
require("skypirate-public-tts/src/Main")
src/Main has this at the top
local Decker = require('Decker.Decker')
-- ... other lua code
Decker.ttslua
is located in the same folder as Main.ttslua
Anyway, Save & Play just tells me it failed to bundle resolved module skypirate-public-tts/src/Main. I'm assuming I've just missed something, but can't figure it out for the life of me.
I got it to work by explicitly adding the directory where my code is in setting for @id:TTSLua.includeOtherFilesPaths . That the folder that contained my main.ttslua was in was opened did not seem to work.
Edit: And now it stopped working seven days later.
Could we have a option so the combined search paths are displayed in the console to make it possible to see what is not found. Something like: looking in c:\Users\foo\game\main.ttslua for require("game/main")