Is it possible to automate the type checker?s

How could I replace this part of my code

with some sort of way to replace the strings with the keys of the module table automatically??

-- sample of the module

export type setting_name = "name" | "locked" | "roblox_server_type" | "flightpoint_server_type"

module.name = {
	locked = false,
	_type = "string",

	value = http_service:GenerateGUID(false)
}

module.locked = {
	locked = false,
	_type = "boolean",
	
	value = false,
}

You would have yo do something like table.unpack on the module, but i don’t know how you would implement the | character. Why do you need it automated? Which table are you talking anout?

2 Likes

The module table.

min character limit

As in the module itself?

also why do you need it automated cuz there might be a workaround

Nothing much, just for quality of life.

That isn’t really helpful, what do you mean by that? As in you can’t modify the source in-game, so why make it automated? I need more detail to be able to help.

I plan to add more values to the module, and this module structure might be used in other places, and the setting_name string type might need to be used here and there a few times. It is more of a small thing than a big influence on the project, but I’m just trying to see if it is possible.

You cannot automate writing the source of a script without using a plugin to do so, as a normal script lacks the capability Plugin. However, since the Studio command bar has that capability, you may be able to run a command there that reads the source of the module and updates the source of the desired script accordingly.

This doesn’t exactly solve your issue, however, Roblox is working on an implementation of keyof for this exact problem

2 Likes