Skip to content

roblox-compilers/roblox-rb

 
 

Repository files navigation

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

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

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

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 98.4%
  • Other 1.6%