https://github.com/fastering18/luavascript
JavaScript functions written in lua
https://github.com/fastering18/luavascript
javascript lua luau roblox robloxstudio
Last synced: 2 months ago
JSON representation
JavaScript functions written in lua
- Host: GitHub
- URL: https://github.com/fastering18/luavascript
- Owner: Fastering18
- License: mit
- Created: 2021-01-15T16:50:14.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-16T05:49:34.000Z (over 3 years ago)
- Last Synced: 2025-06-04T16:05:47.008Z (4 months ago)
- Topics: javascript, lua, luau, roblox, robloxstudio
- Language: Lua
- Homepage:
- Size: 16.6 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> **This project is discontinued.**
> As alternative you can use default roblox promise.
> check out another project [here](https://github.com/Fastering18/JS-like-discordia-bot)
# LuavaScript
JavaScript functions written in lua, Roblox Studio.## EXAMPLE USAGE
```lua
local JavaScript = require(path to main 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;-- ARRAY
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());
-- STRING
local str = String.new(" Hello World ");
print(str.toLowerCase().trim().value);-- PROCESS & Environment variables
-- this doesnt store env instead store into normal table.
process.env.token = "This isn't bot token";
print(process.env);-- PROMISE
local promise = Promise.new(function(resolve, reject)
wait(6)
if process.env == nil then
resolve("correct!")
else
reject("wrong!!")
end
end)
promise.result(
function(result)
print("Sucess: "..result);
end
).catch(
function(err)
print("error: "..err);
end
).finally(function()
print("promise ended")
end)
```[Toolbox LuavaScript](https://www.roblox.com/library/6244962761/LuavaScript)
Install package directly from ROBLOX toolbox.## Made by Fastering18, 2021
Please report any bug if you found, feedback appreciated!