mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 14:38:50 +00:00
add colour input and date input usage examples
This commit is contained in:
1 parent
9c7785ead0
commit
c220b7cb78
1 file changed
+16
@@ -229,6 +229,12 @@ local input = lib.inputDialog('Dialog title', {
|
||||
})
|
||||
|
||||
print(json.encode(input))
|
||||
|
||||
-- Getting r, g and b values from colour picker
|
||||
local r, g, b = string.match(input[4], "rgb%((%d+), (%d+), (%d+)%)")
|
||||
|
||||
-- Transforming unit date return to be used with Lua's os library
|
||||
local date = input[5] / 1000
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -249,6 +255,16 @@ const input = await lib.inputDialog('Police locker', [
|
||||
]);
|
||||
|
||||
console.log(JSON.stringify(input, null, 2));
|
||||
|
||||
// Getting r, g and b values from colour picker
|
||||
const regExp = /rgb\((\d+),\s*(\d+),\s*(\d+)\)/;
|
||||
const colourInput = input[3];
|
||||
|
||||
const color = regExp.exec(colourInput);
|
||||
|
||||
if (!color) return
|
||||
|
||||
console.log(+color[1], +color[2], +color[3])
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
Reference in new issue
Block a user