Easily import modules and create classes

Hello, Easy imports and classes is a plugin that allowes you to import modules and create classes easily
It utilizes the Script Editor API so if you don’t have it enabled, please enable it to use the plugin

warning # and ; in this plugin are important, # signifies a start of the plugin statement and ; signifies the end of it

Imports
To import a module you write:
#import ModuleName;

it will import ModuleName in a variable called ModuleName producing a result like this:
local ModuleName = require(PATH_TO_MODULE_NAME)
of course the path will be automatically replaced with the correct one

if you want to call the variable differently add as at the end

#import ModuleName as Name;
will produce following code

local Name = require(PATH_TO_MODULE_NAME)

classes
#class Name;

will produce code for a class
prefixing class with public or export (for example #public class Hello;) will add return CLASS_NAME at the end which should be used only in module scripts

#class Name extends OtherClassName;
will create a class which will extend the OtherClassName
extends is interchangeable with inherits

#class Name extends OtherClassName import;
Will ALSO try to import OtherClassName

Video showcasing the plugin:

Warning: this plugin was made in few hours so you can expect bugs and if you look into the source code of the plugin its very ugly

5 Likes

Very interesting! I can see this saving people a lot of time writing code. Little short cuts like this are always a nice feature to see on the platform. :+1:

1 Like

Cool plugin, but I think it should utilize game:GetService(...) instead of referencing services directly, and also for class constructors, it is simpler to use return setmetatable({...}, ClassName), because adding that extra local variable is redundant

1 Like