script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.Frame.Visible == true then
script.Parent.Parent.Frame.Visible = false
end
if script.Parent.Parent.Frame.Visible == false then
script.Parent.Parent.Frame.Visible = true
end
end)
I am very new to coding (have started practically yesterday ) and ive decided to start with lua in roblox studio. The program here is working i can assure you (some things in code may not be in proper place since im having a bit trouble writing code on this site) but the code works. I have tried to make it seperatly for 2 buttons then I tried this and nothing seems to work. I am starting to think it is caused by the program itself and not the code since I can make other things invisible with that code. I've placed those 2 codes for visibility and invisibility in 1 thing since I've been told that events caused by the code happen at same time so some of them may not work.
Assume Visible is true. The first condition will be true and Visible will be set to false. Then, in the next condition Visible is false and the condition is therefore true, again. And it sets Visible back to true.
Now, in order to fix it you want to execute the second condition only if the first failed. Take a look at elseif https://www.lua.org/pil/4.3.1.html.
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.Frame.Visible == true then
script.Parent.Parent.Frame.Visible = false
elseif script.Parent.Parent.Frame.Visible == false then
script.Parent.Parent.Frame.Visible = true
end
end)
This code is still quite bulky and can be improved:
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Frame.Visible = not script.Parent.Parent.Frame.Visible
end)
Now you assign true to Visible if Visible does not evaluate to true. It basically toggles the boolean.
I am currently working on a project that uses Firebase Remote Config for feature flags. What I am wanting to try and do is create a new flag that combines multiple other values in the config. For instance:
Feature 1: True
Feature 2: True
Feature 3: False
Feature 4 = Feature 1 || Feature 2 || Feature 3 = True
Is this possible in Remote Config?
A workaround is to create multiple conditional values with the same value in the fourth parameter.
Like:
Parameter Feature 4:
default_value: FALSE
if condition_value_1: TRUE
if condition_value_2: TRUE
if condition_value_3: TRUE
I am hoping to set up keymaps for when I am in a git directory and when I am not. Maybe now that I am using Lua that maybe I cannot do this like this. Any help would be appreciated.
if vim.fn.isdirectory('.git') then
map('n', '<leader>t', '<cmd>lua require(\'telescope.builtin\').git_files({hidden = true})<CR>', options)
else
map('n', '<leader>e', '<cmd>lua require(\'telescope.builtin\').find_files({hidden = true})<CR>', options)
end
Seems like if always hits and never the else.
:h isdirectory
isdirectory({directory})
isdirectory() The result is a Number,
which is non-zero when a directory with the name {directory} exists.
If {directory} doesn't exist, or isn't a directory, the result is
FALSE. {directory} is any expression, which is used as a String.
:h FALSE
For boolean operators Numbers are used. Zero is FALSE, non-zero is
TRUE. You can also use |v:false| and |v:true|. When TRUE is returned
from a function it is the Number one, FALSE is the number zero.
Make sure that FALSE is actually false. It is probably 0 which would be a true value in Lua.
In Lua any values but false or nil are true.
So ideally check if vim.fn.isdirectory('.git') ~= 0 then
In clang-format the following template function declaration gets wrapped to three lines. I think it should only be wrapped to two. Is the problem in my .clang-format file or a bug in the tool?
template <class VEC3_T, class FLOAT_T>
FLOAT_T functionNamedBlahBlahhh(const VEC3_T blabla, const VEC3_T bla, FLOAT_T blah1,
FLOAT_T blah2) // foo
{
}
I am using clang-format version 10.0.0.
My .clang-format file is:
BasedOnStyle: LLVM # (LLVM, Google, Chromium, Mozilla, WebKit)
AccessModifierOffset: -4
AlignEscapedNewlines: Left
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
BreakBeforeBraces: Custom # If this is "Custom" then use the BraceWrapping settings
BraceWrapping:
AfterClass: false
AfterStruct: false
AfterUnion: true
AfterEnum: true
AfterNamespace: false
AfterControlStatement: false
AfterFunction: true
AfterExternBlock: false
BeforeCatch: true
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakConstructorInitializers: AfterColon
ColumnLimit: 130 # Drawback: AllowShort*OnASingleLine kind of goes crazy with it. Is there a Penalty property to adjust this?
IncludeBlocks: Regroup
IndentCaseLabels: false
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: false
PointerAlignment: Left
SpaceBeforeCpp11BracedList: true
UseTab: Never
I see a few other cases where it wraps a long line to 3+ lines, as well. Here's one more:
OCLShaderEnv::OCLShaderEnv(OCLEnv* oclEnv, SVMStruct* svm, std::string prog, std::string kernelName, int width, int height,
std::string buildOptions, Camera* camera, void* otherStuff, std::array<float, 4> fillColor) :
m_device(oclEnv->getDevice()),
m_context(oclEnv->getContext()), m_cmdQ(oclEnv->getCmdQ()), m_prog(prog), m_kernelName(kernelName), m_width(width),
m_height(height), m_camera(camera), m_svmStructPtr(svm), m_oclEnv(oclEnv)
{
}
Note the three lines of initializers that could easily fit on two.
In your first example, there appears to be an interaction between 1) starting with just one of the parameters on a line, and 2) having a comment on that line. If you remove the comment, it formats to:
template <class VEC3_T, class FLOAT_T>
FLOAT_T functionNamedBlahBlahhh(const VEC3_T blabla, const VEC3_T bla, FLOAT_T blah1, FLOAT_T blah2)
{
}
as you would expect. If you leave the comment, but start with all parameters on one line, it leaves them all on one line, as you would expect.
It seems like a bug in clang-format to me. Possibly it is intended behavior, thinking that the comment must apply to just that parameter and so shouldn't be moved around? But it's hard to imagine that being very useful.
Workaround: Remove the comment, or manually put all parameter together on one line.
In your second example, this seems to be an interaction between 1) having a constructor with enough parameters that the parameters take multiple lines, 2) having multiple initializers for that constructor, and 3) setting BreakConstructorInitializers: AfterColon. In this case, the first initializer is put on its own line even if it could be combined with the subsequent initializers.
This also seems like a bug in clang-format to me.
Workaround: Reduce the parameters to the constructor so that they fit on one line - which I know you shouldn't have to do, but might make your code cleaner anyway. Or set BreakConstructorInitializers to something other than AfterColon. Or just live with the sub-optimal formatting, which is probably what I would do :(.
I have two ways to print a report, into a PDF or on letterhead.
Is it possible to have in a report a customization so that in the PDF I have a logo in the header, and on the letterhead I don't have that logo in the header?
You could add a parameter with a boolean to the report. Something like IsPDF and then in the header Click on the Format Graphic (assuming it is an image) of the logo and then choose the X2 across from the Suppress checkbox.
From there you can write code that will suppress the graphic when the IsPDF paramater is False and not suppress when the IsPDF is True.
IF {?IsPDF} = True Then
False
Edit: After writing this out I think I would actually make the boolean parameter be IsLetterHead so that when it was True it would be consistent with the True in the Suppress. In other words
IF {?IsLetterHead} = True Then
True