1 Commits

Author SHA1 Message Date
Larry Rowe
1d50585bfc Update Input.md
Added that input objects are derived from ChangeableObject.
2024-10-01 13:33:50 -04:00
7 changed files with 16 additions and 47 deletions

View File

@@ -78,7 +78,7 @@ local getObject = function(objectName)
return getObjects()[objectName] return getObjects()[objectName]
end end
local createObject = function(objectName, id) local createObject = function(basalt, objectName, id)
return getObject(objectName)(id, basalt) return getObject(objectName)(id, basalt)
end end
@@ -515,9 +515,6 @@ 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

View File

@@ -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

View File

@@ -100,7 +100,7 @@ end
return { return {
basalt = function(basalt) basalt = function(basalt)
local function createObjectsFromXMLNode(node, env) local createObjectsFromXMLNode = function(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,20 +109,12 @@ 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
object[attribute](object, function(...) registerFunctionEvent(object, object[attribute], expression .. "()", env)
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)()
@@ -132,7 +124,7 @@ return {
end end
end end
for _, child in ipairs(node.children) do for _, child in ipairs(node.children) do
local childObjects = createObjectsFromXMLNode(child, env) local childObjects = basalt.createObjectsFromXMLNode(child, env)
for _, childObject in ipairs(childObjects) do for _, childObject in ipairs(childObjects) do
object:addChild(childObject) object:addChild(childObject)
end end
@@ -167,9 +159,6 @@ 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
}) })
@@ -207,24 +196,6 @@ 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

1
docs/CNAME Normal file
View File

@@ -0,0 +1 @@
basalt.madefor.cc

View File

@@ -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://raw.githubusercontent.com/Pyroxenium/Basalt/refs/heads/master/docs/install.lua release [remote_filename] [local_filename]` `wget run https://basalt.madefor.cc/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://raw.githubusercontent.com/Pyroxenium/Basalt/refs/heads/master/docs/install.lua release latest.lua` `wget run https://basalt.madefor.cc/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://raw.githubusercontent.com/Pyroxenium/Basalt/refs/heads/master/docs/install.lua packed [filename] [branch]` `wget run https://basalt.madefor.cc/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://raw.githubusercontent.com/Pyroxenium/Basalt/refs/heads/master/docs/install.lua source [foldername] [branch]` `wget run https://basalt.madefor.cc/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,7 +45,7 @@ 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://raw.githubusercontent.com/Pyroxenium/Basalt/refs/heads/master/docs/install.lua web [version] [filename]` `wget run https://basalt.madefor.cc/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`).

View File

@@ -1,6 +1,6 @@
Input objects allow you to create a field where the user can enter text. Input objects allow you to create a field where the user can enter text.
In addition to the Object and VisualObject methods, Input objects have the following methods: Input objects are derived from Object, VisualObject, and ChangeableObject. Input objects have the following additional methods:
| | | | | |
|---|---| |---|---|