add gui.process_template, vc.get_setting,vc.get_setting_str, vc.get_setting_info

This commit is contained in:
MihailRis 2026-05-21 21:30:42 +03:00
parent b307b5c93b
commit 411021052e
2 changed files with 12 additions and 5 deletions

View file

@ -319,9 +319,8 @@ function console.chat(...)
events.emit("core:chat", ...)
end
function gui.template(name, params)
local text = file.read(file.find("layouts/templates/"..name..".xml"))
text = text:gsub("%%{([^}]+)}", function(n)
function gui.process_template(source, params)
local text = source:gsub("%%{([^}]+)}", function(n)
local s = params[n]
if s == nil then
return
@ -341,6 +340,11 @@ function gui.template(name, params)
return text
end
function gui.template(name, params)
local text = file.read(file.find("layouts/templates/"..name..".xml"))
return gui.process_template(text, params)
end
session = require "core:internal/session"
stdcomp = require "core:internal/stdcomp"
entities.get = stdcomp.get_Entity

View file

@ -5,9 +5,12 @@ vc = {
is_headless = function()
return _vc_headless
end,
is_client = function ()
is_client = function()
return not _vc_headless
end
end,
get_setting = __vc_app.get_setting,
get_setting_str = __vc_app.get_setting_str,
get_setting_info = __vc_app.get_setting_info,
}
local _ffi = ffi