Compare commits
5 Commits
larryr1/pa
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14c0630c1e | ||
|
|
64cb0d15e8 | ||
|
|
322ddb6158 | ||
|
|
c71557feb7 | ||
|
|
98b4191504 |
@@ -78,7 +78,7 @@ local getObject = function(objectName)
|
|||||||
return getObjects()[objectName]
|
return getObjects()[objectName]
|
||||||
end
|
end
|
||||||
|
|
||||||
local createObject = function(basalt, objectName, id)
|
local createObject = function(objectName, id)
|
||||||
return getObject(objectName)(id, basalt)
|
return getObject(objectName)(id, basalt)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -515,6 +515,9 @@ basalt = {
|
|||||||
|
|
||||||
stop = stop,
|
stop = stop,
|
||||||
stopUpdate = stop,
|
stopUpdate = stop,
|
||||||
|
getTerm = function()
|
||||||
|
return baseTerm
|
||||||
|
end,
|
||||||
|
|
||||||
isKeyDown = function(key)
|
isKeyDown = function(key)
|
||||||
if(activeKey[key]==nil)then return false end
|
if(activeKey[key]==nil)then return false end
|
||||||
|
|||||||
@@ -419,7 +419,7 @@ return function(name, basalt)
|
|||||||
|
|
||||||
for objectName, _ in pairs(basalt.getObjects()) do
|
for objectName, _ in pairs(basalt.getObjects()) do
|
||||||
container["add" .. objectName] = function(self, id)
|
container["add" .. objectName] = function(self, id)
|
||||||
return self:addChild(basalt:createObject(objectName, id))
|
return self:addChild(basalt.createObject(objectName, id))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ end
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
basalt = function(basalt)
|
basalt = function(basalt)
|
||||||
local createObjectsFromXMLNode = function(node, env)
|
local function createObjectsFromXMLNode(node, env)
|
||||||
local layout = env[node.tag]
|
local layout = env[node.tag]
|
||||||
if (layout ~= nil) then
|
if (layout ~= nil) then
|
||||||
local props = {}
|
local props = {}
|
||||||
@@ -109,12 +109,20 @@ return {
|
|||||||
end
|
end
|
||||||
return basalt.createObjectsFromLayout(layout, props)
|
return basalt.createObjectsFromLayout(layout, props)
|
||||||
end
|
end
|
||||||
|
|
||||||
local objectName = node.tag:gsub("^%l", string.upper)
|
local objectName = node.tag:gsub("^%l", string.upper)
|
||||||
local object = basalt:createObject(objectName, node.attributes["id"])
|
local object = basalt.createObject(objectName, node.attributes["id"])
|
||||||
for attribute, expression in pairs(node.attributes) do
|
for attribute, expression in pairs(node.attributes) do
|
||||||
if (attribute:sub(1, 2) == "on") then
|
if (attribute:sub(1, 2) == "on") then
|
||||||
registerFunctionEvent(object, object[attribute], expression .. "()", env)
|
object[attribute](object, function(...)
|
||||||
|
local basaltCallback = basalt.getVariable(expression:gsub("\"", ""):gsub("\'", ""))
|
||||||
|
if(basaltCallback ~= nil) then
|
||||||
|
basaltCallback()
|
||||||
|
elseif(env[expression] ~= nil) then
|
||||||
|
env[expression]()
|
||||||
|
else
|
||||||
|
registerFunctionEvent(object, object[attribute], expression .. "()", env)
|
||||||
|
end
|
||||||
|
end)
|
||||||
else
|
else
|
||||||
local update = function()
|
local update = function()
|
||||||
local value = load("return " .. expression, nil, "t", env)()
|
local value = load("return " .. expression, nil, "t", env)()
|
||||||
@@ -124,7 +132,7 @@ return {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
for _, child in ipairs(node.children) do
|
for _, child in ipairs(node.children) do
|
||||||
local childObjects = basalt.createObjectsFromXMLNode(child, env)
|
local childObjects = createObjectsFromXMLNode(child, env)
|
||||||
for _, childObject in ipairs(childObjects) do
|
for _, childObject in ipairs(childObjects) do
|
||||||
object:addChild(childObject)
|
object:addChild(childObject)
|
||||||
end
|
end
|
||||||
@@ -159,6 +167,9 @@ return {
|
|||||||
end
|
end
|
||||||
setmetatable(env.props, {
|
setmetatable(env.props, {
|
||||||
__index = function(_, k)
|
__index = function(_, k)
|
||||||
|
if(updateFns[k] == nil) then
|
||||||
|
error("Property " .. k .. " not found")
|
||||||
|
end
|
||||||
return updateFns[k]()
|
return updateFns[k]()
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@@ -196,6 +207,24 @@ return {
|
|||||||
self:addChild(object)
|
self:addChild(object)
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
|
end,
|
||||||
|
|
||||||
|
loadLayoutFromString = function(self, xmlContent, props)
|
||||||
|
local wrappedProps = {}
|
||||||
|
if (props == nil) then
|
||||||
|
props = {}
|
||||||
|
end
|
||||||
|
for prop, value in pairs(props) do
|
||||||
|
wrappedProps[prop] = function()
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local layout = Layout.fromXML(xmlContent)
|
||||||
|
local objects = basalt.createObjectsFromLayout(layout, wrappedProps)
|
||||||
|
for _, object in ipairs(objects) do
|
||||||
|
self:addChild(object)
|
||||||
|
end
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
return object
|
return object
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ plugin[v] = function(base, name, basalt)
|
|||||||
if(base.init(self))then
|
if(base.init(self))then
|
||||||
local parent = self:getParent() or self
|
local parent = self:getParent() or self
|
||||||
self:setBackground(parent:getTheme(v.."BG"))
|
self:setBackground(parent:getTheme(v.."BG"))
|
||||||
self:setForeground(parent:getTheme(v.."Text"))
|
self:setForeground(parent:getTheme(v.."Text"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
basalt.madefor.cc
|
|
||||||
@@ -6,11 +6,11 @@ The Release version provides a specific, stable version of Basalt. Use this vers
|
|||||||
|
|
||||||
To download the Release version, use the following command:
|
To download the Release version, use the following command:
|
||||||
|
|
||||||
`wget run https://basalt.madefor.cc/install.lua release [remote_filename] [local_filename]`
|
`wget run https://raw.githubusercontent.com/Pyroxenium/Basalt/refs/heads/master/docs/install.lua release [remote_filename] [local_filename]`
|
||||||
|
|
||||||
In most cases, you'll likely want to use:
|
In most cases, you'll likely want to use:
|
||||||
|
|
||||||
`wget run https://basalt.madefor.cc/install.lua release latest.lua`
|
`wget run https://raw.githubusercontent.com/Pyroxenium/Basalt/refs/heads/master/docs/install.lua release latest.lua`
|
||||||
|
|
||||||
- `remote_filename`: The file name of the Basalt release you want to download (e.g., basalt-1.6.6.lua, latest.lua).
|
- `remote_filename`: The file name of the Basalt release you want to download (e.g., basalt-1.6.6.lua, latest.lua).
|
||||||
- `local_filename` (optional): The file name for the Basalt installation on your local system (e.g., basalt.lua).
|
- `local_filename` (optional): The file name for the Basalt installation on your local system (e.g., basalt.lua).
|
||||||
@@ -23,7 +23,7 @@ The Minified/Packed version is a compressed version of the Basalt code directly
|
|||||||
|
|
||||||
To download the Minified/Packed version, use the following command:
|
To download the Minified/Packed version, use the following command:
|
||||||
|
|
||||||
`wget run https://basalt.madefor.cc/install.lua packed [filename] [branch]`
|
`wget run https://raw.githubusercontent.com/Pyroxenium/Basalt/refs/heads/master/docs/install.lua packed [filename] [branch]`
|
||||||
|
|
||||||
- `filename` (optional): The file name for the Basalt installation (default: `basalt.lua`).
|
- `filename` (optional): The file name for the Basalt installation (default: `basalt.lua`).
|
||||||
- `branch` (optional): Choose between `master` and `dev` branches (default: `master`).
|
- `branch` (optional): Choose between `master` and `dev` branches (default: `master`).
|
||||||
@@ -34,7 +34,7 @@ The Source version, as the name suggests, contains the unmodified source code of
|
|||||||
|
|
||||||
To download the Source version, use the following command:
|
To download the Source version, use the following command:
|
||||||
|
|
||||||
`wget run https://basalt.madefor.cc/install.lua source [foldername] [branch]`
|
`wget run https://raw.githubusercontent.com/Pyroxenium/Basalt/refs/heads/master/docs/install.lua source [foldername] [branch]`
|
||||||
|
|
||||||
- `foldername` (optional): The folder name for the Basalt installation (default: `basalt`).
|
- `foldername` (optional): The folder name for the Basalt installation (default: `basalt`).
|
||||||
- `branch` (optional): Choose between `master` and `dev` branches (default: `master`).
|
- `branch` (optional): Choose between `master` and `dev` branches (default: `master`).
|
||||||
@@ -45,9 +45,9 @@ The Web version is designed for minimal project size and fetches the required co
|
|||||||
|
|
||||||
To download the Web version, use the following command:
|
To download the Web version, use the following command:
|
||||||
|
|
||||||
`wget run https://basalt.madefor.cc/install.lua web [version] [filename]`
|
`wget run https://raw.githubusercontent.com/Pyroxenium/Basalt/refs/heads/master/docs/install.lua web [version] [filename]`
|
||||||
|
|
||||||
- `version` (optional): Specify the desired version of Basalt (default: latest version). [Click here](https://github.com/Pyroxenium/Basalt/tree/master/docs/versions) to see the available versions.
|
- `version` (optional): Specify the desired version of Basalt (default: latest version). [Click here](https://github.com/Pyroxenium/Basalt/tree/master/docs/versions) to see the available versions.
|
||||||
- `filename` (optional): The file name for the Basalt installation (default: `basaltWeb.lua`).
|
- `filename` (optional): The file name for the Basalt installation (default: `basaltWeb.lua`).
|
||||||
|
|
||||||
**Note**: If using the Web version, remember to change `local basalt = require("basalt")` to `local basalt = require("basaltWeb")` in your code.
|
**Note**: If using the Web version, remember to change `local basalt = require("basalt")` to `local basalt = require("basaltWeb")` in your code.
|
||||||
|
|||||||
Reference in New Issue
Block a user