GustavoDestroyer

Roact

Dec 25th, 2021
1,192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. function _G.createElement(class, properties, children)
  2.     return {
  3.         ["Class"] = class,
  4.         ["Children"] = children,
  5.         ["Properties"] = properties
  6.     }
  7. end
  8.  
  9. function _G.mount(element, parent)
  10.     local instance = Instance.new(element.Class, parent)
  11.  
  12.     for name, value in pairs(element.Properties) do
  13.         instance[name] = value
  14.     end
  15.  
  16.     for _, child in pairs(element.Children) do
  17.         _G.mount(child, instance)
  18.     end
  19.  
  20.     return instance
  21. end
  22.  
  23. _G.Roact = {["createElement"] = _G.createElement, ["mount"] = _G.mount}
Advertisement
Add Comment
Please, Sign In to add comment