beyond-all-reason / spring

A powerful free cross-platform RTS game engine
https://beyond-all-reason.github.io/spring/
Other
210 stars 100 forks source link

Rmlui/element binding fixes #1457

Closed ChrisFloofyKitsune closed 5 months ago

ChrisFloofyKitsune commented 5 months ago

improvements and fixes to the Rml::Element SolLua bindings

the following Lua code blocks now work

local _target = document:GetElementById('target')
local _div = document:CreateElement('div')
_div:SetClass('element', true)
_div = _target:AppendChild(_div)
_div.style.width = '20px'
_div.style.height = '50px'

local _div_prepend = document:CreateElement('div')
_div_prepend.inner_rml = "p"
_div_prepend = _target:InsertBefore(_div_prepend, _div)

local _div_replace = document:CreateElement('div')
_div_replace.inner_rml = "r"

_div = _target:ReplaceChild(_div_replace, _div)
_div.inner_rml = 'asdf'
_div = _target:AppendChild(_div)
_div.style.width = nil
_div.style.height = ''
local textureElement = document:GetElementById('tex')

for k, v in textureElement.style:__pairs() do
    Spring.Echo(k .. ': ' .. v)
end