Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/r-unic/rogems

A Ruby to Lua transpiler written in pure Ruby for use in the Roblox game engine
https://github.com/r-unic/rogems

compiler game lua roblox roblox-ruby rogems ruby transpiler

Last synced: about 2 months ago
JSON representation

A Ruby to Lua transpiler written in pure Ruby for use in the Roblox game engine

Awesome Lists containing this project

README

        


build_ci


Gem Version

# RoGems
RoGems is a Ruby to Lua transpiler written for use with Roblox (like roblox-ts)
It is **unfinished**.

## Examples
See examples for more

### Lava Bricks
Ruby Source
```rb
collection = game.GetService("CollectionService")
lava_bricks = collection.GetTagged("Lava")

lava_bricks.each do |lava|
lava.Touched.Connect do |hit|
parent = hit.Parent
humanoid = parent.FindFirstChildOfClass("Humanoid")
if !humanoid.nil? then
humanoid.TakeDamage(humanoid.Health)
end
end
end
```

Lua Output
```lua
local ruby = require(game.ReplicatedStorage.Ruby.Runtime)

local collection = game:GetService("CollectionService")
local lava_bricks = collection:GetTagged("Lava")
for lava in ruby.list(lava_bricks) do
(type(lava.Touched) == "function" and lava:Touched() or lava.Touched):Connect(function(hit)
local parent = (type(hit.Parent) == "function" and hit:Parent() or hit.Parent)
local humanoid = parent:FindFirstChildOfClass("Humanoid")
if humanoid == nil then
humanoid:TakeDamage((type(humanoid.Health) == "function" and humanoid:Health() or humanoid.Health))
end
end)
end
```