ofs
¶
Core functions
| print() | Print to the extension log |
| clamp() | Clamp a value |
| ofs.Version() | Get the API version |
| ofs.ExtensionDir() | Get the extension directory path |
| ofs.ScriptCount() | Get the currently loaded script count |
| ofs.ScriptName() | Get the script name |
Print to the extension log.
Takes a variable amount of arguments strings and numbers.
print("Number", 42) -- "Number 42"
Clamp a value
| val | (number) | |
| min | (number) | |
| max | (number) |
| (number) | Result |
Get the API version
| (number) | Version |
Get the extension directory path
| (string) | Path |
Get the currently loaded script count
| (number) | Count |
Get the script name
| scriptIdx | (number) |
| (String) | Name |
| ofs.ActiveIdx() | Gets the index of the currently active script |
| ofs.Script() | Get a currently loaded script Example
|
| ofs.Clipboard() | Get a read-only version of the clipboard |
| ofs.Undo() | Undo the last modification Note This function can only undo modifications done by a Lua extension |
Gets the index of the currently active script
| (number) | scriptIdx |
Get a currently loaded script
local script = ofs.Script(ofs.ActiveIdx())
| (Funscript) | funscript |
Get a read-only version of the clipboard
| (Funscript) | clipboard |
Undo the last modification
This function can only undo modifications done by a Lua extension.
| (bool) | hasUndoneSomething |
All of these functions must be called from within the gui() function.
| ofs.Text() | Display text |
| ofs.Button() | Create a button Example
|
| ofs.Input() | Create an input field Example
|
| ofs.InputInt() | Create an input field |
| ofs.Drag() | Create a numeric drag input |
| ofs.DragInt() | Create a numeric integer drag input |
| ofs.Slider() | Create a numeric slider |
| ofs.SliderInt() | Create a numeric integer slider |
| ofs.Checkbox() | Create a checkbox |
| ofs.Combo() | Create a combobox |
| ofs.CollapsingHeader() | Create a collapsable header Example
|
| ofs.SameLine() | Put next control on the same line as the previous Example
|
| ofs.Separator() | Insert a separator |
| ofs.NewLine() | Insert a new line between controls Example
|
| ofs.Tooltip() | Create a tooltip Example
|
| ofs.BeginDisabled() | Begin disabled area Example
|
| ofs.EndDisabled() | End disabled area |
Display text
| txt | (string) |
| (nil) |
Create a button
if ofs.Button("Click me") then
print("I was clicked!")
end
| txt | (string) |
| (bool) | clicked |
Create an input field
-- global variables
text = ""
number = 5
function gui()
text, textChanged = ofs.Input("Text", text)
number, valueChanged = ofs.Input("Number", number, 2)
end
| txt | (string) | |
| value | (string or number) | |
| stepSize | (number or nil) | only applies to numeric inputs, |
| 1. | (string or number) | value |
| 2. | (bool) | valueChanged |
Create an input field
| txt | (string) | |
| value | (string or number) | |
| stepSize | (number or nil) | only applies to numeric inputs, |
| 1. | (number) | value |
| 2. | (bool) | valueChanged |
Create a numeric drag input
| txt | (string) | |
| value | (number) | |
| stepSize | (number or nil) |
| 1. | (number) | value |
| 2. | (bool) | valueChanged |
Create a numeric integer drag input
| txt | (string) | |
| value | (number) | |
| stepSize | (number or nil) |
| 1. | (number) | value |
| 2. | (bool) | valueChanged |
Create a numeric slider
| txt | (string) | |
| value | (number) | |
| min | (number) | |
| max | (number) |
| 1. | (number) | value |
| 2. | (bool) | valueChanged |
Create a numeric integer slider
| txt | (string) | |
| value | (number) | |
| min | (number) | |
| max | (number) |
| 1. | (number) | value |
| 2. | (bool) | valueChanged |
Create a checkbox
| txt | (string) | |
| checked | (bool) |
| 1. | (bool) | checked |
| 2. | (bool) | checkChanged |
Create a combobox
| txt | (string) | |
| currentIdx | (number) | |
| items | (string[]) |
| 1. | (number) | currentIdx |
| 2. | (bool) | selectionChanged |
Create a collapsable header
function gui()
if ofs.CollapsingHeader("abc") then
ofs.Text("This text is only visible when the header is opened")
end
end
| txt | (string) |
| (bool) | headerOpened |
Put next control on the same line as the previous
ofs.Button("Button 1")
ofs.SameLine()
ofs.Button("Button 2")
| (nil) |
Insert a separator
| (nil) |
Insert a new line between controls
ofs.Button("Button 1")
ofs.NewLine()
ofs.Button("Button 2")
| (nil) |
Create a tooltip
ofs.Button("...")
ofs.Tooltip("The button does X") -- displayed when hovering the button
| txt | (string) |
| (nil) |
Begin disabled area
ofs.BeginDisabled(true)
ofs.Button("...") -- button is forever disabled
ofs.EndDisabled()
| disabled | (bool) |
| (nil) |
End disabled area
| (nil) |