-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLuavaScript.lua
More file actions
46 lines (33 loc) · 1.62 KB
/
LuavaScript.lua
File metadata and controls
46 lines (33 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--[[
LuaU & JavaScript function, written in LuaU with OOP programming.
Requested resources will automatically imported if its doesnt exist.
Made by Fastering18, 2021.
=====================================================================================
USAGE EXAMPLE:
local JavaScript = require(path to this module); -- You can fill with asset id of main module
local Array = JavaScript.Array;
local process = JavaScript.process;
local String = JavaScript.String;
local Promise = JavaScript.Promise;
local arr = Array.new({"Two", "Three"});
arr.unshift("One");
arr.push("Four");
print(arr.indexOf("Two"));
arr.forEach(function(element)
print("value: "..element);
end);
print(arr.toString());
]]
local Process, String, Array, Promise;
if (not script:FindFirstChild("DataType")) then local dataTypes = Instance.new("Folder"); dataTypes.Parent = script; end;
if (script:FindFirstChild("Process")) then Process = require(script.Process); else Process = require(6244642730); end;
if (script.DataType:FindFirstChild("String")) then String = require(script.DataType.String); else String = require(6244645359); end;
if (script.DataType:FindFirstChild("Array")) then Array = require(script.DataType.Array); else Array = require(6244647301); end;
if (script.DataType:FindFirstChild("Promise")) then Promise = require(script.DataType.Promise); else Promise = require(6245278266); end;
local module = {};
module.process = Process;
module.String = String;
module.Array = Array;
module.Promise = Promise;
-- Still on working -_-
return module;