As a Roblox developer, it is currently too hard to build a Luau package that works both within Roblox and Luau generally, this is because unlike the entirety of Luau tooling externally, Roblox forces us to use the script.Parent.Module
syntax.
If we’re writing code directly for Roblox, this isn’t an issue (and is pretty user friendly actually). The issue is when I’m trying to write tests externally for said project. Roblox doesn’t provide us with roblox-cli
, so we have to come up with hacky solutions like this to convert the script
system to a relative path system:
local function dir(directory: string)
return setmetatable({} :: { [string]: any },
{ __index = function(_, path) return directory .. path end })
end
local script = dir ""
script.Parent = dir "./"
return script
And this is at the top of every script that uses require
:
if not script then script = require("./RelativeString") end
Instead, if Roblox allowed us to require the same way we require from Lune or any other external tool, we wouldn’t need this hacky script to get string paths from a script
parameter.
If Roblox is able to address this issue, it would improve my development experience because I wouldn’t need a hacky module to require modules externally.