. . . "<p>In the current version of GHub the <code>PROFILE_ACTIVATED</code> event has its second parameter <code>arg=nil</code> (in the previous versions <code>arg</code> was <code>0</code>), so you must replace</p>\n<pre><code>OutputLogMessage(&quot;event = %s, arg = %d\\n&quot;, event, arg)\n</code></pre>\n<p>with either</p>\n<pre><code>OutputLogMessage(&quot;event = %s, arg = %s\\n&quot;, event, tostring(arg))\n</code></pre>\n<p>or</p>\n<pre><code>OutputLogMessage(&quot;event = %s, arg = %d\\n&quot;, event, arg or 0)\n</code></pre>\n<p>Without such modification, all your GHub scripts now fail to handle events <code>PROFILE_ACTIVATED</code> and <code>PROFILE_DEACTIVATED</code> as the code generates an exception at the line <code>OutputLogMessage</code>.</p>\n"^^ . . . . "<p>How can I get points of parabola as by the Bresenham's argorithm?</p>\n<p>Now I have:</p>\n<pre><code>function getParabolaBresenham (x0, y0, a, b, c, deltaXmax)\n local pixels = {}\n local dy = 0\n local dx = 0\n local p = b\n\n while math.abs(dx) &lt;= deltaXmax do\n local x1 = x0 + dx\n local y1 = a * x1 * x1 + b * x1 + c\n setPixel(pixels, x1, y1)\n dy = dy + 1\n if p &lt; 0 then\n dx = dx + 1\n p = p + 2 * a\n else -- next column\n dy = dy + 1\n dx = dx + 1\n p = p + 2 * a - 2 * b\n end\n end\n return pixels\nend\n</code></pre>\n<p>where x0, y0 - starting point of drawn parabola;</p>\n<p>a, b, c, - parabola's values in function y = a * x * x + b * x + c</p>\n<p>deltaXmax - the horizontal limit of parabola</p>\n<p><em>(the deltaYmax will be helpful too)</em></p>\n<p>Actually, I need to draw every second manhattan's pixel, but it will be helpful to fix the problem.</p>\n"^^ . "0"^^ . . . . . "-1"^^ . . . . "<p>I have created a Quarto extension to remove all occurrences of &quot;.html&quot; from the links. The Lua script is as follows:</p>\n<pre><code>function Link(el)\n local str = el.target\n local result = str:gsub(&quot;(.-)%.html(.-)&quot;, &quot;%1%2&quot;)\n el.target = result\n return el\nend\n</code></pre>\n<p>It works perfectly in the test example created within the extension. However, when I include it in my Quarto book project, it doesn't work.</p>\n<p>The extension is being called correctly because I replaced the code with another one to format tags with italics, and upon rendering, it worked. But when I put the above code back, it doesn't work. All links ( tags) still have &quot;.html.&quot;</p>\n<p>I also tried changing the order so that my filter runs after the Quarto’s built-in filters (as below), but it still didn't work.</p>\n<pre><code>filters:\n - lightbox\n - quarto\n - strip-dot-html-off\n</code></pre>\n<p>Any ideas?</p>\n"^^ . . "1"^^ . "0"^^ . . . . "How to add an empty table to an existing table in Lua using its C-API?"^^ . . . . "@MonsieurMerso Ahh, my bad. Here is the link: https://pastebin.com/9LEVG4VJ. I hope it's the log that you mean."^^ . "0"^^ . . . . "scrapy"^^ . . . "0"^^ . . . "0"^^ . . . . "lua Failed finding Lua header files. You may need to install them or configure LUA_INCDIR"^^ . "0"^^ . "0"^^ . "0"^^ . . "@Aki i answered my own question, q&a-style, i kind of know"^^ . . . . "Just store it in a local file."^^ . . . . . . "0"^^ . "what's in the lsp log? You can see path to it in a LspInfo dialog. What happens when you try to run lus ls manually from cmd.exe?"^^ . "How do you change Neovim's directory to the directory within a terminal session? Can this be done using a key map?"^^ . . "<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>local player = game.Players.LocalPlayer\nlocal Running = player:WaitForChild("Running")\n--\nlocal Text = script.Parent:WaitForChild("Time")\nText.Text="0.00"\nText.Visible=true\nlocal tab={\n [true]=function()\n Text.TextColor3=Color3.fromRGB(232,232,232)\n while(wait(.125)and Running.Value)do\n Text.Text+=(.125)..[[\n ]]\n end\n end,\n [false]=function()\n Text.TextColor3=Color3.fromRGB(255,47,92)\n Text.Text='0.00'\n end\n}\nRunning.Changed:Connect(function(v)\n tab[v]()\nend)tab[Running.Value]()</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . . . "One small thing I'd add to "floats are imprecise": They *appear* precise because `tostring` covertly rounds them by default. Lua printing `5.0` is wrong; in reality the number won't be exactly `5.0`. Otherwise a duplicate. As for the fix: Just use tenths instead, then everything can keep being exact integers. That is, do `i = i + 1`, then compare `i*10 == totalSeconds` (similarly, you could also use milliseconds, nanoseconds, attoseconds etc. if you need even more precision)."^^ . . . . "ingress-controller"^^ . . . "1"^^ . "scripting"^^ . "0"^^ . . . . "0"^^ . . . . "0"^^ . "ingress-nginx"^^ . "module"^^ . . "10"^^ . . . "0"^^ . "0"^^ . . . . "I don't understand why this doesn't work. When we move the newly created cursor .gotoEndOfUsedArea(True), the result is a range of cells from A1 to the last filled one. `cursor:getRows():getCount()` should return 11, `cursor:getColumns():getCount()` should return 13, and their product should give 143. It would be better if we move this discussion to [**another resource**](https://ask.libreoffice.org/c/english/) - here in the comments we we cannot find a solution to the problem."^^ . "0"^^ . . "2"^^ . . . . "<p>Transform your value to match your scale (e.g., divide by 10), <a href="https://stackoverflow.com/questions/18313171/lua-rounding-numbers-and-then-truncate">round it (floor + 0.5)</a>, transform back.</p>\n<pre class="lang-lua prettyprint-override"><code>function round(value, scale)\n return math.floor(value / scale + 0.5) * scale\nend\n</code></pre>\n"^^ . "<p>I would like to round a number according to the following pattern</p>\n<p>e.g 1246 to 1250\ne.g 1234 to 1230</p>\n<p>As far as I know in java there is math.round(1245,10) to do that. How can I do that in lua?</p>\n<p>I tried it with math.floor an ceil.</p>\n"^^ . . . . . . "1"^^ . . . . . "game-development"^^ . . . "1"^^ . "user-interface"^^ . . "0"^^ . . . . . "0"^^ . . . . . . . "0"^^ . . "1"^^ . . "I need to compare %01[1 02813]$ which is the output from my weighing scale with TCP IP Connection Protocol"^^ . . . "-2"^^ . "0"^^ . "The backend can also be coded in python hence the tag"^^ . "0"^^ . "math.round"^^ . . . . . . "luvit"^^ . "<p>This is an example lua script that can be ran with luvit:</p>\n<pre class="lang-lua prettyprint-override"><code>local discordia = require('discordia')\nlocal client = discordia.Client()\n\nclient:on('ready', function()\n print('Logged in as '.. client.user.username)\nend)\n\nclient:on('messageCreate', function(message)\n if message.content == '!ping' then\n message.channel:send('Pong!')\n end\nend)\n\nclient:run('')\n</code></pre>\n<p>I am wondering how I can compile this lua script into an exe with all packages ( discordia for example ) included in the exe build</p>\n<p>I tried using RTC which compiles normal lua into exe, not luvit .</p>\n<p>RTC: <a href="https://github.com/samyeyo/rtc" rel="nofollow noreferrer">https://github.com/samyeyo/rtc</a></p>\n"^^ . "Have you tried adding `settings = { java = { compiler = { taskTags = "", taskPriorities = ""}, }, },` after `cmd = {...}` in the table passed to `setup`, instead of adding the `-Dorg.eclipse.jdt.ls` command options? You might have to pass an empty table instead of empty strings---try both. [This](https://github.com/mfussenegger/nvim-jdtls#configuration-verbose) configuration example might be of some use as well."^^ . . "Heh, the rubber ducky effect in action again :) Deletion should be fine. You could also answer it yourself if you believe your answer may be useful to others (but this doesn't seem to be the case). Otherwise it would probably be closed as "not reproducible or caused by a typo"."^^ . . . . "0"^^ . . "1"^^ . "1"^^ . "<p>My table:</p>\n<pre class="lang-lua prettyprint-override"><code>local Cache = {\n SurvivalGameFramework = {\n parent = game.ServerStorage\n }\n}\n</code></pre>\n<p>As you can probably tell, this table is not an empty value or &quot;nil&quot; but according to ROBLOX studio, <code>Cache[1]</code> is nil, and I've tried literally everything to figure out what is wrong with this engine.</p>\n<p><code>print(Cache[1])</code> will return nil and so will <code>Cache.SurvivalGameFramework[1]</code>.</p>\n"^^ . . "0"^^ . . "Note: This will only work if `tbl` is a sequence (has only consecutive integer keys starting at 1). I'd probably use `pairs` for a more general solution which will still work for sequences."^^ . . . . . . "lua"^^ . "Lol, I am grateful, but also curious."^^ . . . . . . . . "0"^^ . . "4"^^ . "2"^^ . . . . . . "1"^^ . "Lua: get all words starting with a specific character ("$")?"^^ . "0"^^ . . "<p>I'm writing a script in Lua.</p>\n<p>I would need to get a string and get all the words are beginning with $ (they are wildcards), sending them to a function that will decode them, end rebuild the string with the values of each wildcard <em>do not knowing upfront which wildcard the string has in it.</em></p>\n<p>Example: please suppose the following wildcards having their values:</p>\n<pre><code>$title = Test Song\n$author = Tormy\n$date = 2022-10-15\n$project = Test Project\n</code></pre>\n<p>and a string so built but, as I sadi, I cannot know upfront the kind of contained wildcards. i only now, they are starting with &quot;$&quot;:</p>\n<pre><code>&quot;The title of this song is $title. $title was composed by $author in $date, when he have created the $project&quot;\n</code></pre>\n<p>I know how to make a string substitution (and I know how to do it).\nWhat I'm not able to do is to get all the words starting with &quot;$&quot;</p>\n<p>I was able to get the just the &quot;$&quot; out of the sentence (so I could count it and know how many wildcards the string has)</p>\n<p>I could get all what there is before the character &quot;$&quot; and/or after it.</p>\n<p>But not just the wildcard itself.</p>\n<p>NOTE:\nthe <strong>.gsub</strong> suggested in the comments is not the solution I'm asking.\nThe issue is: to detect one by one, and to send them to an API (which is a function ..let's call it <strong>API()</strong> just to be comfortable in the understanding) that returns the value.\nThis is the problem I can't figure out how to solve it.</p>\n<p>Only when I have one-by-one I can collect them into an array (table, in Lua) and apply the .gsub</p>\n"^^ . . . "0"^^ . . "azerothcore"^^ . "<p>Trying to build a table that looks up effects depending on integer results.</p>\n<p>Some of the results are in a range, like 1 to 5, but ultimately there's a bunch of em.</p>\n<p><a href="http://lua-users.org/wiki/SwitchStatement" rel="nofollow noreferrer">http://lua-users.org/wiki/SwitchStatement</a></p>\n<p>Showcases some of it, but 'conveniently' did not see it necessary to mention anything about the C api.</p>\n<p>So, how would I access the fields of a table/array with numerical indices from the C api?\nAt this point I'd be happy with a redundant solution that duplicates the entries to cover the ranges, the rub for me lies in the C api part of using a numerical index to get at a field.</p>\n<pre><code>Tables = {}\n\n\nTables.Effects = {\n[1] = &quot;effect 1&quot;\n.... \n}\n\n</code></pre>\n<p>If I had to accurately explain what I tried then I'd have to travel back in time and write down a myriad of permutations of blind groping around using</p>\n<p><code>lua_getglobal</code></p>\n<p><code>lua_getfield</code></p>\n<p><code>lua_pushnumber</code></p>\n<p>and the like</p>\n<p>Perhaps this is simple enough to just hand out a spoonfeed?\nThe lua state is initialized. The file is error free and loaded via luaL_dofile, etc.</p>\n<p>For the time being, to get work done, I'll be using a number to string approach, as horrible as that may be, because then I can use <code>lua_getfield</code>. Actually, goint to use a helper proxy function that then indexes the table via Lua itself.</p>\n<p>Edit:\nAfter trying a suggestion from the comments to use lua_geti\nI failed with the following:</p>\n<pre><code>void accessTables(lua_State* L, int value)\n{\n lua_getglobal(L, &quot;Tables.Effects&quot;); \n lua_geti(L, -1,value); \n if (lua_pcall(L, 0, 0, 0) != 0) { // it actually is an array of functions, so calling them should be fine\n std::cout &lt;&lt; &quot;error running function `f':&quot; &lt;&lt; lua_tostring(L,-1) &lt;&lt; '\\n';\n }\n\n}\n</code></pre>\n<p>But even though the value passed is a valid index, I get the following error:\n<code>| PANIC: unprotected error in call to Lua API (attempt to index a nil value)</code></p>\n"^^ . "1"^^ . . . . . "How do I compile a lua luvit script into an exe while including packages"^^ . . . "CMake not finding lua in github action"^^ . . . "4"^^ . . "How many rate-limiting keys do you have?"^^ . "Learn about RTOS-es"^^ . . . . . "0"^^ . . "2"^^ . . . . "2"^^ . . . . . . . . "file"^^ . . . "2"^^ . . . . "1"^^ . "0"^^ . . . . . . . "0"^^ . . "<p>How are you showing the GUI to the player?</p>\n<ul>\n<li>If you put it in StarterGui, the game will automatically handle this by cloning the GUI to the player's PlayerGui folder, which will automatically show the GUI.</li>\n<li>If you did it yourself, you might forget that the ScreenGui is enabled and shows upon being cloned to the player's PlayerGui folder.</li>\n</ul>\n<p>This also means subsequent frames that have their .Visibile property turned on, will also automatically be shown.</p>\n<p>All in all, it means that the GUI is set to show itself first thing it's parented.</p>\n<p>To solve this you might want your localscript to also control the appropiate properties of the ScreenGui and frames you want to show.</p>\n<p>E.g.</p>\n<pre class="lang-lua prettyprint-override"><code>local mainFrame = script.Parent.Parent.Parent.MainFrame\nlocal open = true\n\nscript.Parent.MouseButton1Click:Connect(function()\n if open == true then\n open = false\n mainFrame:TweenPosition(UDim2.new(0.278, 0,0.319, 0), &quot;InOut&quot;, &quot;Quad&quot;, 0.5, true)\n task.wait(0.5)\n mainFrame.Visible = false\n else\n open = true\n mainFrame.Visible = true\n mainFrame:TweenPosition(UDim2.new(0.278, 0,1, 0), &quot;InOut&quot;, &quot;Quad&quot;, 0.5, true)\n end\nend)\n</code></pre>\n<p>Of course, there also might be the start position of the frame isn't properly set causing the issue you currently have. You'd have to either set it in the GUI editing mode, or at the start of a localscript:</p>\n<pre class="lang-lua prettyprint-override"><code>...\nmainFrame.Position = UDim2.new(0.278, 0,0.319, 0)\n...\n-- the rest of the code\n...\n</code></pre>\n"^^ . . "Lua switch like statement with case fallthroughs, accessible via C api"^^ . . . . . . . "0"^^ . "1"^^ . . . . . "0"^^ . . . . . . "0"^^ . . "3"^^ . "The book *Programming in Lua* is a good starting point. [Here is the chapter on tables.](https://www.lua.org/pil/2.5.html)"^^ . . . . . . "<pre><code>local TweenService = game:GetService(&quot;TweenService&quot;)\nlocal part = workspace[&quot;road&quot;]\nlocal information = TweenInfo.new(1)\nlocal Target = {transparency == 1}\nlocal Tween = TweenService:create (part, information, Target)\nwait(5)\nTween:play()\n\n</code></pre>\n<p>I'm getting the error &quot;Unable to cast to Dictionary&quot;. How to fix this?</p>\n"^^ . . . . . . . . "0"^^ . . "How to fix Luasandbox extension error Mediawiki"^^ . . . . . . . "Please [don't post images of code/error/textual content](https://meta.stackoverflow.com/q/285551). Paste them here as text."^^ . "<p>I am making a mini project where i make a leaderstats, and then in the leader stats is the points, and when you leave and join, data sets and retrieves respectively, follows the player through magnitude, and changes the points when it gets touched by player, except im getting error sometimes, sometimes not</p>\n<p>the script is:</p>\n<pre><code>local DatastoreService=game:GetService(&quot;DataStoreService&quot;)\nlocal zombiePointIncrease=DatastoreService:GetDataStore(&quot;zombiePointIncrease&quot;)\n\n\ngame.Players.PlayerAdded:Connect(function(player)\n \n local leaderstats=Instance.new(&quot;Folder&quot;, player)\n leaderstats.Name=&quot;leaderstats&quot;\n \n local points=Instance.new(&quot;IntValue&quot;, leaderstats)\n points.Name=&quot;points&quot;\n local data\n local success, errormessage=pcall(function()\n data=zombiePointIncrease:GetAsync(player.UserId.. &quot;-cash&quot;)\n end) \n \n if success then\n points.Value=data\n else\n print(&quot;there was a error, getting your data&quot;)\n end\nend)\n\ngame.Players.PlayerRemoving:Connect(function(player)\n local success, errormessage=pcall(function()\n zombiePointIncrease:SetAsync(player.UserId.. &quot;-cash&quot;, player.leaderstats.points.Value)\n end) \n \n if success then\n \n print(&quot;Data Successfully saved&quot;)\n else\n print(&quot;There was a error while saving your data&quot;)\n warn(errormessage)\n end\nend)\n</code></pre>\n<p>All goes fine then i get a zombie model and make this script under it,\nit basically looks for other players and follows them within the agroDistance:</p>\n<pre><code>local zombieHumanoid=script.Parent:WaitForChild(&quot;Humanoid&quot;)\nlocal zombieTorso=script.Parent:WaitForChild(&quot;HumanoidRootPart&quot;)\n\nlocal function findTarget()\n local agroDistance=100\n local target\n\n for i, v in pairs(game.Workspace:GetChildren()) do\n local human=v:FindFirstChild(&quot;Humanoid&quot;)\n local torso=v:FindFirstChild(&quot;HumanoidRootPart&quot;)\n\n if human and torso and v~=script.Parent then\n --check distance\n if (torso.Position-zombieTorso.Position).magnitude&lt;agroDistance then\n agroDistance=(torso.Position-zombieTorso.Position).magnitude\n target=torso\n return target\n end\n end\n end\nend\n\nwhile wait(1) do\n local torso=findTarget()\n if torso then\n zombieHumanoid:MoveTo(torso.Position)\n else\n zombieHumanoid:MoveTo(zombieTorso.Position + Vector3.new(-50, 50),0,Vector3.new(-50,50))\n end\nend\n</code></pre>\n<p>then i make this script where when the torso gets touched, the points increase:</p>\n<pre><code>local zombietorso=script.Parent.HumanoidRootPart\nlocal Players=game:GetService(&quot;Players&quot;)\n\nlocal function findHuman()\n for i,v in pairs(game.Workspace:GetChildren()) do\n local human=v:FindFirstChild(&quot;Humanoid&quot;)\n local torso=v:FindFirstChild(&quot;HumanoidRootPart&quot;)\n if human and torso and v~=script.Parent then\n local player=game.Players:GetPlayerFromCharacter(v)\n local points=player.leaderstats.points\n points.Value=points.Value+1\n end\n end \nend\n\nzombietorso.Touched:Connect(findHuman())\n</code></pre>\n<p>it seems as there is legit no problem in my code, no syntax error, nothing, atleast for what i know</p>\n<p>but when the 3rd script is used i get error pointing to</p>\n<pre><code>zombieHumanoid:MoveTo(zombieTorso.Position + Vector3.new(-50, 50),0,Vector3.new(-50,50))\n</code></pre>\n<p>the error says &quot;Enable to cast value to Object&quot;, when i remove the 3rd script it works fine sometimes even when the 3rd script is there, it works fine, is this a bug within roblox studio? wouldn't be surprised with roblox</p>\n<p>I have legit tried everything i could, change script variables whatnot which would not have to do with script even using print statements to debug, it only works sometimes</p>\n"^^ . . . . . "0"^^ . "<p>If you want to use a separate function then make sure to use WaitForChild to reference it before using it in an argument.\nProbably not the best way to go around it, but it works.</p>\n<p>greenPart = game.Workspace:WaitForChild(&quot;Green Part&quot;)</p>\n<p>local function Touched(part)\nplayer:SetAttribute(&quot;GPU&quot;, part)\nend</p>\n<p>Touched(greenPart)</p>\n"^^ . "<h1><em>How do I make it so that when I step on a block, the enabled of the script in the Startergui folder is activated, but when I stop stepping on it, the enabled is turned off again?</em></h1>\n<p><em>For example, I want that when I step on the block called &quot;PartOne&quot; the enabled of a script in starterGui called &quot;First Person&quot; is activated and when I stop stepping on this the enabled of the script is deactivated but I want it to only be activated with the players and no NPC or blocks</em></p>\n<h1><strong>Sorry if this is written wrong but I'm using Google Translate because I don't know English.</strong></h1>\n<p>I was trying to make a script run by touching a block.</p>\n"^^ . "@Luatic My primary concerns are security, reliability, and performance. These scripts are used for financial analysis, making it essential to maintain a secure environment. While I trust the intentions of the script developers, I'm wary of unintentional errors that might impact the system. Such errors can be challenging to debug, especially if they inadvertently affect other scripts. Therefore, I want to ensure that each script runs in a confined context, minimizing the risk of one script inadvertently impacting others, while still maintaining optimal execution speed"^^ . . "0"^^ . "1"^^ . "move "humanoid.WalkSpeed += shoting" after while loop"^^ . "0"^^ . . . "0"^^ . "Stage value isnt adding up when players are touching the part"^^ . . . . . . "1"^^ . . . . "0"^^ . . "<p>As ESkri put it, I treated the array wrongly by trying to use the 'dot' notation directly, when I should have gone through the steps manually.</p>\n<p>Thus:</p>\n<pre><code>void accessTables(lua_State* L, int value)\n{\n lua_getglobal(L, &quot;Tables&quot;); \n lua_getfield(L,-1, &quot;Effects&quot;); // the manual step\n lua_geti(L, -1,value); //now it pushes the function onto the stack\n if (lua_pcall(L, 0, 0, 0) != 0) { //call it\n std::cout &lt;&lt; &quot;error running function `f':&quot; &lt;&lt; lua_tostring(L,-1) &lt;&lt; '\\n';\n }\n lua_pop(L,2); //Only through experimentation I realized that the first getglobal stack entries with the table references had to be popped, but the function stack entry did not\n//without the poppage, the stack grew by two entries each time I called it.\n}\n</code></pre>\n<p>Did the trick</p>\n"^^ . . . . . "1"^^ . "0"^^ . "1"^^ . . . . . . "1"^^ . . . . "post"^^ . "2"^^ . . . . "0"^^ . "0"^^ . . "<p>In OS X, I load the fzf.vim plugin using the command</p>\n<p><code>call minpac#add('junegunn/fzf.vim')</code></p>\n<p>without any subsequent configuration. The Find, Buffer, etc., commands are not executed because Neovim can't find the fzf functions.</p>\n<p>Fzf has been installed with Brew and is working correctly in the Fish shell.</p>\n<p>I'm seeking assistance to properly configure the plugin using Lua.</p>\n<p>Thank you for any contributions.</p>\n"^^ . . "0"^^ . . . . . "<p>According to the <a href="https://github.com/eclipse-jdtls/eclipse.jdt.ls/wiki/Language-Server-Settings-&amp;-Capabilities#java-compiler-options" rel="nofollow noreferrer">jdtls Java Compiler Options section</a>\nyou can set the value for <code>java.settings.url</code> to a settings file.</p>\n<pre><code>require('lspconfig')['jdtls'].setup {\n root_dir = function(fname)\n return vim.fn.getcwd()\n end,\n cmd = {\n 'jdtls',\n '-vmargs',\n },\n settings = {\n ['java.settings.url'] = '&lt;some path&gt;/settings.pref',\n }\n}\n</code></pre>\n<p>Then, in the settings.pref add</p>\n<pre><code>org.eclipse.jdt.core.compiler.taskTags=\n</code></pre>\n<p>This worked for me. There might be a way to configure it without an additional file, but I couldn't figure it out.</p>\n"^^ . . . "0"^^ . . . . . "1246 -> 124.6 -> 125 -> 1250"^^ . "How do I prevent ONE "while" process to run twice at the same time?"^^ . . . . . "1"^^ . "0"^^ . . "0"^^ . . . . . . . . . . "<p>When I try to upload an image through a Discord webhook with the following code below everything works except Discord is not uploading my file correct on there server. When I click on &quot;image.png&quot; or try to download it, then it takes me to this link which is invalid <a href="https://cdn.discordapp.com/attachments/1086674608368931027/1149816147466780672/image.png" rel="nofollow noreferrer">https://cdn.discordapp.com/attachments/1086674608368931027/1149816147466780672/image.png</a>. I know it's 99% my fault and not Discord's but I just can't find the bug. Would be nice if someone here could help me :D\n<a href="https://i.sstatic.net/Qp4Oi.png" rel="nofollow noreferrer">Screenshot of the Discord channel</a>\n<a href="https://i.sstatic.net/aMh1T.jpg" rel="nofollow noreferrer">This is the image that I try to send (before I uploaded it it was .png now it is .jpg I dont know why)</a></p>\n<pre><code>function base64_encode(data)\n local b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n return ((data:gsub('.', function(x)\n local r, b = '', x:byte()\n for i = 8, 1, -1 do\n r = r .. (b % 2 ^ i - b % 2 ^ (i - 1) &gt; 0 and '1' or '0')\n end\n return r\n end) .. '0000'):gsub('%d%d%d?%d?%d?%d?', function(x)\n if #x &lt; 6 then\n return ''\n end\n local c = 0\n for i = 1, 6 do\n c = c + (x:sub(i, i) == '1' and 2 ^ (6 - i) or 0)\n end\n return b64chars:sub(c + 1, c + 1)\n end) .. (#data % 3 == 1 and '==' or #data % 3 == 2 and '=' or ''))\nend\n\nfunction sendDiscordWebhook(webhookUrl, message, imageFilePath)\n local boundary = &quot;----------------------------&quot; .. os.time()\n\n local headers = {\n [&quot;Content-Type&quot;] = &quot;multipart/form-data; boundary=&quot; .. boundary\n }\n\n local body = {}\n table.insert(body, &quot;--&quot; .. boundary)\n table.insert(body, 'Content-Disposition: form-data; name=&quot;content&quot;\\r\\n\\r\\n' .. message)\n\n local imageFileData\n if imageFilePath then\n local file = io.open(imageFilePath, &quot;rb&quot;)\n if file then\n imageFileData = file:read(&quot;*all&quot;)\n file:close()\n local fileName = imageFilePath:match(&quot;^.+[\\\\/](.+)$&quot;)\n local fileExtension = fileName:match(&quot;%.([^%.]+)$&quot;)\n local contentType = &quot;image/&quot; .. fileExtension\n table.insert(body, &quot;--&quot; .. boundary)\n table.insert(body, 'Content-Disposition: form-data; name=&quot;file[0]&quot;; filename=&quot;' .. fileName .. '&quot;')\n table.insert(body, 'Content-Type: ' .. contentType)\n table.insert(body, &quot;&quot;)\n table.insert(body, &quot;data:&quot; .. contentType .. &quot;;base64,&quot; .. base64_encode(imageFileData))\n end\n end\n\n table.insert(body, &quot;--&quot; .. boundary .. &quot;--&quot;)\n local requestBody = table.concat(body, &quot;\\r\\n&quot;)\n\n PerformHttpRequest(webhookUrl, function(err, text, headers)\n print(&quot;TEXT:&quot; .. text)\n print(&quot;ERROR:&quot; .. err)\n print(&quot;HEADERS:&quot; .. json.encode(headers))\n end, 'POST', requestBody, headers)\nend\n\nsendDiscordWebhook(&quot;https://discord.com/api/webhooks/MYWEBHOOK/MYWEBHOOK&quot;, &quot;Test&quot;, &quot;image.png&quot;)\n</code></pre>\n<p>I now try for over 2 month to get this to work with thausands of code modifications but I think that Im just to dumb.</p>\n"^^ . . "<p>In Vim, an input mode map can use <code>&lt;c-r&gt;=input()</code> to fetch user input and insert it at the cursor. How is this done in Neovim?</p>\n<p>Specific Vimscript example:</p>\n<pre><code>imap &lt;buffer&gt; &lt;unique&gt; ;_ &lt;c-r&gt;=&quot;_{&quot;.input(&quot;sub:&quot;).&quot;}&quot;&lt;cr&gt;\n</code></pre>\n<p>What is the Neovim+Lua equivalent?</p>\n"^^ . . "5"^^ . "arrays"^^ . . . . . . . "logitech"^^ . . "0"^^ . . . "<p>I need to fetch all key/value pairs that match a certain key prefix. This needs to be done in parallel (eg. using threads).</p>\n<p>My idea is to scan over all keys matching a prefix and filter only those whose <code>(hash(key) % partition_size) == partition_id</code>, where <code>partition_size</code> is the number of parallel processes and <code>partition_id</code> is a number between <code>0..partition_size-1</code> which is assigned to each process.</p>\n<p>What does Redis command or script look like? Is there a non-script way of doing so?</p>\n"^^ . . . . "max"^^ . . "0"^^ . . "0"^^ . . . . "Quarto extension works in example but not in my project"^^ . "Their approach in particular ensures that there is no corruption; it makes the file write "atomic". In your binary file example, only one of the two writes could get through, leaving you in an inconsistent state."^^ . . "<p>I am trying to open Lua scripts written by another person. While a number of them look well, there others which are displayed like in the first screenshot.</p>\n<p>I can't understand what encoding to use to open these files. Windows notepad seems to be using ANSI when opening them but also no luck. Is there a way to reed these files correctly?</p>\n<p><img src="https://i.sstatic.net/dtr4L.jpg" alt="Screenshot" /></p>\n"^^ . . . "If this is a binary file, so that your editing does not change the SIZE of the buffer, then yes, you can use "w+b" mode and replace a block in the middle of the file. Notice that this is totally unrelated to complexity. Regardless of how you do it, it will still be O(N)."^^ . "@Gerhard no I don't want to mimic the response, I just want to mimic the delay over API(network io), as I am using threads in python."^^ . "0"^^ . . "1"^^ . . . . . "fluentd"^^ . . . . "2"^^ . "What does the error "bad argument to 'OutputLogMessage' (number expected, got nil)" mean?"^^ . . "How can I change the Roblox (Lua) timer to display 3 decimals, and not more?"^^ . "Right. I'll add a caveat."^^ . . "1"^^ . "It is not clear, what is your goal for "fetch all key/value pairs in parallel". I may assume, that you actually want to investigate the fetched values further and need the "fetch in parallel" for speed. With this assumption I'd suggest you consider an approach, to scan Redis-entries server-side, filtering the data by value on server with a special Lua-script, returning to the client only needed data. I created a demo-repo for that approach: https://github.com/a-bobkov/redis-search-values-demo"^^ . "<p>I am trying to implement a custom iterator which works like <code>table.foreach</code> in Lua, but in more &quot;syntax friendly&quot; manner. I came across following construction (not sure if it's done purely in Lua or some kind of C &quot;hack&quot; in the Lua source code.</p>\n<pre class="lang-lua prettyprint-override"><code>-- creature is a collection of Creature objects\n-- &quot;ps&quot; is used as a filter variable\n\nforeach creature cre &quot;ps&quot; do\n if cre.name ~= $name then\n -- code...\n end\nend\n</code></pre>\n<p>I tried to play around with <code>table.foreach</code>, <code>ipairs</code> and so on - but can nowhere get the similar result to the mentioned code sample. Could you give me a hint how this could be implemented?</p>\n"^^ . "c++"^^ . . "<p>You can do this:</p>\n<pre><code>local part = workspace.Part or workspace:WaitForChild(&quot;Part&quot;)\n\n\nlocal function touched(gpu)\nlocal gpuValue = game.Players.LocalPlayer:FindFirstChild(&quot;GPUValue&quot;)\n\nif not gpuValue then gpuValue = Instance.new(&quot;ObjectValue&quot;, game.Players.LocalPlayer) gpuValue.Name = &quot;GPUValue&quot; end\n\ngpuValue.Value = gpu\nend\npart.Touched:Connect(touched)\n</code></pre>\n"^^ . . . . "0"^^ . . "Please, when you study the links kindly provided by @JimK and learn how to use the `.removeByName(Sheet.getName())` methods, be sure to note that your loop `i = sheet_count - 1, 0, -1` will never execute completely, you will always get an error on the last iteration. This is due to the fact that the spreadsheet cannot be completely empty; at least one sheet must remain in it (an attempt to delete the only existing sheet will cause an error)"^^ . "gpu-instancing"^^ . "<p>First of all, thanks for sharing your code. I was in the same boat as you for the whole day yesterday. Now, I think the problem is that the methods used for decoding the base64 string data is incorrect. I've also tried so many decoding functions none of the seemed to work. Thankfully, there's just a simple solution.</p>\n<h1>Solution</h1>\n<p>We just need to take your base64 image data url and filter out the unneeded gibberish.</p>\n<p>This should remove the <em><strong>data:image/png;base64</strong></em>... part.</p>\n<pre class="lang-lua prettyprint-override"><code>-- Unsure about your data string variable name so I made one up\nlocal commaAt = imageDataString:find(&quot;,&quot;)\nlocal formattedImageString = imageDataString:sub(commaAt + 1)\n</code></pre>\n<p>Then add this to set the encoding language to parse <strong>base64</strong> so that we don't need to use any decoders.</p>\n<pre class="lang-lua prettyprint-override"><code>table.insert(body, 'Content-Disposition: form-data; name=&quot;file&quot;; filename=&quot;' .. fileName .. '&quot;')\ntable.insert(body, 'Content-Type: ' .. contentType)\n\n-- Insert this line to your code\ntable.insert(body, 'Content-Transfer-Encoding: base64')\ntable.insert(body, &quot;&quot;)\ntable.insert(body, formattedImageString)\n</code></pre>\n<p>This should work. I've tried and tested this and it worked like a charm. Don't forget the step wherein you omit the unnecessary part of the base64 url, otherwise your webhook won't send at all, which will let you know something's not right.</p>\n<p>Cheers!</p>\n"^^ . . . "0"^^ . "0"^^ . "Yes, either wrap the existing line containing the call to `OutputLogMessage` with an `if` statement that checks that `arg` is not nil. Or replace the line with the second example. Or come up with a different solution, if something else works better. You just have to make sure that a *nil* value isn't being passed to `OutputLogMessage` when a number is expected - it doesn't have to be exactly the code I've shown. (You do not need to change the line `function OnEvent(event, arg)`.)"^^ . "Fetch Redis key/value pairs in parallel"^^ . . . "3"^^ . "1"^^ . "embedded"^^ . . "<p>this is my lua config for cmp:</p>\n<pre class="lang-lua prettyprint-override"><code>require('lspconfig')['jdtls'].setup {\n root_dir = function(fname)\n return vim.fn.getcwd()\n end,\n cmd = {\n 'jdtls',\n '-vmargs',\n '-Dorg.eclipse.jdt.ls.taskTags=',\n '-Dorg.eclipse.jdt.ls.taskPriorities='\n },\n}\n\n</code></pre>\n<p>but still I keep seeing the markers on //TODO</p>\n<p>I tried doing lots and lots of configurations, even using &quot;settings&quot; files in the source of my project</p>\n"^^ . "<p>The core detail of my problem is: I don't know how to do it.</p>\n<p>I encountered the problem I'm trying to solve by wanting to add a table to an existing table in Lua.</p>\n<p>The major difficulty that prevented me from solving it myself is ignorance, and a failure to come across any internet search results that are useful to me in solving the problem, despite my best efforts.</p>\n<p>I tried the following, among other things:</p>\n<pre><code> lua_getglobal(L, &quot;OuterTable&quot;); \n lua_createtable(L, 0,0); \n lua_pushliteral(L, &quot;InnerTable&quot;);\n lua_settable(L,-2);\n\n</code></pre>\n<p>I expected that &quot;InnerTable&quot; would be added to &quot;OuterTable&quot; after considering the accepted answer of this question:</p>\n<p><a href="https://stackoverflow.com/questions/37854422/how-to-create-table-in-table-in-lua-5-1-using-c-api">How to create table in table in Lua 5.1 using C-API?</a></p>\n<p>Which also used <code>lua_settable</code> to add a table to a table, albeit a newly created one.</p>\n<p>I have also looked through Programming In Lua, the <a href="https://www.lua.org/pil/25.1.html" rel="nofollow noreferrer">color table example</a>, but I was not able to solve it with that one, either.</p>\n<p>Minimum reproducible example:</p>\n<p>test.lua</p>\n<pre><code>OuterTable = {\n ExampleInnerTable = {}\n}\n</code></pre>\n<p>Testbed in C (I use Lua 5.3 but my distro is set up in a peculiar way so ...I don't know how YOU would include it, be wary of that)</p>\n<pre><code> #include &lt;lua5.3/lua.h&gt;\n #include &lt;lua5.3/lualib.h&gt;\n #include &lt;lua5.3/lauxlib.h&gt;\n\nint main(int argc, char *argv[])\n{\n \n\n\n lua_State* L;\n L = luaL_newstate();\n luaL_openlibs(L);\n luaL_dofile(L, &quot;test.lua&quot;);\n\n lua_getglobal(L, &quot;OuterTable&quot;); \n int c = lua_gettop(L);\n lua_newtable(L);\n lua_pushliteral(L, &quot;InnerTable&quot;);\n lua_settable(L,c);\n\n return 0;\n}\n</code></pre>\n<p>Basically, I want to add another table to <code>OuterTable</code>, one like <code>ExampleInnerTable</code></p>\n<p>Desired result</p>\n<pre><code>OuterTable = {\n ExampleInnerTable = {}\n ,InnerTable = {}\n}\n</code></pre>\n"^^ . . . "Why are my billboarded quads being rendered this way?"^^ . . . . . "0"^^ . . "Seems like you can make a setting of `setting_type = 'startup'` which can be accessed in the data stage via `settings.startup`. I think a runtime setting fundamentally can't control whether or not something is added to `data`, so if a runtime setting would have to control the music in a different way (but I'm not sure if any such way exists)."^^ . "@Oka Yeah, my bad, it's not a polyfill; rather it's how to properly unpack a vararg if it's not a sequence - apparently `unpack` was just moved to the `table` scope with its functionality left unchanged despite the introduction of `table.pack`."^^ . . "<p>I'm trying to use github actions to check after every push if my program compiles. This program is written in C++ and uses lua library that it has to link to. I tried using the action from <a href="https://github.com/marketplace/actions/install-lua-luajit" rel="nofollow noreferrer">https://github.com/marketplace/actions/install-lua-luajit</a> to get lua so that my program finds it and links to it. So my <code>.github/workflows/myAction.yml</code> file looks like this:</p>\n<pre><code>name: compile\n\non: [push]\n\njobs:\n build:\n runs-on: ubuntu-latest\n\n steps:\n - uses: actions/checkout@master\n\n - uses: leafo/gh-actions-lua@v10\n with:\n luaVersion: &quot;5.1.5&quot;\n\n - uses: leafo/gh-actions-luarocks@v4\n\n - name: checkLuaExistence\n run: lua -v\n\n - name: makeBuildDir\n run: cmake -E make_directory build\n \n - name: useCmake\n run: cmake -B build -S .\n\n - name: compile\n run: cmake --build build\n</code></pre>\n<p>and my CMakeLists.txt file looks like this:</p>\n<pre><code>cmake_minimum_required (VERSION 3.5)\n\nproject (myLuaTest)\n\nfind_package (Lua REQUIRED)\n</code></pre>\n<p>Unfortunately, the job fails during the step <code>useCmake</code> with error <code>Could NOT find Lua (missing: LUA_LIBRARIES LUA_INCLUDE_DIR)</code>. That means that lua is installed, because the step <code>checkLuaExistence</code> works fine. How do I change it so that cmake finds lua?</p>\n"^^ . "1"^^ . . "1"^^ . . . . . . "1"^^ . . "0"^^ . . . "<p>I'm currently writing a code in Roblox Studio (with the Lua language) and I'm making a timer, but the decimals randomly change from 3 to like 30. How can I fix this? Code:</p>\n<pre><code>local player = game.Players.LocalPlayer\nlocal Running = player:WaitForChild(&quot;Running&quot;)\n--\nlocal Text = script.Parent:WaitForChild(&quot;Time&quot;)\nlocal Time = 0.00\n\nwhile wait() do\n if Running.Value == true then\n Text.TextColor3 = Color3.fromRGB(232,232,232)\n Text.Visible = true\n Text.Text = Time\n wait(0.125)\n Time = Time + 0.125\n else\n if Running.Value == false then\n Text.TextColor3 = Color3.fromRGB(255,47,92)\n Time = 0.00\n end\n end\nend\n</code></pre>\n<p>I wanted the timer to update every 0.125 seconds, but instead it works a few times but then the decimals randomly switch up from 3 to 30. FOR EXAMPLE I wanted it to be 2.250 and not 2.25099999999999999999999999987. How can I fix this?</p>\n"^^ . . "1"^^ . . . . "2"^^ . . . . "0"^^ . . . . . . "1"^^ . . . . . . . "You might want to confirm first that all the parts have loaded in. It might just be the replication time taking too long, registering the Touched events on only a few parts that *have* loaded in."^^ . "table.unpack to variadic function?"^^ . "0"^^ . "<p>I don't understand why this happens.</p>\n<pre><code>function findVar()\n local i = string.find(equation, &quot;%a&quot;)\n var = string.sub(equation, i, i)\n while true do\n i = string.find(equation, &quot;%a&quot;, i + 1)\n if i == nil then break end\n check = string.sub(equation, i, i)\n if not var == check then\n quit(&quot;Error. Multiple variables.&quot;, true)\n end\n end\nend\n</code></pre>\n<p>This code is supposed to find the variable in an equation, which it does, but then it needs to find a variable that isn't the same as the 1st variable. If found, it should terminate the script. The problem is, that when it does find a variable that differs the 1st one, it doesn't terminate anything.</p>\n<p>I have tried changing the <em>check</em> variable to global.</p>\n"^^ . . . . . . "1"^^ . "0"^^ . . . "<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>local label=script.Parent\nlocal frame=label.Parent\nframe.Visible=false\nlocal function showText (text,delayBetweenChanges)\n frame.Visible=true\n label.Text=""\n for _,letter in ipairs(text:split"")do\n label.Text=label.Text..letter\n wait(delayBetweenChanges)\n end\n --frame.Visible=false\nend</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . . "hammerspoon"^^ . . "0"^^ . "<p>i'm trying to make a roblox game and i need a gui that shows text character by character but it just shows numbers this is my code</p>\n<pre><code>local frame = script.Parent.Parent\nlocal currentText = &quot;&quot;\nframe.Visible = false\n\nlocal function showText (text, delayBetweenChanges)\n frame.Visible = true\n for letter in string.split(text,&quot;&quot;) do\n local currentText = (currentText .. letter)\n script.Parent.Text = currentText\n wait(delayBetweenChanges)\n end\nend\n</code></pre>\n<p>i thought it would add the next character to the already existing string and then display the final string</p>\n<p>but it showed a number correlating to the position of that character in the string</p>\n"^^ . "0"^^ . "0"^^ . "@MateoVial Added a note about `select`."^^ . "Clicker script only clicking once (Logitech Lua Scripting)"^^ . "1"^^ . . . "Thanks! That is good to know. My question mainly was about the running the lua script while running other C code. For example the C code needs to constantly check for messages from uart and at the same time the lua script would be running some other logic. One reason for this is also that I want to hide the underlying C code logic from the user and the script only contains user defined logic."^^ . . . . . . "1"^^ . . . . . . "0"^^ . . "4"^^ . "1"^^ . "@Oka I would say brief - hence this question, if it's doable to implement this foreach keyword with iterators/next."^^ . . . . . . "ignite"^^ . . . . . "refresh"^^ . . "<p>When i connect to 192.168.1.10:1001 port and send command %01R$$ then i get some value i.e. %01[1 02813]$\nwhich i then splice and get it into one single variable Call Actual Weight . (Please Refer the photo 1 &amp; 2 Attached below)</p>\n<p><a href="https://i.sstatic.net/HZCxl.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HZCxl.jpg" alt="Blocky Diagram for the logic explained above" /></a></p>\n<p><a href="https://i.sstatic.net/02xLb.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/02xLb.jpg" alt="Debugging Tool Description" /></a></p>\n<p>i am getting error &quot;Attempt to compare Number with String&quot;</p>\n<p>What is the way forward please help as it is a on going project for robotics sorting using weighing scale.\nThank you.</p>\n<p>I tried Getting it into another variable which take a number as input and tried converting but no success so far.</p>\n<p>This is the program which was generated in the backend:</p>\n<p>2 Files Generated :</p>\n<p>global.lua</p>\n<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-css lang-css prettyprint-override"><code>Pre_Data = ''\nPost_Data = ''\nWeight = 0\nData_Char = 0\nActual_Weight = 0\nWEIGHT_WEIGHT_WEIGHT = 0 \nfunction Get_Weight()\nresultOpen1,socket1 = TCPCreate(false, '192.168.1.10', 1001)\n if resultOpen1 == 0 then\n print("Create TCP Client Success!")\n else\n print("Create TCP Client failed, code:", resultOpen1)\n end\n resultOpen1 = TCPStart(socket1, 0)\n if resultOpen1 == 0 then\n print("Connect TCP Server Success!")\n else\n print("Connect TCP Server failed, code:", resultOpen1)\n end\n print((resultOpen1))\nresultWrite1 = TCPWrite(socket1, '%01R$$')\nresultRead1,Pre_Data = TCPRead(socket1, 0, 'string')\nPre_Data = Pre_Data.buf\nresultRead1,Post_Data = TCPRead(socket1, 0, 'string')\nPost_Data = Post_Data.buf\nWeight = Pre_Data..Post_Data\nprint(Weight)\nData_Char = 7\nfor count = 1, 5 do\n Actual_Weight = Actual_Weight..(string.sub(Weight, Data_Char ,Data_Char))\n Data_Char = Data_Char + 1\n Sleep(50)\nend\nprint(Actual_Weight)\nend</code></pre>\r\n<pre class="snippet-code-html lang-html prettyprint-override"><code>Get_Weight( )\nWEIGHT_WEIGHT_WEIGHT = Actual_Weight\nSync()\nif WEIGHT_WEIGHT_WEIGHT&gt;280 then\n MovJ((P1))\nelse\n MovJ((P2))\nend</code></pre>\r\n</div>\r\n</div>\r\n</p>\n<p>src0.lua</p>\n<p>Pre_Data = '' Post_Data = '' Weight = 0 Data_Char = 0 Actual_Weight = 0 WEIGHT_WEIGHT_WEIGHT = 0 function Get_Weight() resultOpen1,socket1\n= TCPCreate(false, '192.168.1.10', 1001) if resultOpen1 == 0 then\nprint(&quot;Create TCP Client Success!&quot;) else\nprint(&quot;Create TCP Client failed, code:&quot;, resultOpen1) end resultOpen1 = TCPStart(socket1, 0) if resultOpen1 == 0 then\nprint(&quot;Connect TCP Server Success!&quot;) else\nprint(&quot;Connect TCP Server failed, code:&quot;, resultOpen1) end print((resultOpen1)) resultWrite1 = TCPWrite(socket1, '%01R$$') resultRead1,Pre_Data = TCPRead(socket1, 0, 'string') Pre_Data = Pre_Data.buf resultRead1,Post_Data = TCPRead(socket1, 0, 'string') Post_Data = Post_Data.buf Weight = Pre_Data..Post_Data print(Weight) Data_Char = 7 for count = 1, 5 do Actual_Weight = Actual_Weight..(string.sub(Weight, Data_Char ,Data_Char)) Data_Char\n= Data_Char + 1 Sleep(50) end print(Actual_Weight) end</p>\n"^^ . . "1"^^ . . . "0"^^ . . . "<p>In general, you can capture the values into a <em>table</em></p>\n<pre class="lang-lua prettyprint-override"><code>local t = { foo() }\n</code></pre>\n<p>but it may not be a <a href="https://www.lua.org/manual/5.4/manual.html#3.4.7" rel="nofollow noreferrer"><em>sequence</em></a> if the function returns <em>nil</em> values that create holes in the list.</p>\n<p><a href="https://www.lua.org/manual/5.4/manual.html#pdf-select" rel="nofollow noreferrer"><code>select</code></a> may be used to choose where to begin capturing return values.</p>\n<pre class="lang-lua prettyprint-override"><code>-- capture the second return value and onwards\nlocal t = { select(2, foo()) }\n</code></pre>\n<hr />\n<p>In Lua 5.2+, you also have access to <a href="https://www.lua.org/manual/5.4/manual.html#pdf-table.pack" rel="nofollow noreferrer"><code>table.pack(...)</code></a>, which</p>\n<blockquote>\n<p>Returns a new table with all arguments stored into keys 1, 2, etc. and with a field &quot;n&quot; with the total number of arguments. Note that the resulting table may not be a sequence, if some arguments are nil.</p>\n</blockquote>\n<p>The caveat about the resulting table not being a sequence means that looping over all the returned values may require a numeric <code>for</code>, instead of a generic one using <code>ipairs</code>.</p>\n<pre class="lang-lua prettyprint-override"><code>local function foo()\n return 'a', 'b', 'c', 'd', 'e'\nend\n\nlocal results = table.pack(foo())\n\nfor i = 1, results.n do\n print(results[i])\nend\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>a\nb\nc\nd\ne\n</code></pre>\n<p>The opposite function is <a href="https://www.lua.org/manual/5.4/manual.html#pdf-table.unpack" rel="nofollow noreferrer"><code>table.unpack</code></a>.</p>\n<hr />\n<p>In Lua 5.1, you can polyfill <code>table.pack</code> as</p>\n<pre class="lang-lua prettyprint-override"><code>table.pack = function (...)\n local t = { ... }\n t.n = select('#', ...)\n return t\nend\n</code></pre>\n"^^ . . "json"^^ . . "0"^^ . "2"^^ . . . "1"^^ . "0"^^ . "0"^^ . . . "0"^^ . . . . . "1"^^ . "0"^^ . . "0"^^ . "1"^^ . . "optimization"^^ . . "0"^^ . . . "0"^^ . "9"^^ . . "Bresenham's argorithm is about drawing (a parabola) on usual pixel grid (x,y - integers). So, what is the meaning of `deltaXmax` ?"^^ . . . . "0"^^ . "0"^^ . "1"^^ . "<p>I had a similar issue but resolved it by finding the necessary &quot;include&quot; files from the include folder. I followed <a href="https://github.com/luarocks/luarocks/discussions/1282#discussioncomment-384517" rel="nofollow noreferrer">daurnimator's solution</a> and it worked! As they said, you just need to point <code>luarocks config variables.LUA_INCDIR</code>: to where the files <em>lauxlib.h, lua.h, ... , lualib.h</em> are.</p>\n<p>However, we differ on how we installed Lua, so you might have to look elsewhere for your Includes. I downloaded mine from <a href="https://luabinaries.sourceforge.net/download.html" rel="nofollow noreferrer">LuaBinaries</a>. I was following YouTube tutorials on how to get Lua prebuilt on Windows and I naively thought you only needed the executable and not the DLL's and Includes.</p>\n"^^ . . "0"^^ . . . "garrys-mod"^^ . "<p>You most likely have something capitalized that shouldn't be, or the other way around.</p>\n<p>I recommend temporarily sprinkling lots of <code>print()</code> statements around to see what all the values are, to easily tell where it's going wrong.</p>\n"^^ . . . "Timers session value extracted with Lua"^^ . "0"^^ . "2"^^ . . . . . . . . . "discord"^^ . "Of course, it was also JohnSUN in the other post who suggested to try `1` in Lua, which is the solution shown here."^^ . "2"^^ . . . . "<p>You can specify a table key/index dynamically using brackets, e.g.:</p>\n<pre class="lang-lua prettyprint-override"><code>players[playerName] = ...\n</code></pre>\n<p>In your case, you are trying to modify what is called the <a href="https://www.lua.org/manual/5.4/manual.html#2.2" rel="nofollow noreferrer">global environment</a>, which you can access with <code>_G</code>.</p>\n<p>However, it is highly non-recommended to dump values into that global environment. Aside from accidentally overwriting existing values, its simply not the place to keep player data.</p>\n<p>Make a separate table for your players, and put them there like in my code block and access them as e.g., <code>players.someSpecificName.health</code>, or more dynamically <code>players[playerName].health</code>. Beware nil players.</p>\n"^^ . . . . . . . . "Will editing a file always have O(N) time complexity?"^^ . "<p>Like InSync stated, <code>==</code> is consistently returning false when comparing <code>not var</code> with <code>check</code>.</p>\n<p><a href="http://www.lua.org/manual/5.4/manual.html#3.4.5" rel="nofollow noreferrer">~=</a> would be more suitable ie <code>var ~= check</code>.</p>\n<p>Brackets like <code>not (var == check)</code> could work too.</p>\n"^^ . . . . "0"^^ . "Updated the question to elaborate the problem a bit more."^^ . . . "0"^^ . . . . "<p>here is my error</p>\n<pre><code>Expected objects to be the same.\nPassed in:\n(table) {\n [1] = 1\n [2] = 2\n [3] = 3\n [4] = 4 }\nExpected:\n(nil)\n</code></pre>\n<p>here is my code some one can help me please</p>\n<pre><code>local function between(a, b)\n local table = {}\n while not a == 5 do\n local a = 1\n table[a] = a\n local a = a + 1\n end\n print(table)\nend\n\nreturn between\n</code></pre>\n<p>l have tried to use for loop\ncan someone help me please</p>\n"^^ . . "1"^^ . . . . "Please edit the question to show how you're calling the function. The first problem I see is that `not a` will always be `true` or `false`, neither of which is equal to 5, so the loop won't run."^^ . "1"^^ . . . . . "0"^^ . . "0"^^ . "1"^^ . "<p>I'm using Roblox Studio and the only language I'm familiar with is Java. I created 2 buttons called &quot;open&quot; and &quot;close&quot;, and a frame including images and text called &quot;menu&quot;. I'm trying to make it so when you click on the open button, the menu and the close button slide out while the open button disappears—opposite happens when you click on the close button. My code doesn't work at all and I'm not sure why, any feedback would be appreciated.<a href="https://i.sstatic.net/TAaRa.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TAaRa.jpg" alt="enter image description here" /></a></p>\n"^^ . . . . . . . "1"^^ . . . . "When searching Lua **library**, the script [FindLua.cmake](https://github.com/Kitware/CMake/blob/master/Modules/FindLua.cmake) doesn't take `lua` **executable** into account. You need to hint CMake about location of your Lua installation. E.g. by setting `CMAKE_PREFIX_PATH` variable (environment or CMake one, passed via `-D` option to `cmake`). Alternatively, you may hint about location of Lua installation by setting `LUA_DIR` environment variable: while this variable is not documented, it is used by the script `FindLua.cmake`."^^ . "Math.round(number, 10) in lua"^^ . . . "haproxy"^^ . . "I have updated my question with that (and accidentally deleted the comment where I told you this already, while thinking that clicking "delete" on a new comment would cancel the creation of the comment. Thus...this duplicate. Sorry , lol."^^ . . . "0"^^ . "0"^^ . . ".lua files seem to have been corrupted"^^ . . "1"^^ . "1"^^ . "octave"^^ . "0"^^ . . "0"^^ . . . . . . . . . "1"^^ . . "What exactly is the `command` in `io.popen()` ?"^^ . . "0"^^ . . . . . . . . . . "1"^^ . . "<p>I have this lua and it worked just fine back in may, then yesterday I came back to test it out after several months not used, and now, nothing, did anything change in Ghub/Lua?</p>\n<p>This is the script:</p>\n<pre><code>function OnEvent(event, arg)\n OutputLogMessage(&quot;event = %s, arg = %d\\n&quot;, event, arg)\n if (event == &quot;PROFILE_ACTIVATED&quot;) then\n EnablePrimaryMouseButtonEvents(true)\n elseif event == &quot;PROFILE_DEACTIVATED&quot; then\n ReleaseMouseButton(2) -- to prevent it from being stuck on\n end\n if (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 7) then\n recoil = not recoil\n end\n if (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and recoil) then\n if recoil then\n repeat\n Sleep(18)\n MoveMouseRelative(0,2)\n until not IsMouseButtonPressed(1)\n end\n end\nend\n</code></pre>\n<p>I tried reinstalling Logitech Ghub several times including reboots, nothing changed.</p>\n<p><em>EDIT</em> I added this at the top of my script, and it seems to have done the trick.</p>\n<pre><code>EnablePrimaryMouseButtonEvents(true);\n</code></pre>\n"^^ . "Using `setfenv` alone does not provide proper isolation. Even if you gave them completely different environments, the string metatable for example would still be shared. Are your isolation concerns security or interoperability concerns (are scripts trusted)?"^^ . . "0"^^ . . . "@TormyVanCool it would have been useful to know that upfront, edited."^^ . "0"^^ . "eLua contains a lot of eLua-specific [modules](https://github.com/elua/elua/tree/master/src/modules), and you can add your own module the same way. In an eLua script your function invocation will look like `mymodule.turnlampon()`, where `mymodule` is your module written in C."^^ . . . . . "@IHML, You can approve the answer if it works for you."^^ . "1"^^ . "0"^^ . . . . "0"^^ . "0"^^ . . . . . . "<p>The <em>printf</em>-style <code>OutputLogMessage</code> requires that the arguments associated with the <code>%d</code> <em>format specifier</em> (and other numeric specifiers) be a number type (or be coercible to a number type - i.e., producing a non-<em>nil</em> value from <a href="https://www.lua.org/manual/5.1/manual.html#pdf-tonumber" rel="nofollow noreferrer"><code>tonumber</code></a>).</p>\n<p>This function directly mirrors the <a href="https://www.lua.org/manual/5.1/manual.html#pdf-string.format" rel="nofollow noreferrer"><code>string.format</code></a> function, which can be easily tested:</p>\n<pre class="lang-lua prettyprint-override"><code>Lua 5.4.4 Copyright (C) 1994-2022 Lua.org, PUC-Rio\n&gt; string.format('%d', 42)\n42\n&gt; string.format('%d', '42')\n42\n&gt; string.format('%d', nil)\nstdin:1: bad argument #2 to 'format' (number expected, got nil)\nstack traceback:\n [C]: in function 'string.format'\n stdin:1: in main chunk\n [C]: in ?\n&gt; string.format('%d')\nstdin:1: bad argument #2 to 'format' (no value)\nstack traceback:\n [C]: in function 'string.format'\n stdin:1: in main chunk\n [C]: in ?\n</code></pre>\n<p>During the <code>&quot;PROFILE_ACTIVATED&quot;</code> and <code>&quot;PROFILE_DEACTIVATED&quot;</code>, <code>OnEvent</code> is passed a <em>nil</em> value as its second argument, and you are unconditionally passing it to <code>OutputLogMessage</code> as the argument associated with <code>%d</code>.</p>\n<p>You can guard against this in a few ways, including</p>\n<pre class="lang-lua prettyprint-override"><code>-- check that arg is truthy, choosing to display nothing if it is falsy (nil)\nif arg then\n OutputLogMessage(&quot;event = %s, arg = %d\\n&quot;, event, arg)\nend\n</code></pre>\n<p>or</p>\n<pre class="lang-lua prettyprint-override"><code>-- display a truthy arg, or a sentinel value otherwise\nOutputLogMessage(&quot;event = %s, arg = %d\\n&quot;, event, arg or -1)\n</code></pre>\n<hr />\n<p>As an aside, your <code>mode_change</code> is poor from a maintainability standpoint. Any time you find yourself enumerating variable names (lit. <code>var_one</code>, <code>var_two</code>, <code>var_three</code>, etc.) you should stop and ask yourself if there is not a more appropriate <em>data structure</em> to use.</p>\n<p>In Lua you have access to <a href="https://www.lua.org/manual/5.1/manual.html#2.2" rel="nofollow noreferrer">tables</a>.</p>\n<p>Consider the following, condensed example where any time a G-button is pressed, <code>keymap</code> is reassigned to a new table, effectively setting all possible values of <code>arg</code> to <em>nil</em>, except for the current value of <em>arg</em> being set to the inverse of its previous value.</p>\n<p>(<em>nil is falsy, equivalent to <code>false</code> for the purpose of conditional logic (<code>if not x then</code>, etc.).</em>)</p>\n<p>Current values can be checked through indexing the table (i.e. <code>keymap[4]</code>, <code>keymap[2]</code>, etc.).</p>\n<pre class="lang-lua prettyprint-override"><code>local keymap = {}\n\nfunction OnEvent(event, arg)\n if &quot;G_PRESSED&quot; == event then\n keymap = { [arg] = not keymap[arg] }\n end\n\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and keymap[1] then\n -- ...\n end\nend\n</code></pre>\n"^^ . "Fixed line 19. Not sure what you mean by `buttonC = UDmi2.new()` but it gives me an error saying "unknown global UDmi2" so I tried changing my `local buttonO = gui.open` to `local buttonO = gui.open.new()` but that didn't seem to fix anything. I also added `buttonO.Position = UDim2.new()` with my coordinates since I didn't have that before (the other positions are under my variables) but nothing changed"^^ . "0"^^ . "<p>No syntactic sugar is available for function definitions within table constructors. This includes <code>function name (args) body end</code> for <code>name = function (args) body end</code>, and by extension the colon syntax.</p>\n<p>You must use an explicit first function parameter (it does not <em>need</em> to be named <code>self</code>, but that is good practice).</p>\n<p>As you have noted, this will work, as colon syntax for function calls is a separate form of syntactic sugar.</p>\n<blockquote>\n<p>A call v:name(args) is syntactic sugar for v.name(v,args), except that v is evaluated only once.</p>\n</blockquote>\n<p>Lua 5.4:</p>\n<ul>\n<li><a href="https://www.lua.org/manual/5.4/manual.html#3.4.9" rel="nofollow noreferrer">§3.4.9 - Table Constructors</a></li>\n<li><a href="https://www.lua.org/manual/5.4/manual.html#3.4.10" rel="nofollow noreferrer">§3.4.10 – Function Calls</a></li>\n<li><a href="https://www.lua.org/manual/5.4/manual.html#3.4.11" rel="nofollow noreferrer">§3.4.11 - Function Definitions</a></li>\n</ul>\n"^^ . . . . . . . "0"^^ . "Update. Solved the problem, just had to install the newest version of Scribunto, it works well now."^^ . . "test() is not called anywhere else in my code and I actually don't have a function that sets playerInjuries to nil. Before test() is called, the playerInjuries variable is always initialized, but can never be used outside of its own function. And that's what I don't understand."^^ . "<p>I have a way to create a circle object and put the pointer into a vector before passing the pointer to Lua. I want to be able to call a destroy function that will remove the pointer from the vector and then set the circle object in lua to a nil value before deleting the pointer.</p>\n<p>here's how the Lua state is set up</p>\n<pre class="lang-cpp prettyprint-override"><code>lua_pushlightuserdata(luaState, this);\nlua_setglobal(luaState, &quot;LUA_HOST&quot;);\n\nlua_newtable(luaState);\nint circleTblIdx = lua_gettop(luaState);\nlua_pushvalue(luaState, circleTblIdx);\nlua_setglobal(luaState, &quot;Circle&quot;);\n\nlua_pushcfunction(luaState, wrap_createCircle);\nlua_setfield(luaState, -2, &quot;new&quot;);\nlua_pushcfunction(luaState, wrap_setCircleRadius);\nlua_setfield(luaState, -2, &quot;setRadius&quot;);\nlua_pushcfunction(luaState, wrap_destroyCircle);\nlua_setfield(luaState, -2, &quot;destroy&quot;);\n\nluaL_newmetatable(luaState, &quot;CircleMetaTable&quot;);\n\nlua_pushstring(luaState, &quot;__index&quot;);\nlua_pushvalue(luaState, circleTblIdx);\nlua_settable(luaState, -3);\n</code></pre>\n<p>here's the functions</p>\n<pre class="lang-cpp prettyprint-override"><code>int wrap_createCircle(lua_State* luaState){\n\n if (lua_gettop(luaState) != 1) return -1;\n float radius = lua_tonumber(luaState, 1);\n CircleShape* circle = (CircleShape*)lua_newuserdata(luaState, sizeof(CircleShape));\n new (circle) CircleShape(radius);\n luaL_getmetatable(luaState, &quot;CircleMetaTable&quot;);\n lua_setmetatable(luaState, -2);\n\n //putting the circle into a list called draw objects\n lua_getglobal(luaState, &quot;LUA_HOST&quot;);\n Render* host = static_cast&lt;Render*&gt;(lua_touserdata(luaState, -1));\n host-&gt;drawObjects.push_back(circle);\n lua_pop(luaState, 1);\n\n return 1;\n}\n\n//this works fine, no need to change\nint wrap_setCircleRadius(lua_State* luaState){\n\n if (lua_gettop(luaState) != 2) return -1;\n CircleShape* circle = static_cast&lt;CircleShape*&gt;(lua_touserdata(luaState, 1));\n float radius = lua_tonumber(luaState, 2);\n circle-&gt;setRadius(radius);\n\n return 0;\n\n}\n\nint wrap_destroyCircle(lua_State* luaState){\n\n if (lua_gettop(luaState) != 1) return -1;\n CircleShape* circle = static_cast&lt;CircleShape*&gt;(lua_touserdata(luaState, 1));\n\n // TODO: remove the pointer from Lua and make the circle into a nil value\n\n // This removes the pointer from the list, it works\n lua_getglobal(luaState, &quot;LUA_HOST&quot;);\n Render* host = static_cast&lt;Render*&gt;(lua_touserdata(luaState, -1));\n for (int i=0; i&lt;host-&gt;drawObjects.size(); i++){\n Drawable* obj = host-&gt;drawObjects[i];\n\n if ( (void*)obj == (void*)circle ){\n host-&gt;drawObjects.erase(host-&gt;drawObjects.begin() + i);\n break;\n }\n }\n lua_pop(luaState, 1);\n\n //TODO: delete circle pointer, currently can't delete as what I think is happening\n // is lua is using the pointer, that's why when I delete it, it crashes\n //delete circle;\n\n return 0;\n\n}\n</code></pre>\n<p>here's the lua code</p>\n<pre class="lang-lua prettyprint-override"><code>local circle = Circle.new(100)\ncircle:setRadius(200)\nprint(circle) -- this will print the circle pointer\ncircle:destroy() -- destroy, this is where I want the circle to be set to nil\nprint(circle) -- this should print nil\n</code></pre>\n<p>I have tried setting the metatable to a nil value but this just makes the circle object from a CircleMetaTable type to a user data type, calling delete will still crash</p>\n<p>here`s the code that I tried</p>\n<pre class="lang-cpp prettyprint-override"><code>int wrap_destroyCircle(lua_State* luaState){\n\n if (lua_gettop(luaState) != 1) return -1;\n CircleShape* circle = static_cast&lt;CircleShape*&gt;(lua_touserdata(luaState, 1));\n\n lua_pushnil(luaState);\n lua_setmetatable(luaState, 1); // setting to nil\n\n lua_getglobal(luaState, &quot;LUA_HOST&quot;);\n Render* host = static_cast&lt;Render*&gt;(lua_touserdata(luaState, -1));\n for (int i=0; i&lt;host-&gt;drawObjects.size(); i++){\n Drawable* obj = host-&gt;drawObjects[i];\n\n if ( (void*)obj == (void*)circle ){\n cout &lt;&lt; &quot;Delete: &quot; &lt;&lt; obj &lt;&lt; endl;\n host-&gt;drawObjects.erase(host-&gt;drawObjects.begin() + i);\n break;\n }\n }\n lua_pop(luaState, 1);\n\n // delete circle;\n\n return 0;\n\n}\n\n</code></pre>\n<p>result:</p>\n<pre class="lang-lua prettyprint-override"><code>local circle = Circle.new(100)\ncircle:setRadius(200)\nprint(circle) -- prints: CircleMetaTable: PointerToCircle\ncircle:destroy() -- destroy, this is where I want the circle to be set to nil\nprint(circle) -- prints: userData: PointerToCircle (I want this to print nil)\n</code></pre>\n"^^ . . . . . . "<p>Let's say I have this code:</p>\n<pre class="lang-lua prettyprint-override"><code>local testtbl = {&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;}\n</code></pre>\n<p>How do I get the index of an element?\nFor example:</p>\n<pre class="lang-lua prettyprint-override"><code>print(indexOf(testtbl, &quot;bar&quot;)) -- 2\n</code></pre>\n"^^ . "<p>There is VS Code extension <a href="https://marketplace.visualstudio.com/items?itemName=boressoft.nodemcu-tools" rel="nofollow noreferrer">NodeMCU-Tools</a> (marketplace.visualstudio.com). You can use it instead of ESPlorer.</p>\n"^^ . . . . "<p>I am a new programmer and have been working with some of my friends on Roblox. We have been trying to make a game with a fun combat system, but have failed in every attempt, although we're not ready to give up.</p>\n<p>We've tried googling things, searching tutorials on YouTube and have been trying for about a week to get this to work. We can barely get a punch animation to play when our goal is to make a combat system with a normal attack that combos up to 5, a skill that can be used every 15 seconds, and an ultimate ability that charges whenever you hit an enemy.\nThank you to anyone that can help, I feel as if I'm in way over my head and I don't really know where to start.</p>\n"^^ . "0"^^ . "0"^^ . . "string"^^ . "2"^^ . . . . "Yes, you must use an explicit `self` in the second case."^^ . . . . "<p>I was using a tutorial to make an HP bar and I followed it to a tee (I feel like) but my hp is not working. <a href="https://www.youtube.com/watch?v=qEI9FY8Okis" rel="nofollow noreferrer">Here is the tutorial for reference</a>.</p>\n<p>Here is the code</p>\n<pre class="lang-lua prettyprint-override"><code>local greenFrame = script.Parent.Green\nlocal label = script.Parent.TextLabel\n\nlocal tweenService = game:GetService(&quot;TweenService&quot;)\nlocal info = TweenInfo.new(.5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,0)\n\nlocal lastHealth = 0\n\nwhile wait(1) do\n if game.Players.LocalPlayer.Character then\n local currentHealth = math.floor(game.Player.LocalPlayer.Character.Humanoid.Health)\n \n local newFrameSize = UDim2.new(currentHealth/100,0,1,0)\n \n local tween = tweenService:Create(greenFrame,info,{Size=newFrameSize})\n \n tween:Play()\n \n if currentHealth &gt; lastHealth then\n for i = lastHealth, currentHealth, 1 do\n label.Text = tostring(i)..&quot;Hp&quot;\n wait(1/(currentHealth-lastHealth))\n end\n else\n for i = lastHealth, currentHealth, -1 do\n label.Text = tostring(i)..&quot;Hp&quot;\n wait(1/(currentHealth-lastHealth))\n end\n \n end\n lastHealth = currentHealth\n end\nend \n</code></pre>\n"^^ . . . "0"^^ . . . . . "0"^^ . . "0"^^ . . "nginx"^^ . "<p>I'm not sure I fully understand what you're trying to do, but I don't think AtomicLong is the way to go. I would suggest a cache with a TTL defined for whatever time window you want. Rather than increment your AtomicLong, you insert a new record for every hit. Your count is just the size of the cache.</p>\n"^^ . "0"^^ . "0"^^ . . . . "<pre><code>local Target = {[&quot;Transparency&quot;] = 1}\n</code></pre>\n"^^ . . . . "<p><code>Sleep</code> expects integer amount of milliseconds.<br />\nTry</p>\n<pre><code>Sleep(math.floor(gaussianRandom(800, 200)))\n</code></pre>\n"^^ . . . "3"^^ . "0"^^ . "Lua Discord webhook bugged image dont display"^^ . "fluent-bit"^^ . . "0"^^ . "0"^^ . "<blockquote>\n<p>*EDIT: It is not specific to Zyte, I have the same issue when running in a docker container. I have to throw an exception to log in. I need it to work for multiple runs while having the container be persistent.</p>\n</blockquote>\n<p>I have a login function here that was originally working reliably, however it stopped working and I've been trying to figure out why. During my attempts to fix the problem, I created a new function that checks login success and then repeats the login with a different lua script. However, this did not work, and any new combination of lua script failed to log in even though it should be working.</p>\n<pre><code>def start_requests(self):\n login_url = &quot;URL&quot;\n yield SplashRequest(\n login_url,\n splash_headers={\n # used for initializing zyte splash\n &quot;Authorization&quot;: basic_auth_header(self.settings[&quot;APIKEY&quot;], &quot;&quot;)\n },\n callback=self.start_scraping,\n endpoint=&quot;execute&quot;,\n cache_args=[&quot;lua_source&quot;],\n args={\n &quot;wait&quot;: random.uniform(2.1, 3.4),\n &quot;lua_source&quot;: self.LUA_LOGIN_SOURCE,\n &quot;url&quot;: login_url,\n &quot;ua&quot;: self.random_user_agent,\n },\n meta={\n &quot;max_retry_times&quot;: 0,\n },\n )\n</code></pre>\n<p>Then, I mistakenly added exit() without the requirement/status code and it threw an <code>unhandled in Deferred</code> error. Then, <code>start_scraping</code> ran again, and this time it was logged in and working fine.</p>\n<p>I'm guessing this has something to do with the cache in Zyte or scrapy and maybe the way that I'm storing cookies. The cookies expired at the end of the last session but I don't think they should persist in the Zyte instance.</p>\n<p>Would throwing an error reset Scrapy Splash in Zyte and is that why it is fixing the problem? I need to figure out why this is happening so I don't need to throw an unhandled error at the start of every job hahaha</p>\n<p>Here is the QUICK AND DIRTY check/retry function:</p>\n<pre><code> def start_scraping(self, response):\n if response.xpath(&quot;/html/body/h1//text()&quot;).extract_first() != &quot;Forbidden&quot;:\n while self.login_counter &lt; 4:\n self.login_counter += 1\n \n if self.login_counter == 1:\n self.LUA_LOGIN_SOURCE\n # if the login function fails on attempt 3,\n # then try window-not-selected lua version\n elif self.login_counter == 2:\n lua_source = self.LUA_LOGIN2_TAB_SOURCE\n # try unhandled error (logs in successfully)\n elif self.login_counter == 3:\n exit()\n login_url = &quot;URL&quot;\n yield SplashRequest(\n login_url,\n splash_headers={\n # used for initializing zyte splash\n &quot;Authorization&quot;: basic_auth_header(self.settings[&quot;APIKEY&quot;], &quot;&quot;)\n },\n callback=self.start_scraping,\n endpoint=&quot;execute&quot;,\n cache_args=[&quot;lua_source&quot;],\n args={\n &quot;wait&quot;: random.uniform(4.1, 5.4),\n &quot;lua_source&quot;: lua_source,\n &quot;url&quot;: login_url,\n &quot;ua&quot;: self.random_user_agent,\n },\n meta={\n &quot;max_retry_times&quot;: 0,\n },\n )\n else:\n print(&quot;Logged in!&quot;)\n</code></pre>\n<p>An example of the working lua function:</p>\n<pre><code>function main(splash, args)\n splash:init_cookies(splash.args.cookies)\n assert(splash:go{args.url, headers=splash.args.headers, http_method=splash.args.http_method, body=splash.args.body,})\n assert(splash:wait(1))\n \n -- splash:send_keys(&quot;&lt;Tab&gt;&quot;)\n splash:send_text('&lt;USERNAME&gt;')\n assert(splash:wait(0.5))\n splash:send_keys(&quot;&lt;Tab&gt;&quot;)\n assert(splash:wait(0.5))\n splash:send_text('&lt;PASSWORD&gt;')\n assert(splash:wait(0.5))\n splash:send_keys(&quot;&lt;Return&gt;&quot;)\n assert(splash:wait(2))\n \n return {\n html = splash:html(),\n har = splash:har(),\n png = splash:png(),\n cookies = splash:get_cookies(),\n }\nend\n</code></pre>\n<blockquote>\n<p>*Edit I am also storing cookies in a dictionary, but I don't know if it's relevant:</p>\n</blockquote>\n<pre><code>cookies_dict = {\n cookie[&quot;name&quot;]: cookie[&quot;value&quot;] for cookie in response.data[&quot;cookies&quot;]\n }\n</code></pre>\n"^^ . . . "1"^^ . . . . "You guys are great, thanks so much it worked! Oka, if possible do you have any reference material to tables and an example script? that would help alot in learning LUA. @Eski thank man it works .. if u guys have any type of video or reference material to share that would be great for me (as i am still learrning) thank you"^^ . "0"^^ . . . "0"^^ . "0"^^ . . . "0"^^ . . . "<p>Thank @Nick, I use <code>^%d|[1-2]|.+$</code> works fine.</p>\n"^^ . . "Worth noting, `ply` also acts as a table, and data can be written directly to it. eg. `ply.playerInjuries = ply.playerInjuries or {}`"^^ . "0"^^ . . . "<p>I use <a href="https://github.com/neoclide/coc.nvim" rel="nofollow noreferrer">coc.nvim</a> with the proposed default configuration that set (in a lua file) :</p>\n<pre><code>-- Use `[g` and `]g` to navigate diagnostics\n-- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list\nkeyset(&quot;n&quot;, &quot;[g&quot;, &quot;&lt;Plug&gt;(coc-diagnostic-prev)&quot;, {silent = true})\nkeyset(&quot;n&quot;, &quot;]g&quot;, &quot;&lt;Plug&gt;(coc-diagnostic-next)&quot;, {silent = true})\n</code></pre>\n<p>I would like to know is there is a way to make these motion repeteable with &quot;.&quot;.</p>\n<p>I see that the tpope's plugin <a href="https://github.com/tpope/vim-repeat" rel="nofollow noreferrer">vim-repeat</a> seems to allow it. Indeed, it says that:</p>\n<pre><code>Adding support to a plugin is generally as simple as the following command at the end of your map functions.\n\nsilent! call repeat#set(&quot;\\&lt;Plug&gt;MyWonderfulMap&quot;, v:count)\n</code></pre>\n<p>But I have no idea how to actually put this line of code with the &quot;keyset&quot; command.</p>\n<p>Do you have an idea of how to do it?</p>\n<p>Thanks for reading (and helping) me!</p>\n"^^ . . . "Is there a way to keep clicking at 1-second intervals?"^^ . . . "syslog"^^ . . . . . . . . "Roblox anchoring for a part instance not working"^^ . "cpanel"^^ . . "plugins"^^ . . . . . . . "Well, imagine using TMUX and you have split your window horizontally.\nI usually have lubarvim in upper half and terminal in a bottom part of a window. \n\nWhile Lunarvim is still open, I do `git pull` so the content of the files was changed.\n\nI was looking for some easy way to "refresh" all buffers in LunarVim to reflect the changes when git pull"^^ . . . . . . . "0"^^ . "0"^^ . . . . "In Lua 5.3+ you have `lua_geti` for integer indices. In Lua 5.2- you should use `lua_pushnumber + lua_gettable`"^^ . . "0"^^ . . "There are a lot of cells filled in the document. The last completed one is M11. Unfortunately, the proposed changes did not help. cursor:getRows():getCount() and cursor:getColumns():getCount() are always equal to 1. I don't understand how it works =("^^ . . "syntax"^^ . "0"^^ . . "How to use lua plugins in ingress-nginx controller?"^^ . . "0"^^ . . . . "1"^^ . . . "0"^^ . . "1"^^ . "(Lua C API in C++) creating a destroy function for metatable object"^^ . . "1"^^ . "<p>You have use the dot &quot;.&quot; to get/set the properties of an UI element. In this case,</p>\n<pre class="lang-lua prettyprint-override"><code>buttonC = UDmi2.new() -- this sets the variable to UDmi2 position\nbuttonC.Position = UDmi2.new() -- set the position of buttonC\nbuttonO.Position = UDmi2.new();\n\n</code></pre>\n<p>Also, in line 19 you are missing the closing parenthesis.</p>\n"^^ . . . . . . "3"^^ . . "I my personal setup I would use chezmoi to define a env variable securely and load that value in my lua setup. However, is there a recommended way or even support in Neovim? At least that is the essence of the question."^^ . . . . "rate-limiting"^^ . . "4"^^ . . "linux"^^ . . . "1"^^ . . . . . . . . . "<p>Ran into the same issue. tried null-ls but moved away from it doe to its archiving.</p>\n<p>I now use <a href="https://github.com/prettier/vim-prettier" rel="nofollow noreferrer">vim-prettier</a></p>\n<p>add it to packer using this. but switch out yarn for whatever you use.</p>\n<pre><code>use { 'prettier/vim-prettier',\n run = 'yarn install',\n ft = { 'javascript', 'typescript', 'css', 'less', 'scss', 'graphql', 'markdown', 'vue', 'html' }\n }\n</code></pre>\n<p>what I want to do now is change the key binding to <code>&lt;leader&gt;f</code> if a prettierrc file is present and default to the buff format if not.</p>\n"^^ . . . "1"^^ . . "0"^^ . . . . . . . . . . . . . "<p>I have a long stretch of code here for a bomb script inside a tool that makes acid, but the acid does not anchor, the acid anchoring code piece is on line 41. Its supposed to make acid for an early prototype of a bomb.</p>\n<pre><code>local tool = script.Parent\nlocal char = tool.Parent.Parent.PlayerGui\nlocal acid\ntool.Activated:Connect(function()\n local part = Instance.new(&quot;Part&quot;)\n part.Parent = workspace\n part.Name = &quot;Bomb&quot;\n part.Shape = Enum.PartType.Ball\n part.Size = Vector3.new(2,2,2)\n part.Position = tool.Handle.Position\n part.BrickColor = BrickColor.new(&quot;Black&quot;)\n local flashcount = 0\n \n local function flash()\n local part = part\n part.BrickColor = BrickColor.new(&quot;Really red&quot;)\n wait(0.99)\n part.BrickColor = BrickColor.new(&quot;Black&quot;)\n end\n \n while wait(1) do\n flash()\n flashcount += 1\n if flashcount == 4 then\n local sound = Instance.new(&quot;Sound&quot;)\n sound.SoundId = &quot;rbxassetid://6823153536&quot;\n sound.RollOffMaxDistance = 100\n sound.Parent = part\n sound:Play()\n local explosion = Instance.new(&quot;Explosion&quot;)\n explosion.Parent = workspace\n explosion.Position = part.Position\n explosion.Hit:Connect(function(parti)\n parti.Anchored = false\n end)\n \n acid = Instance.new(&quot;Part&quot;)\n acid.Position = part.Position\n acid.Parent = workspace\n acid.Size = Vector3.new(1, 5, 5)\n acid.Anchored = true\n \n break\n end\n end\n wait(4)\n part:Destroy()\n wait(4)\nend)\n</code></pre>\n<p>I also tried isolating this from it but it didn't work. I need to anchor it for an bomb tool in my game.</p>\n"^^ . . . "I'm using 5.3, but `lua_geti` just gives me "PANIC: unprotected error in call to Lua API (attempt to index a nil value) " Will update the question what I did with that."^^ . "<p>I've seen this question a few times for python but I am looking for how to do it in Lua.\nI have a dictionary that looks like:</p>\n<pre><code>myValues = {\n&quot;key1&quot;:123,\n&quot;key2&quot;:43,\n&quot;key3&quot;:367, \n&quot;key4&quot;:2\n}\n</code></pre>\n<p>I want a function or method that gives me the key with the largest value. In this case I would input the 'myValues' dictionary and it will throw out 'key3' as a result. Any ideas?</p>\n"^^ . . . . "0"^^ . . "@ESkri that did the trick, solved!"^^ . . "Why my Lua table is error when l use while loop"^^ . . "0"^^ . . "although the stacking problem does not occur anymore, now, when i double-click, my character's speed (humanoid.WalkSpeed) keeps adding the "shoting" value, making me incredibly fast, instead of just adding it when i quit shoting. what could i do?"^^ . . "encoding"^^ . "<p>A new <em>keyword</em> requires either a <a href="https://en.wikipedia.org/wiki/Preprocessor" rel="nofollow noreferrer">preproccesor</a> or modifying the language's grammar <a href="https://www.lua.org/source/5.4/" rel="nofollow noreferrer">directly</a>.</p>\n<p>An approximation of this syntax can already be easily achieved without leaving the confines of the language by writing an <a href="https://www.lua.org/manual/5.4/manual.html#3.3.5" rel="nofollow noreferrer"><em>iterator</em></a> - a function that when provided to the generic <a href="https://www.lua.org/manual/5.4/manual.html#3.3.5" rel="nofollow noreferrer"><code>for</code></a> continuously supplies values for the loop variables, until the first value it returns is <em>nil</em>.</p>\n<p>(<em>More specifically, you usually write a function that creates (returns) an iterator. <a href="https://www.lua.org/manual/5.4/manual.html#pdf-pairs" rel="nofollow noreferrer"><code>pairs</code></a> and <a href="https://www.lua.org/manual/5.4/manual.html#pdf-ipairs" rel="nofollow noreferrer"><code>ipairs</code></a> are examples of this.</em>)</p>\n<p><a href="https://www.lua.org/manual/5.4/manual.html#pdf-next" rel="nofollow noreferrer"><code>next</code></a> is a function that when provided a <em>table</em> and a <em>key</em>, returns the <em>next</em> key and its associated value.</p>\n<p>You can extend this with metatables and the <code>__call</code> metamethod to shorten the syntax required to construct the iterator (properly constructed classes / objects / prototypes (i.e., OOP) in Lua already rely heavily on metatables).</p>\n<p>All this means that the syntax</p>\n<pre class="lang-lua prettyprint-override"><code>for value in collection 'filter' do\n print(value)\nend\n</code></pre>\n<p>is very achievable.</p>\n<p>The full example, with a very basic iterator:</p>\n<pre class="lang-lua prettyprint-override"><code>-- This is a live, proxied view into an existing table\nlocal function View(t)\n local methods = {}\n\n local function match(value, filter)\n return type(value) == 'string' and value:match(filter)\n end\n\n function methods:filter(filter)\n local key, value\n\n return function (_)\n repeat\n key, value = next(t, key)\n until value == nil or match(value, filter)\n\n return value, key\n end\n end\n\n return setmetatable({}, {\n __index = methods,\n __metatable = false,\n __call = methods.filter\n })\nend\n\nlocal foo = View { 'c', 'a', 'b', 'a', 'c', 'd' }\n\n-- :filter via __call\nfor value in foo '[ab]' do\n print(value)\nend\n\nprint('-------')\n\n-- explicitly\nfor value in foo:filter '[cd]' do\n print(value)\nend\n\nprint('-------')\n\n-- additional index variable\n-- this is the inverse of the more typical `pairs` construct\nfor value, key in foo '[ad]' do\n print(key)\nend\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>a\nb\na\n-------\nc\nc\nd\n-------\n2\n4\n6\n</code></pre>\n"^^ . . . . . . . . . "<p>I need to work with a LibreOffice COM object. I was able to get a workbook (not sure if this is the correct name), but I don't understand how to properly delete or create a new sheet. Please show me a simple example. Here's what I did:</p>\n<pre><code>local _LibreOfffice = luacom.CreateObject(&quot;com.sun.star.ServiceManager&quot;)\nlocal desktop = _LibreOfffice:createInstance(&quot;com.sun.star.frame.Desktop&quot;)\nself._workbook = desktop:loadComponentFromURL(&quot;private:factory/scalc&quot;, &quot;_blank&quot;, 0, {})\n\n\nlocal sheet_count = self._workbook:getSheets():getCount()\nfor i = sheet_count - 1, 0, -1 do\n local sheet = self._workbook:getSheets():getByIndex(i)\n --remove, but how?\nend\n</code></pre>\n"^^ . . "time-complexity"^^ . . . . . . . "0.1 does not have an exact binary representation."^^ . . "<p>I need to determine if a string is in the format I want. What I want is <code>number|number|string</code>,such as <code>1|2|abc</code>. I tried this</p>\n<pre><code>if string.match( my_str,&quot;[%d]|[1-2]|.&quot;) then \n print(&quot;yes&quot;)\nend\n</code></pre>\n<p>But I also got <code>yes</code> for <code>a1|2|abc</code>, which is not what I want. How to write regular expressions to ensure that the first few digits can only be numbers?</p>\n"^^ . . "0"^^ . "2"^^ . . "bresenham"^^ . . . . "prettier"^^ . . . . "Welcome to StackOverflow! I'm sorry, but such vague, open questions or questions along the lines of "please implement this for us" aren't fit for StackOverflow - take the [tour](https://stackoverflow.com/tour) or visit the [help center](https://stackoverflow.com/help) to see which questions are suitable for StackOverflow. What exactly have you tried, where have you failed?"^^ . "Mod Factorio - an attempt to turn off the music while the game is running"^^ . . . "<p>I believe it's just <code>settings[&quot;my-mod-always-difficult&quot;].value</code> without the global.</p>\n<p>Then your <code>removeAddedMusic</code> function would need to be in the data stage, as the control stage can no longer modify the data global.</p>\n"^^ . . . "0"^^ . "0"^^ . "0"^^ . . . . "Replace the last `Sleep(50)` with `Sleep(900)`"^^ . . "1"^^ . "1"^^ . . . "0"^^ . . . "1"^^ . "0"^^ . . . "I did it, but it doesn't change the outcome.I did more: I emptied ~/config/nvim and reinstalled everything, but the same error persists."^^ . . "<p>I was given a solution here: <a href="https://ask.libreoffice.org/t/how-to-get-number-of-cells-in-libreofficecalc-workspace-using-com-object/96360/5" rel="nofollow noreferrer">https://ask.libreoffice.org/t/how-to-get-number-of-cells-in-libreofficecalc-workspace-using-com-object/96360/5</a></p>\n<p>The answer suggested by JohnSUN is correct, but that's not how &quot;true&quot; and &quot;false&quot; work in Lua. You need to write it like this:</p>\n<pre><code>local cursor = self._worksheet:createCursor()\n cursor:gotoEndOfUsedArea(1)\n local nCountCells = cursor:getRows():getCount() * cursor:getColumns():getCount() --143\n local RCount = cursor:getRows():getCount() --11\n local CCount = cursor:getColumns():getCount() --13\n</code></pre>\n"^^ . "1"^^ . . . "physics"^^ . . . . "0"^^ . . . "<p>You probably need to <code>WaitForChild(“PrimaryPart”)</code> because if it tries to access it before it is loaded it will return <code>nil</code> thus your attempting nil with CFrame.</p>\n<p>Hope this helps!</p>\n"^^ . . . . . . . . "@HasanRaqib - Try `OutputLogMessage("event = %s, arg = %s\\n", event, tostring(arg))`"^^ . . "embedded eLua and C cooperative multitasking"^^ . "0"^^ . . "2"^^ . . . . . "1"^^ . . . . . . "0"^^ . "lua-c++-connection"^^ . . . . "I did, I added my coordinates inside the parenthesis just like that. Also, it's not UDmi2 it's UDim2"^^ . . . . "0"^^ . . . "<p>Does anyone know how to refresh LunarVim after a Git pull or a Git checkout? I keep working around this by closing and reopening LunarVim, which is completely wrong.</p>\n"^^ . . "2"^^ . "I am getting a error which makes legit no sense it's is based on datastore, magnitude and .touched event"^^ . . "1"^^ . . . "3"^^ . "0"^^ . . . . . "2"^^ . "How to "pack" a variable amount of outputs from a function in Lua?"^^ . . "<p>So this is in roblox studio so uhh.. Im kinda new so... idrk how to fix this here's the code.<br />\nimma explain tha code so uhh..<br />\nplayers should touch the checkpoints which is in workspace.Checkpoints<br />\nwhen they touch those the Stage.Value should add + 1<br />\nthen when they reach 30, they'll touch a part that will move them in the winner leaderboard<br />\nthat would add up too.. so uhh</p>\n<p>it seems like nothing is happening and no errors are found in the console</p>\n<pre><code>local Checkpoints = workspace.Checkpoints\n\ngame.Players.PlayerAdded:Connect(function(plr)\n local leaderstats = Instance.new(&quot;Folder&quot;, plr)\n leaderstats.Name = &quot;leaderstats&quot;\n local Stage = Instance.new(&quot;IntValue&quot;, leaderstats)\n Stage.Name = &quot;Stage&quot;\n Stage.Value = nil\n\n local Wins = Instance.new(&quot;IntValue&quot;)\n local WinnerArea = workspace.Checkpoints.WinSpawn\n Wins.Name = &quot;Wins&quot;\n Wins.Parent = leaderstats\n Wins.Value = 0\n\n WinnerArea.Touched:Connect(function(hit)\n if tonumber(Stage.Value) == 30 then\n Wins.Value = Wins.Value + 1\n Stage.Value = 0\n end\n end)\n\n local lastCheckpointName = &quot;&quot; -- Store the name of the last touched checkpoint\n\n for _, checkpoint in pairs(Checkpoints:GetChildren()) do\n checkpoint.Touched:Connect(function(hit)\n\n if hit.Parent:FindFirstChild(&quot;Humanoid&quot;) then\n local char = hit.Parent\n\n -- Ensure the player is the owner of the character\n if char.Parent == plr.Character then\n\n if tonumber(checkpoint.Name) == Stage.Value then\n lastCheckpointName = checkpoint.Name -- Store the name of the last touched checkpoint\n Stage.Value = Stage.Value + 1\n \n \n elseif checkpoint.Name == &quot;MainObbySpawn&quot; then\n Stage.Value = 0\n\n lastCheckpointName = checkpoint.Name -- Store the name of the last touched checkpoint\n end\n end\n end\n end)\n end\n\n plr.CharacterAdded:Connect(function(char)\n wait()\n local checkpointToMoveTo = Checkpoints:FindFirstChild(lastCheckpointName)\n if checkpointToMoveTo then\n \n char:MoveTo(checkpointToMoveTo.Position)\n elseif Checkpoints:FindFirstChild(&quot;MainObbySpawn&quot;) then\n char:MoveTo(Checkpoints:FindFirstChild(&quot;MainObbySpawn&quot;).Position)\n end\n end)\nend)\n</code></pre>\n<p>so i tried fixing some variables and relying on ai haha... nothing happens even the console isnt showing any errors regarding to it</p>\n"^^ . "0"^^ . . . . . "0"^^ . . . . . . . . . . . . "redis-scan"^^ . "I've updated GHub. Indeed, in version 2023.7 `nil` is passed."^^ . . . "0"^^ . . . "how can i convert a string to a list to index using a for loop in lua?"^^ . . . . . . . "0"^^ . . . . "1"^^ . "coc.nvim"^^ . . "<p>The problem's that when I double click quickly, the weapon runs one &quot;while&quot; process twice at the same time (which makes the weapon fire undeterminately as long as the left click is held down), thus making the weapon shot faster than expected.\nIt also, somehow, ignores the InputEnded function (which states that the while proccess yields when the left click is released), which would obviously prevent this &quot;while&quot; stacking as you can't double click without releasing the left mouse button first, obviously.\nI link the proccesses of the code below.</p>\n<pre><code>conn = UIS.InputBegan:Connect(function(input, gameProcessedEvent)\n if input.UserInputType == Enum.UserInputType.MouseButton1 then\n humanoid.WalkSpeed -= shoting\n toolDebounce = true -- the boolean that must be true for the while process to run\n while toolDebounce do\n local startPosition = tool.Part.Position\n local endPosition = mouse.Hit.Position\n\n remoteEvent:FireServer(tool, startPosition, endPosition)\n\n task.wait (debounceTime) \n end\n end\nend)\n\n\nconn2 = UIS.InputEnded:Connect(function(input, gameProcessedEvent)\n if input.UserInputType == Enum.UserInputType.MouseButton1 then\n toolDebounce = false -- when the boolean in question is set to false, the while proccess yields. this only works if the interval between clicks is, aproximately, 0.4 seconds long\n humanoid.WalkSpeed += shoting\n end\nend)\n</code></pre>\n<p>Any help is aprecciated and will be tried.</p>\n<p>I tried adding an &quot;if not&quot; clause before the InputBegan function, which would, in theory, prevent the gun from firing twice, as the toolDebounce boolean would still be true. However, it did not work, as the gun can still run the while function needed to fire twice at the same time though the boolean is still true, ignoring the if not clause which I stated before, somehow.</p>\n"^^ . "that's fine although I need to process it one by one sending them to an API that decodes their content .. an GSUB gets what's already decoded. In my case I need first to interrogate the API, det the value and only then use GSUB.\n\nAs I said: I have not clue which wildcard is contained nor howe many of them. hence my need is to get one by one, interrogate the API and put them into an array and then apply the gsub as you suggested."^^ . . . . . "1"^^ . . . . "Explain why you need a delay? Dobyou want to mimic and actual api response? If so, this is the wrong way to do it."^^ . . . "See https://create.roblox.com/docs/tutorials/scripting/basic-scripting/intro-to-scripting"^^ . . "0"^^ . . . . . "In other words, I understood it correctly, and there is no alternative to the explicit self? \nI'd be okay with that, I am/was just curious."^^ . . . "0"^^ . . "How do I make a script activate an enabled when stepping on a block? (Roblox)"^^ . . . . . . . "4"^^ . . "1"^^ . . . "<pre><code>playerInjuries = {}\n\nfunction OnPlayerTakeDamage(ply, dmginfo)\n if ply:IsPlayer() and dmginfo:IsDamageType(DMG_BULLET) then\n local hitgroup = ply:LastHitGroup()\n \n local injuryType = &quot;&quot;\n local injuryDescription = &quot;&quot;\n \n if hitgroup == HITGROUP_LEFTARM then\n local randomNum = RandomNumber(1, 100)\n if randomNum &gt;= 75 then\n injuryType = injuries[&quot;Arm Links&quot;][1]\n elseif randomNum &lt;= 75 and randomNum &gt;= 85 then\n injuryType = injuries[&quot;Arm Links&quot;][2]\n elseif randomNum &lt;= 85 and randomNum &gt;= 95 then\n injuryType = injuries[&quot;Arm Links&quot;][3]\n else\n injuryType = injuries[&quot;Arm Links&quot;][4]\n end\n elseif hitgroup == HITGROUP_RIGHTARM then\n local randomNum = RandomNumber(1, 100)\n if randomNum &gt;= 75 then\n injuryType = injuries[&quot;Arm Rechts&quot;][1]\n elseif randomNum &lt;= 75 and randomNum &gt;= 85 then\n injuryType = injuries[&quot;Arm Rechts&quot;][2]\n elseif randomNum &lt;= 85 and randomNum &gt;= 95 then\n injuryType = injuries[&quot;Arm Rechts&quot;][3]\n else\n injuryType = injuries[&quot;Arm Rechts&quot;][4]\n end\n elseif hitgroup == HITGROUP_LEFTLEG then\n local randomNum = RandomNumber(1, 100)\n if randomNum &gt;= 75 then\n injuryType = injuries[&quot;Bein Links&quot;][1]\n elseif randomNum &lt;= 75 and randomNum &gt;= 85 then\n injuryType = injuries[&quot;Bein Links&quot;][2]\n elseif randomNum &lt;= 85 and randomNum &gt;= 95 then\n injuryType = injuries[&quot;Bein Links&quot;][3]\n else\n injuryType = injuries[&quot;Bein Links&quot;][4]\n end\n elseif hitgroup == HITGROUP_RIGHTLEG then\n local randomNum = RandomNumber(1, 100)\n if randomNum &gt;= 75 then\n injuryType = injuries[&quot;Bein Rechts&quot;][1]\n elseif randomNum &lt;= 75 and randomNum &gt;= 85 then\n injuryType = injuries[&quot;Bein Rechts&quot;][2]\n elseif randomNum &lt;= 85 and randomNum &gt;= 95 then\n injuryType = injuries[&quot;Bein Rechts&quot;][3]\n else\n injuryType = injuries[&quot;Bein Rechts&quot;][4]\n end\n elseif hitgroup == HITGROUP_CHEST or hitgroup == HITGROUP_GENERIC then\n \n elseif hitgroup == HITGROUP_HEAD then\n \n end\n \n if injuryType ~= &quot;&quot; then\n if not playerInjuries[ply] then\n playerInjuries[ply] = {}\n end\n\n table.insert(playerInjuries[ply], injuryType)\n\n test(ply, injuryType)\n end\n end\nend\n\nfunction test(ply, injuryType)\n ply:ChatPrint(injuryType)\n ply:ChatPrint(&quot;Spielerverletzungen: &quot; .. table.concat(playerInjuries[ply], &quot;, &quot;))\nend\n</code></pre>\n<p>outside the OnPlayerTakeDamage function the player Injuries or players Injuries[ply] array is nil and I don't understand why or how to fix this.</p>\n<p>Everything except the array works.If it's helpful. The code is for the game Garry's mod</p>\n<p>The array playerInjuries[ply] should have a table for each player that contains all injuries of the respective player.</p>\n"^^ . "In line 32 you check if `char.Parent == plr.Character` and since you set `char` to `hit.Parent` in line 29 and hit will be the part of `plr.Character` that touches the baseplate so `hit.Parent` is `plr.Character` so when you check if `char.hit == plr.Charcter` you are checking if `plr.Character.Parent == plr.Charcter` in short changing line 32 to `if hit.Parent == plr.Character then` should fix the problem with checkpoints and wins not increasing. If you give me a detailed description of what you want the script to do, I can try making it for you."^^ . . . . . . "`debug.setmetatable(nil, {__index = {}})` also works"^^ . . . . . . . "lua-table"^^ . . "3"^^ . . . . . "scribunto"^^ . "Initialize Lua array in a function and use it outside. I do not get it"^^ . . "1"^^ . "<p>When I press Left ctrl and then press shift walking, give speed even when I'm squatting</p>\n<p>When you press Left Ctrl and then try to execute by pressing shift, even while squatting, it gives no speed to the character(no speed function in squat animation)</p>\n<pre class="lang-lua prettyprint-override"><code>local UIS = game:GetService('UserInputService');\nlocal key = Enum.KeyCode.LeftShift\nlocal ctrl = Enum.KeyCode.LeftControl\nlocal pl = game.Players.LocalPlayer;\nlocal char = script.Parent or pl.CharacterAdded:Wait();\n \nlocal hum = char:WaitForChild('Humanoid');\n \nlocal Move = 'rbxassetid://14908666655'\nlocal Idle = 'rbxassetid://14908644962'\n \nlocal Crouching = false;\nlocal Holding = false;\n \nlocal HoldCrouching = false;\n \nlocal function ResetAnimation(boolean)\n if boolean then\n script.CrouchAnimation.AnimationId = Move\n else\n script.CrouchAnimation.AnimationId = Idle\n end\nend\n \nlocal function ChangeState(boolean)\n if boolean then \n hum.WalkSpeed = 8\n \n hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)\n \n local Anim = hum:LoadAnimation(script.CrouchAnimation)\n Anim:Play()\n else\n hum.WalkSpeed = 16\n \n hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)\n for _,i in ipairs(hum.Animator:GetPlayingAnimationTracks()) do\n if i and i.Name == 'CrouchAnimation' then\n i:Stop()\n end\n end\n end\nend\n \nscript:WaitForChild('CrouchAnimation').Changed:Connect(function()\n if Crouching then\n \n for _,i in ipairs(hum.Animator:GetPlayingAnimationTracks()) do\n if i and i.Name == 'CrouchAnimation' then\n i:Stop()\n end\n end\n \n local Anim = hum:LoadAnimation(script.CrouchAnimation) \n Anim:Play()\n else\n for _,i in ipairs(hum.Animator:GetPlayingAnimationTracks()) do\n if i and i.Name == 'CrouchAnimation' then\n i:Stop()\n end\n end\n end\nend)\n \nUIS.InputBegan:Connect(function(Input, proc) \n if proc then\n return;\n end\n if Input then\n if Input.KeyCode == ctrl then\n if not Crouching then\n Crouching = true;\n \n ChangeState(true)\n \n elseif Crouching and not Holding then\n Crouching = false;\n \n ChangeState(false)\n \n end\n end\n end\nend)\n \n \n \nUIS.InputEnded:Connect(function(Input, proc)\n if proc then\n return;\n end\n if Input then\n if Input.KeyCode == ctrl then\n if Crouching and Holding then\n Crouching = false;\n \n ChangeState(false)\n end\n end\n end\nend)\n \ngame:GetService('RunService').RenderStepped:Connect(function()\n if Crouching then\n if hum.MoveDirection.Magnitude &gt; 0 then\n ResetAnimation(true)\n else\n ResetAnimation(false)\n end\n end\nend)\n</code></pre>\n<p>The code is working properly, but I was wondering how to solve this little bug of running while squatting</p>\n"^^ . . "1"^^ . . "logitech-gaming-software"^^ . . . "5"^^ . . . . . . . . . "How to get number of cells in LibreOfficeCalc workspace using COM-object?"^^ . "1"^^ . . "<p>I am trying to send the input memory metrics from fluent-bit to a remote syslog server. The output for memory metrics, when printing to stdout, looks typically like this:\n<code>[0] memory: [1694350030.133389853, {&quot;Mem.total&quot;=&gt;2006712, &quot;Mem.used&quot;=&gt;1872936, &quot;Mem.free&quot;=&gt;133776, &quot;Swap.total&quot;=&gt;2744316, &quot;Swap.used&quot;=&gt;718668, &quot;Swap.free&quot;=&gt;2025648}] </code></p>\n<p>When using the syslog output plugin, the <strong>syslog_message_key</strong> must be declared for it to successfully send the message. Now, when I set the syslog_message_key to something like <code>Mem.total</code>, I successfully start seeing &quot;2006712&quot; on my remote syslog server. However, I would like to send the <strong>entire payload</strong>, as in everything inside the {} to the remote syslog server.</p>\n<p>Currently, I tried the Nest filter plugin to nest everything under a single <code>Memstats</code> key. When I do this, the stdout looks as expected:</p>\n<p><code>[0] mem.local: [1694367396.133191260, {&quot;Memstats&quot;=&gt;{&quot;Mem.total&quot;=&gt;2006712, &quot;Mem.used&quot;=&gt;1899256, &quot;Mem.free&quot;=&gt;107456, &quot;Swap.total&quot;=&gt;2744316, &quot;Swap.used&quot;=&gt;737692, &quot;Swap.free&quot;=&gt;2006624}}]</code>, so it does successfully add the Memstats key.</p>\n<p>However, on my remote syslog server, I see blank logs appear. The same is noted when I run fluent bit on this remote system with syslog input (to receive from the sender). At first I thought perhaps there may be an issue with the parsing or receiver configuration, but when using the logger command to send a test nested JSON, I still see it show up on my syslog-ng server.</p>\n<p>Observed Outputs:</p>\n<pre><code>//Using Mem.total as syslog_message_key:\n&lt;date&gt; &lt;time&gt; &lt;IP&gt; 1 2023-09-10T19:14:01.132671Z - - - - - 2006712\n\n//Using the Memstats with Nest Filter as syslog_message_key OR using no key (not setting anything):\n&lt;date&gt; &lt;time&gt; &lt;IP&gt; 1 2023-09-10T19:14:33.133314Z - - - - - \n\n//Using logger command to send a simple test nested JSON to the syslog-ng server:\n&lt;date&gt; &lt;time&gt; &lt;IP&gt; 1 2023-09-10T14:01:33.708649-04:00 UbuntuVM vboxuser1 - - [timeQuality tzKnown=&quot;1&quot; isSynced=&quot;0&quot;] {&quot;Memstats&quot;: {&quot;test&quot;:&quot;hi&quot;, &quot;test2: &quot;hello&quot;}} \n\n</code></pre>\n<p>I have also tried using the record_modifier and modify but I get backend failure, and using the following LUA script has resulted in no difference; I don't even see a Memstats key added with it.</p>\n<pre><code>[FILTER]\n Name Lua\n Match *\n call append_record\n code function append_record(tag, timestamp, record) new_record = record new_record[&quot;Memstats&quot;] = record return 1, timestamp, new_record end\n\n[OUTPUT]\n Name stdout\n Match *\n</code></pre>\n<p>I would preferably like to resolve this using the Fluent Bit plugins, as they are geared towards achieving this sort of task. If anyone has done this before or knows how I may be able to send the entire record with all memory data rather than just an integer value for a single key, I would appreciate the help! Thank you!</p>\n"^^ . . . . . . "0"^^ . "1"^^ . . . "input"^^ . "2"^^ . . "0"^^ . "0"^^ . "2"^^ . . . . . . "0"^^ . "1"^^ . "0"^^ . . "0"^^ . "0"^^ . . "Or just `for letter in text:gmatch"."` if you want to iterate over characters."^^ . "0"^^ . . . "How do I find the index of an element in a table in Lua?"^^ . "0"^^ . "0"^^ . . . "As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . . . "roblox"^^ . "<p>I need to write a script in Lua that can open the required file for LibreOfficeCalc, find the required sheet in it, and count the number of cells in the working range. I was able to get the desired sheet this way:</p>\n<pre><code>self._myLOCdoc = luacom.CreateObject(&quot;com.sun.star.ServiceManager&quot;)\nself._desktop = self._myLOCdoc:createInstance(&quot;com.sun.star.frame.Desktop&quot;)\nself._workbook = self._desktop:loadComponentFromURL(&quot;file:///&quot; .. file_path, &quot;_blank&quot;, 0, {ReadOnly = false})\nself._worksheet = _workbook:getSheets():getByIndex(0) --Yes, I'm sure I'm getting the right sheet because I was able to check its name using :getName()\n</code></pre>\n<p>But what to do next? If I were using MSExcel, I would do something like this:</p>\n<pre><code>local user_range = self._worksheet.UsedRange\n\n--...\n\nlocal cell_cnt = user_range.Cells.count\n</code></pre>\n<p>But how to do the same with LibreOffice? I tried using self._worksheet:getRangeAddress(), but I'm not sure I got what I needed and couldn't get the cells from the result.</p>\n"^^ . "Why is this tagged for Python? I see no Python code"^^ . . "1"^^ . . "0"^^ . . . . "0"^^ . "1"^^ . "0"^^ . "0"^^ . . . "<p>You should look at the search capability of Redis Stack for this. You would use the <code>FT.CREATE</code> command to create a search index over part of the keyspace containing either Redis Hashes or Redis Stack JSON documents, then use the <code>FT.SEARCH</code> command to search for matches with a more SQL like syntax.</p>\n<p>This would allow you do to things like this (demo with hashes, you could also use JSON):</p>\n<p>Create some data:</p>\n<pre><code>\n&gt; hset data:1 value 1 data hello\n(integer) 2\n\n&gt; hset data:2 value 2 data world\n(integer) 2\n\n&gt; hset data:3 value 3 data how\n(integer) 2\n\n&gt; hset data:4 value 4 data are\n(integer) 2\n\n&gt; hset data:5 value 5 data you\n(integer) 2\n</code></pre>\n<p>Create an index over the data, here I'm indexing <code>value</code> as a number but you could also index <code>data</code> as a tag or full-text.</p>\n<pre><code>&gt; ft.create idx:data on hash prefix 1 data: schema value numeric sortable\n&quot;OK&quot;\n</code></pre>\n<p>Search will now keep track of all changes to keys with prefix <code>data:</code> whose type is Hash.</p>\n<p>Now, I can do some searches and get data back. Everything where value is less then 3:</p>\n<pre><code>&gt; ft.search idx:data &quot;@value:[-inf 2]&quot;\n1) &quot;2&quot;\n2) &quot;data:1&quot;\n3) 1) &quot;value&quot;\n 2) &quot;1&quot;\n 3) &quot;data&quot;\n 4) &quot;hello&quot;\n4) &quot;data:2&quot;\n5) 1) &quot;value&quot;\n 2) &quot;2&quot;\n 3) &quot;data&quot;\n 4) &quot;world&quot;\n</code></pre>\n<p>Search that returns all indexed items:</p>\n<pre><code>&gt; ft.search idx:data &quot;*&quot;\n1) &quot;5&quot;\n2) &quot;data:1&quot;\n3) 1) &quot;value&quot;\n 2) &quot;1&quot;\n 3) &quot;data&quot;\n 4) &quot;hello&quot;\n4) &quot;data:4&quot;\n5) 1) &quot;value&quot;\n 2) &quot;4&quot;\n 3) &quot;data&quot;\n 4) &quot;are&quot;\n6) &quot;data:3&quot;\n7) 1) &quot;value&quot;\n 2) &quot;3&quot;\n 3) &quot;data&quot;\n 4) &quot;how&quot;\n8) &quot;data:2&quot;\n9) 1) &quot;value&quot;\n 2) &quot;2&quot;\n 3) &quot;data&quot;\n 4) &quot;world&quot;\n10) &quot;data:5&quot;\n11) 1) &quot;value&quot;\n 2) &quot;5&quot;\n 3) &quot;data&quot;\n 4) &quot;you&quot;\n</code></pre>\n<p>By default you'll get the first 10 and can paginate using <code>LIMIT</code>... let's get 2:</p>\n<pre><code>&gt; ft.search idx:data &quot;*&quot; LIMIT 0 2\n1) &quot;5&quot;\n2) &quot;data:1&quot;\n3) 1) &quot;value&quot;\n 2) &quot;1&quot;\n 3) &quot;data&quot;\n 4) &quot;hello&quot;\n4) &quot;data:4&quot;\n5) 1) &quot;value&quot;\n 2) &quot;4&quot;\n 3) &quot;data&quot;\n 4) &quot;are&quot;\n</code></pre>\n<p>If you only want certain parts of the data back use <code>RETURN</code>:</p>\n<pre><code>&gt; ft.search idx:data &quot;*&quot; LIMIT 0 2 RETURN 1 data\n1) &quot;5&quot;\n2) &quot;data:1&quot;\n3) 1) &quot;data&quot;\n 2) &quot;hello&quot;\n4) &quot;data:4&quot;\n5) 1) &quot;data&quot;\n 2) &quot;are&quot;\n</code></pre>\n<p>If you just want the keynames, use <code>NOCONTENT</code>:</p>\n<pre><code>&gt; ft.search idx:data &quot;*&quot; LIMIT 0 2 NOCONTENT\n1) &quot;5&quot;\n2) &quot;data:1&quot;\n3) &quot;data:4&quot;\n</code></pre>\n<p>Note that Redis is fundamentally single threaded so &quot;in parallel&quot; will have limited use here.</p>\n<p>References:</p>\n<ul>\n<li>Redis Stack: <a href="https://redis.io/docs/getting-started/install-stack/" rel="nofollow noreferrer">https://redis.io/docs/getting-started/install-stack/</a></li>\n<li>FT.CREATE: <a href="https://redis.io/commands/ft.create/" rel="nofollow noreferrer">https://redis.io/commands/ft.create/</a></li>\n<li>FT.SEARCH: <a href="https://redis.io/commands/ft.search/" rel="nofollow noreferrer">https://redis.io/commands/ft.search/</a></li>\n<li>Course on search with Redis: <a href="https://university.redis.com/courses/ru203/" rel="nofollow noreferrer">https://university.redis.com/courses/ru203/</a></li>\n<li>Course on search with JSON documents and Redis: <a href="https://university.redis.com/courses/ru204/" rel="nofollow noreferrer">https://university.redis.com/courses/ru204/</a></li>\n</ul>\n"^^ . . "0"^^ . . . . . "This appears to be bytecode, use a decompiler (e.g. luac or unluac) to read"^^ . . "Unicode characters writen as questions marks by LuaTeX"^^ . . . "0"^^ . "0"^^ . . . . . . "0"^^ . . . . . . . . . "<p>I usually write myself a nifty little helper function for this called <code>nilget</code> (others may call this &quot;delve&quot;):</p>\n<pre class="lang-lua prettyprint-override"><code>local function nilget(value, ...)\n for i = 1, select(&quot;#&quot;, ...) do\n if value == nil then return nil end\n value = value[select(i, ...)]\n end\n return value\nend\n</code></pre>\n<p>In your example, you could use this as <code>nilget(hello, &quot;this&quot;, &quot;is&quot;, &quot;a&quot;, &quot;test&quot;)</code>.</p>\n<hr />\n<p>If you want something more similar to the <code>?.</code> operator many languages have for this, the closest construct you can get in Lua is <code>(t or {}).k</code> (which unfortunately, at least in PUC, seems to come at the runtime cost of allocating an empty table if <code>t</code> is falsey, so don't do this in performance-critical code). Your chain would be pretty verbose if written this way, though: <code>(((((hello or {}).this or {}).is or {}).a or {}).test</code>.</p>\n<hr />\n<p>There's also the option of modifying the metatable of <code>nil</code> using <code>debug.setmetatable</code> to just return <code>nil</code> on indexing. I am just including this for fun (and the sake of completeness); you should not do this in serious code:</p>\n<pre class="lang-lua prettyprint-override"><code>debug.setmetatable(nil, {__index = function() end})\n</code></pre>\n<p>After this, <code>(nil).k</code> will always be <code>nil</code> in your entire program (VM state), so your chain <code>hello.this.is.a.test</code> will evaluate without an error even if some items evaluate to <code>nil</code>.</p>\n"^^ . . . . "stm32"^^ . . "0"^^ . . . . . . "<p>I see a couple of problems with your code, the Vector3.new constructor method only accepts 3 arguments, not two, these are x, y and z.\nAs for the MoveTo method, it only accepts at max two arguments.</p>\n<p>Modifying your code, it would look like so:</p>\n<pre class="lang-lua prettyprint-override"><code>zombieHumanoid:MoveTo(Vector3.new(zombieTorso.Position + Vector3.new(-50, 50, 0),0,Vector3.new(-50,50, 0)))\n</code></pre>\n<p>I have added the value 0 as the Z vector in the vector3 constructors, as I'm not really sure what you want to achieve here.</p>\n<p>Related documentation:\n<a href="https://create.roblox.com/docs/reference/engine/classes/Humanoid#MoveTo" rel="nofollow noreferrer">MoveTo documentation</a>\n<a href="https://create.roblox.com/docs/reference/engine/datatypes/Vector3#new" rel="nofollow noreferrer">Vector3 documentation</a></p>\n"^^ . "4"^^ . . . "0"^^ . "3"^^ . "neovim"^^ . . . . "3"^^ . "1"^^ . "0"^^ . "You know, I think this actually works... I just failed to 're push' the initial global, outer table, onto the stack to inspect it ...since settable pops things off the thing. ...dang. I'm sorry for the confusion and inconvenience. Do I delete non questions like this? Or what happens to em?"^^ . . "<p>So I zipped my Love2D project and it works when I launch it in the same folder, but elsewhere my io.open doesn't work. Here's my file system:</p>\n<pre><code>...\nutils\n |json.lua &lt;-- library I use for encoding and decoding\n |JSONHandler.lua\n |parameters.json\nconf.lua\nmain.lua\n...\n</code></pre>\n<p>I get my error in <strong>JSONHandler.lua</strong> where I have:</p>\n<pre><code>local json = require &quot;utils/json&quot;\n\nHandler = {\n filename = &quot;utils/parameters.json&quot;,\n params = {},\n ...\n}\n\nfunction Handler:init()\n local o = {}\n setmetatable(o, self)\n self.__index = self\n\n local file = io.open(self.filename, &quot;r&quot;)\n local content = file:read(&quot;a&quot;)\n ...\n</code></pre>\n<p>My <strong>file</strong> ends up being <strong>nil</strong></p>\n<p>I tried many different relative paths for <strong>filename</strong> but nothing worked so I'm wondering how .love files handle paths, how should I track to my <strong>parameters.json</strong>?</p>\n"^^ . . . . "The parabola has no limit and it must be limited by some value, for example x not more than 10 or y not more than 100."^^ . . "1"^^ . . "0"^^ . "0"^^ . . . "0"^^ . "1"^^ . . . . . . . . . . "<p>If I were writing this in BASIC, I would do it like this:</p>\n<pre><code> _worksheet = oSheets.getByIndex(0)\n oCursor = _worksheet.createCursor()\n oCursor.gotoEndOfUsedArea(False)\n oCursor.gotoStartOfUsedArea(True)\n nCountCells = oCursor.getRows().getCount() * oCursor.getColumns().getCount()\n\n</code></pre>\n<p>Can you translate this into LUA?</p>\n"^^ . "0"^^ . . . . "How to send entire JSON payload to syslog through fluent bit"^^ . "You need to put the location inside the UDmi2.new() for example: UDmi2.new(0.5,0,0.5,0)"^^ . "<p>I'm often deserializing JSONs into Lua tables which leads to tables with lots of nesting levels. When trying to access a non-existing one, Lua will throw the error &quot;attempt to index a nil value&quot;. Is there a way to &quot;catch&quot; this error beforehand in order to check if specific table items exist, e.g.</p>\n<pre><code>local hello = {}\nlocal v = hello.this.is.a.test\n</code></pre>\n<p>Is there a simple way to check if the item <code>hello.this.is.a.test</code> exists without manually checking each sub-table in the hierarchy?</p>\n"^^ . . "You need to have luasandbox PHP extension enabled, so that `php -i | grep 'luasandbox'` shows it.\nSo, you need to have access to your PHP configuration."^^ . "This is a syntax error in Lua; it can't be implemented in plain Lua. You could add a `foreach` keyword to the tokenizer, a production to the grammer etc. just to have some syntactic sugar that will stump every tool that supports Lua. Is it really worth it? Why is a standard Lua for loop like `for cre in creature:filter"ps" do ... end` not good enough? I find it more readable, and since it is just regular Lua, it will play nice with whatever tools you choose to use."^^ . . . . . "0"^^ . . "mediawiki"^^ . . . . . "0"^^ . "<p>Your order of code seems to affect the results you actually expected.</p>\n<p>When creating instances to-be inserted in the workspace, it is usually done in the order of parenting the instance to workspace last, while applying certain property modifications first. For example, the event listener for the explosion might be registered only after the explosion has gone off, leading to such a thing as never getting that event to be called.\nTo avoid such a situation, you would move the line\n<code>explosion.Parent = part</code>\ndown to under the event listener.</p>\n<p>The same for your acid part, you'd only parent after you've set all the properties, including setting Anchored to true.</p>\n<p>What might be happening is, that your explosion blows away the acid part before it even had the chance to get anchored in the first place.</p>\n<p>Consider reading the <a href="https://create.roblox.com/docs/studio/microprofiler/task-scheduler#scheduler-priority" rel="nofollow noreferrer">following article</a> to learn more about how Roblox' task schedule prioritizes running your code.</p>\n"^^ . "Upvalues in Lua are very cheap. An upvalue costs almost as a local variable."^^ . "0"^^ . . . "1"^^ . . "0"^^ . "kubernetes"^^ . . . . . . "configuration"^^ . . "0"^^ . . "0"^^ . "0"^^ . . . "0"^^ . . . . . . . . . "com"^^ . "windows-10"^^ . "2"^^ . . . . . . . . "0"^^ . "0"^^ . . . "3"^^ . . . "1"^^ . . "0"^^ . "Crouch animation bug"^^ . . . . . . . . . . "<p>The problem with your code is you are trying to see if <code>Workspace</code> <em>is</em> <code>plr.Character</code>.</p>\n<p>You set <code>char = hit.Parent</code> then check if <code>char.Parent == plr.Character</code> - essentially checking if <code>hit.Parent.Parent == plr.Charcter</code>\nwhich it will not.</p>\n<p>I hope this helps!</p>\n"^^ . . . . . "1"^^ . "0"^^ . . "0"^^ . "I just realized that the extension is working for the links in the body of the document, that is, for the links I add in the markdown document. It just doesn't work for the navigation links, and it should be that way to avoid breaking the navigation links in the preview if you don't adjust your Apache .htaccess file."^^ . . . "please provide a minimal reproducible code snipped (as code block - put it between those ``` and not as picture)"^^ . "how to add delay in Nginx response"^^ . . . . . "Can't figure out how to make a combat system on Lua in Roblox Studio"^^ . "0"^^ . . . "@Luatic Does Lua 5.2+'s [`table.unpack`](https://www.lua.org/manual/5.2/manual.html#pdf-table.unpack) fundamentally differ from Lua 5.1's [`unpack`](https://www.lua.org/manual/5.1/manual.html#pdf-unpack) (i.e., does the former consider an `.n` member)? The manual descriptions are very similar. The source code looks nearly identical ([5.1](https://www.lua.org/source/5.1/lbaselib.c.html#luaB_unpack), [5.2](https://www.lua.org/source/5.2/ltablib.c.html#unpack)), as well. Otherwise, your suggested polyfill is more like an applicable use case for all versions (for when *t* is not a sequence) no?"^^ . . . "Uh, sort of - the runtime will explode if you attempt to plainly register a new index in that table :). `rawset` bypasses that. That part of the example isn't important, but I probably meant `__metatable = false` so that `methods` cannot be changed/referenced via the proxy/view (`getametatable`). I'll update the wording as its not exactly read-only."^^ . . "1"^^ . "1"^^ . . . "<p>I'm trying to write a mod that adds music to the game. Just add music is obtained through the data.lua file</p>\n<p>here is the code (data.lua):</p>\n<pre class="lang-lua prettyprint-override"><code>require(&quot;music.gameplay.gameplay&quot;)\nrequire(&quot;music.rock.rock&quot;)\nrequire(&quot;music.starcraft.starcraft&quot;)\n</code></pre>\n<p>these are albums - each has a file that adds music via &quot;data:extend&quot;</p>\n<p>There are no problems here, everything works. But I would like to implement such a feature - the ability to disable a certain album in the game settings (mod settings)</p>\n<p>I created a button in the &quot;settings.lua&quot; file</p>\n<p>here is the code (settings.lua):</p>\n<pre class="lang-lua prettyprint-override"><code>data:extend({\n {\n type = &quot;string-setting&quot;,\n name = &quot;my-mod-always-difficult&quot;,\n setting_type = &quot;runtime-global&quot;,\n default_value = &quot;yes&quot;,\n allowed_values = {&quot;yes&quot;, &quot;no&quot;}\n }\n})\n</code></pre>\n<p>And from this moment the problems begin.\nI tried to add music when starting the game in the same &quot;data.lua&quot; file with the condition.</p>\n<pre class="lang-lua prettyprint-override"><code>if settings.global[&quot;my-mod-always-difficult&quot;].value == &quot;yes&quot; then\n require(&quot;music.randFT.gameplay.gameplay&quot;)\n require(&quot;music.randFT.rock.rock&quot;)\n require(&quot;music.randFT.starcraft.starcraft&quot;)\nend\n</code></pre>\n<p>returns an error: attempt to index field 'global' (a nil value)</p>\n<p>then I decided to delete the tracks during the map launch in the &quot;control.lua&quot; file:\nhere is the code (settings.lua):</p>\n<pre class="lang-lua prettyprint-override"><code>local function removeAddedMusic()\n for i, sound in ipairs(data.raw[&quot;ambient-sound&quot;]) do\n if sound.name ~= &quot;Terran_1&quot; then\n table.remove(data.raw[&quot;ambient-sound&quot;], i)\n end\n end\nend\n\nscript.on_init(removeAddedMusic)\n</code></pre>\n<p>tried to delete all but one music - &quot;Terran_1&quot;\nanother mistake: factorio attempt to index global 'data' (a nil value)</p>\n<p>I understand that I use to &quot;data&quot; and &quot;global&quot; at the moment when they have the value &quot;nil&quot;\nbut how to do otherwise, I don't understand</p>\n<p>I tried to do a couple more actions, but the same trouble, the same mistakes.</p>\n"^^ . . . . "0"^^ . . "0"^^ . . . "2"^^ . . . . . "1"^^ . . . "shader"^^ . . "0"^^ . "2"^^ . . . "So, when you git clone, some files change and usualy it is a problem"^^ . "0"^^ . . . . . . "0"^^ . . . . "1"^^ . . "lua-api"^^ . . . . . "<p>The event is not registered properly. The syntax is</p>\n<pre class="lang-lua prettyprint-override"><code>cancel = RegisterPlayerEvent( event, function )\n</code></pre>\n<p>So you need to replace your last 2 lines by</p>\n<pre class="lang-lua prettyprint-override"><code>RegisterPlayerEvent( 27, OnLoot )\n</code></pre>\n<p>However, I suggest writing an SQL query that removes the grey items from the <code>creature_loot_template</code> and possibly other tables instead.</p>\n<p>A good way to debug scripts, is to add <code>print</code> statements. These show text in the worldserver console. Firstly you see if the line is reached at all and you can also easily display values.</p>\n"^^ . "2"^^ . "As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . "glsl"^^ . . . "0"^^ . "2"^^ . . "2"^^ . "0"^^ . . "ubuntu"^^ . . . "Thanks for your help but I get a 400 error code. I also tried your code with base64_encode and get the same problem as described in the post."^^ . . . . . . . . . . . . . . . . . . . . . "0"^^ . "@Deadshot "but can never be used outside of its own function" in the code you shared the variable is global though, so it doesn't belong to any function. Make sure that it's actually global by adding `print(playerInjuries)` in `test()`, and letting `test()` get called somehow. After that, continue with what my answer suggested."^^ . "0"^^ . . "<p>Mason is a package manager that allows you to <em>manage</em> packages. Some packages will work out of the box, others require manual set up and/or calling the required functionality via commands---formatters are one example of this.</p>\n<p>Once you've installed the formatter via Mason, you can set up a Neovim auto-command that calls the formatter on particular files with desired arguments. For example, for <code>yamlfmt</code>, you can create a file (e.g. <code>~/.config/nvim/lua/autocmds.lua</code>) and add the following code:</p>\n<pre class="lang-lua prettyprint-override"><code>-- Create group to assign commands\n-- &quot;clear = true&quot; must be set to prevent loading an\n-- auto-command repeatedly every time a file is resourced\nlocal autocmd_group = vim.api.nvim_create_augroup(&quot;Custom auto-commands&quot;, { clear = true })\n\nvim.api.nvim_create_autocmd({ &quot;BufWritePost&quot; }, {\n pattern = { &quot;*.yaml&quot;, &quot;*.yml&quot; },\n desc = &quot;Auto-format YAML files after saving&quot;,\n callback = function()\n local fileName = vim.api.nvim_buf_get_name(0)\n vim.cmd(&quot;:!yamlfmt &quot; .. fileName)\n end,\n group = autocmd_group,\n})\n</code></pre>\n<p>Then, ensure this file (<code>autocmds.lua</code>) is sourced every time you start Neovim by adding <code>require(&quot;autocmds&quot;)</code> to your <code>~/.config/nvim/init.lua</code> file.</p>\n<p>Now, every time you write a buffer (<code>BufWritePost</code>) (i.e. save a file) ending with a <code>.yaml</code> or <code>.yml</code> extension, the callback will be made which gets the absolute path of the file loaded in the current buffer (<code>nvim_buf_get_name(0)</code>), and then executes a non-interactive terminal command that calls the YAML formatter on that file.</p>\n<p>To suppress the command's output, you add <code>silent</code> to the non-interactive terminal command:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.cmd(&quot;:silent !yamlfmt &quot; .. fileName)\n</code></pre>\n<p>You can also add multiple terminal commands to the callback. For example, when editing my Python files, I call the following formatters, each of which handles a specific part of code:</p>\n<pre><code>vim.api.nvim_create_autocmd({ &quot;BufWritePost&quot; }, {\n pattern = { &quot;*.py&quot; },\n desc = &quot;Auto-format Python files after saving&quot;,\n callback = function()\n local fileName = vim.api.nvim_buf_get_name(0)\n vim.cmd(&quot;:silent !black --preview -q &quot; .. fileName)\n vim.cmd(&quot;:silent !isort --profile black --float-to-top -q &quot; .. fileName)\n vim.cmd(&quot;:silent !docformatter --in-place --black &quot; .. fileName)\n end,\n group = autocmd_group,\n})\n</code></pre>\n<p>Don't forget to add each auto-command to an auto-command group that has the <code>clear</code> flag set to avoid repeatedly loading a command every time a file is resourced. You can read more about auto-commands via the manual <code>:h autocmd</code>.</p>\n"^^ . . . "nvim-lspconfig"^^ . . "<p>I am using lsp-zero &amp; mason to install LSPs, formatters and linters. However, I am not sure how the formatters work and how can I configure them.</p>\n<p>For example, the formatter for <code>yml</code> files seems not to be working even though that I've installed <code>yamlls</code> and <code>yamlfmt</code>. On the other hand, Golang's formatter seems to be working just fine, when I save a <code>*.go</code> file, it will be automatically formatted.</p>\n<p>How would you setup the YAML formatter in this case? Here is a snippet of my configuration:</p>\n<p><strong>lsp.lua</strong></p>\n<pre class="lang-lua prettyprint-override"><code>local lsp = require(&quot;lsp-zero&quot;)\n\nlsp.preset(&quot;recommended&quot;)\n\n-- Fix Undefined global 'vim'\nlsp.nvim_workspace()\n\nlocal cmp = require('cmp')\nlocal cmp_select = {behavior = cmp.SelectBehavior.Select}\nlocal cmp_mappings = lsp.defaults.cmp_mappings({\n ['&lt;C-p&gt;'] = cmp.mapping.select_prev_item(cmp_select),\n ['&lt;C-n&gt;'] = cmp.mapping.select_next_item(cmp_select),\n ['&lt;CR&gt;'] = cmp.mapping.confirm({ select = true }),\n [&quot;&lt;C-Space&gt;&quot;] = cmp.mapping.complete(),\n})\n\ncmp_mappings['&lt;Tab&gt;'] = nil\ncmp_mappings['&lt;S-Tab&gt;'] = nil\n\nlsp.setup_nvim_cmp({\n mapping = cmp_mappings\n})\n\nlsp.set_preferences({\n suggest_lsp_servers = false,\n sign_icons = {\n error = 'E',\n warn = 'W',\n hint = 'H',\n info = 'I'\n }\n})\n\nlsp.on_attach(function(client, bufnr)\n local opts = {buffer = bufnr, remap = false}\n\n vim.keymap.set(&quot;n&quot;, &quot;gd&quot;, function() vim.lsp.buf.definition() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;K&quot;, function() vim.lsp.buf.hover() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;vws&quot;, function() vim.lsp.buf.workspace_symbol() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;vd&quot;, function() vim.diagnostic.open_float() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;[d&quot;, function() vim.diagnostic.goto_next() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;]d&quot;, function() vim.diagnostic.goto_prev() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;vca&quot;, function() vim.lsp.buf.code_action() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;vrr&quot;, function() vim.lsp.buf.references() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;vrn&quot;, function() vim.lsp.buf.rename() end, opts)\n vim.keymap.set(&quot;i&quot;, &quot;&lt;C-h&gt;&quot;, function() vim.lsp.buf.signature_help() end, opts)\nend)\n\nvim.diagnostic.config({\n virtual_text = true\n})\n</code></pre>\n<p><strong>mason.lua</strong></p>\n<pre class="lang-lua prettyprint-override"><code>require('mason-tool-installer').setup {\n ensure_installed = {\n 'golangci-lint',\n 'bash-language-server',\n 'lua-language-server',\n 'vim-language-server',\n 'gopls',\n 'stylua',\n 'shellcheck',\n 'sqlfmt',\n 'editorconfig-checker',\n 'gofumpt',\n 'golines',\n 'gomodifytags',\n 'gotests',\n 'goimports',\n 'impl',\n 'json-to-struct',\n 'jq',\n 'misspell',\n 'revive',\n 'shellcheck',\n 'shfmt',\n 'staticcheck',\n 'vint',\n 'yamllint',\n 'yamlfmt',\n 'yamlls',\n 'hadolint',\n 'dockerls',\n 'diagnosticls',\n 'sqlls',\n 'terraformls',\n 'delve'\n }\n}\n</code></pre>\n"^^ . . "0"^^ . . "<p>When you call the following function the previous buttons get destroyed so there is no mousebutton1click function after calling display(). Just add back the mousebutton1click function when rebuilding the hotbar buttons. I hope this makes sense to you.</p>\n<pre class="lang-lua prettyprint-override"><code>removeInventoryFrames()\n</code></pre>\n"^^ . "1"^^ . "1"^^ . "0"^^ . "0"^^ . "<p>I tried to use the hamerspoon package to write a timer as follows.</p>\n<pre class="lang-lua prettyprint-override"><code> local function startTimer()\n local totalSeconds = 5\n local i = 0\n local function onTimeout()\n i = i + .1\n local stopTimer = i == totalSeconds -- THIS BOOLEAN COMPARISSON RETURNS WRONG RESULT\n print('stopTimer:', stopTimer)\n print(i, totalSeconds, type(i), type(totalSeconds), 5 == 5.0)\n if stopTimer then \n timer:stop()\n end\n end\n local timer = hs.timer.new(.1, onTimeout)\n timer:start()\n end\n</code></pre>\n<p>As you can see in the output below</p>\n<ul>\n<li><code>stopTimer</code> variable in above function is always <code>false</code> even for a comparisson of <code>5 == 5.0</code></li>\n<li>The types of both variables are numbers</li>\n<li>Simply printing <code>5 == 5.0</code> seems to show the correct result</li>\n</ul>\n<p><a href="https://i.sstatic.net/DM5Vu.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/DM5Vu.png" alt="enter image description here" /></a></p>\n<p><code>stopTimer</code> variable should be <code>false</code> when <code>i</code> is <code>5</code></p>\n"^^ . "<p>To mock the API I have to create an endpoint on Nginx and the response time should match as I receive from the actual API.</p>\n<p>I tried to find help online and came to know that, this echo module can help: <a href="https://github.com/openresty/echo-nginx-module" rel="nofollow noreferrer">https://github.com/openresty/echo-nginx-module</a>\nBut this module does not support nginx 1.17.0 or above and my nginx version is above the supported version.</p>\n<p>I also came to know that lua script can also be used but I found that lua script and nginx integrations is not for beginner.</p>\n"^^ . "1"^^ . . . . . . "2"^^ . . "luarocks"^^ . "Why doesn't == return false here?"^^ . "I meant contents of the lsp log, PATH to the log you can see in the LspInfo dialog"^^ . "security"^^ . "Fixed that too, thanks. Note that the `nvim_feedkeys` are very hacky, it doesn't block or wait until the execution is done. So it's better to not use `feedkeys` but call a corresponding function (see the general recipe)."^^ . "<p>Is there an alternative syntax for</p>\n<pre class="lang-lua prettyprint-override"><code>Account = {}\n\nfunction Account:new (o)\n o = o or {}\n setmetatable(o, self)\n self.__index = self\n return o\nend\n</code></pre>\n<p>where <code>new</code> could be put directly into the table constructor for <code>Account</code>, and where the function gains an implicit <code>self</code> variable?</p>\n<p>Or must one use a <code>self</code> parameter (or equivalent), and do it the following way?</p>\n<pre class="lang-lua prettyprint-override"><code>Account = {\n new = function (self, o)\n o = o or {}\n setmetatable(o, self)\n self.__index = self\n return o\n end\n}\n</code></pre>\n"^^ . . "Do you have hardware interrupt for "byte arrived at UART" event? Polling hardware devices while Lua VM is working on a single-core system may be difficult."^^ . . "How to incorporate user input in an input-mode Lua keymap in Neovim?"^^ . . . "cmp"^^ . "I installed the https://github.com/wikimedia/mediawiki-php-luasandbox/archive/master.tar.gz snapshot version that was on the mediawiki site, and i dumped the zip on the extensions folder of the wiki in the Cpanel, and tried listing it on the LocalSettings.php. Don't know if it's a separate version i have to download, or if i have to put the zip on another place."^^ . . . . . "0"^^ . . . . "iterable-unpacking"^^ . . "Thank you a lot for this explanation! There was just a third missing argument in the vim.api.nvim_feedkeys functions, that is a boolean. I just put it to false and it works perfectly!"^^ . . "5"^^ . . "0"^^ . "<p>I'm planning on implementing scripting support to embedded project coded in C. I have never done such thing before and found out about eLua.</p>\n<p>My goal is to get a scripting support to my existing C based system. I would like to keep the C code running and doing its thing 'on the background' while the user script is running as well. The user script does not need to directly interface with any hardware, but is intended to build logic, like conditions, loops and timed events and the HW control is all handled in the C side.</p>\n<p>In my use case the system is basically automation controller where the script would be user implemented logic and the C code would handle the interfacing with various interfaces and protocols (already implemented in C). The script can then just say 'turn on lamp number x' and the C code actually does the heavy lifting, packs and transmits the message to the correct lamp.</p>\n<p>The problem I face is that all the examples I've found all either do everything in Lua, or the script is run to completion before any other things can happen. In my case that won't work because the C side needs to listen for inputs to uart for example. UART and the HW in general will be interrupt driven so its ok if the lua side takes some time to process its things.</p>\n<p>I've read the documentation and looked at examples but cannot understand how (if it is possible even) to run a lua script while also running other C code.</p>\n<p>Is there a way to do this in eLua? Or is there a better alternative. My goal eventually is to just run some user defined logic that can be changed easily.</p>\n<p>my question is basically if I can do something like this with eLua:</p>\n<pre><code>int main() {\n\n initialize_everything();\n load_script_from_memory();\n\n while(1) {\n \n step_script();\n step_other_logic();\n\n if( has_new_script() ) {\n load_new_script();\n }\n }\n}\n</code></pre>\n<p>For reference my hardware at the moment is STM32 evaluation kit(STM32L476G-DISCO) to test the idea. If there is a better solution to my problem that would be more resource intensive I'm still also interested.</p>\n"^^ . "0"^^ . . "math"^^ . . . "0"^^ . "Roblox - Scripts not firing"^^ . . "0"^^ . . . . . "How to prohibit letter input, only allow numbers in Lua?"^^ . . "That is, in your test sheet only cell M11 (or K13) was filled in and you wanted to know the number of cells in the range A1:M11 (or A1:K13)? No problem! Just remove the line with `gotoStartOfUsedArea(True)` and change False to True in `gotoEndOfUsedArea()`"^^ . . "Setting up formatters in Neovim with mason & lsp-zero"^^ . "See also https://stackoverflow.com/q/18005146/107090"^^ . . . . . "1"^^ . . "Bresenham's parabola algorithm, Lua"^^ . "0"^^ . "1"^^ . . "1"^^ . . . . . "0"^^ . . . . "0"^^ . "-1"^^ . . "Getting key with maximum value in dictionary? -In lua specifically"^^ . . . "Can a Lua function using the colon syntactic sugar be defined inside a table?"^^ . "0"^^ . . "5"^^ . "webhooks"^^ . . . "1"^^ . . . "1"^^ . . . . "0"^^ . "0"^^ . "<p>The issue was that in the LUA script, I was calling <code> splash:init_cookies(splash.args.cookies)</code> in the start_requests method. By default, scrapy stores cookies in the cookie jar. When you call <code>splash:init_cookies</code>, you are retrieving the cookies from the cookie jar and replacing the cookies in your request. Since there were no cookies in the cookie jar, the request failed. Then, since the new request cookies were subsequently not added to the cookie jar, in the next request retry the same error would repeat.</p>\n<p>By throwing an unhandled error, I guess the cookie jar contents were updated without the LUA script replacing them, then on the next loop, it was able to initialize the correct cookies from the cookie jar and run successfully.</p>\n<p>Removing <code> splash:init_cookies(splash.args.cookies)</code> from the initial request solved the problem. Keeping init in the page extraction LUA script (not the login script) continued to work to transfer the login cookies to each new page.</p>\n"^^ . "1"^^ . . . . "It seems like the plugin code is unable to correctly invoke FZF programs installed with Brew (available and functional in the Fish shell running in the terminal)."^^ . . "1"^^ . . . "0"^^ . . "0"^^ . "10"^^ . "How can I load a NeoVim plugin with Packer conditionally from local or remote?"^^ . . . . . "Issue uploading Lua code to nodemcu on ESP32 due to missing file.open()"^^ . . . . . . "0"^^ . . "<p>I am working on a Roblox game where I need to clone an object and allow players to pick up the cloned object after it has been thrown. However, I am facing an issue where the cloned object cannot be picked up.</p>\n<p>Here is my <strong>local script for throwing</strong></p>\n<pre><code>local userInputService = game:GetService(&quot;UserInputService&quot;)\nlocal playersService = game:GetService(&quot;Players&quot;)\nlocal tool = script.Parent.Parent\nlocal humanoid = playersService.LocalPlayer.Character:WaitForChild(&quot;Humanoid&quot;)\nlocal workspace = game:GetService(&quot;Workspace&quot;)\n\nlocal isEquipped = false\nlocal mouse = playersService.LocalPlayer:GetMouse()\n\nlocal function createToolCopy()\n local toolCopy = tool:Clone()\n toolCopy.Parent = workspace\n\n local throwDirection = (mouse.Hit.p - toolCopy.Handle.Position).unit\n local throwForce = 100 \n\n toolCopy.Handle.Velocity = throwDirection * throwForce\n isEquipped = false\n tool:Destroy()\nend\n\n\ntool.Equipped:Connect( function() isEquipped = true end)\ntool.Unequipped:Connect(function() isEquipped = false end)\n\nuserInputService.InputBegan:Connect(function(input, gameProcessedEvent)\n if isEquipped and not gameProcessedEvent then\n if input.UserInputType == Enum.UserInputType.MouseButton1 then\n createToolCopy()\n end\n end\nend)\n</code></pre>\n<p>This is my <strong>global script for for picking up the cup</strong></p>\n<pre><code>local clickDetector = script.Parent\nlocal tool = clickDetector.Parent\n\nif clickDetector then\n clickDetector.MaxActivationDistance = 10\n\n clickDetector.MouseClick:Connect(function(playerWhoClicked: Player)\n print(&quot;Player clicked the clickDetector&quot;)\n tool.Parent = playerWhoClicked.Backpack\n end)\nelse\n warn(&quot;clickDetector not found in the object.&quot;)\nend\n</code></pre>\n<p>I also provide for a general understanding of the situation, this is struct of cup:</p>\n<pre><code>├─ clickDetector/\n│ ├─ GlobalScriptForPickUp\n│ ├─ LocalScriptForThrowing\n├─ ModelOfCup\n├─ Handle/\n│ ├─ TouchInterest\n│ ├─ WeldConstraint\n</code></pre>\n<p>I wanted it to be like this:\nthe player picks up the cup -&gt; picks it up -&gt; right mouse button -&gt; the cup in the inventory is cloned into the workspace -&gt; flies -&gt; disappears from the inventory -&gt; the player runs up to the cloned cup and can throw it again (although in the future I would like to make a system throwing force depending on the length of the press,\nand if the force is greater than a certain value, then the cup will break)</p>\n<p>What happened:\nAll of the above steps were completed, except for the last one, which is why I wrote the post</p>\n"^^ . . . . "<p>On Fedora install lua-devel. (Probably similar on other ones)</p>\n"^^ . . "So if I'm understanding this right, I should replace the line function onevent (event, arg) OutputLogMessage("event = %s, arg = %d\\n", event, arg)\n To if arg then\n OutputLogMessage("event = %s, arg = %d\\n", event, arg)\nend . Or OutputLogMessage("event = %s, arg = %d\\n", event, arg or -1) after function onevent (event, arg) ?"^^ . . . "ok I can use the array outside the function. But I have another question. When I try to call `for i, path in pairs(playerInjuries[ply]) do` I get nil. Do you know why?"^^ . . . "<p>The <a href="https://gitlab.com/schrieveslaach/sonarlint.nvim" rel="nofollow noreferrer">sonarlint.nvim</a> should offer in the <code>setup</code> call a possibility provide connection properties to a remote server a.k.a <a href="https://docs.sonarsource.com/sonarqube/latest/user-guide/sonarlint-connected-mode/" rel="nofollow noreferrer">connected mode</a>.</p>\n<blockquote>\n<p>SonarLint's Connected Mode connects SonarLint to your SonarQube project and provides additional benefits you won't get by using SonarLint or SonarQube alone.</p>\n</blockquote>\n<p>For the connected mode an API token is required which could lead following syntax:</p>\n<pre class="lang-lua prettyprint-override"><code>require('sonarlint').setup({\n -- …\n connected_mode = {\n ['https://sonarcloud.io'] = {\n token = &quot;my super secret token&quot;,\n -- … other stuff\n }\n }\n})\n</code></pre>\n<p>Now, I'm wondering what is a good and <strong>secure</strong> way of retrieving the token from some secure location because Neovim users are likely to version control such file in a dotfiles repo. I'm aware of using environment variables, e.g. you can do that securely with <a href="https://chezmoi.io/" rel="nofollow noreferrer">chezmoi</a>, but is there a native integration with a secure store such as secret-tool within the Neovim Lua API?</p>\n"^^ . . . "Likely the second argument to your config attempt should be in quotes, or otherwise escape the space character, i.e., `"C:\\Program Files\\lua-5.4.2"`. Use `luarocks help config` to learn about the tool, and `luarocks config` (maybe with `--local`) to see your configuration - there may be a handful of paths you need to fix (might be easier to simply rebuild/reinstall/reconfigure Luarocks, but I cannot speak to the specifics of that on Windows)."^^ . "scrapy-splash"^^ . "1"^^ . "<p>I am new to <code>NeoVim</code> ecosystem. I set up my config based from the <code>ThePrimeage's</code> video. After that I tried to install additional formatting using <code>formatter.nvim</code> package for <code>NeoVim</code>.</p>\n<p>This is how my <code>formatter.lua</code> file looks like:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.cmd([[nnoremap &lt;silent&gt; &lt;leader&gt;fm :Format&lt;CR&gt;]])\n\nlocal util = require(&quot;formatter.util&quot;)\n\nlocal function prettier()\n return {\n exe = &quot;prettier&quot;,\n args = {\n &quot;--write&quot;,\n &quot;--config-precedence&quot;,\n &quot;prefer-file&quot;,\n &quot;--single-quote&quot;,\n &quot;--no-bracket-spacing&quot;,\n &quot;--prose-wrap&quot;,\n &quot;always&quot;,\n &quot;--arrow-parens&quot;,\n &quot;always&quot;,\n &quot;--trailing-comma&quot;,\n &quot;all&quot;,\n &quot;--no-semi&quot;,\n &quot;--end-of-line&quot;,\n &quot;lf&quot;,\n &quot;--print-width&quot;,\n vim.bo.textwidth,\n &quot;--stdin-filepath&quot;,\n vim.fn.shellescape(vim.api.nvim_buf_get_name(0)),\n },\n stdin = true,\n }\nend\n\nrequire(&quot;formatter&quot;).setup({\n logging = true,\n log_level = vim.log.levels.WARN,\n filetype = {\n javascript = { prettier },\n typescript = { prettier },\n javascriptreact = { prettier },\n typescriptreact = { prettier },\n vue = { prettier },\n [&quot;javascript.jsx&quot;] = { prettier },\n [&quot;typescript.tsx&quot;] = { prettier },\n markdown = { prettier },\n css = { prettier },\n json = { prettier },\n jsonc = { prettier },\n scss = { prettier },\n less = { prettier },\n yaml = { prettier },\n graphql = { prettier },\n html = { prettier },\n reason = {\n function()\n return {\n exe = &quot;refmt&quot;,\n stdin = true,\n }\n end,\n },\n lua = {\n require(&quot;formatter.filetypes.lua&quot;).stylua,\n\n function()\n if util.get_current_buffer_file_name() == &quot;special.lua&quot; then\n return nil\n end\n\n return {\n exe = &quot;stylua&quot;,\n args = {\n &quot;--search-parent-directories&quot;,\n &quot;--stdin-filepath&quot;,\n util.escape_path(util.get_current_buffer_file_path()),\n &quot;--&quot;,\n &quot;-&quot;,\n },\n stdin = true,\n }\n end,\n },\n go = {\n function()\n return {\n exe = &quot;gofmt&quot;,\n args = { &quot;-s&quot;, &quot;-w&quot;, vim.fn.fnameescape(vim.api.nvim_buf_get_name(0)) },\n stdin = false,\n }\n end,\n },\n c = {\n function()\n return {\n exe = &quot;clang-format&quot;,\n args = { &quot;-i&quot;, vim.fn.fnameescape(vim.api.nvim_buf_get_name(0)) },\n stdin = false,\n }\n end,\n },\n rust = {\n function()\n return {\n exe = &quot;rustfmt&quot;,\n args = { &quot;--emit=stdout&quot;, &quot;--edition=2018&quot;, vim.fn.fnameescape(vim.api.nvim_buf_get_name(0)) },\n stdin = false,\n }\n end,\n },\n },\n})\n</code></pre>\n<p>I have <code>prettier</code> installed globally on my system: <code>/usr/local/bin/prettier</code>.</p>\n<p>When I try to provide a relative path to the prettier executable instead of just writing <code>prettier</code> it does not find the formatter.</p>\n<p>I have default <code>prettier</code> configuration file in my <code>project directory</code> (<code>.prettierrc.json</code>)</p>\n<p><em>Note: I've tried other formats for config too, but without any results.</em></p>\n<p><em>Note: Formatting for other files does work (<code>Go</code>, <code>Rust</code>, <code>C</code>). Only <code>prettier</code> seems to have a problem.</em></p>\n<p><em>Note: I had <code>prettier</code> installed using <code>Mason</code> too, but it did not fix the issue, just changed the <code>prettier</code> path while executing the formatting (this command - <code>print(vim.inspect(vim.fn[&quot;systemlist&quot;](&quot;which prettier&quot;)))</code>)</em></p>\n<p>What can I do to successfully utilize <code>prettier</code> formatting in my <code>NeoVim</code> setup?</p>\n"^^ . . . . "Have you searched this site? https://stackoverflow.com/questions/71447528/what-is-the-code-to-create-a-new-sheet-in-libreoffice-additionally-how-do-i-re, https://stackoverflow.com/questions/70426708/using-ole-remove-all-sheets-except-first-one-from-a-openoffice-libreoffice-calc"^^ . . . . . "lunarvim"^^ . . "Do you want to refresh a file that you are currently editing in your buffer, or refresh a file that affects the configuration of Neovim?"^^ . "0"^^ . . "0"^^ . "Lua doesn't even have `++`, you should be grateful to be able to define functions in two ways."^^ . . "<p>This Lua script defined in a tex file:</p>\n<pre><code>\\begin{luacode*}\n\nfunction run_octave_script(octavescript)\n\n local command = os.getenv(&quot;HOME&quot;) &quot; &quot; .. octavescript\n\n local outputfile = io.popen(command)\n local outputtext = outputfile:read(&quot;*all&quot;)\n outputfile:close()\n\n for line in outputtext:gmatch(&quot;[^\\n]+&quot;) do \n tex.print(line)\n tex.print(&quot;&quot;)\n end\n\nend\n\n\\end{luacode*}\n</code></pre>\n<p>captures the text output of an Octave script and copies it in a text box:</p>\n<pre><code>\\newenvironment{scriptbox}{\n \\begin{tcolorbox}\n \\fontsize{16pt}{22pt}\n \\fontspec{DejaVu Sans Mono}\n }{ \n \\end{tcolorbox}\n}\n\n\\newcommand{\\runscript}[1]{\\directlua{run_octave_script(&quot;#1&quot;)}}\n</code></pre>\n<p>when called like this:</p>\n<pre><code>\\begin{scriptbox}\n\\runscript{myscript(1,2);}\n\\end{scriptbox}\n</code></pre>\n<p>The output might contain Unicode symbols, like the &quot;Em Quad&quot; character (U+2001) or &quot;element of&quot; (U+2208), and the Lua script writes them as &quot;???&quot;, even if the Octave script outputs the original Unicode characters (both in the Octave prompt, and from the terminal), while others Unicode symbols are rendered correctly (e.g. the union of sets).</p>\n<p>This is an example of the output to the TeX file:</p>\n<pre><code>{(a,a), (c,a), (c,c)}???∪???{(a,c), (b,c), (c,a)}\n</code></pre>\n<p>where two Em Quad symbols have been replaced by question marks.</p>\n<p>The DejaVu Sans Mono font is available for the Lua 5.4.4 compiler:</p>\n<pre><code>$ luaotfload-tool --find=&quot;DejaVu Sans Mono&quot;\nluaotfload | resolve : Font &quot;DejaVu Sans Mono&quot; found!\nluaotfload | resolve : Resolved file name &quot;/usr/share/texlive/texmf-dist/fonts/truetype/public/dejavu/DejaVuSansMono.ttf&quot;\n</code></pre>\n<p>and contains these symbols. The system is also using UTF-8:</p>\n<pre><code>$ locale charmap | grep -qi 'utf-\\+8' &amp;&amp; echo &quot;Uses UTF-8 encoding..&quot;\nUses UTF-8 encoding..\n</code></pre>\n<p>The code used to work fine on an Ubuntu 18.04, but when upgraded to 22.04 it generates this problem. Can't figure out what was making it work in the former (and older) distro version.</p>\n"^^ . "0"^^ . . . "1"^^ . "<p>You need to iterate over the table with <code>ipairs</code>, like so:</p>\n<pre class="lang-lua prettyprint-override"><code>function indexOf(tbl, value)\n for i, v in ipairs(tbl) do\n if v == value then\n return i\n end\n end\nend\n</code></pre>\n"^^ . "1"^^ . . "1"^^ . "Excellent answer. A couple tiny things I'd like to add: 1. The polyfill can be written as a single expression using `{n = select('#', ...), ...}` (but not the other way around, otherwise the vararg is truncated); 2. In Lua 5.1, `table.unpack` needs to be polyfilled as `unpack(t, 1, t.n)`; 3. There are other ways to store varargs (such as using a coroutine) - you can find them [here](http://lua-users.org/wiki/VarargTheSecondClassCitizen) - but using a table is generally regarded as the best one."^^ . "Is `parameters.json` inside the zip archive?"^^ . . . . "1"^^ . . "0"^^ . . . . . . "Is `__newindex = false` a fast-and-dirty way to implement read-only?"^^ . . . . . . "Could you please provide a minimal reproducible example, e.g. a C file I can feed my compiler which doesn't work if executed?"^^ . . . "0"^^ . "<blockquote>\n<p>outside the OnPlayerTakeDamage function the player Injuries or players Injuries[ply] array is nil</p>\n</blockquote>\n<p>Before worrying about <code>playerInjuries[ply]</code>, make sure that <code>playerInjuries</code> isn't <code>nil</code> in <code>test()</code> by printing it. I suspect <code>playerInjuries</code> is never <code>nil</code> in your program, though you may have some code you didn't share that sets it to <code>nil</code>.</p>\n<p>Make sure <code>test()</code> is getting called at all, and only by the one spot you shared.</p>\n<p>Once you made sure <code>playerInjuries</code> is never <code>nil</code> inside <code>test</code>, you can add <code>for k, v in pairs(playerInjuries) do print(k, v) end</code> to print the keys and values in it.</p>\n"^^ . "<p>Unlike C++ which has manual memory management, Lua is a garbage-collected language; you typically don't release memory by manually &quot;destroying&quot; objects (*), you just let them go out of scope and don't reference them anymore, then Lua's garbage collection will eventually collect them. If you have userdata with associated data (say, a vector) you need to free, set the <code>__gc</code> metamethod appropriately.</p>\n<p>Now let's get back to your code:</p>\n<pre class="lang-lua prettyprint-override"><code>local circle = Circle.new(100)\nprint(circle) -- prints: CircleMetaTable: PointerToCircle\ncircle:destroy() -- destroy, this is where I want the circle to be set to nil\nprint(circle) -- prints: userData: PointerToCircle (I want this to print nil)\n</code></pre>\n<p>This is <em>not possible</em>. It is <em>not possible</em> to set a reference to <code>nil</code> from &quot;under&quot; the user (think about it: this would require Lua to have a &quot;reverse lookup&quot; of all places where there is a reference to this userdata - you might be storing the userdata in a million places after all! If there was some easy way to set it to <code>nil</code>, Lua would have to change the values stored in a million places to <code>nil</code>). You can however set some internal data in your userdata to <em>mark</em> the circle as &quot;destroyed&quot;, and you can write your <code>__index</code> metamethod / all your methods accordingly that they check for this and error on an invalid object (for example, Lua will mark closed files as closed, and any attempt to use them will error).</p>\n<p>(*) resources like files or database connections are an exception here, as it may be important that they are released timely, so newer Lua versions offer the <code>&lt;close&gt;</code> annotation to release variables as they go out of scope using the <code>__close</code> metamethod; in older Lua versions you'd have to manually call <code>:close()</code>.</p>\n"^^ . "0"^^ . . . . . . . "0"^^ . . "<p>The good old string interpolation in Lua. You can do this pretty conveniently using <a href="https://www.lua.org/manual/5.1/manual.html#pdf-string.gsub" rel="nofollow noreferrer"><code>string.gsub</code></a>:</p>\n<pre class="lang-lua prettyprint-override"><code>local vars = {\n title = &quot;Test Song&quot;,\n author = &quot;Tormy&quot;,\n date = &quot;2022-10-15&quot;,\n project = &quot;Test Project&quot;,\n}\nlocal template = &quot;The title of this song is $title. $title was composed by $author in $date, when he have created the $project&quot;\nlocal interpolated = template:gsub(&quot;%$(%w+)&quot;, vars)\nprint(interpolated) -- The title of this song is Test Song. Test Song was composed by Tormy in 2022-10-15, when he have created the Test Project\n</code></pre>\n<p>Note:</p>\n<ul>\n<li>The pattern is <code>%$(%w+)</code>: A dollar sign (escaped because it is a magic character), followed by a captured word (one or more alphanumeric characters).</li>\n<li><code>gsub</code> allows passing a table as second argument; it will look up the capture in that table, and replace the entire matched substring with the value if it is non-nil.</li>\n</ul>\n<p>Regarding your edit: If you don't have the variables up-front but rather need to pass the <code>$...</code> to an API function, you can pass a function to <code>gsub</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>local interpolated = template:gsub(&quot;%$%w+&quot;, API)\n</code></pre>\n<p>This will call the <code>API</code> function for each variable in the template string, replacing it with the return value of the <code>API</code> function. If your <code>API</code> function is slow and benefits from being batched or similar, then you might want to first collect the &quot;wildcards&quot; into a table using <code>gmatch</code> as you already seem to have figured out.</p>\n"^^ . . . "This completely did the job and as you say, in an elegant and efficient manner. Thank you!"^^ . . "0"^^ . . "Yes, SO can be used as a rubber duck :-)"^^ . "1"^^ . "0"^^ . . "<p>I'm making an inventory system, and I have been trying to make it so I can move items between the hotbar and backpack. The scripts work perfectly fine at first, but then when I do one of the actions the other one doesn't work. I am posting the entire script if you need it but the problems are at the bottom 2 for loops.</p>\n<pre><code>game.StarterGui:SetCoreGuiEnabled(Enum. CoreGuiType. Backpack, false)\n\nlocal replicatedStorage = game.ReplicatedStorage\nlocal userInputService\nlocal toolFolder = replicatedStorage.ToolFolder\nlocal images = replicatedStorage.Images\nlocal uis = game:GetService(&quot;UserInputService&quot;)\nlocal player = game.Players.LocalPlayer\nlocal playergui = player.PlayerGui\n\nlocal inventory = playergui:WaitForChild(&quot;Inventory&quot;)\nlocal hotbar = inventory.Hotbar\nlocal inventoryFrame = inventory.Inventory\nlocal itemFrame = inventoryFrame.ScrollingFrame\n\nlocal hotbarTable = {}\nlocal inventoryTable = {}\nlocal insertedItems = {}\nlocal keyConversions = {\n [Enum.KeyCode.One] = 1,\n [Enum.KeyCode.Two] = 2,\n [Enum.KeyCode.Three] = 3,\n [Enum.KeyCode.Four] = 4,\n [Enum.KeyCode.Five] = 5,\n [Enum.KeyCode.Six] = 6,\n [Enum.KeyCode.Seven] = 7,\n [Enum.KeyCode.Eight] = 8,\n [Enum.KeyCode.Nine] = 9,\n [Enum.KeyCode.Zero] = 10,\n}\n\nlocal function pickSlot()\n for i, v in pairs(hotbarTable) do\n if v.Item == &quot;None&quot; then\n return i\n end\n end\nend\n\nlocal function addItem(item)\n local slot = pickSlot()\n if slot ~= nil then\n hotbarTable[slot].Item = item\n hotbarTable[slot].Count = 1\n hotbarTable[slot].Image = images[item].Texture\n table.insert(insertedItems, item)\n elseif slot == nil then\n inventoryTable[item] = {\n Count = 1;\n Image = images[item].Texture\n }\n end\nend\n\n\nlocal function fillInventoryTables()\n for i = 1, 10 do\n hotbarTable[i] = {\n Item = &quot;None&quot;;\n Count = 0;\n Image = &quot;None&quot;\n }\n end\n for i, v in pairs(toolFolder:GetChildren()) do\n if #insertedItems &gt; 0 then\n if table.find(insertedItems, v.Name) then\n for x, c in pairs(hotbarTable) do\n if c.Item == v.Name then\n c.Count += 1\n end\n end\n else\n addItem(v.Name)\n end\n else\n addItem(v.Name)\n end\n end\nend\n\nlocal function display()\n for i, v in pairs(hotbarTable) do\n hotbar[i].Image = v.Image\n hotbar[i].Counter.Text = v.Count\n end \n for i, v in pairs(inventoryTable) do\n local clone = inventoryFrame.ScrollingFrame.Sample:Clone()\n clone.Visible = true\n clone.Name = tostring(i)\n clone.Parent = inventoryFrame.ScrollingFrame\n clone.Image = v.Image\n clone.Counter.Text = v.Count\n end\nend\n\nlocal function Equip(key)\n local tool = hotbarTable[key].Item\n if player.Character:FindFirstChildOfClass(&quot;Tool&quot;) then\n if player.Character:FindFirstChildOfClass(&quot;Tool&quot;).Name == tool then\n player.Character:FindFirstChild(&quot;Humanoid&quot;):UnequipTools()\n player.Backpack[tool]:Destroy()\n elseif player.Character:FindFirstChildOfClass(&quot;Tool&quot;).Name ~= tool then\n player.Character:FindFirstChild(&quot;Humanoid&quot;):UnequipTools()\n player.Backpack:GetChildren()[1]:Destroy()\n toolFolder[tool]:Clone().Parent = player.Backpack\n player.Character:FindFirstChild(&quot;Humanoid&quot;):EquipTool(player.Backpack:GetChildren()[1])\n end\n elseif not player.Character:FindFirstChild(tool) then\n toolFolder[tool]:Clone().Parent = player.Backpack\n player.Character:FindFirstChild(&quot;Humanoid&quot;):EquipTool(player.Backpack:GetChildren()[1])\n end\nend\n\nlocal function removeInventoryFrames()\n for i, v in pairs(inventoryFrame.ScrollingFrame:GetChildren()) do\n if v.ClassName == &quot;ImageButton&quot; and v.Name ~= &quot;Sample&quot; then\n v:Destroy()\n end\n end\nend\n\nfillInventoryTables()\nhotbarTable[1].Item = &quot;None&quot;\nhotbarTable[1].Count = 0\nhotbarTable[1].Image = &quot;None&quot;\ndisplay()\n\nuis.InputBegan:Connect(function(key)\n if key.UserInputType == Enum.UserInputType.Keyboard then\n Equip(keyConversions[key.KeyCode])\n end\nend)\n\n-- Moving items from backpack to hotbar\nfor i, v in ipairs(inventoryFrame.ScrollingFrame:GetChildren()) do\n if v.ClassName == &quot;ImageButton&quot; then\n v.MouseButton1Click:Connect(function()\n print(1)\n for x, c in pairs(hotbarTable) do\n if c.Item == &quot;None&quot; then\n c.Item = v\n c.Count = v.Counter.Text\n c.Image = v.Image\n inventoryTable[v.Name] = nil\n removeInventoryFrames()\n display()\n end\n end\n end)\n end\nend \n\n-- Moving items from hotbar to backpack\nfor i, v in ipairs(hotbar:GetChildren()) do\n if v.ClassName == &quot;ImageButton&quot; then\n v.MouseButton1Click:Connect(function()\n inventoryTable[v.Name] = {\n Count = hotbarTable[tonumber(v.Name)].Count;\n Image = hotbarTable[tonumber(v.Name)].Image\n }\n hotbarTable[tonumber(v.Name)].Item = &quot;None&quot;\n hotbarTable[tonumber(v.Name)].Count = 0\n hotbarTable[tonumber(v.Name)].Image = &quot;None&quot;\n print(v.Name)\n removeInventoryFrames()\n display()\n end)\n end\n print(hotbarTable)\nend \n</code></pre>\n"^^ . . . . "<p>This is an script that i created, however, it is not working. It is supposed to stop the rotation when i press the space bar:</p>\n<pre><code>local spinning = script.Parent\nlocal state = true\n\nlocal function stopAndGo()\n state = not state\nend\n\ngame:GetService(&quot;UserInputService&quot;).InputBegan:Connect(function(input, gameProcessedEvent)\n if not gameProcessedEvent and input.KeyCode == Enum.KeyCode.Space then\n stopAndGo()\n end\nend)\n\nwhile true do\n if state then\n spinning.CFrame = spinning.CFrame * CFrame.fromEulerAnglesXYZ(255, 0, 0)\n end\n wait(0.03)\nend\n</code></pre>\n<p>it just keeps rotating when i press the space bar, i tried to change the order of the codes, i added the while part inside of the function and it didn`t work. But i noticed that the state variable never changes from true to false, it is like the stopAndGo function is never called.</p>\n"^^ . "0"^^ . . "python"^^ . . "0"^^ . "Lua number comparison returns wrong result"^^ . . . . "2"^^ . "c"^^ . . . . . . . . . "0"^^ . . . . "0"^^ . . "0"^^ . "I have access to PHP configuration, but in my case, my cpanel uses MultiPHP Manager instead of Select PHP version. Could you please tell me, how to enable extensions in php in that case ?"^^ . . "1"^^ . . . . "there _Access denied_ errors in log. Try fixing permission on our lua-lsp installation, it looks like lua-lsp server fails to access certain files."^^ . "1"^^ . . . . "<p>I work within Neovim's own terminal session; in fact, my development work is done completely inside of Neovide. However, I have to use <code>:cd</code> to change Neovim's directory to match the directory within the terminal session; I'd like for this to be automated.</p>\n<p>I've tried the following, but nothing works so far; the directory just gets changed to the home directory each time.</p>\n<p>I tried to use <code>vim.fn.getreg(&quot;+&quot;)</code> to read the <code>+</code> register where the copied value is stored and then I tried to pass this <code>string</code> value to the <code>vim.fn.chdir</code> function, but for some reason, this does not work.</p>\n<p>Note that the function <code>vim.fn.getreg</code> seems to return a string value with extra characters at the start and end.</p>\n<pre class="lang-lua prettyprint-override"><code>local tnoremap = function(lhs, rhs)\n vim.api.nvim_set_keymap(&quot;t&quot;, lhs, rhs, { noremap = true })\nend\n\ntnoremap(&quot;&lt;C-d&gt;&quot;, 'pwd|pbcopy&lt;CR&gt;&lt;C-\\\\&gt;&lt;C-n&gt;:lua vim.fn.chdir(string.lower(string.sub(vim.fn.getreg(&quot;+&quot;), 1, string.len(vim.fn.getreg(&quot;+&quot;))-1)))&lt;CR&gt;')\ntnoremap('&lt;C-d&gt;', 'pwd|pbcopy&lt;CR&gt;&lt;C-\\\\&gt;&lt;C-n&gt;:cd &lt;C-r&gt;&lt;C-o&gt;+&lt;CR&gt;')\n\n</code></pre>\n"^^ . "<p>I was writing a Lua script to read, browse, and edit a large text file. The approach I chose was to 'page through' the file, reading a segment into a buffer variable, then editing it or moving to the next page.</p>\n<p>This works great for reading the file, but my current approach to writing the file doesn't save much time when compared to loading the whole file into memory and then dumping it back into the file system.</p>\n<p>For writing I'm currently:</p>\n<ol>\n<li>opening &quot;tempFile&quot; in append mode</li>\n<li>appending bytes [0, N) to the temp file</li>\n<li>appending the buffer</li>\n<li>appending [N + pageSize, fileSize]</li>\n<li>doing os.rename (&quot;tempFile&quot;, &quot;fileName&quot;)</li>\n</ol>\n<p>Since I have an int that points to the beginning of where buffer was taken from, and another that says what length buffer was originally, would there be any way to replace only the N bytes that were modified, instead of making a whole copy of the file and then moving it?</p>\n"^^ . . . . . "0"^^ . . . "Custom foreach implementation in Lua"^^ . . "Is there a standardized approach of retrievening credentials for Neovim Lua plugins"^^ . . . "0"^^ . "<p>i made a settings gui for the player to cut off the music or turn it on and the only problem is that the gui is by default showing</p>\n<p>i tried moving the code or setting true to false... but nothing worked, i will addd the code below</p>\n<pre><code>local open = true\n\nscript.Parent.MouseButton1Click:Connect(function()\n if open == true then\n open = false\n script.Parent.Parent.Parent.MainFrame:TweenPosition(UDim2.new(0.278, 0,0.319, 0), &quot;InOut&quot;, &quot;Quad&quot;, 0.5, true)\n else\n open = true\n script.Parent.Parent.Parent.MainFrame:TweenPosition(UDim2.new(0.278, 0,1, 0), &quot;InOut&quot;, &quot;Quad&quot;, 0.5, true)\n end\nend)\n</code></pre>\n"^^ . . "Check that `fzf` is in `PATH`."^^ . "1"^^ . . . . . "1"^^ . . . . "<p>There are several issues with the loop that need to be fixed to make it work:</p>\n<pre class="lang-lua prettyprint-override"><code>local function between(a, b)\n local table = {}\n while a &gt; 0 do\n -- local a = 1 -- this is not needed, as it:\n -- (1) creates a *new* `a` value, which shadows the original value without changing it\n -- (2) is reset every loop iteration without any impact on the `a` value above\n table[a] = a\n -- local a = a + 1 -- this creates yet another `a` variable that is only visible\n -- inside the loop, so doesn't have any impact on the `while` condition\n\n -- since you already have the number of iterations you want to do (`a`)\n -- you can simply keep subtracting from it until it reaches 0:\n a = a - 1\n end\n -- it's better to return the value, as you may do something other than printing\n return table\nend\n</code></pre>\n<p>This should work, but in those cases when you know the number of iterations, it's better to use the <code>for</code> loop instead of the <code>while</code> loop, as it takes care of increasing/decreasing your loop variable:</p>\n<pre class="lang-lua prettyprint-override"><code>local tbl = {}\nfor i = 1, a do tbl[i] = i end\nreturn tbl\n</code></pre>\n<p>You should avoid using <code>table</code> as a variable name, as it clashes with the table value already provided by Lua.</p>\n"^^ . "0"^^ . . "1"^^ . "0"^^ . . . . . "problem with a user interface in roblox studio"^^ . . "1"^^ . "0"^^ . . . . . . . "Did you [install](https://www.mediawiki.org/wiki/LuaSandbox#Installation) it?"^^ . . . "0"^^ . . . "@MonsieurMerso I don't really know how to insert an image of the LspInfo, but here's the image link: https://i.sstatic.net/X8FAf.png. Is "lus ls" supposed to be "lua_ls"/"lua-language-server"? if it's right, it just prints:\nContent-Length: 120\n{"jsonrpc":"2.0","method":"$/status/report","params":{"text":"≡ƒÿ║Lua","tooltip":"Cached files: 0/0\\nMemory usage: 2M"}}""^^ . . "0"^^ . . . "0"^^ . "0"^^ . . . . . . "0"^^ . . . . "0"^^ . . "0"^^ . "0"^^ . . . . . "1"^^ . . "The `LUA_INCDIR` is where Luarocks looks for the Lua C Headers; what method did you use to install Lua? is there a `lua.h` file anywhere on your computer?"^^ . . . . "1"^^ . "@ESkri that's right (and I do this sometimes), but that makes it even more verbose (if you count the cost of having to pass this variable around / manage it) and you may incur upvalue costs etc..."^^ . . . . . "-3"^^ . "Yes, it is but ..."^^ . . "0"^^ . . . . "1"^^ . . . . . . . . "Maybe try love.filesystem? Or you could use parameters.lua and a table for config instead."^^ . . . . . . . . "quarto"^^ . . . . . "1"^^ . "unicode"^^ . . . "If you want to work with existing filesystems (e.g. through POSIX APIs), then no; these APIs allow writing at positions, but they don't have any particular support for "inserting" or "deleting"; you have to implement insertions or deletions (by shifting everything) yourself, meaning you will have linear time complexity in the size of the file."^^ . . . . "0"^^ . "Do you want to match *numbers* (e.g. 123) or *digits* (e.g. 9)?"^^ . . "1"^^ . "<p>So , this is babblo , say hi to him <a href="https://i.sstatic.net/Oo8xn.jpg" rel="nofollow noreferrer">enter image description here</a></p>\n<p>So Babblo is an Pet model that i need to move , problem with that i can not , so there are three parts where the pet can move to PetTeleportationPart 1 2 and 3 where Babblo can be teleported to , see yourself</p>\n<pre><code>local PrimaryPart = workspace:WaitForChild(&quot;Pet&quot;).PrimaryPart\n\nPrimaryPart.Position = workspace:FindFirstChild(&quot;PetTeleportationPart1&quot;).Position\n</code></pre>\n<p>Whats This Tab , well i am just gonna post the code here again :</p>\n<pre><code>local PrimaryPart = workspace:WaitForChild(&quot;Pet&quot;).PrimaryPart\n\nPrimaryPart.Position = workspace:FindFirstChild(&quot;PetTeleportationPart1&quot;).Position\n</code></pre>\n"^^ . . . . . "<p>You need to learn how to do multi-threading on your target. Then put the processing of the script in one thread, and use more threads as you see fit for the other tasks that need to run concurrently.</p>\n<p>This has nothing to do with Lua, as you show in your example source. Running the Lua script is nothing more than calling some C function. Just think how you would do it, if such a script were written as a sequence of C statements, which potentially block or run a long time.</p>\n<p>A simple way of multi-threading is to use a periodic timer interrupt. Put the script executor in the main thread, and anything else in the timer ISR or other applicable interrupts. Make sure that this &quot;anything else&quot; never blocks and runs quickly as necessary.</p>\n"^^ . "<p>It repeats mouse click while mouse button 5 is pressed</p>\n<pre><code>function OnEvent(event, arg)\n --OutputLogMessage(&quot;event = %s, arg = %s\\n&quot;, event, arg)\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 5 then\n repeat\n MoveMouseTo(62487,39895) \n Sleep(50)\n PressMouseButton(1) \n Sleep(50)\n ReleaseMouseButton(1) \n Sleep(50)\n until not IsMouseButtonPressed(5)\n end\nend\n</code></pre>\n"^^ . "0"^^ . "0"^^ . . . "<p>Consider this test function to print arg count and type (reduction to MCVE of something else):</p>\n<pre><code>function printArgs(...)\n local args = table.pack(...)\n local str = args.n .. ' args:'\n for i=1,args.n do str = str..' '..type(args[i]) end\n print(str)\nend\n</code></pre>\n<p>and a few basic examples:</p>\n<pre><code>printArgs(1, 's', nil)\n-- 3 args: number string nil\n\nprintArgs(nil)\n-- 1 args: nil\n</code></pre>\n<p>now I have a variable list of arguments coming from another part of my application, which I want to pass to this function, so I thought I'd use <code>table.unpack</code>:</p>\n<pre><code>printArgs(table.unpack{n=2, [1]=1, [2]='s'})\n-- 2 args: number string\n</code></pre>\n<p>so far so good, but the following tests do not produce the expected results (should produce the same result as the first two tests):</p>\n<pre><code>printArgs(table.unpack{n=3, [1]=1, [2]='s'})\n-- 2 args: number string\n\nprintArgs(table.unpack{n=1})\n-- 0 args:\n</code></pre>\n<p>Why?\nHow to fix?</p>\n"^^ . . . . "1"^^ . "<p>So I am instancing a quad a bunch of times in an area in love2d, which seems to be going fine, but when I add some shader code to billboard them they render at an odd spot and look like they are all pivoting around (0, 0, 0) (the position of the mesh i am instancing many times). Do I maybe have to make a new matrix for each instance to get them all to face the camera from their position,\nor I am doing something else wrong?</p>\n<p>Here is the vertex shader code for the regular, non-billboard version:</p>\n<pre><code>mat4 ModelView = viewMatrix*modelMatrix;\n \nrelativeWorldPosition = projectionMatrix * ModelView * (vertexPosition + vec4(instancePositions[love_InstanceID].xyz, 0)); \n \nreturn relativeWorldPosition;\n</code></pre>\n<p><a href="https://i.sstatic.net/GoyGO.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/GoyGO.png" alt="" /></a></p>\n<p>Here is the vertex shader code for the billboard version:</p>\n<pre><code>mat4 ModelView = viewMatrix*modelMatrix;\n \nModelView[0][0] = 1;\nModelView[0][1] = 0;\nModelView[0][2] = 0;\n\n // Column 1:\nModelView[1][0] = 0;\nModelView[1][1] = 1;\nModelView[1][2] = 0;\n\n // Column 2:\nModelView[2][0] = 0;\nModelView[2][1] = 0;\nModelView[2][2] = 1;\n\nrelativeWorldPosition = projectionMatrix * ModelView * (vertexPosition + vec4(instancePositions[love_InstanceID].xyz, 0));\n \n \nreturn relativeWorldPosition;\n</code></pre>\n<p><a href="https://i.sstatic.net/7Z85g.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7Z85g.png" alt="" /></a></p>\n<p>I tried to add billboarding to each instance of a mesh (a quad).\nI expected them to face the camera like a billboard from their current position.\nMy attempt resulted in the instances rendering in a weird position that changed based on the cameras rotation.</p>\n"^^ . . . "1"^^ . . . . "<p>I'm trying to run nodemcu on an ESP32 (more memory than esp8266). I've build the firmware using the sources from <a href="https://github.com/nodemcu/nodemcu-firmware.git" rel="nofollow noreferrer">https://github.com/nodemcu/nodemcu-firmware.git</a>, the dev-esp32 branch. The build was done on a windows/WSL2/Ubuntu system.</p>\n<p>The firmware works, however I am having issues with uploading and saving lua files. I've tried various tools, for example <a href="http://chilipeppr.com/esp32" rel="nofollow noreferrer">http://chilipeppr.com/esp32</a>.</p>\n<p>Functions like 'Heap' and 'Reset' work fine. However, uploading files fails. The console output is:</p>\n<pre><code>file.open(&quot;unnamed1.lua&quot;, &quot;w&quot;)\n file.writeline([[print(&quot;Test&quot;)]])\n file.writeline([[]])\n file.close()\n node.compile(&quot;unnamed1.lua&quot;)\n&gt; file.open(&quot;unnamed1.lua&quot;, &quot;w&quot;)\nLua error: stdin:1: attempt to call field 'open' (a nil value)\nstack traceback:\n stdin:1: in main chunk\n [C]: ?\n [C]: ?\n&gt; file.writeline([[print(&quot;Test&quot;)]])\nLua error: stdin:1: attempt to call field 'writeline' (a nil value)\nstack traceback:\n stdin:1: in main chunk\n [C]: ?\n [C]: ?\n&gt; file.writeline([[]])\nLua error: stdin:1: attempt to call field 'writeline' (a nil value)\nstack traceback:\n stdin:1: in main chunk\n [C]: ?\n [C]: ?\n&gt; file.close()\nLua error: stdin:1: attempt to call field 'close' (a nil value)\nstack traceback:\n stdin:1: in main chunk\n [C]: ?\n [C]: ?\n&gt; node.compile(&quot;unnamed1.lua&quot;)\nLua error: stdin:1: cannot open unnamed1.lua: No such file or directory\nstack traceback:\n [C]: in function 'compile'\n stdin:1: in main chunk\n [C]: ?\n [C]: ?\n</code></pre>\n<p>Apparently, ESP8266 nodemcu implements file.open() where ESP32 nodemcu doesn't (ESP32 seems to implement the Lua io lib instead).</p>\n<p>Am I having a build issue? I don't think so as <a href="https://nodemcu.readthedocs.io/en/dev-esp32/modules/file/" rel="nofollow noreferrer">https://nodemcu.readthedocs.io/en/dev-esp32/modules/file/</a> doesn't list file.open()</p>\n<p>Is there an issue with the upload tools failing to detect my ESP32? Upon reset, my firmware reports as:\n'''\nNodeMCU ESP32 build unspecified powered by Lua 5.1.4 [5.1-doublefp] on IDF v4.4.3\n'''</p>\n<p>Any help is appreciated.</p>\n"^^ . . . "<pre><code>vim.o.autoread = true\nvim.api.nvim_create_autocmd({ 'CursorHold', \n'CursorHoldI', 'FocusGained' }, {\n command = &quot;if mode() != 'c' | \n checktime | endif&quot;,\n pattern = { '*' },\n})\n</code></pre>\n<p>You can create autocmd like this and it will change buffer if file changed in disk like git pull</p>\n"^^ . . "Repeat with "." a motion plugin command mapped in lua throught keyset?"^^ . "disable task tag [TODO] jdtls [nvim, cmp, lua]"^^ . . . . "1"^^ . . "In the Lua script you are actually inserting `Memstats` field that refers to the object containing the field. So, the object now has non-tree structure (because of the loop) which may be a reason to fail its load. What have you tried to achieve by using this Lua script?"^^ . . . "1"^^ . . . "Unable to pick up cloned object in Roblox Lua. How to fix?"^^ . "<p>To build luvit app into executable, you can use <code>lit make</code>.<br />\nappdir should contain <code>main.lua</code> &amp; <code>package.lua</code>, you can generate it with <code>lit init</code></p>\n"^^ . "<p>i tried to write a script that removes poor (grey) items from the creature loot table globally, without touching the database. But it does not work and i can't figure out why because i am very new to lua programming and azerothcore in general.</p>\n<p>i am using this azerothcore version:\nAzerothCore rev. 96a5224d927f+ 2023-04-22 07:25:31 +0700 (npcbots_3.3.5 branch) (Win64, Release, Static)</p>\n<p>This is my script, it is stored in the lua_scripts folder with other lua scripts that seem to work:</p>\n<pre><code>-- Function to check if an item is grey (common)\nfunction IsGreyItem(item)\n local itemQuality = item:GetQuality()\n return itemQuality == 0 -- 0 represents poor quality (common)\nend\n\n-- Hook into the loot drop event globally\nfunction OnLoot(event, player, creature)\n local loot = creature:GetLoot()\n\n if not loot then\n return\n end\n\n for i = loot:GetSize(), 1, -1 do\n local item = loot:GetItem(i)\n\n if item and IsGreyItem(item) then\n -- Grey item found, remove it from the loot\n loot:RemoveItem(i)\n end\n end\nend\n\n-- Register the loot event handler globally\nRegisterPlayerEvent(27) -- Register the loot event (ID 27) globally\nAddEvent(&quot;OnCreatureLoot&quot;, OnLoot)\n\n</code></pre>\n<p>maybe someone has an idea why it doesn't work :)</p>\n<p>i killed some low level mobs to check if they still drop grey items and they do.</p>\n"^^ . . "keycode"^^ . "0"^^ . . "0"^^ . "0"^^ . "0"^^ . "3"^^ . "Ghub Lua script used to work, but all of a sudden stopped"^^ . . . . "0"^^ . . . "<p>You can use my code if u can read it :P</p>\n<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>--Server Script\n\nlocal re=Instance.new("RemoteEvent",game.ReplicatedStorage)\n-- all abilities(except the ultimate)are not on cooldown at start of the game\nlocal ability_cds={\n ["basicAttack"]=1,\n ["r"]=15, -- Skill1 (binded to button r with 15s cooldown)\n ["t"]=60 -- Ultimate ability\n}\nlocal ultcd=60 -- ultimate ability default cooldown\nlocal function ultcd_update(player,cd) \n re:FireClient(player,"t",5) \nend\nlocal ability={\n ["basicAttack"]=function(player,combo)\n local hint=workspace:FindFirstChild"Message"or Instance.new("Hint",workspace)\n hint.Text="basicAttack x"..combo\n end,\n ["r"]=function(player,combo) -- Skill1 (binded to button r with 15s cooldown)\n end,\n ["t"]=function(player) --[[Ultimate ability(charging cd by kill not implemented)\n \nultcd_update(player,5) -- use to decrease ultimate cooldown by 5seconds(example)\n\n]] \n end\n \n \n}\nlocal maxcombo=5\nlocal function useAbility(ability_name,player,combo)\n ability[ability_name](player,combo)\nend\nlocal ability_combo,ability_cds2={},{}\nre.OnServerEvent:Connect(function(player,ability)\n if not ability or type(ability)~="string"then player:Kick()end\n local cd=ability_cds[ability]\n if not cd then player:Kick()end\n ability_cds2[player.Name]=ability_cds2[player.Name]or table.clone(ability_cds)\n local ability_cds=ability_cds2[player.Name]\n cd=ability_cds[ability]\n -- ultimate charging mechanism override:\n --(ult. cooldown will not decrease every second)\n if ability=="t"and cd==0 then\n ability_cds[ability]=ultcd\n useAbility("t",player,0)\n end\n --\n if cd==0 then return end\n ability_cds[ability]=0\n ability_combo[player.Name]=ability_combo[player.Name]or {}\n ability_combo[player.Name][ability]=ability_combo[player.Name][ability]or 0\n if not(ability_combo[player.Name][ability]+1&gt;maxcombo) then\n ability_combo[player.Name][ability]+=1\n else\n ability_combo[player.Name][ability]=1\n end\n delay(cd,function()\n ability_cds[ability]=cd\n local combo=ability_combo[player.Name][ability]\n delay(cd,function()\n if combo==ability_combo[player.Name][ability]then\n ability_combo[player.Name][ability]=0\n end\n \n end)\n end)\n spawn(function()\n useAbility(ability,player,ability_combo[player.Name][ability])\n end)\nend)\n-------------------------------------------------------------------</code></pre>\r\n</div>\r\n</div>\r\n</p>\n<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>--LocalScript\n\n\n\nlocal player=game.Players.LocalPlayer\n\n--local gui=script.Parent\n\nlocal char=player.Character\nlocal hum=char:WaitForChild"Humanoid"\n\nlocal mouse=player:GetMouse()\nlocal re=game.ReplicatedStorage:WaitForChild"RemoteEvent"\nlocal ability_cds={\n ["basicAttack"]=1,\n ["r"]=15, -- Skill1 (binded to button r with 15s cooldown)\n ["t"]=60 -- Ultimate ability\n}\nre.OnClientEvent:Connect(function(ability,cd)\n local newcd=ability_cds[ability]-cd\n newcd=newcd&lt;0 and 0 or newcd\n ability_cds[ability]=cd\nend)\nlocal ultcd=60\nlocal function useAbility(ability)\n local cd=ability_cds[ability]\n -- ultimate ability special charging mechanism\n if ability=="t"then\n if cd==0 then\n ability_cds[ability]=ultcd\n re:FireServer(ability)\n end\n return\n end\n --\n if not cd or cd==0 then return end\n ability_cds[ability]=0\n delay(cd,function()\n ability_cds[ability]=cd\n end)\n re:FireServer(ability)\nend\nmouse.KeyDown:Connect(function(key)\n useAbility(key:lower())\nend)\nmouse.Button1Down:Connect(function(key)\n useAbility("basicAttack")\nend)</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . . "I do not understand what specifically you are asking. Is it how to embed eLua in your C program? Or is it how to multitask a C or Lua program? These two aspects are independent. Please [edit] your question to clarify, this is not a forum."^^ . . . "1"^^ . . "1"^^ . . . . . . . . . . . "libreoffice"^^ . . . . "TTL for AtomicLong in Apache Ignite"^^ . "0"^^ . . "How do you clear scrapy splash cache after running in a container"^^ . . "@Tsyvarev Thank You! It worked after adding ```-DCMAKE_PREFIX_PATH="/home/runner/work/luatest/luatest/.lua/"``` as cmake flag (after checking the location with ```whereis```)."^^ . . "<p>I am trying to run the Lua plugin on ingress-nginx. I am able to do the below steps using documentaion. however, I have some challenges yet.</p>\n<p>Steps on K8s</p>\n<pre><code>1. Rename the auth.lua to main.lua\n\n2. Create configMap auth-lua using the file above.\nk create configmap auth-lua --from-file main.lua -n ingress-nginx\n\n3. Mount the configmap as folder inside ingress-nginx deployment\n..\n ...\n spec:\n volumes:\n - name: auth-lua\n configMap:\n name: auth-lua\n defaultMode: 420\n containers:\n - ...\n ...\n volumeMounts:\n - name: auth-lua\n mountPath: /etc/nginx/lua/plugins/auth-lua\n\n4. Update the ingress-nginx confimap to include this plugin\ndata:\n plugins: auth-lua\n\n5. Rollout restart the ingress-nginx deployment.\n</code></pre>\n<p>Now, My question is. is my all requests go to plugins or is there any way that I need to mention in ingress-resource to use this plugin?\nI want to use this plugin only for some ingress resource. and how can I achieve this?</p>\n"^^ . . "0"^^ . "love2d"^^ . "path"^^ . . . . . . "Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . . . . . . "2"^^ . "0"^^ . "3"^^ . "<p>I decided to use VIM API <code>vim.fn.isdirectory</code> to check whether the local directory is present.</p>\n<pre><code>...\nreturn require('packer').startup(function(use)\n use 'wbthomason/packer.nvim'\n\n -- My plugins here\n...\n local user = os.getenv(&quot;USERNAME&quot;)\n local path = &quot;/home/&quot; .. user .. &quot;/src/azure-functions.nvim&quot;\n if vim.fn.isdirectory(path) ~= 0 then\n use {\n path,\n config = function()\n require(&quot;azure-functions&quot;).setup({})\n end,\n }\n else\n use {\n &quot;kaiwalter/azure-functions.nvim&quot;,\n config = function()\n require(&quot;azure-functions&quot;).setup({})\n end,\n }\n end\n...\nend)\n</code></pre>\n<p>I was not able to achieve this with <code>cond</code> condition like</p>\n<pre><code> use {\n path,\n opt = true,\n cond = function()\n return vim.fn.isdirectory(path) ~= 0,\n end,\n config = function()\n require(&quot;azure-functions&quot;).setup({})\n end,\n }\n</code></pre>\n<p>as the <code>cond</code> specification does not seem influence whether a package is installed or not.</p>\n"^^ . . "<p>Try <code>io</code> lib instead.</p>\n<pre><code>do\n local file = io.open(&quot;unnamed1.lua&quot;, &quot;w&quot;)\n file:write[[\n print(&quot;Test&quot;)\n ]]\n file:close()\nend\nnode.compile(&quot;unnamed1.lua&quot;)\n</code></pre>\n"^^ . "1"^^ . . . . . "I'm starting to suspect that Quarto might be preventing this change because, if the .htaccess file isn't configured for it, the preview wouldn't work either.\n\nThank you, Paulo!"^^ . "<p>So basically I just added a made a new model matrix from the existing one and manually set the position of it like so:</p>\n<pre><code> mat4 TransModelMatrix = modelMatrix; \n TransModelMatrix[3][0] = InstData.x;\n TransModelMatrix[3][1] = InstData.y;\n TransModelMatrix[3][2] = InstData.z;\n \n \n mat4 ModelView = viewMatrix*-TransModelMatrix;\n \n ModelView[0][0] = 1;\n ModelView[0][1] = 0;\n ModelView[0][2] = 0;\n\n // Column 1:\n //ModelView[1][0] = 0;\n //ModelView[1][1] = 1;\n //ModelView[1][2] = 0;\n\n // Column 2:\n ModelView[2][0] = 0;\n ModelView[2][1] = 0;\n ModelView[2][2] = 1;\n\n relativeWorldPosition = projectionMatrix * -ModelView * (vertexPosition);\n</code></pre>\n"^^ . . . "Is there a way to check if an arbitrary table item exists?"^^ . "<p>I don't see anything wrong with the string replacement code, as executing <code>(&quot;foo-bar.html-some-more&quot;):gsub(&quot;(.-)%.html(.-)&quot;, &quot;%1%2&quot;)</code> returns <code>foo-bar-some-more</code> as expected. You haven't provided a single example as what kind of URLs you expect to modify, so maybe the issue is with something really simple (for example, using <code>.htm</code> extension instead of <code>.html</code>).</p>\n<p>I'd check if the code works <em>outside</em> of your environment in a regular Lua interpreter and also check if you get the expected result if you set the <code>result</code> value manually to whatever result you expect from <code>gsub</code> (just to make sure that the rest of the processing happens as you envision it).</p>\n"^^ . "0"^^ . . . . . "0"^^ . "0"^^ . "0"^^ . . "Try `io.popen("LC_ALL=en_US.UTF-8 "..command)`"^^ . . . "0"^^ . "0"^^ . "<p>If you need to upload files to the ESP32 using the io-module use this branch of nodeMCU-Tools..<a href="https://github.com/serg3295/NodeMCU-Tool/tree/dev-esp32" rel="nofollow noreferrer">serg3295 NodeMCU-Tool</a></p>\n<p>It took me hours of searching to find this. Its a command line tool, so not as easy to use as Chillipeppr or ESPlorer.</p>\n"^^ . "1"^^ . "0"^^ . "<p>You can use <code>vim.fn.input()</code> to get the input and store it in a Lua variable. Then get the current cursor position in the current buffer with <code>vim.api.nvim_win_get_cursor(0)</code>. Finally, set the text in the current buffer at the current cursor position using <code>vim.api.nvim_buf_set_text()</code>.</p>\n<p>Here is a complete mapping:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.keymap.set(&quot;i&quot;, &quot;&lt;C-r&gt;&quot;, function()\n local user_input = vim.fn.input(&quot;Enter input: &quot;)\n local row, col = unpack(vim.api.nvim_win_get_cursor(0))\n vim.api.nvim_buf_set_text(0, row - 1, col, row - 1, col, { &quot;_{&quot; .. user_input .. &quot;}&quot; })\nend)\n</code></pre>\n<p>There's also the option to use <code>vim.api.nvim_feedkeys()</code> to insert the text into the buffer.</p>\n"^^ . . . . . "<p>You can also deselect the loot option for greys in the bot menu and the bots won't loot them.</p>\n"^^ . . "You are trying to read `_G["Tables.Effects"][value]` instead of `_G["Tables"].Effects[value]`"^^ . "How to refresh LunarVim after Git pull or Git checkout?"^^ . . "Rather than just providing the solution, take the time and explain what is wrong too"^^ . "0"^^ . "Theoretically though, there is nothing that would prevent a file system from offering special, efficient support for insertions. If files are stored as B-Trees of chunks without keys, using only ranks (counts), then you can do logarithmic time insertions of chunks; this gives you linearithmic insertion time (in the count of the inserted chunks, not in the size of the file). Using bulk insertions of multiple chunks it should even be possible to achieve O(n + lg n). But again, this is just theory, I know of no file system that does this (but you may find databases that do this for BLOBs)."^^ . . . "io"^^ . . . . "cmake"^^ . "0"^^ . "1"^^ . "<p>In documentation about <a href="http://cbonte.github.io/haproxy-dconv/2.5/configuration.html#8.4" rel="nofollow noreferrer">Timing events</a> can be observed values like Ta/Tr/Tw/Td. A general question is how can correspondence of such values can be extracted in some additional code, like Lua one.</p>\n"^^ . . "1"^^ . . "0"^^ . . "0"^^ . . . . "1"^^ . . . "<p>It looks like the issue you're facing might be related to the way you're encoding and sending the image data in your Lua Discord webhook code. Here's a modified version of your code that should properly handle the image attachment:</p>\n<pre><code>function sendDiscordWebhook(webhookUrl, message, imageFilePath)\nlocal boundary = &quot;---------------------------&quot; .. os.time()\n\nlocal headers = {\n [&quot;Content-Type&quot;] = &quot;multipart/form-data; boundary=&quot; .. boundary\n}\n\nlocal body = {}\ntable.insert(body, &quot;--&quot; .. boundary)\ntable.insert(body, 'Content-Disposition: form-data; name=&quot;content&quot;\\r\\n\\r\\n' .. message)\n\nif imageFilePath then\n local fileName = imageFilePath:match(&quot;^.+[\\\\/](.+)$&quot;)\n local fileExtension = fileName:match(&quot;%.([^%.]+)$&quot;)\n local contentType = &quot;image/&quot; .. fileExtension\n\n table.insert(body, &quot;--&quot; .. boundary)\n table.insert(body, 'Content-Disposition: form-data; name=&quot;file&quot;; filename=&quot;' .. fileName .. '&quot;')\n table.insert(body, 'Content-Type: ' .. contentType)\n table.insert(body, &quot;&quot;)\n\n local imageFileData\n local file = io.open(imageFilePath, &quot;rb&quot;)\n if file then\n imageFileData = file:read(&quot;*all&quot;)\n file:close()\n table.insert(body, imageFileData)\n else\n print(&quot;Failed to open the image file: &quot; .. imageFilePath)\n return\n end\nend\n\ntable.insert(body, &quot;--&quot; .. boundary .. &quot;--&quot;)\nlocal requestBody = table.concat(body, &quot;\\r\\n&quot;)\n\nPerformHttpRequest(webhookUrl, function(err, text, headers)\n if err == 200 then\n print(&quot;Message sent successfully!&quot;)\n else\n print(&quot;Failed to send message. Error code: &quot; .. err)\n end\nend, 'POST', requestBody, headers)\n</code></pre>\n"^^ . "0"^^ . "0"^^ . "1"^^ . . "0"^^ . . "2"^^ . . . "0"^^ . "I have to increment and get a counter atomically due to concurrency."^^ . "0"^^ . . . . "<p>I'm currently making a wiki with mediawiki 1.39 on a hosted server, I decided to enable scribunto through my cpanel in order to utilize modules, i selected luasandbox as my default engine, and wrote the code in the LocalSettings.php as:</p>\n<pre><code>wfLoadExtension( 'Scribunto' );\n$wgScribuntoDefaultEngine = 'luasandbox'; // Use LuaSandbox as the default engine\n</code></pre>\n<p>Everything seemed fine, when i decide to create a module page, pasting one from wikipedia, when i clicked on save page, it threw me an internal error. It read:</p>\n<pre><code>[ZQkYSxr_nfXN6YUDbjbzjQAAkTM] /index.php?title=Module:For&amp;action=submit Scribunto_LuaInterpreterNotFoundError: The luasandbox extension is not present, this engine cannot be used.\n\nBacktrace:\n\nfrom /home3/funkinch/public_html/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxInterpreter.php(44)\n#0 /home3/funkinch/public_html/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxInterpreter.php(61): MediaWiki\\Extension\\Scribunto\\Engines\\LuaSandbox\\LuaSandboxInterpreter::checkLuaSandboxVersion()\n#1 /home3/funkinch/public_html/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxEngine.php(258): MediaWiki\\Extension\\Scribunto\\Engines\\LuaSandbox\\LuaSandboxInterpreter-&gt;__construct(MediaWiki\\Extension\\Scribunto\\Engines\\LuaSandbox\\LuaSandboxEngine, array)\n#2 /home3/funkinch/public_html/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(131): MediaWiki\\Extension\\Scribunto\\Engines\\LuaSandbox\\LuaSandboxEngine-&gt;newInterpreter()\n#3 /home3/funkinch/public_html/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(235): Scribunto_LuaEngine-&gt;load()\n#4 /home3/funkinch/public_html/extensions/Scribunto/includes/engines/LuaCommon/LuaModule.php(41): Scribunto_LuaEngine-&gt;getInterpreter()\n#5 /home3/funkinch/public_html/extensions/Scribunto/includes/engines/LuaCommon/LuaModule.php(28): Scribunto_LuaModule-&gt;getInitChunk()\n#6 /home3/funkinch/public_html/extensions/Scribunto/includes/ScribuntoEngineBase.php(201): Scribunto_LuaModule-&gt;validate()\n#7 /home3/funkinch/public_html/extensions/Scribunto/includes/ScribuntoContentHandler.php(105): MediaWiki\\Extension\\Scribunto\\ScribuntoEngineBase-&gt;validate(string, string)\n#8 /home3/funkinch/public_html/extensions/Scribunto/includes/Hooks.php(389): MediaWiki\\Extension\\Scribunto\\ScribuntoContentHandler-&gt;validate(MediaWiki\\Extension\\Scribunto\\ScribuntoContent, Title)\n#9 /home3/funkinch/public_html/includes/HookContainer/HookContainer.php(338): MediaWiki\\Extension\\Scribunto\\Hooks::validateScript(DerivativeContext, MediaWiki\\Extension\\Scribunto\\ScribuntoContent, Status, string, User, boolean)\n#10 /home3/funkinch/public_html/includes/HookContainer/HookContainer.php(137): MediaWiki\\HookContainer\\HookContainer-&gt;callLegacyHook(string, array, array, array)\n#11 /home3/funkinch/public_html/includes/HookContainer/HookRunner.php(1472): MediaWiki\\HookContainer\\HookContainer-&gt;run(string, array)\n#12 /home3/funkinch/public_html/includes/editpage/Constraint/EditFilterMergedContentHookConstraint.php(100): MediaWiki\\HookContainer\\HookRunner-&gt;onEditFilterMergedContent(DerivativeContext, MediaWiki\\Extension\\Scribunto\\ScribuntoContent, Status, string, User, boolean)\n#13 /home3/funkinch/public_html/includes/editpage/Constraint/EditConstraintRunner.php(88): MediaWiki\\EditPage\\Constraint\\EditFilterMergedContentHookConstraint-&gt;checkConstraint()\n#14 /home3/funkinch/public_html/includes/EditPage.php(2344): MediaWiki\\EditPage\\Constraint\\EditConstraintRunner-&gt;checkConstraints()\n#15 /home3/funkinch/public_html/includes/EditPage.php(1904): EditPage-&gt;internalAttemptSave(array, boolean, boolean)\n#16 /home3/funkinch/public_html/includes/EditPage.php(721): EditPage-&gt;attemptSave(array)\n#17 /home3/funkinch/public_html/includes/actions/EditAction.php(73): EditPage-&gt;edit()\n#18 /home3/funkinch/public_html/includes/actions/SubmitAction.php(38): EditAction-&gt;show()\n#19 /home3/funkinch/public_html/includes/MediaWiki.php(542): SubmitAction-&gt;show()\n#20 /home3/funkinch/public_html/includes/MediaWiki.php(322): MediaWiki-&gt;performAction(Article, Title)\n#21 /home3/funkinch/public_html/includes/MediaWiki.php(904): MediaWiki-&gt;performRequest()\n#22 /home3/funkinch/public_html/includes/MediaWiki.php(562): MediaWiki-&gt;main()\n#23 /home3/funkinch/public_html/index.php(50): MediaWiki-&gt;run()\n#24 /home3/funkinch/public_html/index.php(46): wfIndexMain()\n#25 {main}\n</code></pre>\n<p>I tried messing around the LocalSettings.php and the Cpanel, even putting the luasandbox folder as an extension and reinstalling Scribunto as 1.40, but none of it have worked.\nIf any of you have any experience writting modules for mediawiki, tell me what did you do to enable them.</p>\n<p>Thanks in advance.</p>\n"^^ . . . . "1"^^ . . . "0"^^ . . . "0"^^ . "1"^^ . . "1"^^ . "argument-unpacking"^^ . . . . . . "0"^^ . . . "0"^^ . . . "0"^^ . . "Attempting nil with CFrame"^^ . . "@ESkri well, local values use registers, upvalues incur an allocation and occupy an upvalue slot in a closure using them. But it is indeed much more efficient than creating fresh empty tables. The main point "against" it is the verbosity. (Of course you could use something like a one-letter name for the variable, but that would result in unreadable code.) Frankly I just wish Lua(JIT) was smart enough to optimize `(t or {}).k` it out..."^^ . . . "1"^^ . . . "Is there a way to create a function that creates a new variable with the name of one of the parameters?"^^ . . "neovim-plugin"^^ . . . "0"^^ . "1"^^ . "0"^^ . "0"^^ . "0"^^ . "nginx-config"^^ . . . "0"^^ . . . . "while-loop"^^ . . "0"^^ . "0"^^ . . . . . "<p>Cross-posted with <a href="https://github.com/tpope/vim-repeat/issues/92#issuecomment-1826910664" rel="nofollow noreferrer">https://github.com/tpope/vim-repeat/issues/92#issuecomment-1826910664</a></p>\n<h2>In your example:</h2>\n<pre><code>vim.keymap.set(&quot;n&quot;, &quot;[g&quot;, &quot;&lt;Plug&gt;(coc-diagnostic-prev)&quot;, {silent = true})\nvim.keymap.set(&quot;n&quot;, &quot;]g&quot;, &quot;&lt;Plug&gt;(coc-diagnostic-next)&quot;, {silent = true})\n</code></pre>\n<p>You can do something like:</p>\n<pre><code>local t = function(keycode) return vim.api.nvim_replace_termcodes(keycode, true, true, true) end\n\nvim.keymap.set(&quot;n&quot;, &quot;[g&quot;, function()\n vim.api.nvim_feedkeys(t '&lt;Plug&gt;(coc-diagnostic-prev)', &quot;n&quot;, false)\n vim.fn[&quot;repeat#set&quot;](t '&lt;Plug&gt;(coc-diagnostic-prev)')\nend, {silent = true})\n</code></pre>\n<p>or</p>\n<pre><code>local t = function(keycode) return vim.api.nvim_replace_termcodes(keycode, true, true, true) end\n\nvim.keymap.set(&quot;n&quot;, &quot;[g&quot;, function()\n vim.fn[&quot;repeat#set&quot;](t '&lt;Plug&gt;(coc-diagnostic-prev)')\n return '&lt;Plug&gt;(coc-diagnostic-prev)'\nend, { silent = true, expr = true, remap = true })\n</code></pre>\n<p>and similar for <code>]g</code>. You may want to make some helper function to reduce repeating similar lines.</p>\n<p>The use of <code>feedkeys</code> is quite hacky and brittle here (although you can use <code>expr</code> to avoid <code>feedkeys</code>), so below I would suggest some ways to automatically create an internal wrapper mapping that makes things repeatable.</p>\n<h2>A general recipe &amp; usage for neovim (Lua)</h2>\n<p>You can use the following wrapper to conveniently wrap a <code>rhs</code> to be passed to <code>vim.keymap.set</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>---Register a global internal keymap that wraps `rhs` to be repeatable.\n---@param mode string|table keymap mode, see vim.keymap.set()\n---@param lhs string lhs of the internal keymap to be created, should be in the form `&lt;Plug&gt;(...)`\n---@param rhs string|function rhs of the keymap, see vim.keymap.set()\n---@return string The name of a registered internal `&lt;Plug&gt;(name)` keymap. Make sure you use { remap = true }.\nlocal make_repeatable_keymap = function (mode, lhs, rhs)\n vim.validate {\n mode = { mode, { 'string', 'table' } },\n rhs = { rhs, { 'string', 'function' },\n lhs = { name = 'string' } }\n }\n if not vim.startswith(lhs, &quot;&lt;Plug&gt;&quot;) then\n error(&quot;`lhs` should start with `&lt;Plug&gt;`, given: &quot; .. lhs)\n end\n vim.keymap.set(mode, lhs, function()\n rhs()\n vim.fn['repeat#set'](vim.api.nvim_replace_termcodes(lhs, true, true, true))\n end)\n return lhs\nend\n</code></pre>\n<p>(Note: this does not implement <code>opts</code> for such as <code>buffer</code>, <code>nowait</code>, <code>silent</code>, etc., but it should be straightforward to extend)</p>\n<p><strong>Example</strong>: If you want to make a keymap <code>&lt;leader&gt;tc</code> mapped to a lua function (or any keymap sequence string) repeatable:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.keymap.set('n', '&lt;leader&gt;tc', make_repeatable_keymap('n', '&lt;Plug&gt;(ToggleComment)', function()\n -- the actual body (rhs) goes here: some complex logic that you want to repeat\nend, { remap = true })\n</code></pre>\n<p>This will:</p>\n<ul>\n<li>Create an internal keymap <code>&lt;Plug&gt;(ToggleComment)</code> that does the job to make the internal keymap repeatable.</li>\n<li>Map <code>&lt;leader&gt;tc</code> to <code>&lt;Plug&gt;(ToggleComment)</code>, which will execute the desired body (rhs).</li>\n<li>Note: Make sure you use <strong><code>{ remap = true }</code></strong>.</li>\n</ul>\n<h3>More detailed explanation and breakdown</h3>\n<p>So in order to make vim-repeat work, in general one should have a keymap (or a command) like:</p>\n<ol>\n<li>BEGIN: A keymap (or command) starts, say <code>&lt;Plug&gt;(MyKeymap)</code>.</li>\n<li>(body -- what is going to be repeated; this is the body (rhs) of the keymap)</li>\n<li>END: call <code>repeat#set(&quot;&lt;Plug&gt;(MyKeymap)&quot;)</code> to mark the <em>keymap</em> sequence to repeat by <code>.</code>.\n<ul>\n<li>Note this is just implemented by <strong><code>feedkeys</code></strong> under the hood -- so need to use <code>nvim_replace_termcodes</code>; also an anonymous function cannot be used.</li>\n</ul>\n</li>\n</ol>\n<p>For keymap, it is very recommended (although not mandatory) to use <a href="https://vimhelp.org/map.txt.html#%3CPlug%3E" rel="nofollow noreferrer"><code>&lt;Plug&gt;</code></a> to create an <em>internal mapping</em>, because this will make key repeat much, much easier to write and understand.</p>\n"^^ . "3"^^ . . "0"^^ . . . . "1"^^ . "<p>When you display the time, use the <code>string.format</code> function to format the number :</p>\n<pre class="lang-lua prettyprint-override"><code> Text.Text = string.format(&quot;%.3f&quot;, Time)\n</code></pre>\n<p>In this example, <code>%f</code> is used to display a floating point number, and <code>%.3f</code> limits the precision of that number to just 3 decimal points.</p>\n<p>For more information, see this answer : <a href="https://stackoverflow.com/a/1811889/2860267">https://stackoverflow.com/a/1811889/2860267</a></p>\n"^^ . . . "@Oka I'm fairly new to lua bit have a somewhat understanding of coding in general. Perhaps you can help me out & yes I agree tables would be better but that will be my next project to understand ."^^ . "0"^^ . "`call minpac#update()`"^^ . "game-engine"^^ . "Can't read file in Lua after I moved the .love file elsewhere"^^ . "1"^^ . . . "0"^^ . . "0"^^ . . "0"^^ . . . . . . . . . "If you know and there is already answer on SO, then why?"^^ . . "lazy-evaluation"^^ . "Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking."^^ . "0"^^ . . . "0"^^ . . . "0"^^ . "Why is my hp bar not working (should turn green and hp should go up) when i run my code?"^^ . . . "liskov-substitution-principle"^^ . . . . . "0"^^ . . "As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . . "<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>local debounce=false\nconn = UIS.InputBegan:Connect(function(input, gameProcessedEvent)\n if input.UserInputType == Enum.UserInputType.MouseButton1 then\n if debounce then return end\n debounce=true\n humanoid.WalkSpeed -= shoting\n toolDebounce = true -- the boolean that must be true for the while process to run\n while toolDebounce do\n local startPosition = tool.Part.Position\n local endPosition = mouse.Hit.Position\n\n remoteEvent:FireServer(tool, startPosition, endPosition)\n\n task.wait (debounceTime) \n end\n humanoid.WalkSpeed += shoting\n debounce=false\n end\nend)\n\n\nconn2 = UIS.InputEnded:Connect(function(input, gameProcessedEvent)\n if input.UserInputType == Enum.UserInputType.MouseButton1 then\n toolDebounce = false -- when the boolean in question is set to false, the while proccess yields. this only works if the interval between clicks is, aproximately, 0.4 seconds long\n \n end\nend)</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . . . . "0"^^ . . . . . "@Deadshot As general advice, when in doubt: print everything. In this case you didn't tell me what `print(playerInjuries[ply])` prints. Whatever followup question you ask me is pretty much always going to be answered with "print everything". :)"^^ . "One interesting thing to note though, unlike the following versions, Lua 5.2's `table.unpack` (table library in general) does not invoke getter (and setter) metamethods (it *does* invoke `__len` with no third argument, like the following versions). This was [changed in Lua 5.3](https://www.lua.org/manual/5.3/manual.html#8.2)."^^ . "<p>The reason is simple, <code>table.unpack</code> does not recognize <code>n</code>, its default length is <code>#t</code>.</p>\n<p>You should use its 3rd argument to indicate the length:</p>\n<pre><code>local t = {n=3, [1]=1, [2]='s'}\nprintArgs(table.unpack(t, 1, t.n))\n</code></pre>\n<p>And you can redefine <code>table.unpack</code> to make it more elegant:</p>\n<pre><code>local unpack = table.unpack\nfunction table.unpack(t, i, j)\n return unpack(t, i, j or t.n)\nend\nprintArgs(table.unpack{n=3, [1]=1, [2]='s'})\n</code></pre>\n"^^ . "0"^^ . "Key for every second, if rate-limiting per second.\nKey for every minute, if rate-limiting per minute etc."^^ . . . . . "0"^^ . . "0"^^ . . . "0"^^ . . "Ahhh, I was thrown off by the way Lua does it in the scripts. Since you don't seem to want to, I'll have to write the answer to this question and accept it, huh?"^^ . "0"^^ . . . . . "1"^^ . . "2"^^ . . "<p><code>Cache[1]</code> being <code>nil</code> is correct: The only key used in your <code>Cache</code> table is <code>SurvivalGameFramework</code>. <code>Cache.SurvivalGameFramework</code> in turn only has a <code>parent</code> key, so <code>Cache.SurvivalGameFramework[1]</code> is <code>nil</code> as well. <code>Cache.SurvivalGameFramework.parent</code> on the other hand would be <code>game.ServerStorage</code>.</p>\n<p>A table <code>t = {42}</code> or <code>t = {[1] = 42}</code> would have <code>t[1] == 42</code>. A table <code>t2 = {k = 42}</code> or <code>t2 = {[&quot;k&quot;] = 42}</code> has <code>t2.k == 42</code> and <code>t2[&quot;k&quot;] == 42</code>. Absent keys have <code>nil</code> values in Lua, so <code>t2[1]</code> is <code>nil</code>.</p>\n"^^ . . . "0"^^ . . . "Fzf.vim does not work due to fzf missing programs"^^ . . . . "<p>This is a typical script that would have worked in Filtering Disabled.\nThough since the introduction of Filtering Enabled only, the server filters what the client can do. So it is now not possible for clients to create serverscripts (in your case global scripts) anymore, as they would be able to affect other clients too.</p>\n<p>Since a localscript and therefore a client creates a new tool that includes a serverscript, the server won't detect that serverscript was made by the client, as it isn't replicated to the server, neither the tool.</p>\n<p>Consider using <a href="https://create.roblox.com/docs/reference/engine/classes/RemoteEvent" rel="nofollow noreferrer">RemoteEvents</a> to communicate between the client and server.</p>\n<p>I suggest for you to seperate the detection of tool activation on the client and the rest on the sever (e.g. throwing tool and cloning it)</p>\n"^^ . . . . . . . . . . "The Lua script was just one of the many variations I tried to create a key-value pair where the value would be the entire JSON payload received from the metrics. Currently, I use the Nest filter instead to nest the received metrics under a new larger one. However, when sending to my syslog server, I just see blank messages, same with if I receive with tcpdump and open with Wireshark"^^ . "0"^^ . . "0"^^ . "isolate Lua scripts in C++"^^ . . "What do you mean by "refresh"?"^^ . . "Slide In and Out Gui Using Buttons Doesn't Work"^^ . "<p>When treating a file as <em>binary</em>, you can certainly replace <em>fixed length</em> data at a particular file offset:</p>\n<pre class="lang-lua prettyprint-override"><code>local file = assert(io.open('data', 'w+b'))\n\n-- write three unsigned longs\nfile:write(string.pack('LLL', 11, 22, 33)):flush()\n-- offset by the size of one unsigned long\nfile:seek('set', string.packsize 'L')\n-- overwrite the second unsigned long\nfile:write(string.pack('L', 42)):flush()\n-- rewind\nfile:seek('set')\n\nlocal a, b, c = string.unpack('LLL', file:read(string.packsize 'LLL'))\n\nfile:close()\nassert(os.remove 'data')\n \nprint(a, b, c) -- 11, 42, 33\n</code></pre>\n<p>This is quite common, but leaves your file open to data corruption if any given write operation <em>fails</em>.</p>\n<p>Given</p>\n<blockquote>\n<p>read, browse, and edit a large <em>text file</em></p>\n</blockquote>\n<p>though, the typical <em>text</em> file contains <em>variable length</em> (usually lines of) data.</p>\n<p>Trying to directly replace a section of text with a <em>smaller</em> amount of data will lead to stale data remaining in the file (the <em>tail</em> of the previous data). Overwriting a section of text with a <em>larger</em> amount of data leads to data loss, when you overwrite the data that followed the original data.</p>\n<p>If you are truly replacing a fixed amount of text (e.g., uppercasing a section of ASCII), then this is not too much different from dealing with binary data, except you may (will) run into problems on certain platforms that perform text mode translations (e.g., <a href="https://learn.microsoft.com/en-us/cpp/c-runtime-library/file-translation-constants?view=msvc-170" rel="nofollow noreferrer">Windows</a>, when [over]writing a newline (LF)).</p>\n<p>Your approach of appending data to a temporary file, and then renaming the file is incredibly common, and is good practice as it leaves a paper trail that is easier to follow when things go wrong, and generally offers more control over the process.</p>\n<p>If we presume <code>file:read</code> and <code>file:write</code> (ultimately <a href="https://en.cppreference.com/w/c/io/fread" rel="nofollow noreferrer"><code>fread</code></a> and <a href="https://en.cppreference.com/w/c/io/fwrite" rel="nofollow noreferrer"><code>fwrite</code></a>) to be O(n), then everything mentioned is O(n).</p>\n"^^ . "<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>local Players,part,tab=game:GetService"Players",script.Parent,{}\nlocal function onPlayerAdded(player)\n table.insert(tab,player.Name)\n table.insert(tab,{})\nend;Players.PlayerAdded:Connect(onPlayerAdded)\nfor _,v in ipairs(Players:GetPlayers())do onPlayerAdded(v)end\npart.Touched:Connect(function(part)\n local player=Players:GetPlayerFromCharacter(part.Parent)\n if player then\n local tab=tab[table.find(tab,player.Name)+1]\n local v=table.find(tab,part)\n table.insert(tab,part)\n player.PlayerGui["First Person"].Enabled=true\n end\nend)\npart.TouchEnded:Connect(function(part)\n local player=Players:GetPlayerFromCharacter(part.Parent)\n if player then\n local tab=tab[table.find(tab,player.Name)+1]\n table.remove(tab,table.find(tab,part))\n wait(.1)\n if #tab==0 then\n player.PlayerGui["First Person"].Enabled=false\n end\n end\nend)\nPlayers.PlayerRemoving:Connect(function(player)\n local i=table.find(tab,player.Name)\n table.remove(tab,i)\n table.remove(tab,i)\nend)</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . . "This sounds nice, is there a way to pack only, say all outputs except the first one ? Like in python, `output_1, *other_outputs = my_function` ?"^^ . . . "0"^^ . "1"^^ . "0"^^ . . "1"^^ . . "0"^^ . "thank u for the feedback but i cant understand it much ;w;\nlike how did i compare workspace from plr.character haha im reallyyyyy sorryyy i dont seem to understand"^^ . . "1"^^ . . "<p>i am a newby in lua and installed the version <code>5.4.2</code> und luarocks in the version <code>3.9.2</code> in windows.\nI added the two tools into the <code>$PATH</code> by system variables.</p>\n<p>But i tried to install a library with luarocks and got this error:</p>\n<pre><code>luarocks install lua-cjson\nWarning: Lua 5.4 interpreter not found at C:\\Program Files\\luarock\n\nModules may not install with the correct configurations. You may want to configure the path prefix to your build of Lua 5.4 using\n\n luarocks config --local lua_dir &lt;your-lua-prefix&gt;\n\nInstalling https://luarocks.org/lua-cjson-2.1.0.10-1.src.rock\n\nError: Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.\n</code></pre>\n<p>i tried this with another error:</p>\n<pre><code>luarocks config lua_dir &quot;C:\\Program Files\\lua-5.4.2&quot;\nWrote\n lua_interpreter = &quot;lua.exe&quot;\n variables.LUA_BINDIR = &quot;C:\\\\Program Files\\\\lua-5.4.2&quot;\n variables.LUA_DIR = &quot;C:\\\\Program Files\\\\lua-5.4.2&quot;\n variables.LUA_LIBDIR = &quot;C:\\\\Program Files\\\\lua-5.4.2&quot;\nto\n C:/Users/me/AppData/Roaming/luarocks/config-5.4.lua\n\n\nC:\\Users\\me&gt;luarocks install lua-cjson\nInstalling https://luarocks.org/lua-cjson-2.1.0.10-1.src.rock\n\nError: Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.\n\nC:\\Users\\me&gt;luarocks config --local lua_dir C:\\Program Files\\lua-5.4.2\n\nC:\\Users\\me&gt;luarocks config LUA_INCDIR &quot;C:\\Program Files\\lua-5.4.2&quot;\nWrote\n LUA_INCDIR = &quot;C:\\\\Program Files\\\\lua-5.4.2&quot;\nto\n C:/Users/me/AppData/Roaming/luarocks/config-5.4.lua\n\nC:\\Users\\me&gt;luarocks install lua-cjson\nInstalling https://luarocks.org/lua-cjson-2.1.0.10-1.src.rock\n\nError: Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.\n</code></pre>\n<p>luarocks return:</p>\n<pre><code>C:\\Users\\me&gt;luarocks\n...\nVariables:\n Variables from the &quot;variables&quot; table of the configuration file can be\n overridden with VAR=VALUE assignments.\n\nConfiguration:\n Lua:\n Version : 5.4\n Interpreter: C:\\Program Files\\lua-5.4.2/lua.exe (ok)\n LUA_DIR : C:\\Program Files\\lua-5.4.2 (ok)\n LUA_BINDIR : C:\\Program Files\\lua-5.4.2 (ok)\n LUA_INCDIR : C:\\Program Files\\lua-5.4.2 (not found)\n ****************************************\n Use the command\n\n luarocks config variables.LUA_INCDIR &lt;dir&gt;\n\n to fix the location\n ****************************************\n LUA_LIBDIR : C:\\Program Files\\lua-5.4.2 (ok)\n\n Configuration files:\n System : C:/Program Files/luarocks/config-5.4.lua (ok)\n User : C:/Users/xemleue/AppData/Roaming/luarocks/config-5.4.lua (ok)\n\n Rocks trees in use:\n C:\\Users\\me\\AppData\\Roaming/luarocks (&quot;user&quot;)\n</code></pre>\n<p>i tried <code>luarocks config variables.LUA_INCDIR &quot;C:\\Program Files\\lua-5.4.2&quot;</code> but same problem.</p>\n"^^ . . . . "0"^^ . . "0"^^ . . "<p>I'm trying to configuring my lua <em>LSP</em>, but it's keep giving me <code>&quot;Client 1 quit with exit code 1 and signal 0&quot;</code> warning and it (the LSP) won't run. I don't know why it happen. It keeps printing that warning message every time I open a lua file.</p>\n<hr />\n<h2>Neovim (Windows 10)</h2>\n<pre><code>NVIM v0.9.2\nBuild type: RelWithDebInfo\nLuaJIT 2.1.1694082368\nCompilation: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe /MD /Zi /O2 /Ob1 -W3 -wd4311 -wd4146 -DUNIT_TESTING -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0602 -DMSWIN -DINCLUDE_GENERATED_DECLARATIONS -ID:/a/neovim/neovim/.deps/usr/include/luajit-2.1 -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/build/src/nvim/auto -ID:/a/neovim/neovim/build/include -ID:/a/neovim/neovim/build/cmake.config -ID:/a/neovim/neovim/src -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include\n\n system vimrc file: &quot;$VIM\\sysinit.vim&quot;\n fall-back for $VIM: &quot;C:/Program Files (x86)/nvim/share/nvim&quot;\n\nRun :checkhealth for more info\n</code></pre>\n<hr />\n<h2>Code</h2>\n<pre><code>vim.lsp.set_log_level &quot;debug&quot;\n\nlocal ready, lspconfig = pcall(require, &quot;lspconfig&quot;)\nif not ready then\n print &quot;ERROR: C:/User/Alpha/AppData/Local/nvim/plugin/lspconfig rc.lua: Failed to load nvim-lspconfig&quot;\n return\nend\n\nlocal protocol = require &quot;vim.lsp.protocol&quot;\n\nlocal augroup_format = vim.api.nvim_create_augroup(&quot;Format&quot;, { clear = true })\nlocal enable_format_on_save = function(_, bufnr)\n vim.api.nvim_clear_autocmds { group = augroup_format, buffer = bufnr }\n\n vim.api.nvim_create_autocmd(&quot;BufWritePre&quot;, {\n group = augroup_format,\n buffer = bufnr,\n callback = function()\n vim.lsp.buf.format { bufnr = bufnr }\n end\n })\nend\n\nlocal on_attach = function(client, bufnr)\n local function buf_set_keymap(...)\n vim.api.nvim_buf_set_keymap(bufnr, ...)\n end\n\n local opts = { noremap = true, silent = true }\n\n buf_set_keymap(&quot;n&quot;, &quot;gd&quot;, &quot;&lt;Cmd&gt;lua vim.lsp.buf.declaration()&lt;CR&gt;&quot;, opts)\n buf_set_keymap(&quot;n&quot;, &quot;gi&quot;, &quot;&lt;Cmd&gt;lua vim.lsp.buf.implementation()&lt;CR&gt;&quot;, opts)\n buf_set_keymap(&quot;n&quot;, &quot;K&quot;, &quot;&lt;Cmd&gt;lua vim.lsp.buf.hover()&lt;CR&gt;&quot;, opts)\nend\n\n-- local capabilities = require &quot;cmp_lspconfig .default_capabilities()\n\nlspconfig.clangd.setup {\n on_attach = function(client, bufnr)\n client.server_capabilities.signatureHelpProvider = false\n on_attach(client, bufnr)\n end,\n\n -- capabilities = capabilities\n}\n\nlspconfig.lua_ls.setup {\n on_attach = function(client, bufnr)\n on_attach(client, bufnr)\n enable_format_on_save(client, bufnr)\n end,\n\n -- capabilities = capabilities\n\n settings = {\n Lua = {\n diagnostics = {\n globals = { &quot;vim&quot; },\n },\n\n workspace = {\n library = vim.api.nvim_get_runtime_file(&quot;&quot;, true),\n checkThirdParty = false\n }\n }\n }\n}\n\nvim.lsp.handlers[&quot;textDocument/publishDiagnostics&quot;] = vim.lsp.with(\n vim.lsp.diagnostic.on_publish_diagnostics, {\n underline = true,\n update_in_insert = false,\n virtual_text = { spacing = 4, prefix = &quot;\\u{ea71}&quot; },\n severity_sort = true\n }\n)\n\nlocal signs = { Error = &quot; &quot;, Warn = &quot; &quot;, Hint = &quot; &quot;, Info = &quot; &quot; }\nfor type, icon in pairs(signs) do\n local hl = &quot;DiagnosticSign&quot; .. type\n vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = &quot;&quot; })\nend\n\nvim.diagnostic.config {\n virtual_text = {\n prefix = &quot;●&quot;\n },\n\n update_in_insert = true,\n\n float = {\n source = &quot;always&quot;\n }\n}\n</code></pre>\n<hr />\n<h2>Result</h2>\n<pre><code>Client 1 quit with exit code 1 and signal 0\n</code></pre>\n<p>My <a href="https://i.sstatic.net/X8FAf.png" rel="nofollow noreferrer">:LspInfo</a> result.</p>\n<hr />\n<h2>Expectation</h2>\n<p>That warning message dissapear and the LSP work.</p>\n"^^ . "it was written. Then I edited it just to repeat the same concept with other words. However nevermind. Your help was useful to find the way to develop the solution I needed and I posted. Thank you :-)"^^ . "webserver"^^ . . "0"^^ . . "libreoffice-calc"^^ . . . . . . . "vim-fzf"^^ . "There's no `return` nor any arguments (what's `equation`?). Also, `not var == check` is parsed as `(not var) == check`, which cannot be true since `check` is a string whereas `not var` is a boolean; do you mean `var ~= check`?"^^ . . . "0"^^ . . . . . . . . . "0"^^ . . . "0"^^ . "0"^^ . . . . . "redis"^^ . . "<p>I'm fairly new to Roblox studio and am in the process of making a PC building game. I'm currently trying to make it so when a player steps on a &quot;BuyBlock&quot; they get an attribute added for that part. Using this code:</p>\n<pre><code>local list = game.Workspace.Store.GPU.BuyBlocks:GetDescendants()\n\nwhile true do\n for index=1, #list do\n if list[index] then\n \n list[index].Touched:Connect(function()\n Touched(list[index])\n \n end)\n end\n end\n wait(1)\nend\n</code></pre>\n<p>Essentially, the code iterates through each &quot;BuyBlock&quot; until one is touched and then calls a function to change the players attribute to that part. This part worked as a normal script in the workspace however i realised it would need to be a LocalScript to change the players attribute and so i did, adding the rest of the code and moving to StarterPlayerScripts:</p>\n<pre><code>\nlocal player = game.Players.LocalPlayer\n\nlocal function Touched(part) -- called whenever one of the parts are touched\n\n player:SetAttribute(&quot;GPU&quot;, part)\nend\n</code></pre>\n<p>Im assuming LocalScripts can't search through the workspace however i can't think of how to split the two pieces of code into Local and non-Local scripts. Any suggestions or explanations would be greatly appreciated.</p>\n"^^ . . . . . "I know it's possible to achieve this by editing the Apache .htaccess file, but it would be interesting to understand why it's not working in Quarto.\n\nThe URLs are the ones that appear in the menu of a Quarto book.\n\nI tested what you suggested... I replaced 'result' with a manual value, but it still didn't work. I also created a new Quarto book with just the default settings from "quarto create project" and then added the extension, but it still didn't work."^^ . . . . "1"^^ . . "0"^^ . "0"^^ . . . . . "Unable to find parts in workspace with localscript"^^ . . . . . "1"^^ . . . . . "<p>Is it possible to add TTL for AtomicLong in Apache Ignite or for any atomic objects?</p>\n<p>Just for my pet project I created Rate Limiting service in Lua Nginx + Apache Ignite and store RL keys in AtomicLong. But I need TTL or any possible eviction configuration for my AtomicLong counter.</p>\n"^^ . "2"^^ . "<p>I am trying to create a very rudimentary system for storing player stats and want to create a table where I can enter a parameter for the table's variable name. I am very new to lua and am unsure about if it's possible.</p>\n<p>I made a basic outline that I wanted to expand upon but made this for testing purposes</p>\n<pre><code>local function Info(playerInfo,health,energy,speed,attack,physicalDefense,magicalDefense)\n playerInfo = {\n health = health,\n energy = energy,\n speed = speed,\n attack = attack,\n physicalDefense = physicalDefense, \n magicalDefense = magicalDefense, \n }\n return playerInfo\nend\nInfo(playerName,[rest of the stats])\n</code></pre>\n<p>Is there a way to make it so that if i used the argument &quot;playerName&quot; for playerInfo the table is given the identifier &quot;playerName&quot; so I can make unique tables for different characters? I want to be able to reference the info within the table such as playerName.health for example but another character may have characterName.health. Essentially, I'm looking for a way to optimize how much I need to type for each character.</p>\n"^^ . . . . "1"^^ . . . . "<p>It probably works when you do not move the <code>.love</code> file because it still has access to the original files from the working directory.</p>\n<p>Lua can not read content in zip files out of the box, but Love2d offers <a href="https://love2d.org/wiki/love.filesystem" rel="nofollow noreferrer">love.filesystem</a>.</p>\n<p>It also has file wrappers, but if you just want to read the content prefer <a href="https://love2d.org/wiki/love.filesystem.read" rel="nofollow noreferrer"><code>read</code></a>:</p>\n<pre><code>local content = love.filesystem.read(self.filename)\n</code></pre>\n<p>Note that you can only read files in the love zip, in the working directory and in the save directory.</p>\n"^^ . "You don't need the trailing `$`, `.+` will greedily match everything until the end anyways. Note that the crucial part here is the `^` anchor, which forces pattern matching to start at the beginning of the string (rather than anywhere in the string)."^^ . . . "<p>It looks like that I've solved it:</p>\n<p>Lua code to make parabola rasterization, the output is a list of integers as {x1, y1, x2, y2 ...}</p>\n<pre><code>function getParabolaPoints (a, xMax)\n local x, y = 0, 0\n local points = {x, y}\n while x &lt; xMax do\n local dx, dy = 0, 0\n if ((y+1)/a)^0.5 - x - 0.5 &gt; 0 then dx = 1 end\n if a*(x+1)^2 - y - 0.5 &gt;= 0 then dy = 1 end\n x = x + dx\n y = y + dy\n table.insert (points, x)\n table.insert (points, y)\n end\n return points\nend\n</code></pre>\n"^^ . . "I am trying to utilize `prettier` for formatting certain types of files, but my `formatter.lua` setup does not seem to work, what could be the issue?"^^ . . . . . "2"^^ . "Table value returns nil when it should not be"^^ . . "Why LSP keep giving "Client 1 quit with exit code 1 and signal 0" error (lua_ls)?"^^ . . "<p>I am developing an experimental NeoVim plugin <a href="https://github.com/KaiWalter/azure-functions.nvim" rel="nofollow noreferrer">https://github.com/KaiWalter/azure-functions.nvim</a> and want to load the local source code on the development system and load it remotely from repository on other machines.</p>\n<p>How can I achieve this?</p>\n"^^ . . . . . "0"^^ . . . . . . "0"^^ . "<p>I get an error stating:</p>\n<pre class="lang-none prettyprint-override"><code>[string &quot;LuaVM&quot;]:163: bad argument #3 to 'OutputLogMessage' (number expected, got nil) Line Number:1\nLOADED\n[string &quot;LuaVM&quot;]:163: bad argument #3 to 'OutputLogMessage' (number expected, got nil) Line Number:1\n</code></pre>\n<p>What does the error mean and what do I need to fix?</p>\n<pre class="lang-lua prettyprint-override"><code>function mode_change(event, arg)\n ---one_ NO RECOIL\n if (event == &quot;G_PRESSED&quot; and arg == 1) then\n one_ = not one_\n two_ = false\n three_ = false\n four_ = false\n five_ = false\n six_ = false\n seven_ = false\n eight_ = false\n nine_ = false\n ten_ = false\n eleven_ = false\n twelve_ = false\n elseif (event == &quot;G_PRESSED&quot; and arg == 2) then\n two_ = not two_\n one_ = false\n three_ = false\n four_ = false\n five_ = false\n six_ = false\n seven_ = false\n eight_ = false\n nine_ = false\n ten_ = false\n eleven_ = false\n twelve_ = false\n elseif (event == &quot;G_PRESSED&quot; and arg == 3) then\n three_ = not three_\n one_ = false\n two_ = false\n four_ = false\n five_ = false\n six_ = false\n seven_ = false\n eight_ = false\n nine_ = false\n ten_ = false\n eleven_ = false\n twelve_ = false\n elseif (event == &quot;G_PRESSED&quot; and arg == 4) then\n four_ = not four_\n one_ = false\n two_ = false\n three_ = false\n five_ = false\n six_ = false\n seven_ = false\n eight_ = false\n nine_ = false\n ten_ = false\n eleven_ = false\n twelve_ = false\n elseif (event == &quot;G_PRESSED&quot; and arg == 5) then\n five_ = not five_\n one_ = false\n two_ = false\n three_ = false\n four_ = false\n six_ = false\n seven_ = false\n eight_ = false\n nine_ = false\n ten_ = false\n eleven_ = false\n twelve_ = false\n elseif (event == &quot;G_PRESSED&quot; and arg == 6) then\n six_ = not six_\n one_ = false\n two_ = false\n three_ = false\n four_ = false\n five_ = false\n seven_ = false\n eight_ = false\n nine_ = false\n ten_ = false\n eleven_ = false\n twelve_ = false\n elseif (event == &quot;G_PRESSED&quot; and arg == 7) then\n seven_ = not seven_\n one_ = false\n two_ = false\n three_ = false\n four_ = false\n five_ = false\n six_ = false\n eight_ = false\n nine_ = false\n ten_ = false\n eleven_ = false\n twelve_ = false\n elseif (event == &quot;G_PRESSED&quot; and arg == 8) then\n eight_ = not eight_\n one_ = false\n two_ = false\n three_ = false\n four_ = false\n five_ = false\n six_ = false\n seven_ = false\n nine_ = false\n ten_ = false\n eleven_ = false\n twelve_ = false\n elseif (event == &quot;G_PRESSED&quot; and arg == 9) then\n nine_ = not nine_\n one_ = false\n two_ = false\n three_ = false\n four_ = false\n five_ = false\n six_ = false\n seven_ = false\n eight_ = false\n ten_ = false\n eleven_ = false\n twelve_ = false\n elseif (event == &quot;G_PRESSED&quot; and arg == 10) then\n ten_ = not ten_\n one_ = false\n two_ = false\n three_ = false\n four_ = false\n five_ = false\n six_ = false\n seven_ = false\n eight_ = false\n nine_ = false\n eleven_ = false\n twelve_ = false\n elseif (event == &quot;G_PRESSED&quot; and arg == 11) then\n eleven_ = not eleven_\n one_ = false\n two_ = false\n three_ = false\n four_ = false\n five_ = false\n six_ = false\n seven_ = false\n eight_ = false\n nine_ = false\n ten_ = false\n twelve_ = false\n elseif (event == &quot;G_PRESSED&quot; and arg == 12) then\n twelve_ = not twelve_\n one_ = false\n two_ = false\n three_ = false\n four_ = false\n five_ = false\n six_ = false\n seven_ = false\n eight_ = false\n nine_ = false\n ten_ = false\n eleven_ = false\n end\nend\n \nfunction OnEvent(event, arg)\n OutputLogMessage(&quot;event = %s, arg = %d\\n&quot;, event, arg)\n if (event == &quot;PROFILE_ACTIVATED&quot;) then\n EnablePrimaryMouseButtonEvents(true)\n elseif event == &quot;PROFILE_DEACTIVATED&quot; then\n ReleaseMouseButton(2)\n \n end\n mode_change(event, arg)\n ---For Setting F1~F12 Key\n ---NO RECOIL SETTINGS (You can edit Sleep time and X,Y of NO RECOIL)\n \n ---one_ SETTINGS\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and one_ and IsMouseButtonPressed(3) then\n if one_ then\n repeat\n MoveMouseRelative(0, 8)\n Sleep(10)\n until not IsMouseButtonPressed(1)\n end\n \n ---two_ SETTINGS\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and two_ and IsMouseButtonPressed(3) then\n if two_ then\n repeat\n MoveMouseRelative(0, 5)\n Sleep(10)\n until not IsMouseButtonPressed(1)\n end\n \n ---three_ SETTINGS\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and three_ and IsMouseButtonPressed(3) then\n if three_ then\n repeat\n MoveMouseRelative(0, 7)\n Sleep(9)\n until not IsMouseButtonPressed(1)\n end\n \n ---four_ SETTINGS\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and four_ and IsMouseButtonPressed(3) then\n if four_ then\n repeat\n MoveMouseRelative(0, 5)\n Sleep(8)\n until not IsMouseButtonPressed(1)\n end\n \n ---five_ SETTINGS\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and five_ and IsMouseButtonPressed(3) then\n if five_ then\n repeat\n MoveMouseRelative(1, 10)\n Sleep(7)\n MoveMouseRelative(-1, 1)\n Sleep(8)\n until not IsMouseButtonPressed(1)\n end\n \n ---six_ SETTINGS\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and six_ and IsMouseButtonPressed(3) then\n if six_ then\n repeat\n MoveMouseRelative(1, 10)\n Sleep(9)\n MoveMouseRelative(-1, 1)\n Sleep(8)\n until not IsMouseButtonPressed(1)\n end\n \n ---seven_ SETTINGS\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and seven_ and IsMouseButtonPressed(3) then\n if seven_ then\n repeat\n MoveMouseRelative(1, 10)\n Sleep(10)\n MoveMouseRelative(-1, 0)\n Sleep(8)\n until not IsMouseButtonPressed(1)\n end\n \n ---eight_ SETTINGS\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and eight_ and IsMouseButtonPressed(3) then\n if eight_ then\n repeat\n MoveMouseRelative(0, 6)\n Sleep(15)\n until not IsMouseButtonPressed(1)\n end\n \n ---nine_ SETTINGS\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and nine_ and IsMouseButtonPressed(3) then\n if nine_ then\n repeat\n PressKey(&quot;P&quot;)\n MoveMouseRelative(0,9)\n Sleep(30)\n ReleaseKey(&quot;P&quot;) \n Sleep(50)\n until not IsMouseButtonPressed(1)\n end\n \n ---ten_ SETTINGS\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and ten_ and IsMouseButtonPressed(3) then\n if ten_ then\n repeat\n MoveMouseRelative(0, 6)\n Sleep(9)\n until not IsMouseButtonPressed(1)\n end\n \n ---eleven_ SETTINGS\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and eleven_ and IsMouseButtonPressed(3) then\n if eleven_ then\n repeat\n MoveMouseRelative(0, 6)\n Sleep(11)\n until not IsMouseButtonPressed(1)\n end\n \n ---twelve_ SETTINGS\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and twelve_ and IsMouseButtonPressed(3) then\n return\n end\nend\n</code></pre>\n"^^ . . "rotation"^^ . . . "1"^^ . . . "latex"^^ . . . . "@MonsieurMerso after reinstalling it, it's working now. Thank you for helping me!"^^ . . . . . . "0"^^ . "Replace `i = i + .1` with `i = math.floor((i + .1) * 10 + 0.5) / 10`"^^ . "0"^^ . . . "Compiling source into bytecode is different from applying some character encoding. But the result is similar: you see gibberish instead of readable text :-)"^^ . "-1"^^ . "0"^^ . . . . . . . "Removing a sheet from a LibreOfficeCalc document"^^ . . . . . . . "0"^^ . . . . "1"^^ . "0"^^ . . . . . . . . . . . "0"^^ . "<p>The simplest and most efficient solution that I found for this use case is <a href="https://nginx-extras.getpagespeed.com/" rel="nofollow noreferrer">nginx-extras</a> which comes with already added extra nginx modules and it have echo module as well, which I was looking.\nYou can find more available modules of your need by clicking the link.</p>\n"^^ . . . . . "<p>Try to reinstall the lsp language. It works for me on WSL2 on windows.</p>\n"^^ . . . . . "thank youuu soo muchh, i understand it now ^v^\nbro, have a nice day"^^ . . . "-1"^^ . "fivem"^^ . "0"^^ . . "0"^^ . . . "<p>I found the way, based also on the suggestion I got, but this is what I need:</p>\n<pre><code>local template = &quot;The title of this song is $title. $title was composed by $author in $date, when he have created the $project&quot;\n\nfor wildcard in string.gmatch(template,&quot;%$(%w+)&quot;) do\nwildcard_ = '$'..wildcard\nval = API(wildcard_) -- or also API('$'..wildcard_)\n...\n...\n...\nend\n</code></pre>\n"^^ . . . . . "0"^^ . "0"^^ . . . . . "`come at the runtime cost of allocating an empty table if t is falsey` - You can use pre-allocated single table instead of all `{}`"^^ . "0"^^ . "1"^^ . . "0"^^ . . . "dictionary"^^ . . "<p>I hadn't realized that it was necessary to install fzf.vim as well.</p>\n"^^ . "0"^^ . "0"^^ . . . . . . . "<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>spawn(function()\nwhile true do\n if state then\n spinning.CFrame = spinning.CFrame * CFrame.fromEulerAnglesXYZ(255, 0, 0)\n end\n wait(0.03)\nend\nend)</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . . . "0"^^ . . . . . . "0"^^ . . . "0"^^ . "<p>I'm trying to integrate Lua into my program via LuaJIT.</p>\n<p>Here's the requirement: scripts are obligated to define specific functions (such as <code>on_update()</code>, etc.), and these will be invoked from the C++ side. A single script can be loaded multiple times, but each instance should operate independently of the others.</p>\n<p>I've considered several approaches to achieve this:</p>\n<ol>\n<li><strong>Using separate <code>lua_State*</code> instances for each script.</strong>\n<ul>\n<li><strong>Pros:</strong> Easily isolates each script.</li>\n<li><strong>Cons:</strong> Seems to introduce unnecessary overhead.</li>\n</ul>\n</li>\n<li><strong>Isolating scripts with <code>lua_setfenv</code>:</strong></li>\n</ol>\n<pre class="lang-cpp prettyprint-override"><code>lua_newtable(L);\nint env = lua_gettop(L);\nluaL_loadfile(L, &quot;my_script.lua&quot;);\nlua_pushvalue(L, env);\nlua_setfenv(L, -2);\nlua_call(L, 0, LUA_MULTRET);\n\nint ref = luaL_ref(L, LUA_REGISTRYINDEX);\n</code></pre>\n<p>I believe this approach provides proper isolation for the scripts.</p>\n<ol start="3">\n<li><strong>Simply loading and referencing the script:</strong></li>\n</ol>\n<pre><code>luaL_dofile(L, &quot;script.lua&quot;);\nint ref = luaL_ref(L, LUA_REGISTRYINDEX);\n</code></pre>\n<ul>\n<li><strong>Cons:</strong> The major downside is the potential for global variables to introduce elusive bugs, particularly when scripts are authored by multiple contributors.</li>\n</ul>\n<p>I've been unable to find detailed information or best practices for this. Can anyone provide insights or recommend the best approach?</p>\n"^^ . "<p>Can I know the script that repeats mouse clicks in a specific location?</p>\n<p>MoveMouseTo(62487,39895)\nPressMouseButton(1)\nsleep(1)</p>\n<p>I am a beginner. Results value created by searching, but an error occurs.</p>\n<p>MoveMouseTo(62487,39895)\nPressMouseButton(1)\nsleep(1)</p>\n"^^ . . "0"^^ . . "1"^^ . "lua-patterns"^^ . . . . . . "<p>Wrote this in Lua for my Logitech mouse. It's an autoclicker script that should autoclick with intervals between clicks following a normal distribution while holding the back button.</p>\n<pre><code>local currentTime = GetRunningTime()\nmath.randomseed(currentTime)\n\nfunction gaussianRandom(mean, stddev)\n local u1 = math.random()\n local u2 = math.random()\n\n local z0 = math.sqrt(-2.0 * math.log(u1)) * math.cos(2.0 * math.pi * u2)\n\n return mean + z0 * stddev\nend\n\nfunction OnEvent(event, arg)\n while IsMouseButtonPressed(4) do\n PressAndReleaseMouseButton(1)\n Sleep(gaussianRandom(800, 200))\n end\nend\n</code></pre>\n<p>However it only clicks once. If I instead use this code:</p>\n<pre><code>min = 500\nmax = 1000\n\nlocal currentTime = GetRunningTime()\nmath.randomseed(currentTime)\n\nfunction OnEvent(event, arg)\n while IsMouseButtonPressed(4) do\n PressAndReleaseMouseButton(1)\n Sleep(math.random(min,max))\n end\nend\n</code></pre>\n<p>It autoclicks continuously while holding down the back button. I'm just confused as to why the normal distribution code doesn't work the same way.</p>\n"^^ . . "Azerothcore lua script doesnt work or load"^^ . . "3"^^ . "github-actions"^^ . "0"^^ . . "The part keeps rotating even when l press space bar"^^ . "I'm trying to make a script that will make a part fade out. Please tell me what's wrong here?"^^ . "0"^^ . . "`During the "PROFILE_ACTIVATED" and "PROFILE_DEACTIVATED", OnEvent is passed a nil value as its second argument` - On my PC, zero is passed as `arg`."^^ . . . "0"^^ . . "<p>I have a function in Lua that gives a variable number of outputs. How can I get all its outputs, regardless of how many outputs it has?</p>\n<pre class="lang-lua prettyprint-override"><code>function my_function()\n -- whatever\nend\n\noutputs_list = my_function()\n</code></pre>\n<p>The above example doesn't work because <code>outputs_list</code> gets only the first output of the function, and all the others are discarded.\nI want <code>outputs_list</code> to contain all the outputs of the function so I can retrieve them later.</p>\n<p>I think this is equivalent in python to doing <code>*outputs_list = my_function()</code></p>\n"^^ . "1"^^ . . . . . . . "0"^^ . . "1"^^ . . "9"^^ . . . . . . "0"^^ . "<p>Lua table syntax isn't JSON. As a Lua table, this would be</p>\n<pre class="lang-lua prettyprint-override"><code>tab = {key1 = 123, key2 = 43, key3 = 367, key4 = 2}\n</code></pre>\n<p>To find the key corresponding to the highest value, simply loop over the table:</p>\n<pre class="lang-lua prettyprint-override"><code>local max_key\nfor key, value in pairs(tab) do\n if max_key == nil or value &gt; tab[max_key] then\n max_key = key\n end\nend\n</code></pre>\n<p>This can be rewritten to be slightly more elegant using <code>next</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>local max_key = next(tab)\nfor key, value in next, tab, max_key do\n if value &gt; tab[max_key] then\n max_key = key\n end\nend\n</code></pre>\n<p>For performance, you might want to keep the corresponding max. value in a local variable:</p>\n<pre class="lang-lua prettyprint-override"><code>local max_key, max_value = next(tab)\nfor key, value in next, tab, max_key do\n if value &gt; max_value then\n max_key, max_value = key, value\n end\nend\n</code></pre>\n"^^ . "0"^^ . . "You should read a Lua tutorial about local variable's scope in Lua."^^ . . . "nodemcu"^^ . . . "character-encoding"^^ . "Yes, I was able to translate it. But I got the number 1. And I expected 143."^^ . . . . . . "0"^^ . . . . . "2"^^ . . "1"^^ . . . "0"^^ . "0"^^ . . "1"^^ . "debugging"^^ . . "4"^^ . "1"^^ . . "1"^^ . . . . . . "0"^^ . "0"^^ . . "0"^^ . "3"^^ . . . "0"^^ . "4"^^ . . "0"^^ . . . . "1"^^ . . . . . . . . "@ESkri it runs an Octave script which outputs the result as lines of text. When run from the a shell or the Octave prompt this text can be read properly, including the Unicode characters; when run from the Lua script these characters display as '???'. Actually, it is the same for several Octave scripts, not just one."^^ . . . "Can I know the script that repeats mouse clicks in a specific location?"^^ . "0"^^ . "Also, I have mainly been using a Dummy input that starts off with a nested input or a list of key-value pairs to remove any problems that may be occurring because of the additional workarounds. Essentially, I just would like to be able to transfer a full received list of key-value pairs at the same time to a remote syslog server, and this may include formatting the list into a string message or nested object instead with a Lua filter."^^ . "0"^^ . "0"^^ . . "0"^^ . "Yes, in general, the approach of directly writing to the target file is fragile; if you do multiple small writes, it's possible that only some of them get through, and if you do a single large write, a partial write is more likely."^^ . . "1"^^ . . . "1"^^ . . . . . . . . "1"^^ . "Write a function to shuffle a given list. Make sure that all permutations are equally probable"^^ . . . . "2"^^ . "How can I sunstract ONE value (z) from two vector3's between them?"^^ . . . "Can you load that image with something else than cairo? What does `file` identify the image it? Can you perhaps upload the image? A random guess is that this is some other kind of error that just gets coerced into "out of memory" somewhere."^^ . . . . . . . "<p>Im using Neovim with lua and iterm2 terminal and want to bind ctrl+j to 7j or ctrl+k 7k using neovim with lua and iterm2.</p>\n<p>I've tried the following but its not working.</p>\n<p><code>keymap.set(&quot;n&quot;, &quot;&lt;C-k&gt;&quot;, &quot;7k&quot;, {remap = true, silent = true})</code>\n<code>keymap.set(&quot;n&quot;, &quot;&lt;C-j&gt;&quot;, &quot;7j&quot;, {remap = true, silent = true})</code></p>\n<p>Using something like <code>keymap.set(&quot;n&quot;, &quot;&lt;C-a&gt;&quot;, &quot;7j&quot;, {remap = true, silent = true})</code> works, but its not wat I want.</p>\n<p>Feels like there are some other keybindings in the way blocking ctrl+k and ctrl+j.</p>\n"^^ . "@Oka - Perhaps I missed something, where is the C++ outside of the comments?"^^ . . . "2"^^ . "0"^^ . . "0"^^ . . . . "4"^^ . "<p>try to use <a href="https://github.com/folke/which-key.nvim" rel="nofollow noreferrer">which key</a> to figure out the keybindings</p>\n"^^ . . . "1"^^ . "1"^^ . . . . . . "amazon-s3"^^ . "2"^^ . . . "-1"^^ . "1"^^ . . . . . . . . . . . . . "0"^^ . . "0"^^ . . . "scripting"^^ . . . "<p>I have code where I create userdata (a circle) which gets passed to Lua that I also store as a pointer in C++ and put into a vector. After I call <code>lua_close(L)</code>, I try to delete the pointer, but this causes the program to crash. I also tried free, but that had the same result</p>\n<p>I then learned from <a href="https://stackoverflow.com/a/4332717/16076705">this post</a> that Lua will automatically free userdata and therefore I do not need to delete the pointer. Is this true?</p>\n<p>I am skeptical because after I close Lua using lua_close(), I can still access the circle, moving it, drawing it, etc.</p>\n<p>If I don't delete the pointer to the userdata will this cause a memory leak?</p>\n<p>I've tried deleting and freeing the pointer, doing it before I close Lua, but all just crashes</p>\n<p>Here's how I create the userdata</p>\n<pre class="lang-cpp prettyprint-override"><code>\nint wrap_createCircle(lua_State* luaState){\n\n float radius = lua_tonumber(luaState, 1);\n CircleShape* circle = (CircleShape*)lua_newuserdata(luaState, sizeof(CircleShape));\n new (circle) CircleShape(radius);\n luaL_getmetatable(luaState, &quot;CircleMetaTable&quot;);\n lua_setmetatable(luaState, -2);\n\n return 1;\n}\n</code></pre>\n"^^ . "0"^^ . . . "Are you asking "how do I pass a table as an argument when calling a Lua function from Go?""^^ . "2"^^ . . "4"^^ . "2"^^ . . . . "1"^^ . "0"^^ . . "module"^^ . "1"^^ . . . . . . . . "<p>Given a vararg <code>...</code> like <code>1, 2, 3, nil, 5</code>, I would like to write a function <code>reverse</code>, such that <code>reverse(...)</code> returns the vararg <code>5, nil, 3, 2, 1</code>.</p>\n"^^ . . "0"^^ . "0"^^ . "<p>i wrote a lua script to modify the response of my request. How it is possible to return de response of the lua script. I got the initial response of the request and not the modified response.</p>\n<pre><code>{\n&quot;$schema&quot;: &quot;https://www.krakend.io/schema/v3.json&quot;,\n&quot;version&quot;: 3,\n&quot;port&quot;: 9000,\n&quot;timeout&quot;: &quot;300000s&quot;,\n&quot;cache_ttl&quot;: &quot;4000s&quot;,\n&quot;extra_config&quot;: {\n&quot;router&quot;: {\n&quot;return_error_msg&quot;: true\n}\n},\n&quot;endpoints&quot;: [\n{\n&quot;@comment&quot;: &quot;Feature: GET apps by identification&quot;,\n&quot;endpoint&quot;: &quot;/apps/{id}&quot;,\n&quot;output_encoding&quot;: &quot;no-op&quot;,\n&quot;method&quot;: &quot;GET&quot;,\n&quot;backend&quot;: [\n{\n&quot;host&quot;: [\n&quot;http://xxx.yyy.zzz:8080&quot;\n],\n&quot;url_pattern&quot;: &quot;/apps/{id}&quot;,\n&quot;extra_config&quot;: {\n&quot;modifier/lua-backend&quot;: {\n&quot;sources&quot;: [\n&quot;/etc/krakend/json.lua&quot;,\n&quot;/etc/krakend/Hello.lua&quot;\n],\n&quot;post&quot;: &quot;local r = response.load(); modifyBody(r);&quot;,\n&quot;live&quot;: true,\n&quot;allow_open_libs&quot;: true\n}\n}\n}\n]\n},\n</code></pre>\n<p>My Hello.lua</p>\n<pre><code>function modifyBody(response)\nprint(response:body()) //return the body\nlocal json_parse = json_parse(response);\nprint(json_parse) //return the modified body\nprint(response:body(json_parse)) //return the modified body\nprint(response) //return userdata: 0xc000618b10\nreturn response:body(json_parse)\nend\n</code></pre>\n<p>i got a 200 from the container:</p>\n<pre><code>[00] 2023/10/18 09:18:21 KRAKEND INFO: [SERVICE: Gin] Listening on port: 9000\n[00] [GIN] 2023/10/18 - 09:18:27 | 200 | 312.644487ms | 172.20.0.1 | GET &quot;/apps/aaaaa&quot;\n</code></pre>\n<p>print(json_parse) the logs returns a correct formated json but the but the postman console is empty:</p>\n<pre><code>Could not get response\nError: aborted\n</code></pre>\n<p>i tried another combination:</p>\n<pre><code>&quot;output_encoding&quot;: &quot;json&quot;, //endpoint level\n&quot;encoding&quot;: &quot;no-op&quot;, //backend level -&gt; empty json {}\n</code></pre>\n<pre><code>&quot;output_encoding&quot;: &quot;json&quot;, //endpoint level\n&quot;encoding&quot;: &quot;json&quot;, //backend level -&gt;\n\n2023/10/19 15:06:33 KRAKEND ERROR: [ENDPOINT: /apps/:id] unexpected character '' at line 1 col 1\n[00] [GIN] 2023/10/19 - 15:06:33 | 500 | 578.746497ms | 172.20.0.1 | GET &quot;/ apps /11111&quot;\n</code></pre>\n<p><a href="https://i.sstatic.net/RZTci.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RZTci.png" alt="enter image description here" /></a></p>\n"^^ . . . . "cairo"^^ . . . . . . . . . "0"^^ . . . "0"^^ . "Thank you so much. But what if script failed to execute this "return newAmount" line of code?"^^ . . "datastore"^^ . "<p>What you're trying to do is to save the location of the FiveM Server.</p>\n<pre><code>-- This means that you want to get the ped of the current user.\n-- This only works in the FiveM client, not the server.\nlocal ped = GetPlayerPed(-1)\n</code></pre>\n<p>On the server side, you can get the player's location by passing the player's ID in the <code>GetPlayerPed(param1)</code> function (<a href="https://docs.fivem.net/natives/?_0x43A66C31C68491C0" rel="nofollow noreferrer">Fivem Docs</a>).</p>\n<p>When registering a command (as you did), you'll get the player's ID as the first parameter (0 is the server, and when the ID is &gt; 0, it's a player).</p>\n<p>Try this instead:</p>\n<pre><code>-- Save player's location to the database\nRegisterCommand('savelocation', function(source, args, rawCommand)\n local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(source)))\n local playerId = GetPlayerIdentifier(source, 0)\n\n -- Check if x, y, or z are NaN (not a number) and replace them with 0\n if not x or not tonumber(x) then\n x = 0.0\n end\n if not y or not tonumber(y) then\n y = 0.0\n end\n if not z or not tonumber(z) then\n z = 0.0\n end\n local query = &quot;INSERT INTO player_locations (player_id, x, y, z) VALUES (@player_id, @x, @y, @z)&quot;\n local params = {\n ['@player_id'] = playerId,\n ['@x'] = x,\n ['@y'] = y,\n ['@z'] = z\n }\n exports.oxmysql:execute(query, params, function(affectedRows)\n if affectedRows &gt; 0 then\n TriggerClientEvent('chatMessage', source, '^2Location saved!')\n else\n TriggerClientEvent('chatMessage', source, '^1Error saving location!')\n end\n end)\nend, false)\n</code></pre>\n"^^ . "game-development"^^ . "<p>I'm working on a REST API client in Lua that consumes data from a third-party service. The service returns deeply nested JSON objects, and I need to map these to more simplified Lua tables for easier manipulation and data analysis. I've explored using libraries like <code>cjson</code> for basic deserialization, but I'm struggling with mapping the nested JSON to my custom data structures efficiently.</p>\n<p>Here's a simplified example of the JSON object returned by the API:</p>\n<pre class="lang-json prettyprint-override"><code>{\n &quot;data&quot;: {\n &quot;id&quot;: 1,\n &quot;attributes&quot;: {\n &quot;name&quot;: &quot;John&quot;,\n &quot;details&quot;: {\n &quot;age&quot;: 30,\n &quot;address&quot;: {\n &quot;street&quot;: &quot;123 Main St&quot;,\n &quot;city&quot;: &quot;Anytown&quot;\n }\n }\n }\n }\n}\n</code></pre>\n<p>And here's what I would like to map this to in Lua:</p>\n<pre class="lang-lua prettyprint-override"><code>Person = {\n id = 1,\n name = &quot;John&quot;,\n age = 30,\n street_address = &quot;123 Main St&quot;,\n city = &quot;Anytown&quot;\n}\n</code></pre>\n<p>Is there a best practice for this type of mapping? Are there any Lua libraries that can assist with this, or should I be writing custom mapping functions? I'm concerned about both code maintainability and performance.</p>\n<p>Thank you in advance for any insights or recommendations!</p>\n"^^ . . . "Try `path:match(".*/(.+)_config.json")`."^^ . . "geometry"^^ . . "2"^^ . . "0"^^ . . . "I want to complete the FiveM Lua syntax"^^ . . . . . . "0"^^ . . "0"^^ . . . . . . . "2"^^ . . . . "<p>I am new to lua script. I am working on dissecting a proprietary protocol. Inside the protocol bytes there are 8 bytes related to rtcp, like, rtcp version, padding, reception report count, packet type, length and ssrc. A total of 8 bytes. my question is, how to sub-dissect those bytes inside my proprietary protocol?</p>\n<p>Basically I need to use rtcp sub-dissector to present the below:</p>\n<pre><code>10.. .... = Version: RFC 1889 Version (2) \n..0. .... = Padding: False \n...0 0001 = Reception report count: 1 \nPacket type: Report (200) \nLength: 12 (52 bytes) \nSSRC: 0x107bb175 (276541813) \n</code></pre>\n<p>I am trying the below code:</p>\n<pre><code>my_proto = Proto(&quot;my_proto&quot;, &quot;My Protocol&quot;) \n\nmagic_number = ProtoField.uint32(&quot;my_proto.magic_number&quot;, &quot;Magic number&quot;, base.DEC) \nversion = ProtoField.uint16(&quot;my_proto.version&quot; , &quot;Version&quot; , base.DEC) \n\nmy_proto.fields = { magic_number, version ) \n\nfunction my_proto.dissector(buffer, pinfo, tree) \n length = buffer:reported_length_remaining() \n local offset = 0 \n if length &lt; 16 then return end \n\n local subtree = tree:add(my_proto, buffer:range(offset,length), &quot;My protocol (Report)&quot;) \n\n subtree:add(magic_number, buffer(offset,4)) \n offset = offset + 4 \n subtree:add(version, buffer(offset,2)) \n offset = offset + 2 \n -- Then I have 8 bytes related to rtcp protocol, i.e. version, padding, etc. \n Dissector.get(&quot;rtcp&quot;):call(buffer(offset, offset+8):tvb(), pinfo, subtree) \n</code></pre>\n<p>This line: <code>Dissector.get(&quot;rtcp&quot;):call(buffer(offset, offset+8):tvb(), pinfo, subtree)</code>\nis not working for me. I need it to be presented as below:</p>\n<pre><code>10.. .... = Version: RFC 1889 Version (2) \n..0. .... = Padding: False \n...0 0001 = Reception report count: 1 \nPacket type: Report (200) \nLength: 12 (52 bytes) \nSSRC: 0x107bb175 (276541813) \n</code></pre>\n<p>Any help please?</p>\n"^^ . "I need to create a part where the target I shot is at"^^ . . . . . . . . . . "And how could I do it?"^^ . . . "<p>Because you started inserting elements from 1. To insert elements into empty slots, you can use either <code>t[#t+1]</code> or <code>table.insert</code>.</p>\n<pre><code>--local count = 1\nfor word in v:gmatch((&quot;[^%s]+&quot;):format(&quot;#&quot;)) do\n tbl[#tbl+1] = { [&quot;aura&quot;] = word }\n --count = count + 1\nend\n</code></pre>\n<pre><code>--local count = 1\nfor word in v:gmatch((&quot;[^%s]+&quot;):format(&quot;#&quot;)) do\n table.insert(tbl, { [&quot;aura&quot;] = word })\n --count = count + 1\nend\n</code></pre>\n"^^ . "Create table as `local table_ = {["A"]=1,["B"]=1}` and your code will work."^^ . "Well in the 5.3 spec of `lua_yieldk` mentions that i can use this inside a hook, without a continuation function, (I don't want a continuation function anyways) https://www.lua.org/manual/5.3/manual.html#lua_yieldk, i will however adjust this to use lua_resume instead and see where i get from that"^^ . "lua"^^ . . "2"^^ . . . "0"^^ . "0"^^ . . . "1"^^ . "<p>You can return a predefined table if argument is ommited.<br />\nExample</p>\n<pre><code>-- pdtfunc.lua\nlocal function pdtfunc(pdt)\n local pdt = pdt and setmetatable(pdt, {__index = table}) or setmetatable({&quot;Exampe Value (Index Key 1)&quot;, [&quot;Example&quot;] = &quot;Example Value by named Key&quot;}, {__index = table})\n return(pdt)\nend\n\nreturn(pdtfunc)\n</code></pre>\n<p>The Constructor of the returned table has all table functions attached as methods.<br />\nExample of use (Lua 5.1 Standalone)</p>\n<pre><code>€ /bin/lua\nLua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio\n&gt; pdt = require(&quot;pdtfunc&quot;)\n&gt; print(pdt())\ntable: 0x565b2bf0\n&gt; print(pdt():concat()) -- Attached Method to get string or number values\nExampe Value (Index Key 1)\n&gt; print(pdt()[1])\nExampe Value (Index Key 1)\n&gt; print(pdt()[&quot;Example&quot;])\nExample Value by named Key\n&gt; print(pdt().Example)\nExample Value by named Key\n&gt; mytab = pdt()\n&gt; print(mytab:concat())\nExampe Value (Index Key 1)\n&gt; print(mytab.Example)\nExample Value by named Key\n&gt; mytab:insert(&quot;New Value with insert()&quot;)\n&gt; print(#mytab)\n2\n&gt; print(mytab:concat(&quot;\\n&quot;))\nExampe Value (Index Key 1)\nNew Value with insert()\n&gt; -- Now give a table as argument\n&gt; mytab = require(&quot;pdtfunc&quot;)({&quot;With a table as argument&quot;})\n&gt; print(mytab:concat())\nWith a table as argument\n</code></pre>\n"^^ . . . "0"^^ . "Also do you have emojis in your code on purpose? `if (btn(⬇️)) then`"^^ . "0"^^ . . . "How to get circumcircle midpoint and radius in Lua?"^^ . "curl"^^ . . . . . "Try passing only 8 bytes for the length instead of `offset+8`, e.g., `rtcp_dissector:call(buffer(offset, 8):tvb(), pinfo, subtree)`."^^ . . "0"^^ . "0"^^ . "1"^^ . . "0"^^ . . "1"^^ . . . "0"^^ . . "0"^^ . . . "websocket"^^ . "2"^^ . . . "0"^^ . . "1"^^ . . "2"^^ . . . . "1"^^ . . . "0"^^ . . . . "my function does not work and i cant find out why iv ben doing reserch for a few hours and havent ben able to corect whatever mistake iv made"^^ . "0"^^ . . . . "1"^^ . . "variadic-functions"^^ . . "0"^^ . "Thanks @tehtmi I understand the gaps now!"^^ . "3"^^ . "1"^^ . "This scirpt is broken: writes only the first value, the other three are empty (`nil`)"^^ . "0"^^ . "0"^^ . . "0"^^ . "2"^^ . . . . . . "<p>Just to give you one idea, here it is how I set my colors:</p>\n<pre><code>local colorscheme = &quot;tokyonight&quot;\n-- vim.notify(&quot;Selected colorscheme: &quot; .. colorscheme) -- Debugging message\n\n-- local colorscheme = &quot;tokyonight&quot;\nlocal status_ok, _ = pcall(vim.cmd, &quot;colorscheme &quot; .. colorscheme)\nif not status_ok then\n vim.notify(&quot;colorscheme &quot; .. colorscheme .. &quot; not found!&quot;)\n return\nend\n</code></pre>\n"^^ . . . "1"^^ . . . "1"^^ . . . "<p>I am creating a Roblox work game, and I am using Davey_Bones's Adonis Admin. There are two ways that I know of to rank someone with that admin system: you could use a command in the game or your could put their user into the script. However, both of those ways rank the players individually. What I want is to link my group to the Admin system, so that if a user is a certain rank in the group, then they can access the commands.</p>\n<p>I know how to script rank individuals, and I have tried putting in the script in the format Davey_Bones has provided. This does not work. Here is how I can rank people with the script:</p>\n<p>settings.Moderators(&quot;username&quot;, &quot;username2&quot;, &quot;username3&quot;)</p>\n<p>And here is how I have tried to link the group with that script:</p>\n<p>settings.Moderators(&quot;groupname:groupid:grouprank&quot;)</p>\n"^^ . "<p>It's like cashpersecond function isnt actually per second though im not really sure what could be causing this.</p>\n<p>Also each time I rob the increment increased by like a second which is so weird.</p>\n<p>Script below:</p>\n<pre class="lang-lua prettyprint-override"><code>local maxCash = 3000\nlocal cashPerSecond = 500\nlocal timeToRob = 300\nlocal robbing = false\nlocal cooldown = 30\nlocal closed = false\nlocal defaultVaultPosition = script.Parent.VaultDoor.Position\n\nlocal playersRobbing = {}\nlocal alreadyRobbed = {}\nlocal guis = {}\n\n\nfunction endRobbery()\n\n closed = true\n robbing = false\n\n wait(1)\n\n script.Parent.Door.CanCollide = true\n script.Parent.VaultDoor.Position = defaultVaultPosition\n\n\n for i, gui in pairs(guis) do\n gui:Destroy()\n end\n\n for p, x in pairs(playersRobbing) do\n p.Character.HumanoidRootPart.CFrame = script.Parent.FailedToRob.CFrame\n end\n\n\n playersRobbing = {}\n alreadyRobbed = {}\n\n script.Alarm:Stop()\n\n wait(cooldown)\n closed = false\n\n script.Parent.Door.CanCollide = false\nend\n\n\nfunction beginRobbery()\n\n for i = 1, timeToRob do\n\n wait(1)\n\n local region3 = Region3.new(script.Parent.VaultArea.Position - script.Parent.VaultArea.Size/2, script.Parent.VaultArea.Position + script.Parent.VaultArea.Size/2)\n local parts = workspace:FindPartsInRegion3(region3, script.Parent, math.huge)\n\n local playersGivenCashTo = {}\n\n for x, part in pairs(parts) do\n\n if playersRobbing[game.Players:GetPlayerFromCharacter(part.Parent)] and playersRobbing[game.Players:GetPlayerFromCharacter(part.Parent)] &lt; maxCash and not playersGivenCashTo[game.Players:GetPlayerFromCharacter(part.Parent)] then\n\n playersGivenCashTo[game.Players:GetPlayerFromCharacter(part.Parent)] = true\n \n playersRobbing[game.Players:GetPlayerFromCharacter(part.Parent)] += cashPerSecond\n\n if not game.Players:GetPlayerFromCharacter(part.Parent).PlayerGui:FindFirstChild(&quot;RobberyGui&quot;) then\n script.RobberyGui:Clone().Parent = game.Players:GetPlayerFromCharacter(part.Parent).PlayerGui\n game.Players:GetPlayerFromCharacter(part.Parent).PlayerGui.RobberyGui.StatsHUD.CashBagHUD.Cash.Amount.Text = &quot;$0&quot;\n table.insert(guis, game.Players:GetPlayerFromCharacter(part.Parent).PlayerGui.RobberyGui)\n game.Players:GetPlayerFromCharacter(part.Parent).PlayerGui.RobberyGui.StatsHUD.CashBagHUD.Cash.Visible = true\n game.Players:GetPlayerFromCharacter(part.Parent).PlayerGui.RobberyGui.StatsHUD.CashBagHUD.CashIcon.Visible = true\n end\n\n game.Players:GetPlayerFromCharacter(part.Parent).PlayerGui.RobberyGui.StatsHUD.CashBagHUD.Cash.Amount.Text= &quot;$&quot; .. playersRobbing[game.Players:GetPlayerFromCharacter(part.Parent)]\n end\n end\n end\n\n endRobbery()\nend\n\n\nlocal touchedCooldown = {}\n\nscript.Parent.Door.Touched:Connect(function(hit)\n if not closed and game.Players:GetPlayerFromCharacter(hit.Parent) and not touchedCooldown[game.Players:GetPlayerFromCharacter(hit.Parent)] and not playersRobbing[game.Players:GetPlayerFromCharacter(hit.Parent)] and not alreadyRobbed[game.Players:GetPlayerFromCharacter(hit.Parent)] then\n script.Alarm:Resume()\n touchedCooldown[game.Players:GetPlayerFromCharacter(hit.Parent)] = true\n playersRobbing[game.Players:GetPlayerFromCharacter(hit.Parent)] = 0\n spawn(function()\n wait(2)\n touchedCooldown[game.Players:GetPlayerFromCharacter(hit.Parent)] = nil\n end)\n if not robbing then\n beginRobbery()\n end\n robbing = true\n\n elseif not closed and game.Players:GetPlayerFromCharacter(hit.Parent) and not touchedCooldown[game.Players:GetPlayerFromCharacter(hit.Parent)] and playersRobbing[game.Players:GetPlayerFromCharacter(hit.Parent)] then\n -- Remove this section\n\n end\nend)\n\n-- Connect to the Trigger part instead of the Door part\ngame.Workspace.Doors.DoubleKeyDoorCriminal.Trigger.Touched:Connect(function(hit)\n \n if not closed and game.Players:GetPlayerFromCharacter(hit.Parent) and not touchedCooldown[game.Players:GetPlayerFromCharacter(hit.Parent)] and playersRobbing[game.Players:GetPlayerFromCharacter(hit.Parent)] then\n -- on hit collect money\n game.Players:GetPlayerFromCharacter(hit.Parent).leaderstats.Cash.Value += playersRobbing[game.Players:GetPlayerFromCharacter(hit.Parent)]\n playersRobbing[game.Players:GetPlayerFromCharacter(hit.Parent)] = nil\n alreadyRobbed[game.Players:GetPlayerFromCharacter(hit.Parent)] = true\n\n local stillRobbing = false\n for _, x in pairs(playersRobbing) do\n if x then stillRobbing = true end\n end\n\n if not stillRobbing then\n endRobbery()\n end\n end\nend)\n\n\n\nscript.Parent.OpenVault.Touched:Connect(function(hit)\n\n if game.Players:GetPlayerFromCharacter(hit.Parent) then\n\n wait(3)\n\n game:GetService(&quot;TweenService&quot;):Create(script.Parent.VaultDoor, TweenInfo.new(5), {Position = defaultVaultPosition + Vector3.new(0, script.Parent.Door.Size.Y, 0)}):Play()\n end\nend)\n</code></pre>\n<p>I've tried <code>playersRobbing[game.Players:GetPlayerFromCharacter(part.Parent)] += cashPerSecond + wait(1)</code> which sort of worked but it made the increment into weird decimal amounts while also passing the maximum amount. would be great if someone could explain this script more</p>\n"^^ . . . . . . . "0"^^ . . . "@Barmar - I seen that StackOverflow post. They use `-1` instead of `1`. Will `2` work as you suggested? Maybe there's more to the `-1`, I am not skilled in Lua."^^ . . . . "Try moving the `Dissector.get("rtcp")` call **outside** and above your `my_proto.dissector()` function, e..g, `local rtcp_dissector = Dissector.get("rtcp")`, then use the `rtcp_dissector` inside your dissector function if it's not `nil`. For an example, see: https://www.wireshark.org/docs/wsdg_html/#wslua_dissector_example"^^ . . "<p>For my Neovim setup I have a config folder under the <code>lua</code> folder that contains all of my plugin configs (lsp, tabline, telescope, etc.) as well as a print statement displaying what plugins were loaded successfully via the following which is invoked in <code>/zfg/init.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>local plugins = {\n 'pear',\n 'harpoon',\n 'lsp-zero',\n 'treesitter',\n 'undotree',\n 'colors',\n 'lualine',\n 'snip',\n 'tabline',\n 'telescope',\n 'tmux'\n}\n\nlocal imports = &quot;Loaded: &quot;\n\nfor i,plug in pairs(plugins) do\n _ = i\n if not pcall(require, 'zfg.config.'..plug) then\n print('Failed to load '..plug)\n else\n imports = imports..&quot; &quot;..plug\n end\nend\n\nprint(imports)\n</code></pre>\n<p>My directory structure is as follows:</p>\n<pre><code>nvim/\n| -- init.lua\n| - lua/zfg/\n| | - config/\n| | |-- pear.lua\n| | |-- colors.lua\n| | |-- harpoon.lua\n| | |-- lsp-zero.lua\n| | |-- lualine.lua\n| | |-- snip.lua\n| | |-- tabline.lua\n| | |-- telescope.lua\n| | |-- treesitter.lua\n| | |-- undotree.lua\n| |-- init.lua\n|-- init.lua\n</code></pre>\n<p>I can then check this message in <code>:mes</code> to verify that most all the <code>require</code> calls worked (or at least I think that's how that works) in addition to using the other plugins.</p>\n<p>The main issue is that other plugins will modify my buffer as expected: I can invoke snippets, the <code>pears.nvim</code> will expand on enter and use the pairs correctly, and most everything else will work as far as I've been able to tell. The issue appears to only be <code>lsp-zero</code> in that none of my setup seems to take (no bordered window boxes with suggestions, autocompletion, or mappings).</p>\n<p>I have added an additional source command to the <code>/nvim/zfg/init.lua</code> file in an attempt to force the file to be sourced but this also failed:</p>\n<pre class="lang-lua prettyprint-override"><code>local src = &quot;:so ~/.config/nvim/lua/zfg/config/lsp-zero.lua&quot;\n\nvim.api.nvim_command(src)\n</code></pre>\n<p>It will work correctly when I source <code>nvim/zfg/init.lua</code> manually after starting up neovim but it will not work on startup despite seeing the log messages making it look like the lsp-zero.lua file was loaded.</p>\n"^^ . "How to Efficiently Map Nested JSON to Custom Lua Data Structures in a REST API Client?"^^ . "2"^^ . . . . . . . . "2"^^ . "Again, I'm not super familiar with Roblox, but even with just this as the only script, it seems there could theoretically be self-interference from multiple instances of just this callback running concurrently (depending on where yielding can occur)."^^ . . "0"^^ . "Lua debugger, hooks, yield and resume"^^ . . . "Could you elaborate on PlayOnRemove ? how is it used? the situation in which it's used is the one I'm in actually."^^ . . . . . "1"^^ . . . . "<p>'I know that this tutorial is for Linux, but I followed another tutorial for windows with the same results.'</p>\n<p>I am pretty sure your Errors in require depends on wrong use of Slashes and Backslashes.<br />\nI mean it looks you use Scripts for a Linux Machine on Windows and that will fail.</p>\n<pre><code>...r1\\AppData\\Local\\nvim/lua/core/plugin_config/gruvbox.lua:1: '=' expected\n</code></pre>\n<p>The Windows Path without the filename ends: <code>...r1\\AppData\\Local\\</code><br />\n...and the filename will be interpreted with Slashes as: <code>&quot;nvim/lua/core/plugin_config/gruvbox.lua&quot;</code><br />\nSo try to correct/replace every occurance of a Slash in a Path with: <code>\\\\</code> (Escaped Backslash)<br />\nThat will be interpreted by Lua to a single Backslash.</p>\n<p>PS: The Dot (<code>.</code>) in require is OS Independend but harcoded Paths in the Script' that dont make a decision (&quot;Am i on Linux or Windows?&quot; - LuaJIT/<a href="http://luajit.org/ext_ffi_tutorial.html" rel="nofollow noreferrer">FFI</a>) will fail.</p>\n"^^ . . "Flattening nested lists in Lua"^^ . "0"^^ . "lua-userdata"^^ . "0"^^ . "1"^^ . "0"^^ . "0"^^ . . . . . . "0"^^ . "0"^^ . "1"^^ . . . "1"^^ . . "0"^^ . . . . . . . . . . "0"^^ . . . "1"^^ . "arrays"^^ . "0"^^ . "logitech"^^ . "-1"^^ . . . . . "5"^^ . . "Neovim - Conditional colorschemes"^^ . . . "ROBLOX script still allows messages through"^^ . . . "<p>There are a few problems here that build on each other.</p>\n<p>For starters, when an <code>__index</code> metamethod is invoked, and that metamethod is a function, the value resolved by that index is the return value of the function.</p>\n<p>For example,</p>\n<pre class="lang-lua prettyprint-override"><code>local t = setmetatable({}, {\n __index = function (self, key)\n return 42\n end\n})\n\nprint(t.a, t.b)\n</code></pre>\n<p>prints</p>\n<pre class="lang-none prettyprint-override"><code>42 42\n</code></pre>\n<p>So in your code, even if you assign a value to that key in the table</p>\n<pre class="lang-lua prettyprint-override"><code>function index_metamethod(t,i)\n t[i] = 0\nend\n</code></pre>\n<p>the metamethod returns nothing, and the result of <code>table.player</code> is <em>nil</em>. You need to <code>return t[i]</code> (or equivalent) after you set it.</p>\n<hr />\n<p>Next, nested indexing does not repeatedly invoke the metamethod(s) of the root table, but rather it invokes the metamethod(s) of each individual table in the chain of access.</p>\n<p>That is, for <code>a.b.c</code>, if <code>'b'</code> does not exist in <code>a</code>, but <code>a</code> has an <code>__index</code> metamethod, then <code>a.b</code> is resolved to the result of invoking that metamethod (as previously discussed). Then, that <em>intermediate value</em> (<code>a.b</code>) is indexed by <code>'c'</code>, and again if <code>'c'</code> does not exist in that <em>intermediate value</em>, then that <em>intermediate value</em>'s <code>__index</code> metamethod would be invoked, assuming it exists.</p>\n<p>Basically <code>a.b.c</code> is</p>\n<pre class="lang-lua prettyprint-override"><code>local result\ndo\n local x = a.b -- possibly invoke `getmetatable(a).__index`\n result = x.c -- possibly invoke `getmetatable(x).__index`\nend\n</code></pre>\n<p>Any table you want keys to be auto-magically generated in must have its own metatable and metamethods set that do just that (though the metatable can possibly be <em>reused</em> by more than one table).</p>\n<p><em>This issue is very similar in concept to <a href="https://stackoverflow.com/q/77251312/2505965">this question</a> from just a few days ago, which shows how to solve this on the Lua side.</em></p>\n<hr />\n<p>Finally, assuming you fix everything else, the value set by <code>index_metamethod</code> (<code>t[i] = 0</code>) means <code>table.player</code> will resolve as <code>0</code>, and so</p>\n<pre class="lang-lua prettyprint-override"><code>table.player.killedEnemys\n</code></pre>\n<p>will create the error</p>\n<pre class="lang-none prettyprint-override"><code>attempt to index a number value (field 'player')\n</code></pre>\n<p>but &quot;fixing&quot; (assuming you use the same <code>index_metamethod</code> for every nested table) this by changing <code>t[i] = 0</code> to <code>t[i] = {}</code> means that</p>\n<pre class="lang-lua prettyprint-override"><code>table.player.killedEnemys &gt; 5\n</code></pre>\n<p>will create the error</p>\n<pre class="lang-none prettyprint-override"><code>attempt to compare number with table\n</code></pre>\n<p>It would be possible to address this by implementing more <a href="https://www.lua.org/manual/5.4/manual.html#2.4" rel="nofollow noreferrer">metamethods</a> (e.g., <code>__call</code>, <code>__lt</code>, <code>__eq</code>, etc.), but you still need a way to decide what each key's true value is at any given point in time.</p>\n<p>Basically, at some point you will need a way to distinguish keys from one another and decide what their actual value should be, and how to access it. This is an issue of design, and thus very subjective, so it is really on you to figure out how to accomplish this.</p>\n"^^ . . "0"^^ . . . "0"^^ . . . . . . "Possible duplicate of https://stackoverflow.com/questions/36489928/lua-attempt-to-index-a-nil-value-avoiding-errors-in-conditionals"^^ . . . . . . . . "I can't, I reach the max characters available when coping the code. It's exactly the same, but in the second script, swap every instance of "diferencia" for "hit".\n\nand hit is: local hit = raycast.Position"^^ . "<p>I have a lua function called from c, giving it a table as argument with some string fields and number values. I serialized some world state from my c program in this table. This is for a dialogue system.\nWhen I access the table in lua, i want to check whether or not some world state matches. This controls the output of the dialogue options (see example code below).</p>\n<p>What I don´t want is to pre initialize all possible state.</p>\n<p>I only want to ask in lua for example:</p>\n<pre><code>if(table.player.killedEnemys &gt; 5) then\n //calls a c-function that loads the given Text to display and the follow up function when clicked\n PresentOption(&quot;Try to impress opponent.&quot;, &quot;show_off_to_soldier&quot;)\nend\n</code></pre>\n<p>It works fine. If a player field was setted in the table before calling the function with this table as argument, killedEnemys is 0 due to the metamethod __index and __newindex:</p>\n<pre><code>function newindex_metamethod(t,i, v)\n rawset(t, i, v)\nend\n\nfunction index_metamethod(t,i)\n t[i] = 0\nend\n</code></pre>\n<p><strong>But</strong> I encounter an error by the line of the if-condition, saying:\n<em>attempt to index a nil value (field 'player')</em>\nwhen player is also not existing in the table so far.</p>\n<p>I thought the metamethods set the field &quot;player&quot; in the table before indexing this field further with &quot;killedEnemys&quot;. But this seems to be wrong and I do not understand why.</p>\n<p>In my imagination the table should looks like this:</p>\n<pre><code>table =\n {\n &quot;player&quot; = //set by the metamethods\n {\n &quot;killedEnemys&quot; = 0 //set by the metamethod\n }\n }\n</code></pre>\n<p><strong>Questions:</strong>\n<strong>1. Is it possible to use metamethods in lua like this, if more than one field in a nested table does not exist?\n2. How does Lua operate on this nested table calls?</strong></p>\n<p>This is how I call it from C and the function being called in lua:</p>\n<pre><code>//IN C:\n lua_getglobal(L, funcName); // where funcName represents a string for the function\n //&quot;small_talk&quot; below\n \n lua_table_serializer ser = {}; //serialization of the game state using the LBP-Method\n ser.L = L; //it creates a table and pushes it to the stack where\n Serialize(&amp;ser, npc); \n\n lua_newtable(L); // creating a table and set it as metatable of the\n lua_pushstring(L, &quot;__index&quot;); // table with the serialized game state\n lua_getglobal(L, &quot;index_metamethod&quot;);\n lua_rawset(L, -3);\n lua_pushstring(L, &quot;__newindex&quot;);\n lua_getglobal(L, &quot;newindex_metamethod&quot;);\n lua_rawset(L, -3);\n lua_setmetatable(L, -2);\n\n lua_pcall(L, 1, 0, 0);\n\n//IN LUA:\nfunction small_talk(table)\n PlayText(&quot;....&quot;)\n PresentOption(&quot;...&quot;, &quot;small_talk2&quot;)\n if(table.player.killedEnemys &gt; 5) then\n PresentOption(&quot;Try to impress opponent.&quot;, &quot;show_off_to_soldier&quot;)\n end\nend\n</code></pre>\n<p>There are no other global variables with the same name.</p>\n<p>I also tried some variations for the metamethods like setting t[i] = {} and so on.</p>\n<p>The metamethods are called for field player, but not killedEnemys (I printed the metamethod calls to check).</p>\n<p>Anything works fine unless there are multiple levels of not existing fields.</p>\n<p>I also saw <a href="https://stackoverflow.com/questions/36489928/lua-attempt-to-index-a-nil-value-avoiding-errors-in-conditionals">this </a> question which is similar. But with the solutions the syntacic sugar is lost. Also I want to know why the metamethod-solution does not the job.</p>\n"^^ . "0"^^ . "0"^^ . "nested-table"^^ . "0"^^ . "1"^^ . "c++"^^ . . . . . "1"^^ . . . . . "1"^^ . "How to require "__base__/bar" in Lua?"^^ . "lgi"^^ . "0"^^ . . . "<p>I want to create a function to change a value in Dictionary. I came up with something really complicated. It works, but it also adds additional output I can't explain.</p>\n<pre><code>boolValues = {\n firstBool=true,\n secondBool=true,\n thirdBool=true,\n}\n\nfunction setBoolValue(boolName, state)\n local newTable = {boolName, false,}\n for k, v in pairs(boolValues) do\n if k == boolName then\n v = state\n end\n newTable[k] = v\n end\n return newTable\nend\n\nfunction showTable(tableName)\n print(&quot;printing the table:&quot;)\n for k, v in pairs(tableName) do\n print(k,v)\n end\n print(&quot;&quot;)\nend\n\nshowTable(boolValues)\nboolValues = setBoolValue(&quot;secondBool&quot;, false)\nshowTable(boolValues)\n</code></pre>\n<p>The result:</p>\n<pre><code>printing the table:\nfirstBool true\nsecondBool true\nthirdBool true\n\nprinting the table:\n1 secondBool\n2 false\nfirstBool true\nsecondBool false\nthirdBool true\n</code></pre>\n<p>Where are the pairs &quot;1 , secondBool&quot; and &quot;2, false&quot; coming from? What is a better way to write a function to change a value in dictionary?</p>\n"^^ . . "0"^^ . . . "0"^^ . . . "The way it is now, 'string' would have an index of [2][2], but I would like to get it as an index of 3 because it's the third element in the entire array, then apply the same logic to the entire array without changing the structure of it."^^ . . "1"^^ . . . . . . "pico-8"^^ . "`like this: " "` That IS a space in a string?"^^ . . . . . . . . "You don't need a new loader. 1) Create `C:\\Temp\\__base__` folder and put `bar.lua` there. 2) Add `C:\\Temp\\?.lua;` to `package.path` variable. 3) Invoke `require("__base__.bar")`"^^ . "1"^^ . . . "1"^^ . "Thanks a lot. That is exactly what I did. But unfortunately, it override cols.info, I need to update it accordingly. An option maybe can help but I am not sure it is possible, is it possible to make a copy of 8 bytes, a copy of packetInfo and a copy of a tree then I can retrieve each field manually that I know how to do. Thanks!"^^ . . . "0"^^ . . "Yeah, my compiler was the problem the entire time."^^ . . . "Fixed. See the complete script in my auto-answer. I just modified your `if type(tbl.track == "string") then...` to `if tbl.track and type(tbl.track == "string") then...`"^^ . . "<p>I made a program, which checks if in table has (for example) &quot;A&quot; and a &quot;B&quot; in itself. But it doesn't works.</p>\n<p>Here's code:</p>\n<pre><code>function inTable(t,e)\n return t[e] ~= nil\nend\n\n--Example\nlocal table_ = {&quot;A&quot;,&quot;B&quot;}\n\nif inTable(table_,&quot;A&quot;) and inTable(table_,&quot;B&quot;) then\n --Do some stuff\nend\n</code></pre>\n<p>Please, help me.</p>\n<p>I tried everything but it still doesn't work.</p>\n"^^ . . . . "0"^^ . . . "resty"^^ . "2"^^ . . . . . . . . "<p>When you call <code>lua_newuserdata</code>, you're creating a <strong>full</strong> userdata. The pointer returned by that function will be freed automatically by Lua when the corresponding userdata object goes away, so there will not be a memory leak, and you should not try to free it yourself.</p>\n<blockquote>\n<p>I am skeptical because after I close Lua using lua_close() I can still access the circle, moving it, drawing it, etc.</p>\n</blockquote>\n<p>Use-after-free in C++ is Undefined Behavior, which means literally anything can happen, such as accesses succeeding as if the memory were still valid.</p>\n<p>Another note about your function: the C++ standard says this under section 6.7.3 [basic.life]:</p>\n<blockquote>\n<p>For an object of a class type, the program is not required to call the destructor explicitly before the storage which the object occupies is reused or released; however, if there is no explicit call to the destructor or if a <em>delete-expression</em> (7.6.2.8) is not used to release the storage, the destructor is not implicitly called and any program that depends on the side effects produced by the destructor has undefined behavior.</p>\n</blockquote>\n<p>So you should probably add a <code>__gc</code> metamethod that calls <code>circle-&gt;~CircleShape();</code>.</p>\n"^^ . "<p>Are you running the game in Studio? If so by default Roblox disables Studio access to DataStores, it is only recommended to disable this security feature if your game <strong>isn't</strong> live. If you wish to disable this you can do so in the <code>Game Settings</code> under the <code>Home</code> tab. Otherwise, you can test the game from the Roblox Player and all DataStores should operate as intended.</p>\n"^^ . "<p>See this string separator: <a href="https://stackoverflow.com/a/1647577/12968803">https://stackoverflow.com/a/1647577/12968803</a></p>\n<p>The code by the link takes strings <em>between</em> separators (also both ends).</p>\n<p>Update:\nThe function returns the list, not iterator:</p>\n<pre><code>function string:split(pat)\n pat = pat or '%s+'\n local result = {}\n local st, g = 1, self:gmatch(&quot;()(&quot;..pat..&quot;)&quot;)\n local function getter(segs, seps, sep, cap1, ...)\n st = sep and seps + #sep\n table.insert(result, self:sub(segs, (seps or 0) - 1))\n return cap1 or sep, ...\n end\n local function iterate()\n if st then\n getter(st, g())\n end\n return result\n end\n while st do\n iterate()\n end\n return result\nend\n</code></pre>\n<p>usage:</p>\n<pre><code>local str = &quot;one#two#three&quot;\nlocal list = str:split(&quot;#&quot;)\nfor i, v in ipairs (list) do\n print (i, v)\nend\n</code></pre>\n<p>result:</p>\n<pre><code>1 one\n2 two\n3 three\n</code></pre>\n"^^ . . . . "0"^^ . . "indexing"^^ . "If a executable redis's lua script fail to return value to client (java application), is that transaction rolled back or not?"^^ . "5"^^ . "<p>You say it doesn't work, but you don't specify what you're trying to achieve. Yielding from debug hook is not going to work (you'll get &quot;attempt to yield across a C-call boundary&quot; error message) because there is nothing to yield to; you haven't resumed any code to allow yield to be executed. What you can do from the debug hook is to resume some other code; this is the way some of Lua debuggers work (for example, MobDebug and RemDebug).</p>\n<p>You may check this <a href="https://stackoverflow.com/q/54858455/1442917">SO question</a>, as it appears to describe a similar goal and one of the answers suggests an extension (yieldhook) that may be relevant to your question.</p>\n"^^ . . "<p>i am trying to make a game and the leaderboard data should save but isn't. here is the code in serverscriptservice:</p>\n<pre><code>local DataStoreService = game:GetService(&quot;DataStoreService&quot;)\nlocal statsDS = DataStoreService:GetDataStore(&quot;statsDS&quot;)\n\nlocal SAVE_INTERVAL = 60 -- Save data every 60 seconds (1 minute)\n\n-- Helper function to save player data\nlocal function savePlayerData(player)\n local leaderstats = player:FindFirstChild(&quot;leaderstats&quot;)\n\n if leaderstats then\n local Clicks = leaderstats:FindFirstChild(&quot;Clicks&quot;)\n local Time = leaderstats:FindFirstChild(&quot;Time&quot;)\n\n if Clicks and Time then\n local data = {Clicks.Value, Time.Value}\n\n local playerUserId = &quot;Player&quot; .. player.UserId\n\n local success, errorMessage = pcall(function()\n statsDS:SetAsync(playerUserId, data)\n end)\n\n if success then\n print(&quot;Saved data for &quot; .. player.Name)\n else\n warn(&quot;Error saving data for &quot; .. player.Name .. &quot;: &quot; .. errorMessage)\n end\n end\n end\nend\n\ngame.Players.PlayerAdded:Connect(function(player)\n local leaderstats = Instance.new(&quot;Folder&quot;)\n leaderstats.Name = &quot;leaderstats&quot;\n leaderstats.Parent = player\n\n local Clicks = Instance.new(&quot;IntValue&quot;)\n Clicks.Name = &quot;Clicks&quot;\n Clicks.Parent = leaderstats\n\n local Time = Instance.new(&quot;IntValue&quot;)\n Time.Name = &quot;Time&quot;\n Time.Parent = leaderstats\n\n local playerUserId = &quot;Player&quot; .. player.UserId\n\n local data = statsDS:GetAsync(playerUserId)\n\n if data then\n Clicks.Value = data[1]\n Time.Value = data[2]\n end\n\n player:WaitForChild(&quot;leaderstats&quot;)\n player:WaitForChild(&quot;leaderstats&quot;):WaitForChild(&quot;Clicks&quot;)\n\n local lastSaveTime = tick()\n\n local saveTimer\n\n saveTimer = game:GetService(&quot;RunService&quot;).Heartbeat:Connect(function()\n if tick() - lastSaveTime &gt;= SAVE_INTERVAL then\n lastSaveTime = tick()\n savePlayerData(player)\n end\n\n if not player:IsDescendantOf(game) then\n -- Player left the game\n saveTimer:Disconnect()\n savePlayerData(player)\n end\n end)\nend)\n\ngame.Players.PlayerRemoving:Connect(function(player)\n savePlayerData(player)\nend)\n</code></pre>\n<p>i was expecting the data to save when i leave and rejoin, but it is reset to 0</p>\n<p>i tried messing around with the code in every which way but nothing worked and most just made it worse.</p>\n<p>this is a game where there is a button and you click it and it adds to the value clicks and time just shows how much time you spent in the game. the following code should save it so it works between servers but it is never working. always resets. i dont know what else to add to fix it.</p>\n"^^ . "0"^^ . . . . . . . . . . . "0"^^ . . . . . "0"^^ . "1"^^ . . "Reversing a vararg"^^ . . . . . "2"^^ . "Please make a second thread for your second question."^^ . "0"^^ . "json"^^ . "i have put the only error i got thats literly the error the nil value"^^ . . . . . . . . . . . "0"^^ . . . "0"^^ . . "1"^^ . . . . "luau"^^ . "0"^^ . "2"^^ . . . . . . . "Agreed with @Jarod42. I see at least 3 ways to use Lua `userdata`. 1. Pointer to circle stored in a light userdata. 2. circle *object* stored in a full userdata. 3. pointer to circle stored in a full userdata. I think option 3 is the best for the use case."^^ . . "1"^^ . . . "0"^^ . . . . . "I don't know Lua, but I think the key is `lua_settop(L, 1);` at the beginning. In your case you'd use `lua_settop(L, 2);`"^^ . "require"^^ . . . . . . "0"^^ . . . "<p>I found a solution:</p>\n<p>I have to put <code>ngx.exec(ngx.var.file_path)</code> in the end to return the ball to NGINX.</p>\n"^^ . . "<p>Aside from your lack of using variables, the solution is rather simple:\nEvery instruction takes a certain amount of time to be executed.\nFunctions that interact with the WorldRoot are the major part of instructions that take up the most time.</p>\n<p>Because you have a lot of :GetPlayerFromCharacter functions, there are chances where the time may deviate from your target 1 second.</p>\n<p>The wait() function is deprecated, the smallest amount can be 0.30 seconds, so we can conclude from this that it'll wait in partitions of 0.30 seconds.\nThe new function from the task scheduler, task.wait() has the smallest amount of 0.016 seconds, which makes it more accurate to waiting for one second than the wait() function.</p>\n<p>To ensure the player will receive increments of money every second, you want to make use of coroutines. As of this date, you can use the task.spawn() function to make it run on a different thread, bypassing the waiting time required to execute the other instructions:</p>\n<pre class="lang-lua prettyprint-override"><code>...\ntask.spawn(function()\n task.wait(1)\n playersRobbing[player] += cashPerSecond\nend)\n-- rest of the code\n...\n</code></pre>\n"^^ . "<p>While playing YouTube videos, the script saves the cut clips on the RAM rather than a C: directory, I believe.</p>\n<p>What line should I add to the <code>config.lua</code> file?</p>\n<p>I use <a href="https://github.com/familyfriendlymikey/mpv-cut" rel="nofollow noreferrer">mpv-cut</a>, or there is another scrip that allows me to change the location within C:?</p>\n<p>I chose this instead because it was easy to install. I'm don't write Lua code at all. I have windows 10, installed ffmpeg and yt-dlp.</p>\n"^^ . . . . . "<p>Adonis has its configuration settings built upon a ModuleScript, so if you'd like to modify the conditions of the settings, then you'll have to edit the variables and tables within the script to tailor the admin system to your specific requirements.</p>\n<pre class="lang-lua prettyprint-override"><code>-- Let's say you want to add a new moderator to the system\n-- You would go to the &quot;settings.Ranks&quot; table and find the &quot;Moderators&quot; section\n-- Add the new moderator's information to the &quot;Users&quot; list:\n\nsettings.Ranks[&quot;Moderators&quot;].Users = {\n &quot;ExistingModerator&quot;,\n &quot;NewModerator:1234567&quot;,\n 7654321, -- User ID\n &quot;Group:RobloxDevelopers:3&quot;, -- Group ID and rank\n &quot;Item:9876543&quot;, -- Item ID\n}\n\n-- Now, &quot;NewModerator&quot; with User ID 1234567, User ID 7654321, and those in group &quot;RobloxDevelopers&quot; with rank 3, or owning the item with ID 9876543 will be moderators.\n\n-- You can similarly modify other settings as needed to suit your requirements.\n</code></pre>\n"^^ . . . . . . "0"^^ . . . . "You actually made me fix cairo for this: https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/524 Hopefully, this means that eventually in the future one actually gets `CAIRO_STATUS_PNG_ERROR` / "error occurred in libpng while reading from or writing to a PNG file"."^^ . "0"^^ . . "<p>Being more clear, I want to make it so the Z value of a certain vector3 subtracts with the Z value of another vector3, ONLY the Z one, this way making the X and Y values of the first vector3 stay intact, while the only modified one being the Z</p>\n<p>These are the specific lines. If these lines do not represent an actual vector3 value, or I've made a mistake which I didn't notice, tell me.</p>\n<pre><code>local direction = (endPosition - startPosition).Unit * range --I want to subtract the Z value of this vector3...\n\n if raycast then\n local sth = raycast.Instance.Position --...with the Z value of this other one...\n local mod = vector3(Xdirval, Ydirval, Zmodval) --...and create this supossed new vector3, with the X and Y values of the &quot;direction&quot;'s vector3.\n end\n</code></pre>\n<p>I've learned how to get the specific value of vector3's (Z in this case), but I have no idea how to perform arihmetric between the two AND place it in a new vector3, and neither how to extract the vector3 of the items I need (sth's and direction's)</p>\n"^^ . . "1"^^ . . . "I can only think of your API endpoint not processing the chat messages and instead returning no response or a response.Error (making the function return false, thus allowing the message). Can you edit in an example where a toxic message is allowed in, along with the API response?"^^ . . "<p>my lua script</p>\n<pre><code>local redis = require &quot;resty.redis&quot;\nlocal red = redis:new()\n\nred:set_timeout(1000)\n\nlocal ok, err = red:connect(&quot;172.20.0.2&quot;, 6379)\n if not ok then\n ngx.log(ngx.CRIT, &quot;Failed to connect to redis: &quot;, err)\n return\nend\n\nfunction save_bytes_sent()\n local bytes_sent = ngx.var.bytes_sent\n local res, err = red:set(&quot;bytes_sent_&quot; .. ngx.var.uri, bytes_sent)\n if not res then\n ngx.log(ngx.CRIT, &quot;Failed to save bytes_sent in redis: &quot;, err)\n return\n end\n\n local ok, err = red:close()\n if not ok then\n ngx.log(ngx.CRIT, &quot;Failed to close the connection to redis: &quot;, err)\n return\n end\n\n ngx.log(ngx.CRIT, &quot;Saved bytes_sent in redis successfully&quot;)\nend\n\nsave_bytes_sent()\n</code></pre>\n<p>and my nginx.conf</p>\n<pre><code>location / {\n access_by_lua_file /test.lua;\n}\n</code></pre>\n<p>i use openresty docker image and all config is ok such as volumes, network and ...</p>\n<p>I want to get the <strong>ngx.var.bytes_sent</strong> value from the response of each request and insert it in redis, but my problem is that in <code>access_by_lua_file</code>, its value is zero, and if I use the <code>log_by_lua_file</code>, I can get its value, but I cannot use Redis because there is no access to Redis in this phase.</p>\n<p>What is the solution for this problem?</p>\n"^^ . "admin"^^ . . . . "<p>Me and someone are working on a game in boblox studio and we want to know how to highlight both the player and speed coil when it is equipped. Can someone help me with this?</p>\n<p>We looked up code online but couldn't find anything</p>\n"^^ . "0"^^ . "0"^^ . . "1"^^ . . . . . "0"^^ . . . . . . "0"^^ . . . "1"^^ . . . . "<p>change the <code>Content-Length</code> resolved the problem.</p>\n<pre><code>response:body(newBody)\nresponse:headers(&quot;Content-Length&quot;, tostring(string.len(newBody)))\n</code></pre>\n"^^ . "0"^^ . . . . "0"^^ . . "0"^^ . . "I can not compile the file in front of the for{} loop, because the shown "Actions" struct contains the script path dynamically."^^ . . "1"^^ . . . . . "metatable"^^ . . "1"^^ . . "how to access value of ngx.var.bytes_sent in access_by_lua_file"^^ . . "collision-detection"^^ . . . . . "0"^^ . . "From cursory glance, [this](https://github.com/yuin/gopher-lua#sharing-lua-byte-code-between-lstates) looks like what you're after, no?"^^ . . "@user2205930 the `lua_State` stack shouldn't be the problem. It's about the `double` array you're stack-allocation on the C stack. You should be heap-allocating it."^^ . "Display page sort key on MediaWiki page or footer"^^ . . . . . . . . . "Rather than defining that anonymous function, you could also do `pcall(c.perform, c)` instead."^^ . "Thanks! it did work, although I now have a different problem, and a question. Although the ball now appears where my raycast hit, when I hold click (auto-fire the gun), the ball keeps appearing closer and closer the more I hold it. And, how do you consider this code would be "better"? the cframes are there in first reason as, then, I used another kind of part, a ray, which would start where the raycast did, and finish where the raycast did, too."^^ . "1"^^ . . . "0"^^ . "0"^^ . . . "0"^^ . . "1"^^ . . "<p>I tried using Lazy instead of Packer and everything works fine.</p>\n<p>I have no clue why Packer failed but I wanted to switch to Lazy sooner or later anyways.</p>\n<p>EDIT:<br />\nThe icons didn't show because I wasn't using a nerd font.<br />\nSee here: <a href="https://nerdfonts.com" rel="nofollow noreferrer">https://nerdfonts.com</a></p>\n"^^ . . "Best method to convert a vim <expr> value to neovim in lua"^^ . . "<blockquote>\n<p>Is my solution right?</p>\n</blockquote>\n<p>This is not a correct Fisher-Yates shuffle, and the results are not equally probable. This is not obvious, but easy to show with some well-known math.</p>\n<p>Let's call the length of the list <code>n</code>. In each iteration of your loop, you choose a number between <code>1</code> and <code>n</code>. There are <code>n</code> iterations, so there are <code>n^n</code> equally likely ways that all the numbers can be chosen. The number of permutations of the list is <code>n</code> factorial. (Except in trivial small cases), there is no way to divide <code>n</code> factorial permutations evenly into the <code>n^n</code> outcomes, thus it is impossible for all the permutations to be equally likely. For example with <code>n=4</code>, there are 24 permutations, but 256 ways the random numbers can be chosen. 24 doesn't divide into 256 evenly, so there is no way to assign an permutation to each of the 256 random outcomes so that they all appear the same number of times.</p>\n<p>To get the proper Fisher-Yates algorithm, change <code>j = math.random(1, #list)</code> to <code>j = math.random(1, i)</code>. This means that the previous counterargument no longer applies: the first random number is from <code>1</code> to <code>n</code>, then <code>1</code> to <code>n - 1</code>, etc. So, the number of ways the random numbers can be chosen is also <code>n</code> factorial. This doesn't automatically prove that the algorithm works properly; you need to think about it and realize that each permutation can be reached by exactly one way of choosing the random numbers (or you only have to prove that each permutation is possible since the numbers are the same).</p>\n<blockquote>\n<p>One thing I noticed is if I add <code>math.randomseed(1)</code> [...], I always get the same results[...] Why does that happen?</p>\n</blockquote>\n<p><code>math.random</code> is a pseudo-random number generator. This means that it has some hidden internal state, and each time you call it, it does some mysterious but deterministic operation to modify its internal state and return a mysterious number. But, it is not actually random (because common computer operations are inherently always deterministic) (hence &quot;pseudo-random&quot;).</p>\n<p><code>math.randomseed</code> sets the hidden internal state. Because everything is deterministic, if you start with the same state, you will get the same result. This feature can be useful, e.g. to reproduce the same result later, but it is not useful if you just want &quot;random&quot; numbers.</p>\n<p>In Lua 5.4, Lua tries to automatically choose a different starting seed value each time you run the program, so there is not any great need to manually provide a seed when the program starts (but also a no-argument version of <code>math.randomseed()</code> is added to allow this behavior to be invoked explicitly). In earlier versions of Lua it is common to do something like <code>math.randomseed(os.time())</code> so that you get a different seed each time (well, it will be different if at least a second of real time has passed).</p>\n"^^ . . . . "Krakend lua set response body returns nil"^^ . . "@tehtmi I didn't even think about that, I will try that thanks!"^^ . . "string"^^ . "Oops, looks like I have a typo there. It should be `type(tbl.track) == "string"`, otherwise you get `type(tbl.track == "string")` which will always be the string `"boolean"`, which is truthy."^^ . . . . . "-1"^^ . . . . "Your premise is wrong; `" " ~= ""` in Lua. Lua does *not* distinguish strings with a space in them as empty strings. Show your code, because your bug is elsewhere."^^ . "<p>I have been trying to make a roblox game recently, that has a card game built in using GUI, etc. Currently I am implementing the logic for the game, and when I went to test it; it seems as if sometimes when I click either <code>Hit()</code> or <code>Double()</code> <em>it decides it wants <strong>3 cards</strong> instead of <strong>1 card</strong></em>, I am assuming that somewhere in my code im calling it twice on accident, but I have gone over it and haven't been able to see it; so I am starting to think it is something else. Ill attach my code below, if anyone has any clues on why this doesn't work that would be really appreciated. Don't spoonfeed me code, just give me documentation or some line numbers.</p>\n<p>Thanks :D</p>\n<pre class="lang-lua prettyprint-override"><code>local function Hit(player, Hand)\n if #deck == 0 then\n shuffleTable(deck)\n end\n\n local newCard = table.remove(deck, 1)\n local newCardTexture = cardTextures[newCard]\n\n -- Add the new card to the player's hand\n table.insert(Hand, newCard)\n local handTotal = CalculateHandTotal(Hand)\n player.PlayerGui.Blackjack.Main.PlayerTotal.Text = handTotal\n\n -- Update the player's hand display\n local templateCard = game.ReplicatedStorage.CardImages.FirstCard:Clone()\n templateCard.Name = &quot;NewCard&quot; -- Change the name if necessary\n templateCard.Image = newCardTexture\n templateCard.Parent = player.PlayerGui.Blackjack.Main.PlayerCards\n\n if tonumber(player.PlayerGui.Blackjack.Main.PlayerTotal.Text) &gt; 21 then\n print(&quot;You busted!&quot;)\n return false\n end\n return true\nend\n-- Function to handle the &quot;Stand&quot; action\nlocal function Stand(player, playerHand, dealerHand)\n while tonumber(player.PlayerGui.Blackjack.Main.DealerTotal.Text) &lt; 17 do\n dealerTotal = CalculateHandTotal(dealerHand)\n player.PlayerGui.Blackjack.Main.DealerTotal.Text = dealerTotal\n\n if dealerTotal &gt; 17 then\n break\n end\n\n if #deck == 0 then\n shuffleTable(deck)\n end\n\n local newCard = table.remove(deck, 1)\n local newCardTexture = cardTextures[newCard]\n -- Add the new card to the dealer's hand\n table.insert(dealerHand, newCard)\n\n\n -- Update the dealer's hand display\n local templateCard = game.ReplicatedStorage.CardImages.FirstCard:Clone()\n templateCard.Name = &quot;NewCard&quot; -- Change the name if necessary\n templateCard.Image = newCardTexture\n templateCard.Parent = player.PlayerGui.Blackjack.Main.DealerCards\n end\n\n playerTotal = tonumber(player.PlayerGui.Blackjack.Main.PlayerTotal.Text)\n -- Update the dealer's total display\n\n -- Implement your win/lose logic based on the final dealer total and player total\n if dealerTotal &gt; 21 or dealerTotal &lt; playerTotal then\n -- Dealer busts or player has a higher total, player wins\n -- You can implement the reward or outcome here\n print(&quot;You won&quot;)\n else\n -- Dealer has a higher total, player loses\n -- Implement the outcome accordingly\n print(&quot;You lost :(!&quot;)\n end\nend\n\n\nlocal function Double(player, playerHand, dealerHand)\n -- Double the player's bet (if you have a betting system)\n -- Perform a &quot;Hit&quot; and then &quot;Stand&quot;\n Hit(player, playerHand)\n Stand(player, playerHand, dealerHand)\nend\n\ngame.ReplicatedStorage.StartBlackjack.OnServerEvent:Connect(function(plr)\n local dealerCards = plr.PlayerGui.Blackjack.Main.DealerCards\n for _, child in ipairs(dealerCards:GetChildren()) do\n if child.Name ~= &quot;FirstCard&quot; and child.Name ~= &quot;TextLabel&quot; and child.Name ~= &quot;UIListLayout&quot; then\n child:Destroy()\n end\n end\n\n local playerCards = plr.PlayerGui.Blackjack.Main.PlayerCards\n for _, child in ipairs(playerCards:GetChildren()) do\n if child.Name ~= &quot;FirstCard&quot; and child.Name ~= &quot;SecondCard&quot; and child.Name ~= &quot;UIListLayout&quot; then\n child:Destroy()\n end\n end\n\n\n if #deck == 0 then\n shuffleTable(deck)\n end\n\n local dealerFirstCard = table.remove(deck, 1)\n local dealerFirstCardTexture = cardTextures[dealerFirstCard]\n plr.PlayerGui.Blackjack.Main.DealerCards.FirstCard.Image = dealerFirstCardTexture\n\n local dealerSecondCard = table.remove(deck, 1)\n local hiddenCard = game.ReplicatedStorage.CardImages.TextLabel:Clone()\n hiddenCard.Parent = plr.PlayerGui.Blackjack.Main.DealerCards\n\n local playerFirstCard = table.remove(deck, 1)\n local playerFirstCardTexture = cardTextures[playerFirstCard]\n plr.PlayerGui.Blackjack.Main.PlayerCards.FirstCard.Image = playerFirstCardTexture\n\n local playerSecondCard = table.remove(deck, 1)\n local playerSecondCardTexture = cardTextures[playerSecondCard]\n plr.PlayerGui.Blackjack.Main.PlayerCards.SecondCard.Image = playerSecondCardTexture\n\n local playerTotal = GetCardValue(playerFirstCard) + GetCardValue(playerSecondCard)\n plr.PlayerGui.Blackjack.Main.PlayerTotal.Text = playerTotal\n\n local dealerTotal = GetCardValue(dealerFirstCard)\n plr.PlayerGui.Blackjack.Main.DealerTotal.Text = dealerTotal\n\n -- Initialize player data\n Hand = {playerFirstCard, playerSecondCard}\n Total = plr.PlayerGui.Blackjack.Main.PlayerTotal\n Cards = {\n [&quot;Card1&quot;] = plr.PlayerGui.Blackjack.Main.PlayerCards.FirstCard,\n [&quot;Card2&quot;] = plr.PlayerGui.Blackjack.Main.PlayerCards.SecondCard,\n }\n\n -- Connect the GUI buttons to the corresponding actions\n local hitButton = plr.PlayerGui.Blackjack.Main.Hit\n local standButton = plr.PlayerGui.Blackjack.Main.Stand\n local doubleButton = plr.PlayerGui.Blackjack.Main.Double\n local gameOver = false \n \n hitButton.Transparency = 0\n standButton.Transparency = 0\n doubleButton.Transparency = 0\n hitButton.TextTransparency = 0\n standButton.TextTransparency = 0\n doubleButton.TextTransparency = 0\n\n hitButton.MouseButton1Click:Connect(function()\n if hitButton.Transparency &lt;= 0 then\n if gameOver then\n return -- Exit the handler if the game is already over\n end\n \n if Hit(plr, Hand) == false then\n gameOver = true\n print(&quot;Made game quit&quot;)\n \n hitButton.Transparency = 0.6\n hitButton.TextTransparency = 0.6\n \n standButton.TextTransparency = 0.6\n standButton.Transparency = 0.6\n \n doubleButton.Transparency = 0.6\n doubleButton.TextTransparency = 0.6\n end\n \n \n else\n return\n end\n \n end)\n\n standButton.MouseButton1Click:Connect(function()\n if standButton.Transparency &lt;= 0 then\n if gameOver then\n return -- Exit the handler if the game is already over\n end\n \n s, e = pcall(function()\n plr.PlayerGui.Blackjack.Main.DealerCards.TextLabel:Destroy()\n end)\n \n local newCard = game.ReplicatedStorage.CardImages.FirstCard:Clone()\n newCard.Name = &quot;RemoveHiddenCard&quot;\n newCard.Parent = plr.PlayerGui.Blackjack.Main.DealerCards\n newCard.Image = cardTextures[dealerSecondCard]\n\n print(&quot;Standing&quot;)\n Stand(plr, Hand, {dealerFirstCard, dealerSecondCard})\n print(&quot;Completed&quot;)\n \n hitButton.Transparency = 0.6\n hitButton.TextTransparency = 0.6\n\n standButton.TextTransparency = 0.6\n standButton.Transparency = 0.6\n\n doubleButton.Transparency = 0.6\n doubleButton.TextTransparency = 0.6\n else\n return\n end\n end)\n\n doubleButton.MouseButton1Click:Connect(function()\n if doubleButton.Transparency &lt;= 0 then\n if gameOver then\n return\n end\n \n Double(plr, Hand, {dealerFirstCard, dealerSecondCard})\n else\n return\n end\n end)\n\n if gameOver then\n return true\n end\nend)\n</code></pre>\n"^^ . . . "nginx"^^ . . . . "<p>EDIT: Calling <code>fn</code> on <code>set</code> works, the Lua function is called. The problem is on the timer's callback.</p>\n<p>I suspect this conversion[*] from &quot;std::function&quot; to &quot;void *&quot; is the problem.</p>\n<pre><code>&amp;const_cast&lt;std::function&lt;void()&gt; &amp;&gt;(fn)\n</code></pre>\n<p>Because on the timer's callback I got an <code>EXC_BAD_ACCESS</code>.</p>\n<hr />\n<p>CONFIRMED: The problem is between the conversion between std::function to void pointer.</p>\n<p>Is there a safe way to do this? I would like to use SDL timers.</p>\n<hr />\n<p>I'm using the sol2 library to create bindings between Lua and C++. I've created a class called <code>timermanager</code>, where the <code>set</code> function works perfectly with C++ lambdas. However, now I want to be able to pass a Lua callback to C++, but it crashes on the line with <code>(*fn)();</code>. I also tried using <code>sol::function</code>, which is supposedly more flexible than <code>std::function</code>, but it crashes at the same line.</p>\n<p>The binding works, and the timer is correctly configured with the interval I pass.</p>\n<p>I suspect it might have something to do with Lua's garbage collector. It's possible that the collector is sweeping and taking the callback function with it. However, it's strange because below I have an <code>engine.run()</code> that gets stuck in a loop.</p>\n<pre><code>#include &lt;sol/sol.hpp&gt;\n\n#include &lt;iostream&gt;\n#include &lt;list&gt;\n#include &lt;map&gt;\n#include &lt;memory&gt;\n#include &lt;string&gt;\n#include &lt;unordered_map&gt;\n\n\nuint32_t wrapper(uint32_t interval, void *param) {\n auto fn = static_cast&lt;std::function&lt;void()&gt; *&gt;(param);\n (*fn)();\n return interval;\n}\n\nclass timermanager {\npublic:\n timermanager() = default;\n virtual ~timermanager();\n\n void set(int32_t interval, const std::function&lt;void()&gt; &amp;fn) {\n const auto id = SDL_AddTimer(interval, wrapper, &amp;const_cast&lt;std::function&lt;void()&gt; &amp;&gt;(fn));\n if (id == 0) {\n throw std::runtime_error(&quot;[SDL_AddTimer] failed to set timer&quot;);\n }\n\n _timers[id] = fn;\n}\n\nprivate:\n std::map&lt;int32_t, std::function&lt;void()&gt;&gt; _timers;\n};\n\nclass scriptengine {\npublic:\n scriptengine() = default;\n virtual ~scriptengine() = default;\n\n void run() {\n _lua.set_function(&quot;set&quot;, &amp;timermanager::set, &amp;_timermanager);\n\n const auto script = R&quot;(\n local e = engine:new()\n\n set(1000, function()\n print(&quot;on_timer&quot;)\n end)\n\n e:run() # runs forever here\n )&quot;\n\n SDL_Event event;\n\n while (SDL_PollEvent(&amp;event)) {\n switch (event.type) {\n case SDL_QUIT:\n exit();\n break;\n }\n }\n\nprivate:\n sol::state _lua;\n\n timermanager _timermanager;\n};\n\nint main() {\n SDL_Init(SDL_INIT_TIMER);\n\n scriptengine se;\n se.run();\n\n return 0;\n}\n</code></pre>\n<p>MRE <a href="https://godbolt.org/z/Kb8P565c8" rel="nofollow noreferrer">https://godbolt.org/z/Kb8P565c8</a></p>\n"^^ . "0"^^ . . . . . . "fluent-bit"^^ . . . . . . . . . . "Recursive metamethod __index?"^^ . . "0"^^ . . . . . . . . . . . . . "0"^^ . "<p>I have found out that everything was client side and none of the data was being on the server. now it works fine.</p>\n"^^ . . "Thanks it helped. But still I get all fields of rtcp,, like Timestamp, MSW: 0 (0x00000000), Timestamp, LSW: 0 (0x00000000), etc. Any idea on how to dissect only 8 bytes needed (up to ssrc), below is my call to rtcp dissectro:\nrtcp_dissector:call(buffer(7):tvb(8), pinfo, subtree)"^^ . . "4"^^ . . . "0"^^ . . "nginx: How to define 404 error page based on environment variable"^^ . "0"^^ . "0"^^ . "windows"^^ . "Why do the other arguments make a difference? Use the technique in https://stackoverflow.com/questions/25940366/passing-array-to-c-as-argument-in-the-stack and specify `2` as the argument index for the Lua table."^^ . "1"^^ . . "How can I define a Lua function with gopher-lua that has a pre-defined table as param, where the Lua script can access the table within that function?"^^ . "<p>I managed to resolve this issue by changing my structure around slightly. I used the following directory configuration:</p>\n<pre><code>nvim/\n|-- init.lua\n| - lua/zfg/\n| | - config/\n| | |-- pear.lua\n| | |-- colors.lua\n| | |-- harpoon.lua\n| | |-- lualine.lua\n| | |-- snip.lua\n| | |-- tabline.lua\n| | |-- telescope.lua\n| | |-- treesitter.lua\n| | |-- undotree.lua\n| |-- init.lua\n| - after/plugin\n| |-- lsp-zero.lua\n</code></pre>\n<p>As far as I can tell this fixes the issue by loading the completion engine and LSP functionalities after everything under the <code>lua</code> directory and the plugins are loaded (if I'm understanding Neovim configuration correctly).</p>\n"^^ . . . . . . "0"^^ . "1"^^ . . "0"^^ . . . "<p>So a few more hours in, I found out about <strong>ffi.cast</strong> and wrote another testcase that combines <strong>Light Userdata</strong> and <strong>ffi</strong>. Timings are very close to native C++ now. For very performance critical stuff this could work for me but I fear I am giving up on safety. Maybe somebody has an other idea on how to improve performance without using ffi.</p>\n<p><strong>Timings:</strong></p>\n<pre class="lang-none prettyprint-override"><code>C++ elapsed time: 0.001683s\nSol (Container) elapsed time: 1.020745s\nLua (Light Userdata) elapsed time: 0.337135s\nLuaJit ffi elapsed time: 0.004741s\n</code></pre>\n<p><strong>Code:</strong></p>\n<pre class="lang-c++ prettyprint-override"><code>void ffi_perf_test( int32_t iterations, int32_t count )\n{\n sol::state lua;\n lua.open_libraries( sol::lib::base, sol::lib::package, sol::lib::jit, sol::lib::ffi );\n lua_State* p_lua = lua.lua_state();\n\n create_transform_library( p_lua );\n\n int status = luaL_dostring( p_lua, R&quot;(\n local ffi = require( &quot;ffi&quot; )\n\n ffi.cdef[[\n typedef struct Transform\n {\n float position_x;\n float position_y;\n float position_z;\n float scale_x;\n float scale_y;\n float scale_z;\n } Transform;\n ]]\n\n function Update( count )\n local transforms = Transform:GetLightTransformArray()\n local ffi_transforms = ffi.cast( &quot;Transform*&quot;, transforms )\n\n for i = 0, count-1, 1 do\n local position_x = ffi_transforms[i].position_x\n local scale_x = ffi_transforms[i].scale_x\n\n position_x = position_x + 0.01\n scale_x = scale_x + 0.01\n\n ffi_transforms[i].position_x = position_x\n ffi_transforms[i].scale_x = scale_x\n end\n end\n )&quot; );\n\n if( status != 0 )\n {\n printf( &quot;Error: %s\\n&quot;, lua_tostring( p_lua, -1 ) );\n return;\n }\n\n auto start = std::chrono::high_resolution_clock::now();\n\n for( int i = 0; i &lt; iterations; ++i )\n {\n lua_getglobal( p_lua, &quot;Update&quot; );\n lua_pushinteger( p_lua, count );\n lua_pcall( p_lua, 1, 0, 0 );\n }\n\n auto end = std::chrono::high_resolution_clock::now();\n std::chrono::duration&lt;double&gt; elapsed_seconds = end - start;\n double elapsed = elapsed_seconds.count();\n\n printf( &quot;LuaJit ffi elapsed time: %fs\\n&quot;, elapsed );\n}\n</code></pre>\n"^^ . "<p>What I did is just added <code>neotest-jest.lua</code> file:</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;haydenmeade/neotest-jest&quot;,\n}\n</code></pre>\n"^^ . . . . "0"^^ . . . "<p>It's easy to understand. I want to make it so everytime my shot does NOT land on a target (ex: a player), a rounded, grey part appears where my shot hit, in the obstruction, the way Counter-Strike does.</p>\n<p>My code consists of a LocalScript, which, when the player holds the left mouse button one down, fires a RemoteEvent, which is picked by a Script and creates the hypothetic ball.</p>\n<p>I tried substracting the direction-i-shot's Z value and subtract it by that of the object I shot, accidentally (you are supossed to shot at the target, not at the wall, you know), and sending that vector3 value to a script, so it could create the ball. However, the splinters end up appearing in a strange location, usually far away from the obstruction and to its far left or right.</p>\n<p>The code in question:</p>\n<pre><code>if raycast then\n \n local mf = raycast.Instance.Position\n local hitCharacter = raycast.Instance.Parent\n local diferencia = Vector3.new(direction.X, direction.Y, direction.Z - mf.Z)\n local shot = hitCharacter:FindFirstChild(&quot;Humanoid&quot;)\n \n print (&quot;donde disparaste:&quot;, direction)\n print(&quot;donde esta lo que disparaste:&quot;, mf)\n print (&quot;diferencia entre lo q disparé y donde disparé:&quot;, diferencia)\n \n if shot then\n if hitCharacter.Name ~= player.Character.Name then\n baleado:FireServer(tool, shot, damage)\n end\n elseif not shot then\n esquirla:FireServer(startPosition, diferencia)\n end\n \n end\n</code></pre>\n<p>The script, which catches the remote event fired in the LocalScript:</p>\n<pre><code>\nlocal remoteEvent = script.Parent.esquirlaEvent\nlocal tool = script.Parent\nlocal debris = game:GetService(&quot;Debris&quot;)\n\nremoteEvent.OnServerEvent:Connect(function(player, startPosition, diferencia)\n\n local function crearescombros(startPosition, diferencia)\n local center = startPosition + diferencia / 2\n local distance = diferencia.Magnitude\n \n local visual = Instance.new(&quot;Part&quot;)\n visual.Parent = game.Workspace.linea\n visual.Anchored = true\n visual.CanCollide = false\n visual.BrickColor = BrickColor.new(&quot;Medium stone grey&quot;)\n visual.Material = Enum.Material.Plastic\n visual.Transparency = .4\n visual.Shape = Enum.PartType.Ball\n \n visual.CFrame = CFrame.new(center, startPosition)\n visual.Size = Vector3.new(10, 10, 10)\n \n debris:AddItem(visual, .050)\n end\n\n \n crearescombros(startPosition, diferencia)\nend)\n</code></pre>\n"^^ . . "@lhf well I feel dumb now, I focused so much on the folder indicated in the question that I completely flew over the much simpler `.*/` :-)"^^ . "<p>There is no difference, other than the result will be discarded in the case of a function, but since the Lua engine will cache the result of &quot;require&quot;, when &quot;require&quot; is called next time for the same file, the cached value will be returned. It's an additional table lookup in the latter case and is one of the reasons why global &quot;require&quot; is generally preferred.</p>\n"^^ . . . "OK, well if you set the info column fence *before* calling the RTCP dissector, then at least you'll preserve your information in the Info column and the RTCP dissector will only append to it. As for working with a copy, I'm not sure what you mean exactly. Note that it might be easier to work through ideas on the [Wireshark Discord Server](https://discord.com/invite/ts9GZCjGj5). I may not be available but others usually are and might have other ideas for you. There's a Lua channel that would fit well for this discussion."^^ . . . . . . "1"^^ . "1"^^ . . . . . "api-gateway"^^ . . . "2"^^ . . "1"^^ . . . . "-1"^^ . "Simple solution that I overlooked. I did not consider the fact that the declaration of b outside of the function meant that it would not be unique every time. Thank you"^^ . . . "This is C++, though. Consider changing your question's tags from [tag:c] to [tag:c++] if that's really the language you are working in, and want answers in."^^ . . . . "@Md.SaifulIslam I have updated my answer with an example that hopefully answers your question and other questions regarding what happens in a script."^^ . . "0"^^ . . "<p>Today I bought a logitek g502x mouse\nstarted writing scripts (I had never written them before)\nI looked in different places and saw an interesting option</p>\n<p>The script that i make, does not return errors, but for some reason it does not do anything.\nWhat have I done wrong?</p>\n<pre><code>EnablePrimaryMouseButtonEvents(true);\nfunction OnEvent(event, arg)\n if IsMouseButtonPressed(1) then\n repeat\n if IsModifierPressed (&quot;shift&quot;) then\n repeat\n if IsModifierPressed (&quot;w&quot;) then\n ---\n PressAndReleaseKey(&quot;LCTRL&quot;) \n Sleep(10) \n\n MoveMouseTo(33000, 55000)\n Sleep(50) \n\n PressMouseButton(1) \n Sleep(130) \n\n ReleaseMouseButton(1) \n Sleep(10) \n\n PressAndReleaseKey(&quot;LCTRL&quot;) \n Sleep(10)\n ---\n end\n until not IsModifierPressed (&quot;shift&quot;)\n end \n until not IsMouseButtonPressed(1)\n end\nend\n</code></pre>\n"^^ . "2"^^ . . . . . . . "0"^^ . . . "2"^^ . . . "0"^^ . "Two notes: (1) Why pass the size to `c_function` when you could just determine the length of the `random_array` using the appropriate Lua API call (only use cases I could see would be efficient "slicing" up to a length or dealing with sequences with `nil` where the length isn't well defined); (2) stack-allocating the `double` array is problematic. What if `size` is too large for the stack? You should probably heap allocate this instead."^^ . "<p><em>Note: I am writing my own window manager that is similar to AwesomeWM in that it will be written in C, and have a lua api for customisation.</em></p>\n<h3>The problem I'm facing is with this code:</h3>\n<pre class="lang-lua prettyprint-override"><code>local bg_img = lgi.cairo.ImageSurface.create_from_png(&quot;path_to_image.png&quot;)\nprint(bg_img.status) -- This prints &quot;NO_MEMORY&quot;\n\n-- this is part of the window manager api, but I think you can still make out what's going on\nlocal s = tsoil.create(screen_width, screen_height)\ns.cr:rectangle(0, 0, screen_width, screen_height)\ns.cr:set_source_surface(bg_img)\ns.cr:fill()\n\ntsoil.set_as_wallpaper(s)\n</code></pre>\n<p>This code prints out &quot;NO_MEMORY&quot; for some reason. I don't think this should happen, since the image is only about 600kb of memory.</p>\n<p>I also tried loading in a much smaller image (26kb in size), and that worked.</p>\n<p>I also tried running my window manager with Xephyr, and also directly with <code>startx</code>, but that didn't make my code with the larger image work. I don't know how to fix this.</p>\n<p><strong>EDIT: I also tried this in awesome-wm and it also fails. Again, I don't know why.</strong></p>\n<p><strong>EDIT2: I also tried to rewrite this code in C, and it still gives the same error:</strong></p>\n<pre><code> // only the code that gives this error, for the sake of brevity\n cairo_surface_t *img = cairo_image_surface_create_from_png(path);\n // this prints &quot;out of memory&quot;\n printf(&quot;%s\\n&quot;, cairo_status_to_string(cairo_surface_status(img)));\n</code></pre>\n"^^ . "fisher-yates-shuffle"^^ . "2"^^ . . . . . "<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>local tool=script.Parent\nlocal char=tool.Parent;char=char:IsA"Model"and char or char.Parent.Character\nlocal v=Instance.new("SelectionBox",char)\nv.Visible=false\nv.Adornee=char\ntool.Equipped:Connect(function()\n v.Visible=true\nend)\ntool.Unequipped:Connect(function()\n v.Visible=false\nend)</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . . "cjson"^^ . . "-1"^^ . . . "How to get better performance out of Lua when iterating array of structs"^^ . . "1"^^ . "Astronvim: how to install neotest-jest?"^^ . . . . . "1"^^ . . "radius"^^ . . "0"^^ . . . . . "0"^^ . "1"^^ . . . "<p>Fixed</p>\n<p>Step one:</p>\n<pre><code>local t = {\n [&quot;track&quot;] = &quot;one#two#three&quot;,\n {\n [&quot;track&quot;] = &quot;four&quot;\n }, -- [1]\n}\n\nlocal function probe(tbl) -- Rename &quot;track&quot; to &quot;aura&quot;\n for k, v in pairs(tbl) do \n if type(v) == &quot;table&quot; then \n probe(v)\n end \n end\n if tbl.track then \n tbl.aura = tbl.track\n tbl.track = nil \n end\nend\n</code></pre>\n<p><code>probe(t)</code>:now table becomes</p>\n<pre><code>{\n [&quot;aura&quot;] = &quot;one#two#three&quot;,\n {\n [&quot;aura&quot;] = &quot;four&quot;,\n }, -- [1]\n}\n</code></pre>\n<p>Step two:</p>\n<pre><code>function updateDB(tbl, depth) \n if depth &gt; 0 then \n for k, v in pairs(tbl) do\n if type(v) ~= 'table' then \n if k == 'track' then\n local count = 1\n for word in v:gmatch((&quot;[^%s]+&quot;):format(&quot;#&quot;)) do\n table.insert(tbl,{ [&quot;aura&quot;] = word })\n count = count + 1\n end\n tbl[k] = nil \n end\n else \n updateDB(v, depth-1)\n end\n end\n end\nend\n</code></pre>\n<p><code>updateDB(t,1)</code>: now table becomes</p>\n<pre><code>{\n {\n aura= &quot;one&quot;,\n }, -- [1]\n {\n aura= &quot;two&quot;,\n }, -- [2]\n {\n aura= &quot;three&quot;,\n }, -- [3]\n {\n aura= &quot;four&quot;,\n }, -- [3]\n}\n</code></pre>\n"^^ . "2"^^ . . . . . "0"^^ . . . . . . . "for k, v in pairs(rs) do\n print(k, v)\nend"^^ . "0"^^ . . "<p>Say I have a bunch of files that all follow the same pattern:</p>\n<pre><code>/tmp/project1/server_config.json\n/tmp/project1/client_config.json\n/tmp/project1/monitor_config.json\n</code></pre>\n<p>what I need is to extract the names:</p>\n<pre><code>server\nclient\nmonitor\n</code></pre>\n<p>If all I got is the full paths as a strings, is there a Lua method to extract the part that lies between <code>/tmp/projectXX/</code> and <code>_config.json</code> ?</p>\n"^^ . . . . "0"^^ . . . . "@Luatic - How do I pass the Lua array in if it's too big? What is the cutoff for `lua_State` stacks?"^^ . . "<p>No, there are no automatic rollbacks of transactions in Redis Lua scripts. The executed commands are not rolled back in the event of an failure later in the script. In fact, <a href="https://redis.io/docs/interact/transactions/#what-about-rollbacks" rel="nofollow noreferrer">rollbacks in Redis doesn't exist at all</a>.</p>\n<p>But there are <a href="https://github.com/redis/redis/issues/10576" rel="nofollow noreferrer">discussions</a> about implementing some kind of rollback feature.</p>\n<p>Important <a href="https://redis.io/docs/interact/programmability/eval-intro/" rel="nofollow noreferrer">definition</a> of &quot;atomically&quot;:</p>\n<blockquote>\n<p>Redis guarantees the script's atomic execution. While executing the script, all server activities are blocked during its entire runtime.</p>\n</blockquote>\n<p>That means that Redis treats the complete script as one operation with no other operation interrupting it.</p>\n<p>To prevent errors you should validate all your input arguments very thoroughly before using them. To handle potential errors, you can use <a href="https://redis.io/docs/interact/programmability/lua-api/#a-nameredispcalla-redispcallcommand-arg" rel="nofollow noreferrer"><code>redis.pcall()</code></a> instead of <code>redis.call()</code>. With <code>redis.pcall()</code> you can handle runtime errors that are raised by Redis as <code>redis.pcall()</code> always returns a reply and never throws a runtime exception. This can be helpful in creating your own rollback logic and to <a href="https://redis.io/docs/interact/programmability/lua-api/#a-nameredisloga-redisloglevel-message" rel="nofollow noreferrer">log</a> errors.</p>\n<p>Example:</p>\n<pre class="lang-lua prettyprint-override"><code>local function scriptNoRollback(keys)\n redis.call(&quot;INCR&quot;, keys[1])\n redis.call(&quot;INCR&quot;, keys[2])\n\n return &quot;OK&quot;\nend\n\nlocal function scriptRollback(keys)\n -- Store initial value.\n local initValueCounter1 = redis.call(&quot;GET&quot;, keys[1])\n\n redis.call(&quot;INCR&quot;, keys[1])\n local reply = redis.pcall(&quot;INCR&quot;, keys[2])\n if type(reply) == &quot;table&quot; and reply[&quot;err&quot;] ~= nil then\n reply[&quot;err&quot;] = &quot;Oops, error!&quot;\n -- Try to rollback data.\n redis.call(&quot;SET&quot;, keys[1], initValueCounter1)\n\n return reply\n end\n\n return &quot;OK&quot;\nend\n</code></pre>\n<p><code>scriptNoRollback</code> OK:</p>\n<pre><code>127.0.0.1:6379&gt; MSET counter1 1 counter2 2\nOK\n127.0.0.1:6379&gt; FCALL scriptNoRollback 2 counter1 counter2\n&quot;OK&quot;\n127.0.0.1:6379&gt; MGET counter1 counter2\n1) &quot;2&quot;\n2) &quot;3&quot;\n</code></pre>\n<p><code>scriptNoRollback</code> ERR:</p>\n<pre><code>127.0.0.1:6379&gt; MSET counter1 1 counter2 A\nOK\n127.0.0.1:6379&gt; FCALL scriptNoRollback 2 counter1 counter2\n(error) ERR value is not an integer or out of range script: scriptNoRollback, on @user_function:118.\n127.0.0.1:6379&gt; MGET counter1 counter2\n1) &quot;2&quot;\n2) &quot;A&quot;\n</code></pre>\n<p><code>counter1</code> is not rolled back to initial state.</p>\n<p><code>scriptRollback</code> OK:</p>\n<pre><code>127.0.0.1:6379&gt; MSET counter1 1 counter2 2\nOK\n127.0.0.1:6379&gt; FCALL scriptRollback 2 counter1 counter2\n&quot;OK&quot;\n127.0.0.1:6379&gt; MGET counter1 counter2\n1) &quot;2&quot;\n2) &quot;3&quot;\n</code></pre>\n<p><code>scriptRollback</code> ERR:</p>\n<pre><code>127.0.0.1:6379&gt; MSET counter1 1 counter2 A\nOK\n127.0.0.1:6379&gt; FCALL scriptRollback 2 counter1 counter2\n(error) Oops, error!\n127.0.0.1:6379&gt; MGET counter1 counter2\n1) &quot;1&quot;\n2) &quot;A&quot;\n</code></pre>\n<p><code>counter1</code> is rolled back to initial state.</p>\n"^^ . . . "0"^^ . "I still do not get it: from your question, I gather that you'd spawn multiple goroutines with each `Action` getting the same script. If so, what's the problem or compiling it once and then passing each action the compiled form?"^^ . "0"^^ . . "5"^^ . . . . . "1"^^ . "1"^^ . . . "I don't know. It does seem surprising. I guess there can be multiple channels, but I don't know if a message would go to multiple channels or if there's a reason it would be once for each player. If the response is the same every time, it shouldn't matter if one overrides the other, but maybe there is something else happening. In general I would recommend trying to get more information to narrow down where something strange happens (e.g. adding more prints or using other debugging tools). (And I still think it's a good idea to declare `response` as local in the top level of `isMessageToxic`.)"^^ . . "From what I remeber about LUA .. even if you actuaally was passing functional object to a function, `set` isn't an environment managed by lua, it gets destroyed on exit.Generally you have to register a function with C\\C++ side to call it from C++, not sure how sol2 manages that."^^ . "0"^^ . "openresty"^^ . "0"^^ . . . . . . . "2"^^ . "0"^^ . . "hover"^^ . . . "0"^^ . "lua-c++-connection"^^ . "0"^^ . . "0"^^ . "0"^^ . "Neovim: Can't bind ctrl+j to 7j or ctrl+k 7k using neovim with lua and iterm2"^^ . . . . "0"^^ . . . . "0"^^ . "1"^^ . . . "0"^^ . "The function renames the "track" keys to "aura" keys"^^ . "Thanks for the detailled write-up. I decided to accept shingo's, because it seems a more conventional way of doing it."^^ . "<p>For anybody who might stumble in the same question as I:</p>\n<p>So basically <code>arg1 = 'spawnWaterZone',</code> is not the same as <code>spawnzone = spawnWaterZone</code> and that is a little bit obvious, but if you try <code>arg1 = spawnWaterZone</code> that will not work too.</p>\n<p>That is because you are calling up a variable that is not defined in the file. You need to:</p>\n<ol>\n<li>Define it in the other file you are calling your function</li>\n</ol>\n<p>or</p>\n<ol start="2">\n<li>Set the variable as global</li>\n</ol>\n"^^ . . "0"^^ . . "M bbas Haider Taqvi i changed it and tested but it stil does not work so that isnt the only problem aperently"^^ . . "openssl"^^ . . . "yes i am sure as it works its just the moment i try making somthing like this it dosnt work anymore for some reasn. if i put rs.setBundledOutput(side, white) [just as an example] and then run it then it sets the color white ass expected so rs definetly is a thing. and how would i do a for loop print?"^^ . . "0"^^ . . . "<p>So I found out what to do. I have search for Intellisense settings and disable there. Easy (once you know what to look for)!</p>\n"^^ . "0"^^ . . "0"^^ . "<p>I have been trying to make a function in lua with computercraft. but every time I try loading it as an API it says {attempt to index?( nil value)}</p>\n<pre><code>function toggleBundledColor(side, color)\n applied = rs.getBundledOutput(side)\n if applied == 0 then\n rs.setBundledOutput(side,color)\n elseif applied ~= color and 0 then\n rs.setBundledOutput(side, colors.combine(applied, color))\n elseif applied == color then\n rs.setBundledOutput(side, colors.subtract(applied,color))\n end\nend\n</code></pre>\n<p>I have been to the wiki of computercraft and looked at multiple posts on there sites and have found no solution to what I've done wrong</p>\n"^^ . . "4"^^ . . "How to rank people with Adonis Admin on roblox"^^ . "Some notes on your code: (1) You can use `local function f(...)` as a shorthand for `local f; f = function(...)` (this is esp. convenient for recursive functions, but it's also fine to use it for non-recursive ones); (2) Swapping two elements is just `list[i], list[j] = list[j], list[i]` in Lua (multiple assignments copy), no need to introduce a helper function for that; (3) `printList` could be implemented more succintly as `print(table.concat(list, " "))`. For quick'n'dirty debugging, `print(table.unpack(list))` also works."^^ . . . "<p>In my NGINX-config I have</p>\n<pre><code>location /x {\n access_by_lua_file auth/auth.lua;\n content_by_lua_file auth/content.lua;\n}\n</code></pre>\n<p>access_by_lua_file works fine. I i return nothing there it continues to content_by_lua_file. I want it to replace the content under certain circumstances and otherwise continue and serve the static file as if the content_by_lua_file-directive would not have existed.</p>\n<p>content.lua looks like this:</p>\n<pre class="lang-lua prettyprint-override"><code>local files_cache = require 'files_cache'\n\nlocal filePath = ngx.var.file_path\nlocal fileContent = files_cache.load(filePath)\n\nif fileContent ~= nil then\n ngx.header[&quot;X-Source&quot;] = &quot;Cache&quot;\n ngx.say(fileContent)\n ngx.status = ngx.HTTP_OK\n return ngx.exit(ngx.status)\nend\n</code></pre>\n"^^ . . . . "0"^^ . "3"^^ . . "<p>I think what you want is something like this, when the GC is triggered it will call the deleteCircleShape method which will delete the CircleShape* thus the CircleShapes destructor will be called and then lua will remove the pointer pointer once the GC returns.</p>\n<p>P.S. if you have this pointer stored in a vector as well you can add code in the destructor (or deleteCircleShape method) to remove it from the vector so you don't get any null errors if you are looping said vector for drawing etc</p>\n<pre><code>#include &lt;iostream&gt;\n#include &quot;lua.hpp&quot;\n\n#define LUA_FUNC __declspec(dllexport)\n\nclass CircleShape {\n float radius_;\npublic:\n explicit CircleShape(const float radius) : radius_(radius) {\n std::cout &lt;&lt; &quot;CircleShape Constructor Called&quot; &lt;&lt; std::endl;\n }\n\n ~CircleShape() {\n std::cout &lt;&lt; &quot;CircleShape Destructor Called&quot; &lt;&lt; std::endl;\n }\n\n [[nodiscard]] float getRadius() const { return radius_; }\n};\n\nLUA_FUNC int NewCircleShape(lua_State* L) {\n const auto radius = static_cast&lt;float&gt;(luaL_checknumber(L, 1));\n auto** p_circle_shape = static_cast&lt;CircleShape**&gt;(lua_newuserdata(L, sizeof(CircleShape*)));\n *p_circle_shape = new CircleShape(radius);\n luaL_getmetatable(L, &quot;CircleMetaTable&quot;);\n lua_setmetatable(L, -2);\n return 1;\n}\n\nLUA_FUNC int DeleteCircleShape(lua_State* L) {\n auto** p_circle_shape = static_cast&lt;CircleShape**&gt;(luaL_checkudata(L, 1, &quot;CircleMetaTable&quot;));\n luaL_argcheck(L, *p_circle_shape != NULL, 1, &quot;Error blah&quot;);\n // if pointer is stored somewhere like a vector remove it now!!!\n delete* p_circle_shape;\n return 0;\n}\n\nLUA_FUNC int GetCircleShapeRadius(lua_State* L) {\n auto** p_circle_shape = static_cast&lt;CircleShape**&gt;(luaL_checkudata(L, 1, &quot;CircleMetaTable&quot;));\n const float radius = (*p_circle_shape)-&gt;getRadius();\n lua_pushnumber(L, radius);\n return 1;\n}\n\nextern &quot;C&quot; LUA_FUNC int luaopen_CircleShapeModule(lua_State * L) {\n\n static constexpr luaL_Reg circle_shape_methods[] = {\n { &quot;getRadius&quot;, &amp;GetCircleShapeRadius },\n {nullptr, nullptr}\n };\n\n static constexpr luaL_Reg circle_shape[] = {\n { &quot;new&quot;, &amp;NewCircleShape },\n {nullptr, nullptr}\n };\n\n luaL_newlib(L, circle_shape);\n\n luaL_newmetatable(L, &quot;CircleMetaTable&quot;);\n luaL_newlib(L, circle_shape_methods);\n lua_setfield(L, -2, &quot;__index&quot;);\n\n lua_pushstring(L, &quot;__gc&quot;);\n lua_pushcfunction(L, DeleteCircleShape);\n lua_settable(L, -3);\n lua_pop(L, 1);\n\n return 1;\n}\n</code></pre>\n"^^ . . "1"^^ . . "You need to use the lua function to get an item out of a table. You can't just convert the Lua table into a C array - you have to keep it as a Lua table and access the items individually. (You can use this to make a C array if you really want to)"^^ . . "0"^^ . "0"^^ . . . "<p>I'm not sure how startPosition is created, as I do not see it in your code snippet.\nHowever, you don't have to calculate anything. The RaycastResult, which you call &quot;raycast&quot; in your code holds the property &quot;Position&quot; (raycast.Position), this returns the Vector3 position value where the raycast hit. This position can directly be used to place the ball instance there.</p>\n"^^ . "1"^^ . "1"^^ . . . "0"^^ . "1"^^ . . "2"^^ . "image"^^ . . . . . . . . . . . . . . . . "-1"^^ . "<p>In Redis, Lua scripts do not support traditional transactions like you might find in a relational database management system (RDBMS). Redis doesn't have built-in support for multi-statement transactions with rollback capabilities like ACID transactions in RDBMS systems.</p>\n<p>The Lua script you've provided is an atomic operation, meaning it will either succeed entirely or fail entirely. It's not a transaction in the traditional database sense, and it doesn't have the concept of rollback in case of failure.</p>\n<p>In your Lua script, if an error occurs (for example, due to invalid arguments or a Redis server issue), the script won't return a value, and your Java application won't receive a response. However, it won't trigger a rollback of previous Redis operations.</p>\n<p>If you need transaction-like behavior in Redis, you can use Redis's built-in MULTI/EXEC transaction mechanism. You can queue multiple commands using MULTI, and then execute them atomically with EXEC. If any of the commands fail, the entire transaction is rolled back. However, Lua scripts do not inherently participate in this transaction mechanism.</p>\n<p>In summary, your Lua script, as written, doesn't provide transaction-like behavior with rollback. If you want to ensure transactions in Redis, you should use the MULTI/EXEC mechanism and not rely solely on Lua scripts for that purpose.</p>\n"^^ . . "1"^^ . . "0"^^ . . . "Manipulating table key"^^ . . . "iterm2"^^ . . "0"^^ . . "1"^^ . . . . "<p>You can use string method <code>rep()</code></p>\n<pre><code>-- columns.lua\nlocal cols = 80 -- Amount of spaces\nlocal tab = {} -- A Table\nlocal space = &quot;\\32&quot; -- Byte for a Space\n\ntable.insert(tab, space:rep(cols)) -- Insert it with length of cols time\n\nprint(tab[#tab] .. 'END') -- Show it\n-- Output: END\n</code></pre>\n"^^ . . "1"^^ . "<p>i can't disable hover in vscde for Lua (I am use sumneko's lua server v3.7.0)</p>\n<p>This bug occurs in GH codespaces and on mac (with vs code Version: 1.83.1)</p>\n<p>(I want to kiil it since while informative, it can be visually distracting.)</p>\n<p><a href="https://i.sstatic.net/cHL32.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cHL32.png" alt="with lua etension enabled," /></a></p>\n<p>FYI: i've tried disabling it in the VScode editor section</p>\n<p><a href="https://i.sstatic.net/C9huN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/C9huN.png" alt="enter image description here" /></a></p>\n<p>and also in the Lua extensions section .</p>\n<p><a href="https://i.sstatic.net/0d1Ek.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0d1Ek.png" alt="enter image description here" /></a></p>\n<p>but no luck. help!</p>\n"^^ . "<p>You can create a template named <code>DEFAULTSORT</code> (or whatever) and use that instead of the magic word to intercept the call.</p>\n<p>For example, this adds a <code>&lt;span&gt;</code> containing the sort key to the page:</p>\n<pre><code>{{DEFAULTSORT:{{{1|}}}|{{{2|}}}}}&lt;span class=&quot;sortkey&quot;&gt;{{{1|}}}&lt;/span&gt;\n</code></pre>\n<p>And then you can just replace the <code>:</code> in previous usages with <code>|</code>:</p>\n<pre><code>{{DEFAULTSORT:Doe, John}}\n</code></pre>\n<pre><code>{{DEFAULTSORT|Doe, John}}\n</code></pre>\n"^^ . "<p>You can use a <code>string.match</code> on your names and specify the correct regex like so:</p>\n<pre><code>local file_path = &quot;/tmp/project1/client_config.json&quot;\nlocal filename_no_config = string.match(file_path, &quot;/tmp/project[1-9]*/(.+)_config.json&quot;)\n\nprint(filename_no_config)\n</code></pre>\n<p>In this case <code>print</code> will write <code>client</code> and will work for <code>project</code> followed by whatever number (even bigger than 2 digits)</p>\n"^^ . . "3"^^ . . . "<p>Include both variants in the condition: <code>(arg == 1 and IsMouseButtonPressed(3) or arg == 2 and IsMouseButtonPressed(1))</code></p>\n<pre><code>function OnEvent(event, arg)\n if event == &quot;PROFILE_ACTIVATED&quot; then\n EnablePrimaryMouseButtonEvents(true)\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and (arg == 1 and IsMouseButtonPressed(3) or arg == 2 and IsMouseButtonPressed(1)) then\n repeat\n MoveMouseRelative(1, 1)\n Sleep(10)\n until not IsMouseButtonPressed(1)\n end\nend\n</code></pre>\n"^^ . "2"^^ . . "How can I insert spaces in a table (lua)"^^ . . . . . . "@user name – What you write may be _grammatically correct_, but not meaningful (to me, at least). When someone asks you what you mean by a phrase (here: _"" is redundant_) you can't explain that by again using the very same phrase. Which meaning do you want to express by _redundant_: superfluous, excessive, repeated, unneeded, extravagant, bountiful, prodigal, abundant, …?"^^ . "lua-table"^^ . "<p>To move the file you can use cd and mkdir in your terminal as that's much easier than learning a lua api. mpv-cut saves it to its own folder so if you find the folder with cd, you can then use bash or powershell commands to move it around as you would like to.</p>\n"^^ . "0"^^ . . . . "I assume you can monkeypatch `require()`? If so, would a `_require = require`/`require = fucntion() ... end` solution work for you?"^^ . . . . "logitech-gaming-software"^^ . . . . "1"^^ . "<p>Is it possible to use string.match and %d+ to do this?\nSay for example:</p>\n<pre><code>function extract_name(file_path)\n local pattern = &quot;/tmp/project%d+/(.-)_config.json&quot;\n local name = string.match(file_path, pattern)\n return name\nend\n</code></pre>\n<p>%d represents a digit (0-9) and the '+' makes this match all combinations containing digits 0-9. This means that you can have more than the 3 directories you mentioned.</p>\n<p>You could then create variables with the directories in and call on the function created above.</p>\n<p>Hopefully that helped.</p>\n"^^ . . "Roblox Studio: Why isn't my values saving with datastore?"^^ . . . "Lua sub-dissector for rtcp inside a proprietary protocol"^^ . "How can I prevent DoFile() calls in an threaded environment with gopher-lua?"^^ . "This should be considered a typo, according to my understanding, what you are looking for should be `local newTable = { [boolName] = false }`"^^ . . . . . . "0"^^ . . "0"^^ . . "3"^^ . "<p>In case you have not yet found a solution, it appears there is an error in your move_player() function.</p>\n<pre><code>box_hit(p.x,newy,\n p.w,p.h,\n w.wx,w.wy,\n w.ww,w.wh) \n</code></pre>\n<p>You use the variable w, which I assume refers to a wall, but you never loop through the table of all the walls to assign the value to w. I think you are missing a for loop, like so:</p>\n<pre><code>for w in all(walls) do\n box_hit(p.x,newy,\n p.w,p.h,\n w.wx,w.wy,\n w.ww,w.wh) \nend \n</code></pre>\n"^^ . "<p>I have creted a lua script requesting vi curl a JSON response from a server. This is the code:</p>\n<pre><code>local buffer = {}\nlocal headers = {\n &quot;Content-Type: application/json&quot;\n}\nurl = &quot;https://apiserver/fsapi/json_emcontacts?username=10001&amp;domain=my.domain.com&quot;\nlocal c = curl.easy {\n url = url,\n ssl_verifypeer = false,\n ssl_verifyhost = false,\n httpheader = headers,\n [curl.OPT_TIMEOUT] = 2,\n}\nc:setopt_writefunction(table.insert, buffer)\nlocal ok, err = c:perform()\nif ok then\n local status = c:getinfo_response_code()\n if status == 200 then\n consoleLog(&quot;info&quot;, &quot;API GET JSON OK\\n&quot;)\n local response = json.decode(table.concat(buffer))\n consoleLog(&quot;info&quot;, &quot;Data = &quot;..response['item1']..&quot;\\n&quot;)\n else\n consoleLog(&quot;info&quot;, &quot;API GET JSON FAIL , status code = &quot;..status..&quot;\\n&quot;)\n end\nelse\n consoleLog(&quot;info&quot;, &quot;API Call Timeout\\n&quot;)\nend\n</code></pre>\n<p>I'm using the &quot;[curl.OPT_TIMEOUT]&quot; to set a timeout for 2 secs. Seems to be working ok, but i'm not able to catch the event when the timeout is complete.... so i'm unable to do actions when this happend.\nDoes someone knows how to print some log or do something when the timeout is complete?\nThanks in advance.</p>\n<p>Ricardo</p>\n"^^ . . . "0"^^ . . "1"^^ . . "Lu-oxmysql Assistance"^^ . . "2"^^ . . . "3"^^ . . . . . . . . . . "<p>Here is my Lua script.</p>\n<pre><code>local field = ARGV[1]\nlocal amount = ARGV[2]\n\nlocal newAmount = redis.call(&quot;HINCRBYFLOAT&quot;, key, field, amount)\nreturn newAmount\n</code></pre>\n<p>I have this lua script in my java application. My concern is if this script fail to return &quot;newAmount&quot; then the script's transactions will roll back or not?</p>\n<p>My expectation is the roll back operation should happen.</p>\n"^^ . . . "@Barmar - I used the link you provided and put an answer below. The trick was getting the indices correct. The post you provided uses `-1` everywhere and it wasn't obvious when and when not to use `-1`. I did not use your suggestion of `lua_settop` because they may pop items, which I didn't want to do. Anyway, I didn't accept my answer because I don't know what proper etiquette is here for creating an answer based on a comment."^^ . "1"^^ . . "3"^^ . . . . "roblox"^^ . "0"^^ . "2"^^ . "1"^^ . . "<p>I am using the sol2 library to create a set of C++ class wrappers. About 10 years ago, I did the same with luabind and, as far as I remember, it was quite straightforward.</p>\n<p>However, now I want to use sol2, since the other one seems abandoned.</p>\n<p>So, what I want to do is:</p>\n<p>Define an abstract class in C++\nCreate another class, and in this class, I would have a method that takes instances of classes that implement the interface.\nIn a method of this same class, be able to call the abstract method, which will point to the Lua implementation.\nI'm not quite sure if I'm making a mistake in the Lua code, but I remember this being possible.</p>\n<p>Lua code:</p>\n<pre class="lang-lua prettyprint-override"><code>local Actor = setmetatable({}, {__index = loopable})\n\nfunction Actor:new()\n local obj = {}\n setmetatable(obj, self)\n self.__index = self\n return obj\nend\n\nfunction Actor:loop()\n print(&quot;Actor:loop&quot;) -- It should print this on `e:run()`\nend\n\nlocal a = Actor:new()\n\nlocal e = engine:new()\ne:add_loopable(a)\ne:run()\n</code></pre>\n<p>Where <code>loopable</code> is my abstract class.</p>\n<p>C++ sol2 code:</p>\n<pre><code>lua.new_usertype&lt;engine&gt;(&quot;engine&quot;,\n &quot;add_loopable&quot;, &amp;engine::add_loopable,\n &quot;run&quot;, &amp;engine::run);\n\n// I do not know how to declare a abstract class.\nlua.new_usertype&lt;loopable&gt;(&quot;loopable&quot;,\n &quot;loop&quot;, &amp;loopable::loop);\n</code></pre>\n<p>Minimal reproducible example: <a href="https://godbolt.org/z/6n71v3Pq3" rel="nofollow noreferrer">https://godbolt.org/z/6n71v3Pq3</a></p>\n"^^ . . "@tehtmi I checked, and for every one person in the server it printed “Message has been…” everytime someone had talked. Could that be the problem?"^^ . . "Lua string matching : how to find a target path"^^ . . "2"^^ . "0"^^ . . "0"^^ . "1"^^ . "1"^^ . . . . . "@tehtmi this is the only script that I have in the game, and i don’t think it can be used in all scripts unless under _G or getgenv or whatever"^^ . . . . "0"^^ . . . "<p>I am trying to create a pause function in my CS50G fifty-bird problem set. However, the image I have to come up is behind the pipes and bird when it is rendered. I am new to using Love2d and Lua but I am not finding any documentation on how to move an image to the front when a key is pressed.</p>\n<pre><code>function PlayState:update(dt)\n \n if love.keyboard.wasPressed('p') then\n\n if self.pause then\n self.pause = false\n scrolling = true\n sounds['music']:play()\n sounds['pause']:pause()\n else\n self.pause = true\n scrolling = false\n sounds['music']:pause()\n sounds['pause']:play()\n\n end\n \n end\n\n if not self.pause then\n \n function PlayState:render()\n for k, pair in pairs(self.pipePairs) do\n pair:render()\n end\n if self.pause then\n love.graphics.draw(pause, 235, 100, center)\n end\n\n love.graphics.setFont(flappyFont)\n love.graphics.print('Score: ' .. tostring(self.score), 8, 8)\n \n self.bird:render()\n</code></pre>\n<p>I have messed around with the code a bit and tried moving the picture to main.lua but that did not work either, or I just did it wrong.</p>\n"^^ . "0"^^ . "0"^^ . . . . . . . . . . . "0"^^ . . . . . . . . . "neovim"^^ . "Knowing nothing about Roblox specifically, I'd guess that what happens is that `OnServerEvent` might get called again each time you start a new game, and each time it will connect additional click handlers. To fix this, you would connect click handlers only once (e.g. outside of an event that can be repeated, or keep track of whether they are connected and don't do it if again if they are), or else disconnect the handlers when the game ends."^^ . . "This looks correct. You can make the array converter into a function so you don't have to write the same code twice. Also maybe think about what you want to do if the argument is not a table, and check what happens if the arguments are missing."^^ . "0"^^ . . . "0"^^ . . . . . . . "1"^^ . "0"^^ . . "Actually, I am facing a network problem on getting return value. How can I assure that"^^ . . . . . . . . . . . . "1"^^ . "3"^^ . "Need help to correctly setup ssl for lua"^^ . . "0"^^ . . "2"^^ . . . . "1"^^ . . . "0"^^ . . "<p>Based on @koyaanisqatsi answer, I found out how to get things working in Go.</p>\n<p>Go code example:</p>\n<pre class="lang-golang prettyprint-override"><code>package main\n\nimport (\n &quot;fmt&quot;\n\n &quot;github.com/yuin/gopher-lua&quot;\n)\n\ntype Person struct {\n Name string\n GivenName string\n Street string\n PostalCode string\n City string\n}\n\nfunc main() {\n p := &amp;Person{\n Name: &quot;Mustermann&quot;,\n GivenName: &quot;Max&quot;,\n Street: &quot;Sackgasse 19&quot;,\n PostalCode: &quot;36304&quot;,\n City: &quot;Alsfeld&quot;,\n }\n\n L := lua.NewState()\n defer L.Close()\n\n if err := L.DoFile(&quot;sample.lua&quot;); err != nil {\n panic(err)\n }\n\n t := L.NewTable()\n t.RawSetString(&quot;name&quot;, lua.LString(p.Name))\n t.RawSetString(&quot;given_name&quot;, lua.LString(p.GivenName))\n t.RawSetString(&quot;street&quot;, lua.LString(p.Street))\n t.RawSetString(&quot;postal_code&quot;, lua.LString(p.PostalCode))\n t.RawSetString(&quot;city&quot;, lua.LString(p.City))\n\n if err := L.CallByParam(lua.P{\n Fn: L.GetGlobal(&quot;call_me&quot;),\n NRet: 1,\n Protect: true,\n }, t); err != nil {\n panic(err)\n }\n\n ret := L.Get(-1) // returned value\n L.Pop(1) // remove received value\n\n fmt.Println(&quot;The result of the Lua function is:&quot;, ret)\n}\n</code></pre>\n<p>sample.lua file:</p>\n<pre class="lang-lua prettyprint-override"><code>function call_me(tbl)\n print(tbl.name)\n print(tbl.given_name)\n print(tbl.street)\n print(tbl.postal_code)\n print(tbl.city)\n\n return 0\nend\n</code></pre>\n<p>Result:</p>\n<pre><code>Mustermann\nMax\nSackgasse 19\n36304\nAlsfeld\nThe result of the Lua function is: 0\n</code></pre>\n"^^ . . "2"^^ . "<p>these are my first steps with gopher-lua. So far I have a worker thread that receives &quot;Actions&quot; over a channel. The worker shall provide the action as a Lua module (so far I have no idea on how to do it better!). In a Lua script, I can import the module and use several getters to get all necessary nformation from this action.</p>\n<p>Here is the action module:</p>\n<pre class="lang-golang prettyprint-override"><code>package action\n\nimport (\n &quot;context&quot;\n &quot;fmt&quot;\n &quot;net/http&quot;\n\n &quot;github.com/croessner/authserv/server/decl&quot;\n &quot;github.com/croessner/authserv/server/logging&quot;\n &quot;github.com/go-kit/log/level&quot;\n &quot;github.com/yuin/gopher-lua&quot;\n)\n\nvar Actions chan *Action\n\ntype Action struct {\n Repeating bool\n ScriptPath string\n ClientIP string\n ClientPort string\n ClientNet string\n Username string\n Password string\n Protocol string\n}\n\nfunc (a *Action) Loader(L *lua.LState) int {\n mod := L.SetFuncs(L.NewTable(), map[string]lua.LGFunction{\n &quot;is_repeating&quot;: a.isRepeating,\n &quot;get_client_ip&quot;: a.getClientIP,\n &quot;get_client_port&quot;: a.getClientPort,\n &quot;get_client_net&quot;: a.getClientNet,\n &quot;get_username&quot;: a.getUsername,\n &quot;get_password&quot;: a.getPassword,\n &quot;get_protocol&quot;: a.getProtocol,\n })\n\n L.Push(mod)\n\n return 1\n}\n\nfunc (a *Action) isRepeating(L *lua.LState) int {\n L.Push(lua.LBool(a.Repeating))\n\n return 1\n}\n\nfunc (a *Action) getClientIP(L *lua.LState) int {\n L.Push(lua.LString(a.ClientIP))\n\n return 1\n}\n\nfunc (a *Action) getClientPort(L *lua.LState) int {\n L.Push(lua.LString(a.ClientPort))\n\n return 1\n}\n\nfunc (a *Action) getClientNet(L *lua.LState) int {\n L.Push(lua.LString(a.ClientNet))\n\n return 1\n}\n\nfunc (a *Action) getUsername(L *lua.LState) int {\n L.Push(lua.LString(a.Username))\n\n return 1\n}\n\nfunc (a *Action) getPassword(L *lua.LState) int {\n L.Push(lua.LString(a.Password))\n\n return 1\n}\n\nfunc (a *Action) getProtocol(L *lua.LState) int {\n L.Push(lua.LString(a.Protocol))\n\n return 1\n}\n\nfunc Worker(ctx context.Context) {\n var a *Action\n\n Actions = make(chan *Action)\n\n for {\n select {\n case &lt;-ctx.Done():\n break\n case a = &lt;-Actions:\n func() {\n L := lua.NewState()\n\n defer L.Close()\n\n L.PreloadModule(&quot;as_action&quot;, a.Loader)\n\n // Other useful modules, i.e.: L.PreloadModule(&quot;as_http&quot;, gluahttp.NewHttpModule(&amp;http.Client{}).Loader)\n\n// THE PROBLEM STARTS HERE BY LOADING THE FILE EACH TIME!\n\n if err := L.DoFile(a.ScriptPath); err != nil {\n level.Error(logging.DefaultErrLogger).Log(decl.LogKeyError, err)\n\n return\n }\n }()\n }\n }\n}\n</code></pre>\n<p>A Go process can do something like:</p>\n<pre class="lang-golang prettyprint-override"><code>// Many calls!\ngo func() {\n action.Actions &lt;- &amp;action.Action{\n Repeating: false,\n ScriptPath: &quot;./server/lua-plugins.d/actions/bruteforce.lua&quot;,\n ClientIP: &quot;1.2.3.4&quot;,\n ClientPort: &quot;12345&quot;,\n ClientNet: &quot;1.2.3.0/24&quot;,\n Username: &quot;alice&quot;,\n Password: &quot;secret&quot;,\n Protocol: &quot;http&quot;,\n }\n}()\n</code></pre>\n<p>The bruteforce.lua looks something like this (example):</p>\n<pre class="lang-lua prettyprint-override"><code>local action = require(&quot;as_action&quot;)\n\nprint(&quot;IP=&quot; .. action.get_client_ip())\nprint(&quot;Port=&quot; .. action.get_client_port())\nprint(&quot;Net=&quot; .. action.get_client_net())\nprint(&quot;Username=&quot; .. action.get_username())\nprint(&quot;Password=&quot; .. action.get_password())\nprint(&quot;Protocol=&quot; .. action.get_protocol())\n\nif action.is_repeating() then\n print(&quot;Action is repeating&quot;)\nend\n\n-- Do something with the data...\n</code></pre>\n<p>As you can see, sending &quot;Actions&quot; will always re-create a new module and it will always open the lua file for each request. I feel that I am doing it the wrong way, even this is currently working.</p>\n<p>Is there a better way to &quot;deliver&quot; data from the Action-struct to Lua and to <em>not</em> use DoFile() calls on any invokation? I guess the latter is more important than the first question, but it might depend on each other.</p>\n<p>I also feel that it might be a problem to create lots of LStates! Maybe also related to the wrong approach I took.</p>\n<p>Any help is very welcome and many thanks in advance.</p>\n"^^ . . "@Barmar `lua_settop` isn't even strictly needed. If you know which arguments you want, you can just ignore any others by working with negative indices to reference elements from the top of the stack. As you fetch values from the table, they will be pushed to the top of the stack, and can be found at index `-1`. I think the previously linked question effectively has the answer, though, and this a duplicate. Just needs to be adjusted to floating-points. roughly: https://godbolt.org/z/ead9hefns"^^ . . . . . "0"^^ . . . . . "0"^^ . . "mediawiki"^^ . . . . "0"^^ . . . "kubernetes"^^ . . . . "<p>You need to be careful with the pattern. Assuming you want to match <em>exactly</em> the test strings you have given, where the filename may vary in the prefix, but the suffix needs to be <code>_config.json</code>, and the name of the <code>project</code> folder may vary in the suffix, use the pattern <code>^/tmp/project[^/]+/([^/]+)_config.json</code> for <code>string.match</code>:</p>\n<pre><code>print((&quot;/tmp/project[^/]+/server_config.json&quot;):match&quot;^/tmp/project1/([^/]+)_config.json&quot;) -- server\n</code></pre>\n<p>Note also the nuances in the patterns by the other answerers:</p>\n<ul>\n<li><code>/tmp/project%d+/(.-)_config.json</code> misses <em>anchors</em> (<code>^</code> and <code>$</code>). (Assuming this is unintended) this is a frequent mistake in Lua patterns. This will match anything that has something matching <code>/tmp/project%d+/(.-)_config.json</code> anywhere in it; it will also accept the <code>*_config.json</code> file being included in a subdirectory of the project. The following will match, for example: <code>/foo/bar/tmp/project42/subfolder/server_config.json.blah.blub</code>, and the match would be <code>subfolder/server</code>.</li>\n<li><code>.*/(.+)_config.json</code> effectively matches just the filename, and removes a suffix of <code>_config.json</code>. Note that this also isn't anchored. A <code>^</code> anchor isn't needed here, as <code>.*</code> being greedy already suffices to start at the start of the string, but this pattern will allow arbitrary suffixes after <code>_config.json</code>. It will also allow arbitrary parent folders as it matches just the filename. <code>/blah/blub/server_config.json.blah.blub</code> would match as just <code>server</code>.</li>\n<li><code>/tmp/project[1-9]*/(.+)_config.json</code> is similar to the first pattern in that it isn't anchored. It will pretty much have the same issues; it allows <code>[1-9]*</code> rather than <code>%d+</code> as the project folder suffix though.</li>\n</ul>\n"^^ . "<p>I made a small test and seems to be working fine here.</p>\n<pre><code>local t = {\n blah = &quot;hello&quot;\n}\n\nfunction string.insert(originalString, insertString, position)\n position = math.min(math.max(position, 1), #originalString + 1)\n return originalString:sub(1, position - 1) .. insertString .. originalString:sub(position)\nend\n\nprint(&quot;Before -&gt; &quot; ..t.blah)\nt.blah = t.blah:insert(&quot; &quot;, 3)\nprint(&quot;After -&gt; &quot; ..t.blah)\n\n-- output: Before -&gt; hello\n-- output: After -&gt; he llo\n</code></pre>\n"^^ . . "0"^^ . . . . . . . . . "0"^^ . . . "0"^^ . "windows-10"^^ . . . . . "<p>Use a constructor function to create tables with a metatable that has an <code>__index</code> metamethod that recursively calls the constructor function to create new table depths when an indexed key is not present.</p>\n<p>Here is a condensed example, but this can be written to reuse the metatable.</p>\n<pre class="lang-lua prettyprint-override"><code>local function nestable(t)\n return setmetatable(t or {}, {\n __index = function (self, key)\n local new = nestable {}\n rawset(self, key, new)\n return new\n end\n })\nend\n\nlocal data = nestable {}\n\ndata.raw.a1.a2 = { foo = 'bar' }\n\nprint(data.raw.a1.a2.foo)\n</code></pre>\n<p>Result:</p>\n<pre><code>bar\n</code></pre>\n"^^ . . . . "2"^^ . "0"^^ . "2"^^ . . . . "1"^^ . . . . . "<p>I have a file <code>foo.lua</code> that I'm running with <code>lua foo.lua</code>. The file requires a package <code>__base__/bar</code> like so:</p>\n<pre class="lang-lua prettyprint-override"><code>-- foo.bar\nrequire(&quot;__base__/bar&quot;)\n\nprint(&quot;foo&quot;)\n</code></pre>\n<p>File <code>bar.lua</code> is in <code>C:\\Temp</code>, which is also the <code>__base__</code> path.</p>\n<p><strong>How do I make the require look into <code>C:\\Temp</code> whenever a <code>require</code> imports from <code>__base__</code>?</strong> I cannot change that that line: <code>require(&quot;__base__/bar&quot;)</code>!</p>\n<p>I tried the following in <code>foo.lua</code> which does print the correct path, but somehow it still does not require:</p>\n<pre class="lang-lua prettyprint-override"><code>-- foo.bar\nlocal function custom_loader(name)\n -- Replace &quot;__base__&quot; with &quot;C:/Temp&quot; in the module name\n local modified_name = name:gsub(&quot;__base__&quot;, &quot;C:/Temp&quot;)\n -- Attempt to load the module using the modified name\n print(&quot;DEBUG&quot;, package.searchpath(modified_name, &quot;?.lua&quot;))\n return package.searchpath(modified_name, &quot;?.lua&quot;)\nend\ntable.insert(package.searchers, custom_loader)\n\nrequire(&quot;__base__/bar&quot;)\n\nprint(&quot;foo&quot;)\n</code></pre>\n<pre><code>PS C:\\Users\\Daniel\\Documents\\source\\asset&gt; .\\lua52.exe .\\foo.lua\nDEBUG: C:/Temp/bar.lua\nC:\\Users\\Daniel\\Documents\\source\\asset\\lua52.exe: .\\foo.lua:10: module '__base__/bar' not found:\n no field package.preload['__base__/bar']\n no file 'C:\\Users\\Daniel\\Documents\\source\\asset\\lua\\__base__/bar.lua'\n no file 'C:\\Users\\Daniel\\Documents\\source\\asset\\lua\\__base__/bar\\init.lua'\n no file 'C:\\Users\\Daniel\\Documents\\source\\asset\\__base__/bar.lua'\n no file 'C:\\Users\\Daniel\\Documents\\source\\asset\\__base__/bar\\init.lua'\n no file '.\\__base__/bar.lua'\n no file 'C:\\Users\\Daniel\\Documents\\source\\asset\\__base__/bar.dll'\n no file 'C:\\Users\\Daniel\\Documents\\source\\asset\\loadall.dll'\n no file '.\\__base__/bar.dll'\n no file 'C:\\Users\\Daniel\\Documents\\source\\asset\\__base__/bar52.dll'\n no file '.\\__base__/bar52.dll'C:/Temp/bar.lua\nstack traceback:\n [C]: in function 'require'\n .\\foo.lua:10: in main chunk\n [C]: in ?\n</code></pre>\n"^^ . "<blockquote>\n<p>Where are the pairs &quot;1 , secondBool&quot; and &quot;2, false&quot; coming from?</p>\n</blockquote>\n<p>From here:</p>\n<pre class="lang-lua prettyprint-override"><code>local newTable = {boolName, false,}\n</code></pre>\n<p>This is equivalent to</p>\n<pre class="lang-lua prettyprint-override"><code>local newTable = {}\nnewTable[1] = boolName\nnewTable[2] = false\n</code></pre>\n<blockquote>\n<p>What is a better way to write a function to change a value in dictionary?</p>\n</blockquote>\n<p>If you want to mutate the table: Just <code>boolValues[boolName] = state</code>. No need for a function (note that due to proxy tables with <code>__index</code> and <code>__newindex</code> metamethods, this also isn't a problem if you decide that you need to hook this later on).</p>\n<p>If you want to create a mutated copy, first copy, then mutate. A simple shallowcopy would be:</p>\n<pre class="lang-lua prettyprint-override"><code>local function shallowcopy(t)\n local copy = {}\n for k, v in pairs(t) do copy[k] = v end\n return copy\nend\n</code></pre>\n"^^ . . . "2"^^ . . . "1"^^ . . . . . . . . "Oops, I meant inserting a string only containing spaces (like this: " ") in a table, not inserting a space in a string in a table."^^ . . . "<p>To include a double quote (<strong>&quot;</strong>) within a Lua <a href="https://www.lua.org/pil/2.4.html" rel="nofollow noreferrer">string</a> the character must be escaped. Escaping a character means the character will be treated as part of the string, rather than a Lua instruction. To escape a character place a backslash (<strong>\\</strong>) in front of it, like so:</p>\n<pre><code>local message = &quot;he said \\&quot;bye\\&quot; and left&quot;\nprint(message)\n--Output would be: he said &quot;bye&quot; and left\n</code></pre>\n"^^ . . "I think that would Work. Could you pleased Post a complete answer,because the comment alone doesnt Help me solve my Problem."^^ . "krakend lua scripting fail by load lib"^^ . . "3"^^ . . . . . . . . "A bit awkward to post in a comment, but something like `local function probe(tbl) for k, v in pairs(tbl) do if type(v) == "table" then probe(v) end end if type(tbl.track == "string") then tbl.aura = tbl.track; tbl.track = nil end end`. May also be slightly more efficient :)"^^ . "Start by opening the base library: `lua.open_libraries(sol::lib::base);`"^^ . . . . . "0"^^ . . . "<p>I am attempting to insert a series of tables that have values generated by a function. I have noticed that the generated tables all have the same address and thusly only the most recently generated table is recognized in my program.</p>\n<p>The below represents code in a file the main program is fetching from.</p>\n<p>a.lua</p>\n<pre class="lang-lua prettyprint-override"><code>local a = {}\nlocal b = {}\n\nb.x = 0\nb.y = 0\nb.z = 'Static'\n\nfunction a.new(x, y)\n b.x = x\n b.y = y\n return b\nend\n</code></pre>\n<p>What follows is an example of how the above code is implemented.</p>\n<p>b.lua</p>\n<pre class="lang-lua prettyprint-override"><code>a = require 'a'\n\nd = {}\n\ntable.insert(d, a.new(1, 2))\ntable.insert(d, a.new(2, 3))\n</code></pre>\n<p>The tables generated by a.new all have identical addresses (ie 0x0000001). Because of this, the last table.insert is overwriting the previous table that was generated and there are various entries into the &quot;d&quot; table all pointing to the same location.</p>\n<p>How can I go about generating tables in this way with unique addresses?</p>\n"^^ . . . "Lua: Function to Change Value in Dictionary"^^ . "1"^^ . . "lua-api"^^ . . . "0"^^ . "Pattern will work for the example paths, but note that `.+` may include `/`, which is probably not desirable here. Side note: Lua patterns are not to be confused with regex (they have features "true" regex doesn't have, and they lack choice (`|`), which regex has)."^^ . "2"^^ . "<h1>The Objective</h1>\n<p>I want to set a specific config for a plugin if a certain colorscheme is applied at startup.</p>\n<h1>What I tried</h1>\n<pre class="lang-lua prettyprint-override"><code>If vim.cmd(&quot;colorscheme&quot;) == &quot;oxocarbon&quot; then\n print(&quot;this is oxocarbon&quot;)\nelse\n print(&quot;this isn't oxocarbon&quot;)\nend\n</code></pre>\n<h1>The problem</h1>\n<p>Everytime I open neovim the theme oxocarbon loads, but the return is &quot;this isn't oxocarbon&quot;.</p>\n<h1>Minimal config - init.lua</h1>\n<pre class="lang-lua prettyprint-override"><code>require('lazy').setup({\n{ import = &quot;plugins.core&quot; } -- oxocarbon get installed and loaded\n})\nrequire(&quot;macros&quot;) -- the if statement \n</code></pre>\n<h1>Note</h1>\n<p>After <code>VimEnter</code>, when I type the command <code>:lua vim.cmd(&quot;colorscheme&quot;)</code> (or simply <code>:colorscheme</code>), it returns &quot;oxocarbon&quot; (Which is the configured theme loaded during <code>VimEnter</code>)</p>\n"^^ . . "0"^^ . . . . "2"^^ . . . "0"^^ . . "<p>You can define a special error handler location that will route a request to the approriate error page:</p>\n<pre><code>\n location /error-handler {\n content_by_lua_block {\n local var_value = os.getenv('YOUR_ENV_VAR')\n if var_value == 'some_condition' then\n ngx.exec('/error-pages/404.html')\n else\n ngx.exec('/error-pages/404-2.html')\n end\n }\n }\n\n error_page 404 /error-handler;\n}\n</code></pre>\n"^^ . . "0"^^ . . . "<h4>About rewrite</h4>\n<p>See <a href="https://docs.fluentbit.io/manual/pipeline/filters/rewrite-tag#configuration-example" rel="nofollow noreferrer">https://docs.fluentbit.io/manual/pipeline/filters/rewrite-tag#configuration-example</a></p>\n<p>After you made a rewrite with</p>\n<pre><code>rule $log ^.*$ s3.$namespace_name.$app_name.$container_name.$pod_id true\n</code></pre>\n<p>your tag turned to be s3.*, so your s3 output shouldn't match s3logs.* but s3.*, that's why you didn't get rewrited log</p>\n<p>So output should look like:</p>\n<pre><code>outputs: |\n [OUTPUT]\n Name s3\n Match s3.*\n# etc\n</code></pre>\n<h4>About extension</h4>\n<p>See <a href="https://docs.fluentbit.io/manual/pipeline/outputs/s3#allowing-a-file-extension-in-the-s3-key-format-with-usduuid" rel="nofollow noreferrer">https://docs.fluentbit.io/manual/pipeline/outputs/s3#allowing-a-file-extension-in-the-s3-key-format-with-usduuid</a></p>\n<p>You should change line to</p>\n<pre><code>s3_key_formatm /%Y/%m/%d/$TAG[1]/$TAG[2]/$TAG[3]/$TAG[3]-$TAG[1]-%Y%m%d-%H%M-${podid}-$UUID.txt\n</code></pre>\n"^^ . "<p>Im attempting to make a simple debugger for my game engine to allow to to step line by line through a lua script loaded from disk. All done via the c api.</p>\n<p>I can setup a hook to trigger every line, or every x instructions etc.\nI can also create thread/coroutines to allow yielding which can return control flow back to c.</p>\n<p>The issue comes when trying to combine these. The lua script should not have to invoke anything special for this. is calling <code>lua_yield</code> not allowed from a hook function?</p>\n<p>Here I create a new lua state, a new lua thread, set a hook and run <code>script.lua</code> using <code>pcallk</code></p>\n<pre class="lang-c prettyprint-override"><code>lua_State* L = luaL_newstate();\nluaL_openlibs(L);\nlua_State* T = lua_newthread(L);\nlua_sethook(T, &amp;hookfunc, LUA_HOOKLINE, 1); // Run a hook to trigger every line\nluaL_loadfile(T, &quot;script.lua&quot;);\nint nres; // throwaway, unused\nint status = lua_resume(T, 0, 0, &amp;nres); // Run the script so that it can yield\n</code></pre>\n<p>The hook function simply calls yield.</p>\n<pre class="lang-c prettyprint-override"><code>lua_yield(L, 0);\n</code></pre>\n<p>This doesn't work as expected, is this legal? did I miss something in documentation.</p>\n<p>I've looked at:</p>\n<ul>\n<li>PIL 4th edition.</li>\n<li>The lua.org documentation</li>\n<li><a href="http://lua-users.org/wiki/SandBoxes" rel="nofollow noreferrer">This sandbox page</a></li>\n<li>And an old email thread i cannot find the link to</li>\n</ul>\n<p>I will reiterate this is to be done in the c api, the lua script itself doesn't invoke anything</p>\n"^^ . . . . . "0"^^ . "<p>I see you have a variable set as <code>aplied</code> and you have referenced <code>applied</code> (once with a double <code>p</code>) which won't refer to the original variable <code>aplied</code> (with a single <code>p</code>). so <code>applied</code> is a <code>nil value</code> since it isn't set to anything.</p>\n<p>related line of code for your reference:</p>\n<pre class="lang-py prettyprint-override"><code>elseif aplied ~= color and 0 then\n rs.setBundledOutput(side, colors.combine(--&gt;applied&lt;--, color))\n</code></pre>\n"^^ . . "0"^^ . . "0"^^ . "0"^^ . . "awesome-wm"^^ . . "<p>Vector arithmetic is pretty simple once you know the trick. You just apply each operation to each component of the vectors.</p>\n<p>For example:</p>\n<pre><code>local a = Vector3.new(1, 2, 3)\nlocal b = Vector3.new(4, 5, 6)\n\nprint(a + b) -- returns (5, 7, 9)\nprint(a - b) -- returns (-3, -3, -3)\nprint(a * b) -- returns (4, 10, 18)\nprint(a / b) -- returns (0.25, 0.4, 0.5)\n</code></pre>\n<p>So if you wanted to perform an operation on just one component of the vector, you can apply a <a href="https://en.m.wikipedia.org/wiki/Mask_(computing)" rel="nofollow noreferrer">mask</a> to the vector that will strip out the other values. More simply put, you multiply the values that you don't care about by zero, and you preserve the ones you do by multiplying them by one.</p>\n<pre><code>local direction = (endPosition - startPosition).Unit * range\n\nif raycast then\n local pos = raycast.Instance.Position\n local mask = Vector3.new(0, 0, 1)\n\n -- subtract the position's z value from the direction\n direction -= (pos * mask)\nend\n\n</code></pre>\n"^^ . "@Rodrigo read what UnholySheep wrote, I meant same thing. Even with lambda your approach works only if it's a captureless one (and any async call would have a problem if a copy of capturing lambda wasn't saved somewhere, because it would cease to exist after exit from `set`. An inline function in LUA is a rough equivalent of capturing lambda in C++."^^ . . . "0"^^ . . "1"^^ . . "0"^^ . . "3"^^ . "0"^^ . . . "0"^^ . "The action-handling shall be dynamic, so the ScriptPath is a member in the Action-struct. Second problem is that all struct values are dynamic and if I only have _one_ LState, the PreLoadModule is done only once and all ongoing actions share the same wrong values. If you have a look at the lua example above: I have getters for each struct field. And of course that must provide current data; not the data which was initally preloaded (module with the first call. :-)"^^ . . . "0"^^ . "<p>PEG (Parser Expression Grammars) are inherently left-to-right greedy. This means, among other things that left recursion needs to be avoided.</p>\n<blockquote>\n<p>Why not choose (simexp&gt;&gt;binop&gt;&gt;simexp) when it fails</p>\n</blockquote>\n<p>When what fails? If <code>simexp</code> fails, then by definition the second branch fails because it starts with a <code>simexp</code>. In the general case, parsers <code>a|a &gt;&gt; b</code> will never parse the second branch, because if the <code>a</code> in <code>a &gt;&gt; b</code> would match, then the first branch had already won.</p>\n<p>The logical workaround here seems to rephrase as <code>a &gt;&gt; b|a</code> or indeed even <code>a &gt;&gt; -b</code> depending on the intent/AST.</p>\n<h2>Review</h2>\n<p>There's a lot in the grammar shown that I think can (and should) be fixed. However, most of it is surrounding AST propagation and you specifically left the code out. You can consider posting (a link to) more complete code at codereview.stackexchange.com if you're interested in feedback.</p>\n"^^ . . . . . "luarocks"^^ . "I only know what I read in the documentation. It looks like you don't need to `:Play()`, so maybe `:Destroy()` instead (without waiting) after `sonido.PlayOnRemove = true`. (Probably set all the sound properties before `:Play()` or `:Destroy()`)"^^ . "x3::phrase_parse is not expected"^^ . "0"^^ . . . "1"^^ . "0"^^ . . . . "1"^^ . . . "<p><em>Error: Attempt to index global 'W' (a nil value)</em></p>\n<p>Hello! I am having trouble getting collision working with a different system that spawns sprites in from the map screen.</p>\n<p>This is the collision tutorial I used: <a href="https://youtu.be/Recf5_RJbZI?si=Df6FbJ2FYfCN39Qx" rel="nofollow noreferrer">https://youtu.be/Recf5_RJbZI?si=Df6FbJ2FYfCN39Qx</a>\nThis is the sprite spawning tutorial I used: <a href="https://youtu.be/8jb8SHNS66c?si=233nn8z_S1R4R64n" rel="nofollow noreferrer">https://youtu.be/8jb8SHNS66c?si=233nn8z_S1R4R64n</a></p>\n<p>I have watched TONS of tutorials on this and still can't wrap my head around it. A lot of tutorials create very basic collision that has issues, like only being able to work with certain speed values (1,2,4,8,16,etc.) or that don't let your character slide alongside a wall when holding a diagonal.</p>\n<p>Can anyone help? I definitely want to use this spawning system in the future to spawn in different types of walls and enemies. I have a feeling that I am misunderstanding how to use the table variables properly, so any explanation would be appreciated!</p>\n<pre><code>-- game loop --\n\nfunction _init()\n cls()\n walls={}\n make_player()\n make_walls()\n -- top-left and lower-right\n -- bounds of player area\n a1,b1=8,8\n a2,b2=112,112\nend\n\nfunction _update60()\n -- keep inside the play area\n move_player()\n p.x=mid(a1,p.x,a2)\n p.y=mid(b1,p.y,b2)\nend\n\nfunction _draw()\n cls()\n draw_map()\n draw_player()\n \n for w in all(walls) do\n spr(w.wsp,w.wx,w.wy)\n end \nend\n</code></pre>\n<pre><code>-- map --\n\nfunction draw_map()\n map(0,0,0,0,16,16)\nend\n</code></pre>\n<pre><code>-- player --\n\nfunction make_player()\n p={\n x=40,\n y=40,\n w=8,\n h=8,\n speed=2,\n sprite=1,\n }\nend\n\nfunction move_player()\n --move player with buttons\n --interacts with wall collision\n if (btn(⬅️)) then\n for newx=p.x,p.x-p.speed,-1 \n do\n if not box_hit(newx,p.y,\n p.w,p.h,\n w.wx,w.wy,\n w.ww,w.wh) \n then\n p.x=newx\n end\n end\n end\n \n if (btn(➡️)) then\n for newx=p.x,p.x+p.speed \n do\n if not box_hit(newx,p.y,\n p.w,p.h,\n w.wx,w.wy,\n w.ww,w.wh) \n then\n p.x=newx\n end\n end\n end\n \n if (btn(⬆️)) then\n for newy=p.y,p.y-p.speed,-1 \n do\n if not box_hit(p.x,newy,\n p.w,p.h,\n w.wx,w.wy,\n w.ww,w.wh) \n then\n p.y=newy\n end\n end\n end\n \n if (btn(⬇️)) then\n for newy=p.y,p.y+p.speed \n do\n if not box_hit(p.x,newy,\n p.w,p.h,\n w.wx,w.wy,\n w.ww,w.wh) \n then\n p.y=newy\n end\n end\n end\nend\n\n--draw player\nfunction draw_player()\n spr(p.sprite,p.x,p.y)\nend\n</code></pre>\n<pre><code>-- walls --\n\nfunction make_walls()\n for x=0,15 do\n for y=0,15 do\n if mget(x,y)==65 then\n add(walls,{\n wx=x*8,\n wy=y*8,\n ww=8,\n wh=8,\n wsp=66\n })\n mset(x,y,64)\n end\n end\n end\nend\n\n--wall collision calculations\n\nfunction box_hit(x1,y1,\n w1,h1,\n x2,y2,\n w2,h2)\n\n local hit=false\n local xd=abs((x1+(w1/2))-(x2+w2/2))\n local xs=w1/2+w2/2\n local yd=abs((y1+(h1/2))-(y2+h2/2))\n local ys=h1/2+h2/2 \n \n if xd &lt; xs and yd &lt; ys then\n hit=true\n end\n \n return hit\n \nend\n</code></pre>\n"^^ . . . "0"^^ . . . . . . "Well what typically happens is after the hook returns, program control returns back to lua, whereas i wanted it to return to c"^^ . . . "2"^^ . "<p>That's so far as I can see,</p>\n<ul>\n<li>It looks like there wont write <code>Action</code> by Lua. Why not a Lua table to &quot;deliver&quot; data instead.</li>\n<li><a href="https://github.com/yuin/gopher-lua?tab=readme-ov-file#sharing-lua-byte-code-between-lstates" rel="nofollow noreferrer">Sharing Lua byte code between LStates</a> as @kostix mentioned.</li>\n<li>It is a way to avoid create lots of LStates if you need: <a href="https://github.com/yuin/gopher-lua?tab=readme-ov-file#the-lstate-pool-pattern" rel="nofollow noreferrer">The LState pool pattern\n</a></li>\n</ul>\n<p>I tend to set the action module up like this:</p>\n<pre class="lang-golang prettyprint-override"><code>package action\n\nimport (\n &quot;bufio&quot;\n &quot;context&quot;\n &quot;log&quot;\n &quot;os&quot;\n &quot;sync&quot;\n\n lua &quot;github.com/yuin/gopher-lua&quot;\n &quot;github.com/yuin/gopher-lua/parse&quot;\n)\n\nvar Actions chan *Action\n\ntype Action struct {\n Repeating bool\n ScriptPath string\n ClientIP string\n ClientPort string\n ClientNet string\n Username string\n Password string\n Protocol string\n}\n\nfunc (a *Action) ToLuaTable() *lua.LTable {\n tab := &amp;lua.LTable{}\n tab.RawSet(lua.LString(&quot;Repeating&quot;), lua.LBool(a.Repeating))\n tab.RawSet(lua.LString(&quot;ClientIP&quot;), lua.LString(a.ClientIP))\n tab.RawSet(lua.LString(&quot;ClientPort&quot;), lua.LString(a.ClientPort))\n tab.RawSet(lua.LString(&quot;ClientNet&quot;), lua.LString(a.ClientNet))\n tab.RawSet(lua.LString(&quot;Username&quot;), lua.LString(a.Username))\n tab.RawSet(lua.LString(&quot;Password&quot;), lua.LString(a.Password))\n tab.RawSet(lua.LString(&quot;Protocol&quot;), lua.LString(a.Protocol))\n return tab\n}\n\n// I borrow it from https://github.com/yuin/gopher-lua?tab=readme-ov-file#sharing-lua-byte-code-between-lstates\n// ============================\n// ============================\n// CompileLua reads the passed lua file from disk and compiles it.\nfunc CompileLua(filePath string) (*lua.FunctionProto, error) {\n file, err := os.Open(filePath)\n defer file.Close()\n if err != nil {\n return nil, err\n }\n reader := bufio.NewReader(file)\n chunk, err := parse.Parse(reader, filePath)\n if err != nil {\n return nil, err\n }\n proto, err := lua.Compile(chunk, filePath)\n if err != nil {\n return nil, err\n }\n return proto, nil\n}\n// ============================\n// ============================\n\n\nfunc DoCompiledProto(L *lua.LState, proto *lua.FunctionProto, a *Action) error {\n lFunc := L.NewFunctionFromProto(proto)\n L.Push(lFunc)\n\n tab := a.ToLuaTable()\n L.Push(tab)\n return L.PCall(1, lua.MultRet, nil)\n}\n\nvar luaProtos sync.Map\n\nfunc Worker(ctx context.Context) {\n var a *Action\n\n Actions = make(chan *Action)\n\n for {\n select {\n case &lt;-ctx.Done():\n break\n case a = &lt;-Actions:\n func() {\n L := lua.NewState()\n\n defer L.Close()\n\n // Run FunctionProto if it cached\n if proto, ok := luaProtos.Load(a.ScriptPath); ok {\n if err := DoCompiledProto(L, proto.(*lua.FunctionProto), a); err != nil {\n log.Print(err)\n return\n }\n\n } else {\n // Compile and cache FunctionProto if cache miss\n if newProto, err := CompileLua(a.ScriptPath); err != nil {\n log.Print(err)\n return\n } else {\n luaProtos.Store(a.ScriptPath, newProto)\n\n // Run FunctionProto\n if err := DoCompiledProto(L, newProto, a); err != nil {\n log.Print(err)\n return\n }\n }\n }\n }()\n }\n }\n}\n\n</code></pre>\n<p>And the bruteforce.lua:</p>\n<pre class="lang-lua prettyprint-override"><code>-- first index of args contains the &quot;action&quot; table\nlocal args = {...}\nlocal action = args[1]\n\nprint(&quot;IP=&quot; .. (action.ClientIP and action.ClientIP or &quot;nil&quot;))\nprint(&quot;Port=&quot; .. (action.ClientPort and action.ClientPort or &quot;nil&quot;))\nprint(&quot;Net=&quot; .. (action.ClientNet and action.ClientNet or &quot;nil&quot;))\nprint(&quot;Username=&quot; .. (action.Username and action.Username or &quot;nil&quot;))\nprint(&quot;Password=&quot; .. (action.Password and action.Password or &quot;nil&quot;))\nprint(&quot;Protocol=&quot; .. (action.Protocol and action.Protocol or &quot;nil&quot;))\n\nif action.Repeating == true then\n print(&quot;Action is repeating&quot;)\nend\n</code></pre>\n<p>If there is a better way, please let me know. ;-)</p>\n"^^ . . "<p>As you have seen, if you remove the line with a <code>require</code> that will work. The thing with Lua in KrakenD is that is not a regular Lua engine, but kind of a virtual machine that is restricted to the standard library and has no dependency injection. You cannot use Lua Rocks neither import anything that is not under the <code>sources</code> directory.</p>\n<p>So you cannot import Lua libraries like this (require). If you want to include JSON parsing libraries you will need to import them by hand under <code>sources</code>.</p>\n"^^ . . . . . . "How to highlight player and speed coil in boblox studio"^^ . . . . . . . . . . . "Your error doesn't match with the code posted. `Error: Attempt to index global 'W' (a nil value)` The code you posted does not contain an uppercase W, only lowercase.\nPlease paste the full code and include the complete error message (including line number)"^^ . "0"^^ . . . "1"^^ . . . . "Is there a difference between global require and local require within a function"^^ . . . . "-1"^^ . . . . "1"^^ . "0"^^ . . . . "<p>Maybe somebody knows how to add <a href="https://github.com/nvim-neotest/neotest-jest" rel="nofollow noreferrer">neotes-jest</a> to <a href="https://github.com/nvim-neotest/neotest" rel="nofollow noreferrer">neotest</a> configuration\ninside <a href="https://github.com/AstroNvim/AstroNvim" rel="nofollow noreferrer">AstroNvim</a>?</p>\n<p>P.S. Documentation didn't help</p>\n"^^ . "3"^^ . "video-processing"^^ . . . . "How to improve Pico-8 Collision?"^^ . "config"^^ . "3"^^ . . . . "wireshark-dissector"^^ . "1"^^ . . . "`cairo_image_surface_create_from_png` returns "out of memory", but I have enough memory"^^ . "2"^^ . . . . "<p>Whenever i use body gyros to make the player look straight up it starts flinging the character, and sometimes just slightly straight up and it still flings the character, i've searched around but couldn't find a solution for my problem, any tips or advice on how i can prevent this issue or an alternative solution?</p>\n<p>This is how i make the player look in the direction the velocity is going:\nbodyGyro.CFrame = CFrame.lookAt(Vector3.new(), bodyVelocity.Velocity.Unit * 2 * rayDirection)</p>\n<p>The rayDirection is just either 1 or -1.</p>\n<p>i've tried disabling ragdoll on the humanoid but that didn't help.</p>\n"^^ . "0"^^ . "Yes, I overlooked the greedy nature of left recursion, and I will eliminate the problem of ATS\n\nThe test code is complete"^^ . . . "`response` is global? Could some other code be overriding it? (Not sure if it's possible for Roblox to yield here, for vanilla Lua I would say no...)"^^ . . "0"^^ . "That's correct; you're resuming to the coroutine created on line 3 in your script, which I missed, although, as far as I understand, this behavior with `lua_yieldk` is going to have the same effect as simply returning from the hook."^^ . "1"^^ . "If you want to have the ball part exactly where the Raycast hit, you did it incorrectly. Currently it will be placed in the middle between the hit and the start position, as you're doing startPosition + hit (end position), divided by two.\n\nReplaced CFrame.new with CFrame.lookAt(hit, startPosition). And see what happens.\n\nAlthough, I do not know why you want to use a CFrame lookat method, since it's a ball."^^ . . . . . "The error would suggest you are trying to get the value of some table element that does not exist...are you sure "rs" (I'm assuming stands for redstone) is valid and that it contains those methods? You can use a for loop and print the contents of that table to check."^^ . "Please trim your code to make it easier to find your problem. Follow these guidelines to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example)."^^ . . . "I am not 100% sure. When I started with Dovecot Lua, I found it really nice that there was expected a Lua function that had an object/table as argument. You as a Lua dev had to write this function and use this table. Now to my question: I would like to have this in my Go apps to. Expecting a Lua function that provides a table as arg and a user must use it. And I do not know how to do it."^^ . "0"^^ . . "0"^^ . . "1"^^ . . . . . "0"^^ . . . . . . "0"^^ . . . . "0"^^ . . . . . . . "<p>I've tried to make a function in Lua to get the circumcircle, circumcenter and radius, but something goes wrong:</p>\n<pre><code>local function getCircumcircle (x1, y1, x2, y2, x3, y3)\n local d = 2*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))\n local t1, t2, t3 = x1*x1+y1*y1, x2*x2+y2*y2, x3*x3+y3*y3\n local x = (t1*(y2-y3)+t2*(y3-y1)+t3*(y1-y2))/d\n local y = (t1*(x3-x2)+t2*(x1-x3)+t3*(x2-x1))/d\n local radius = math.sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y))\nend\n</code></pre>\n"^^ . . "As for "is my solution right?": The nice thing about code is that you can easily test it. Randomized algorithms are harder to test, but you can still run some basic tests - for example, if you just count how often each number appears in each position, or average the numbers for each position, you should roughly get an equal distribution. [I happen to have such a test lying around](https://github.com/TheAlgorithms/Lua/blob/main/.spec/random/shuffle_spec.lua). Your implementation will likely fail this test due to reasons outlined by tehtmi."^^ . . "Crash when passing a Lua function as a callback, works well with C++ lambdas"^^ . . . . "Ignore content_by_lua_file under some circumstances and let NGINX do it's job"^^ . . "0"^^ . . "0"^^ . "0"^^ . "You could set a column fence so the RTCP dissector doesn't overwrite the info column but rather appends to it. Ref 11.5.2.6: https://www.wireshark.org/docs/wsdg_html/#lua_class_Column. Or you could read the Info column and overwrite it again with that same string after RTCP has written to it."^^ . "1"^^ . . . "<p>I was following this tutorial here to set up NeoVim:<br />\n<a href="https://www.youtube.com/watch?v=J9yqSdvAKXY" rel="nofollow noreferrer">https://www.youtube.com/watch?v=J9yqSdvAKXY</a></p>\n<p>However, it doesn't work and throws a weird error that I don't understand and can't find anything on google for.</p>\n<p>I know that this tutorial is for Linux, but I followed another tutorial for windows with the same results.</p>\n<p>Restarting/-installing Neovim does not solve the issue.</p>\n<h3>Environment</h3>\n<p>I am working on Windows 11 (22H2) with NeoVim 0.9.2.</p>\n<p>NeoVim does start (and Packer installed the plugins), but with an error in the lua scripts.</p>\n<p>My structure inside the nvim folder is this:<br />\n(Why the icons are not working is another question...)<br />\n<a href="https://i.sstatic.net/PVBWg.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PVBWg.png" alt="Folder Structure" /></a></p>\n<h3>Error</h3>\n<p>The error I am getting is:</p>\n<pre><code>E5113: Error while calling lua chunk: vim/_init_packages.lua:21: ...r1\\AppData\\Local\\nvim/lua/core/plugin_config/gruvbox.lua:1: '=' expected\nstack traceback:\n [C]: in function 'error'\n vim/_init_packages.lua:21: in function &lt;vim/_init_packages.lua:15&gt;\n [C]: in function 'require'\n ...user1\\AppData\\Local\\nvim/lua/core/plugin_config/init.lua:2: in main chunk\n [C]: in function 'require'\n C:\\Users\\user1\\AppData\\Local\\nvim\\init.lua:6: in main chunk\n</code></pre>\n<p>If you scroll down to <code>lua/core/plugin_config/init.lua</code>, you will se that the <code>require</code> parts throw this error, but if I paste the contents of the config scripts (<code>lua/core/plugin_config/*.lua</code>) in <code>lua/core/plugin_config/init.lua</code>, it runs without errors.</p>\n<p>Also, when I leave the <code>gruvbox.lua</code>, <code>lualine.lua</code> or <code>nvim-tree.lua</code> files empty, almost the same error occurs:</p>\n<pre><code>E5113: Error while calling lua chunk: vim/_init_packages.lua:21: ...r1\\AppData\\Local\\nvim/lua/core/plugin_config/gruvbox.lua:1: '=' expected near '&lt;eof&gt;'\nstack traceback:\n [C]: in function 'error'\n vim/_init_packages.lua:21: in function &lt;vim/_init_packages.lua:15&gt;\n [C]: in function 'require'\n ...user1\\AppData\\Local\\nvim/lua/core/plugin_config/init.lua:2: in main chunk\n [C]: in function 'require'\n C:\\Users\\user1\\AppData\\Local\\nvim\\init.lua:6: in main chunk\n</code></pre>\n<h3>Code-ZIP</h3>\n<p><a href="https://drive.google.com/file/d/188hEJQOvcrS7G3zwBgOxKq91adIEpQli/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/188hEJQOvcrS7G3zwBgOxKq91adIEpQli/view?usp=sharing</a></p>\n<h3>Code</h3>\n<p><strong>init.lua</strong></p>\n<pre class="lang-lua prettyprint-override"><code>require(&quot;core.keymaps&quot;)\nrequire(&quot;core.plugins&quot;)\nrequire(&quot;core.plugin_config&quot;)\n</code></pre>\n<p><strong>lua/core/keymaps.lua</strong></p>\n<pre class="lang-lua prettyprint-override"><code>vim.g.mapleader = ' '\nvim.g.maplocalleader = ' '\n\nvim.opt.backspace = '2'\nvim.opt.showcmd = true\nvim.opt.laststatus = 2\nvim.opt.autowrite = true\nvim.opt.cursorline = true\nvim.opt.autoread = true\n\nvim.opt.tabstop = 2\nvim.opt.shiftwidth = 2\nvim.opt.shiftround = true\nvim.opt.expandtab = true\n\nvim.keymap.set('n', '&lt;leader&gt;h', ':nohlsearch&lt;CR&gt;')\n</code></pre>\n<p><strong>lua/core/plugins.lua</strong></p>\n<pre class="lang-lua prettyprint-override"><code>local ensure_packer = function()\n local fn = vim.fn\n local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'\n if fn.empty(fn.glob(install_path)) &gt; 0 then\n fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})\n vim.cmd [[packadd packer.nvim]]\n return true\n end\n return false\nend\n\nlocal packer_bootstrap = ensure_packer()\n\nreturn require('packer').startup(function(use)\n use 'wbthomason/packer.nvim'\n use 'ellisonleao/gruvbox.nvim'\n use 'nvim-tree/nvim-tree.lua'\n use 'nvim-tree/nvim-web-devicons'\n use 'nvim-lualine/lualine.nvim'\n\n if packer_bootstrap then\n require('packer').sync()\n end\nend)\n</code></pre>\n<p><strong>lua/core/plugin_config/init.lua</strong></p>\n<pre class="lang-lua prettyprint-override"><code>-- Requiring the configs in files does not work\nrequire(&quot;core.plugin_config.gruvbox&quot;)\nrequire(&quot;core.plugin_config.lualine&quot;)\nrequire(&quot;core.plugin_config.nvim-tree&quot;)\n\n-- Pasting the config code here works\nvim.o.termguicolors = true\nvim.cmd [[ colorscheme gruvbox ]]\n\n\nrequire('lualine').setup {\n options = {\n icons_enabled = true,\n theme = 'gruvbox',\n },\n sections = {\n lualine_a = {\n {\n 'filename',\n path = 1,\n }\n }\n }\n}\n\n\nvim.g.loaded_netrw = 1\nvim.g.loaded_netrwPlugin = 1\n\nrequire(&quot;nvim-tree&quot;).setup()\n</code></pre>\n<p><strong>lua/core/plugin_config/gruvbox.lua</strong></p>\n<pre class="lang-lua prettyprint-override"><code>vim.o.termguicolors = true\nvim.cmd [[ colorscheme gruvbox ]]\n</code></pre>\n<p><strong>lua/core/plugin_config/lualine.lua</strong></p>\n<pre class="lang-lua prettyprint-override"><code>require('lualine').setup {\n options = {\n icons_enabled = true,\n theme = 'gruvbox',\n },\n sections = {\n lualine_a = {\n {\n 'filename',\n path = 1,\n }\n }\n }\n}\n</code></pre>\n<p><strong>lua/core/plugin_config/nvim-tree.lua</strong></p>\n<pre class="lang-lua prettyprint-override"><code>vim.g.loaded_netrw = 1\nvim.g.loaded_netrwPlugin = 1\n\nrequire(&quot;nvim-tree&quot;).setup()\n</code></pre>\n"^^ . . "Lua Curl catch Timeout"^^ . "0"^^ . "0"^^ . "0"^^ . "1"^^ . . . . "0"^^ . . "Is it the "+" symbol (or rather the `(.+)` ) that gets me the "thing I want" out of the pattern?"^^ . . "1"^^ . . . . "0"^^ . . . "Ah, so you're looking for flattening, got it. Just with a "depth" of 2? E.g. what should happen with `{"foo", {{"bar"}}}` - should that become `{"foo", "bar"}` or `{"foo", {"bar"}}`?"^^ . "c"^^ . . "0"^^ . . . "0"^^ . "lsp plugin config file will load but not modify current buffer until sourced"^^ . "Well, the RTCP dissector is obviously expecting more data, which isn't available, so you're always going to get that "truncated" situation. You could try to dissect everything else, skipping those 8 bytes, and only pass those 8 bytes to the RTCP dissector once you've performed all the other dissection."^^ . . "0"^^ . . "vim"^^ . . . . . . "1"^^ . "0"^^ . . . . "x11"^^ . "luajit"^^ . . "0"^^ . "mediawiki-extensions"^^ . "2"^^ . "0"^^ . . . . . "1"^^ . . "1"^^ . . "1"^^ . "0"^^ . "<p>The script is activated only when the right and then the left mouse button is clicked first. I need to be able to activate the script by any sequence of pressing these two buttons.</p>\n<p>I tried putting (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 3) together/before/after (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1), but the script didn't want to activate in any way.</p>\n<p>function OnEvent(event, arg)</p>\n<pre><code>if (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1) and IsMouseButtonPressed(3) then\n repeat\n MoveMouseRelative(1 , 1) \n if not IsMouseButtonPressed(1) then break end\n until not IsMouseButtonPressed(1)\nend\n\nif (event == &quot;PROFILE_ACTIVATED&quot;) then\n EnablePrimaryMouseButtonEvents(true)\nend\n</code></pre>\n<p>end</p>\n"^^ . . . "0"^^ . . "2"^^ . . . . "0"^^ . . . "1"^^ . . . . . . . "<p>Since <strong>Rewrite/Access Phase</strong> <em>precedes</em> <strong>Content Phase</strong>, it is too early to use <code>$bytes_sent</code> (<code>ngx.var.bytes_sent</code>) in <code>access_by_lua_*</code> directives (the value will be zero). See the figure below.</p>\n<p><strong>Log Phase</strong> (<code>log_by_lua_*</code>) is the right place, but, as you mentioned, it is not possible to use the Redis client in this phase (Cosocket API is disabled in this context).</p>\n<p>The common trick is to wrap your code in a callback and run it via zero-delay timer. See this section of the documentation: <a href="https://github.com/openresty/lua-nginx-module#cosockets-not-available-everywhere" rel="nofollow noreferrer">Cosockets Not Available Everywhere</a>.</p>\n<p>A rough example:</p>\n<pre><code>log_by_lua_block {\n local redis = require &quot;resty.redis&quot;\n\n local REDIS_HOST = &quot;127.20.0.2&quot;\n local REDIS_PORT = 6379\n\n\n local function get_redis_connection(host, port)\n local red = redis:new()\n red:set_timeout(1000)\n local ok, err = red:connect(host, port)\n if not ok then\n return nil, err\n end\n return red\n end\n\n local function save_bytes_sent(_, uri, bytes_sent)\n local red, err = get_redis_connection(REDIS_HOST, REDIS_PORT)\n if not red then\n ngx.log(ngx.CRIT, &quot;Failed to connect to redis: &quot;, err)\n return\n end\n\n local res, err = red:set(&quot;bytes_sent_&quot; .. uri, bytes_sent)\n if not res then\n ngx.log(ngx.CRIT, &quot;Failed to save bytes_sent in redis: &quot;, err)\n return\n end\n\n local ok, err = red:close()\n if not ok then\n ngx.log(ngx.CRIT, &quot;Failed to close the connection to redis: &quot;, err)\n return\n end\n\n ngx.log(ngx.CRIT, &quot;Saved bytes_sent in redis successfully&quot;)\n end\n\n ngx.timer.at(0, save_bytes_sent, ngx.var.uri, ngx.var.bytes_sent)\n}\n</code></pre>\n<p><img src="https://cloud.githubusercontent.com/assets/2137369/15272097/77d1c09e-1a37-11e6-97ef-d9767035fc3e.png" alt="a diagram showing the order in which Lua Nginx Module Directives are executed" /></p>\n"^^ . "2"^^ . . "<p>How can I extend my <code>__index</code> metamethod so that it works regardless of the level of nesting? My current approach works only for <code>data.raw.a1.a2</code>, but not for <code>data.raw.b1.b2.b3</code> and following.</p>\n<pre class="lang-lua prettyprint-override"><code>data = {\n raw = {}\n}\n\nsetmetatable(data.raw, { __index = function(t,k)\n t[k] = {}\n return t[k]\nend })\n\ndata.raw.a1.a2 = { foo = &quot;bar&quot; }\ndata.raw.b1.b2.b3 = { foo = &quot;bar&quot; } -- throws an error\ndata.raw.c1.c2.c3.c4 = { foo = &quot;bar&quot; } -- throws an error\n</code></pre>\n<p>I tried adding a second <code>setmetatable</code> but this only works for one more level of nesting.</p>\n<pre class="lang-lua prettyprint-override"><code>data = {\n raw = {}\n}\n\nsetmetatable(data.raw, { __index = function(t,k)\n t[k] = {}\n -- below is new\n setmetatable(t[k], { __index = function(t,k)\n t[k] = {}\n return t[k]\n end })\n -- above is new\n return t[k]\nend })\n\ndata.raw.a1.a2 = { foo = &quot;bar&quot; }\ndata.raw.b1.b2.b3 = { foo = &quot;bar&quot; } -- now this works\ndata.raw.c1.c2.c3.c4 = { foo = &quot;bar&quot; } -- this still throws an error\n</code></pre>\n<p>I don't know how I can make this recursive, so that it works for all levels of nesting. Send help.</p>\n"^^ . "2"^^ . . . . . . "0"^^ . "0"^^ . "1"^^ . "0"^^ . "0"^^ . . . "Show your code that isn't working."^^ . . "0"^^ . "0"^^ . . "<p>Simply evoke the vector position you want to use.</p>\n<p>if you have two vectors:</p>\n<pre><code>coord1 = vector3(11, 2, 0)\ncoord2 = vector3(1, 1, 1)\n</code></pre>\n<p>you can do mathematical operations as follow</p>\n<pre><code>print(coord1.x - coord2.x)\n&gt;&gt;10\n</code></pre>\n"^^ . . . . "@user253751 - Yes, I am aware of that."^^ . . . "0"^^ . "0"^^ . "<h3>Nevermind, I found the answer.</h3>\n<p>I tried loading a &quot;.jpg&quot; image with the cairo <code>...from_png</code> function, which is my fault.</p>\n<p>However, this is not entirely my fault. Cairo should have an error return value that should clearly signify that the file exists, but is not a PNG.</p>\n"^^ . "0"^^ . "package"^^ . . "fluent-bit-rewrite-tag"^^ . "0"^^ . "performance"^^ . "function"^^ . "0"^^ . . . . . . "@Oka - Ahhh, yeah. I looked right past that."^^ . "0"^^ . "<blockquote>\n<p>This is the part of the string inside the &quot;&quot;. I want to know if this is okay.</p>\n</blockquote>\n<pre><code>&quot;[[�����������&quot;\n</code></pre>\n<blockquote>\n<p>I want to put this inside the string &quot;&quot; is redundant, is there any way?</p>\n</blockquote>\n<pre><code>&quot;`,6&lt;,futb=!;/2f*:=\n</code></pre>\n<p><a href="https://i.sstatic.net/ov29T.png" rel="nofollow noreferrer">enter image description here</a></p>\n<p>I want to put the two values above in a TriggerServerEvent(&quot;&quot;) function that exists in a game called FiveM.</p>\n<p>To convert that value to a TriggerServerEvent, it must be created as follows</p>\n<pre><code>TriggerServerEvent(&quot;&quot;`,6&lt;,futb=!;/2f*:=&quot;, &quot;[[�����������&quot;, ,1573218749406,-1,&quot;T1&quot;,&quot;Dances&quot;)\n</code></pre>\n<p>Let me know what's wrong with this syntax</p>\n"^^ . . . . "2"^^ . "3"^^ . "0"^^ . "Fluentbit S3 Configuration: How to Get Log Paths Similar to FluentD?"^^ . . . "0"^^ . "@ESkri Thanks, but creating a folder `__base__` cannot be part of the answer."^^ . . . . . . . "1"^^ . . "<p>I need to display the MediaWiki <strong>page sort key</strong> on the page, or in the footer by using a template within <em>MediaWiki:Lastmodifiedatby</em>. The sort key can be either automatically defined or by using <code>DEFAULTSORT</code>.</p>\n<p>I searched MediaWiki documentation for builtin variables as well as the Lua reference (no success for mw.title), and also searched for existing extensions providing the sort key, but were not successful so far.</p>\n<p>Is there a way to derive and display the sort key of a MediaWiki page, by template or Lua code?</p>\n"^^ . . "1"^^ . . "0"^^ . . "0"^^ . . . . . "save"^^ . "2"^^ . "Update - I've switched over to C++."^^ . . . "<p>AFAIK, once the module has been loaded, lua caches the result into package.loaded[modName]. Does this statement hold true irrespective of where we are doing require &quot;module&quot;?</p>\n<p>Following example:</p>\n<p>In the below example, <code>script1</code> just loads the module.lua once so any other usage just fetches the content from package.loaded, whereas <code>script2</code> requires it twice. In the second case we are loading the module within the function scope, does that mean lua doesn't cache the result of <code>require &quot;module&quot;</code> as to what it does in the first case?</p>\n<p>module.lua</p>\n<pre><code>local Table = {}\nlocal function print_func(message):\n print(message)\nend\n\nTable.print_func = print_func\n\nreturn Table\n</code></pre>\n<p>script1.lua</p>\n<pre><code>local table = require &quot;module&quot;\nlocal function perform()\n table.print_func(&quot;PERFORM&quot;)\nend\n\nlocal function work()\n table.print_func(&quot;WORK&quot;)\nend\n</code></pre>\n<p>script2.lua</p>\n<pre><code>local function do()\n local table = require &quot;module&quot;\n table.print_func(&quot;DO&quot;)\nend\n\nlocal function work()\n local table = require &quot;module&quot;\n table.print_func(&quot;WORK&quot;)\n</code></pre>\n"^^ . . "0"^^ . "-1"^^ . . . "2"^^ . . . . "0"^^ . . "The issue is that after line of rtco dissector nothing being executed even a simple print. Any suggestion regarding working on a copy of bytes and a copy tree? Then I can retrieve fields needed.."^^ . . "@Luatic true, this will also match `/tmp/project1/foo/client_config.json` returning `foo/client`. I am honestly too rusty in Lua to remember the differences between patterns and regex so there may well be a better way to do this with some specific Lua thing that I'm not aware of/don't remember"^^ . "1"^^ . . . . . . . . . . "2"^^ . . . "1"^^ . "0"^^ . . "0"^^ . . "0"^^ . . "0"^^ . "<p>Whilst reading <a href="https://www.lua.org/pil/#4ed" rel="nofollow noreferrer">Programming in Lua</a> book, I came across an exercise which I'm not sure if I solved right, hence I wanted to ask you all.</p>\n<p>Problem statement:</p>\n<blockquote>\n<p><strong>Exercise 6.4: Write a function to shuffle a given list. Make sure that all permutations are equally probable.</strong></p>\n</blockquote>\n<p>Background: I've very basic mathematical and programmings knowledge</p>\n<p>I researched a bit online, read a bit about combinations vs permutations, how does that come into play in this problem, and then I finally came across <a href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle" rel="nofollow noreferrer">Fisher-Yates Shuffle</a> which I think led me to a &quot;working&quot; solution.</p>\n<p>My ask:</p>\n<ul>\n<li>Is my solution right? If not, what am I doing wrong? If yes, perhaps some details entailing why because I'm confused as to how would I be otherwise shuffling the list with <strong>unequal probabilities</strong>?</li>\n<li>One thing I noticed is if I add <code>math.randomseed(1)</code> (or, any other fixed number) in the <code>getShuffledList</code> function, I always get the same results, no matter how many times I try to shuffle the list. Why does that happen?</li>\n</ul>\n<p>My solution:</p>\n<pre class="lang-lua prettyprint-override"><code>local printList = function (a)\n for _, value in ipairs(a) do\n io.write(value, &quot; &quot;)\n end\n print()\nend\n\nlocal interchangeElements = function(list, i , j)\n local temp\n temp = list[i]\n list[i] = list[j]\n list[j] = temp\n return list\nend\n\nlocal getShuffledList = function(list)\n -- math.randomseed(1) --&gt; gives constant shuffled list on each call\n local j\n for i = #list, 1, -1 do\n j = math.random(1, #list)\n interchangeElements(list, i, j)\n end\n return list\nend\n\nprintList(getShuffledList({1, 2, 3, 4}))\nprintList(getShuffledList({1, 2, 3, 4}))\nprintList(getShuffledList({1, 2, 3, 4}))\nprintList(getShuffledList({1, 2, 3, 4}))\n</code></pre>\n<p>Output:</p>\n<pre class="lang-bash prettyprint-override"><code>3 2 4 1 \n3 4 2 1 \n4 3 1 2 \n1 2 3 4 \n\n[Process exited 0]\n</code></pre>\n"^^ . . . . . "<p>I am making a ROBLOX script to block messages which are toxic from getting to other people. For some reason, it isn't working and still allows the toxic messages to be seen by others. Any ideas on how to fix it?</p>\n<p>I have tried a super basic filter, which just removes words it finds to be “bad” from a table, and that surprisingly works.</p>\n<p><strong>ONLY SCRIPT:</strong></p>\n<pre class="lang-lua prettyprint-override"><code>local TextChatService = game:GetService(&quot;TextChatService&quot;)\nlocal Channels = TextChatService:WaitForChild(&quot;TextChannels&quot;)\nlocal HttpService = game:GetService(&quot;HttpService&quot;)\n\nlocal TextClassifier = &quot;https://api.example.com&quot; -- not actual thing, actual api returns json data\nlocal MaxScore = 0.7\n\nlocal function isMessageToxic(message: string, speaker: TextSource): boolean\n if message == &quot;&quot; then return false end\n \n pcall(function()\n response = HttpService:PostAsync(\n TextClassifier,\n HttpService:JSONEncode({\n text = message\n }),\n Enum.HttpContentType.ApplicationJson\n )\n response = HttpService:JSONDecode(response).response\n end)\n \n if response.Error or not response then\n print(&quot;There has been an error.&quot;) -- no body or etc\n return false\n end\n \n if response[1].score &gt; (MaxScore or 0.7) then\n print(&quot;Message has been flagged.&quot;)\n return true\n else\n print(&quot;Message has passed.&quot;)\n return false\n end\nend\n\nlocal function channelAdded(channel: TextChannel)\n if not channel:IsA(&quot;TextChannel&quot;) then return end\n channel.ShouldDeliverCallback = function(message, textSource)\n return not isMessageToxic(message.Text, textSource)\n end\nend\n\nfor _, channel in pairs(Channels:GetChildren()) do\n channelAdded(channel)\nend\nChannels.ChildAdded:Connect(channelAdded)\n</code></pre>\n<p><strong>What is sent to the API:</strong></p>\n<pre class="lang-json prettyprint-override"><code>{\n &quot;text&quot;: &quot;i hate you”\n}\n</code></pre>\n<p><strong>What it responds with:</strong></p>\n<pre class="lang-json prettyprint-override"><code>{\n &quot;response&quot;: [{\n &quot;label&quot;: &quot;NEGATIVE&quot;,\n &quot;score&quot;: 0.9993651509284973\n }, {\n &quot;label&quot;: &quot;POSITIVE&quot;,\n &quot;score&quot;: 0.0006348910392262042\n }]\n}\n</code></pre>\n<p><strong>Image of it not working:</strong>\n<a href="https://i.sstatic.net/g5p5n.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/g5p5n.jpg" alt="Filtering not working" /></a></p>\n<p><strong>What is printed:</strong></p>\n<pre><code>17:19:59 -- Message has been flagged.\n17:19:59 -- Message has been flagged.\n</code></pre>\n"^^ . . . "Does Lua automatically free userdata?"^^ . . . . "0"^^ . . . "1"^^ . . . . . . . "<p>So it turns out my main mistake was using <code>LUA_HOOKLINE</code> instead of <code>LUA_MASKLINE</code>. I needed to use <code>lua_resume</code> instead of <code>lua_pcallk</code>. Making the thread/coroutine protected is another task. Here's a tiny working example where lua returns control back to c after every line of execution.</p>\n<p>The example below (assuming no errors are raised) will print <code>Executing line: 1</code> 2... 3... and so on as the script executes. and at any moment between line you have full control in c again.</p>\n<pre class="lang-c prettyprint-override"><code>void hookfunc(lua_State* L, lua_Debug* ar)\n{\nlua_getinfo(L, &quot;l&quot;, ar); // Get ar-&gt;currentline\nprintf(&quot;Executing line: %d\\n&quot;, ar-&gt;currentline);\nlua_yield(L, 0); // Yield, only works when using `lua_resume` and with 0 return values\n}\n\nint main()\n{\n// Create state\nlua_State* L = luaL_newstate();\nluaL_openlibs(L);\n\n// Create thread/coroutine\nlua_State* L1 = lua_newthread(L);\n\n// Set hook\nlua_sethook(L1, &amp;hookfunc, LUA_MASKLINE, 1);\n\n// Load lua script\nluaL_loadfile(L1, &quot;script.lua&quot;);\n\n// Execute the thread until it either completes or raises an error\ndo\n{\n int nres; // Number of return values, should be 0 when using inside hooks\n status = lua_resume(L1, 0, 0, &amp;nres); // Start/resume thread\n // The thread may be yielded, completed or have an error, but you get full control back in c, after every line of lua execution\n\n}\nwhile (status == LUA_YIELD);\n\nlua_close(L);\n}\n</code></pre>\n"^^ . . . . . "0"^^ . . . . "I don't know if those formulas are right, but in any case, you are not returning any values from that function. I guess you want a `return x,y,radius` at the end"^^ . . "0"^^ . "love2d"^^ . . "0"^^ . . . . "<p>Finally i figured out. You have to call pcall in order to catch the error from timeout.\nI added this</p>\n<pre><code>local ok, err = pcall(function() c:perform() end)\n</code></pre>\n<p>With this i'm able to catch the error in the else like this :</p>\n<pre><code>print(&quot;API Call - Curl Error No &quot;..err:no()..&quot; - &quot;..err:msg()..&quot;\\n&quot;)\n</code></pre>\n<p>Hope could be help for others....</p>\n<p>Ricardo</p>\n"^^ . "shuffle"^^ . . . . "<p>Suppose I have a list that looks like this:</p>\n<pre class="lang-lua prettyprint-override"><code>{{'text'}, {'something', 'string'}, {'thing'}}\n</code></pre>\n<p>I want to turn this into the following list:</p>\n<pre class="lang-lua prettyprint-override"><code>{'text', 'something', 'string', 'thing'}\n</code></pre>\n<p>&quot;flattening&quot; the nested lists.</p>\n"^^ . . "0"^^ . "Operators: `new` and `delete`. And technically `nullptr`, until [C23](https://en.cppreference.com/w/c/language/nullptr)."^^ . "<p>Thank you for the easy solution, I am doing it like this now, even though the function is not necessary:</p>\n<pre><code>function setBoolValue(boolName, state)\n boolValues[boolName] = state\nend\n</code></pre>\n<p>Example:</p>\n<pre><code>setBoolValue(&quot;secondBool&quot;, false)\n</code></pre>\n"^^ . "@Wh1t3rabbit In Pico-8, you can set certain tokens as a replacement for button IDs. So yes, the arrows are valid, and represents the button ID that presses in that direction."^^ . . . "0"^^ . . . . . . "0"^^ . . . "You are right. I am using sol2, it should get translated automatically though."^^ . "3"^^ . . "0"^^ . . . . "0"^^ . . "<p>It is working as intended, the reason it does not have the desired outcome is because &quot;w&quot; is not a valid parameter for the method <code>IsModifierPressed()</code> which (as the name implies) checks modifier keys not normal keys, thus it returns false for &quot;w&quot;. The api reference is <a href="https://douile.com/logitech-toggle-keys/APIDocs.pdf" rel="nofollow noreferrer">here</a> and lists all valid modifiers for your convenience on page 17.</p>\n"^^ . . "krakend"^^ . . . . "Thanks @Luatic Sweet tricks you've got up your hand, surely implemented them. Question on testing the code (post-fix), I see the code in GitHub link provided by you shuffles the array 1e5 times but I don't get how you're asserting the results by comparing difference of max and min sum being lesser than 1e4? Why 1e4 and how does this prove? Again, apologies for lack of my knowledge in the topic"^^ . . "How to check in Lua if there are multiple elements in a table?"^^ . . . "2"^^ . . . "Convert Lua array to C array when C function takes multiple inputs"^^ . "0"^^ . . . . "1"^^ . . "2"^^ . "0"^^ . . "0"^^ . "Yes, and you can't (as in, aren't allowed to, it will *often* work fine, but it you may run into problems when a rehash is triggered) do that while you're iterating the table. You should do it outside of the loop."^^ . "0"^^ . "0"^^ . . . . "mpv"^^ . "1"^^ . "0"^^ . . "0"^^ . . . . . "1"^^ . . . "2"^^ . "1"^^ . . "1"^^ . . . . "<p>Your idea is correct, but you incorrectly defined the searcher, as stated in the <a href="http://www.lua.org/manual/5.3/manual.html#pdf-package.searchers" rel="nofollow noreferrer">document</a></p>\n<blockquote>\n<p>The function can <strong>return another function</strong> (the module loader) plus an extra value that will be passed to that loader, <strong>or a string</strong> explaining why it did not find that module (or nil if it has nothing to say).</p>\n</blockquote>\n<p>Since you returned a string, it is equivalent to telling <code>require</code> that your search failed. Here's a working version:</p>\n<pre><code>local function custom_loader(name)\n return function(name)\n local modified_name = name:gsub(&quot;__base__&quot;, &quot;C:/Temp&quot;)\n modified_name = package.searchpath(modified_name, &quot;?.lua&quot;)\n package.loaded[name] = dofile(modified_name)\n end\nend\n</code></pre>\n"^^ . "So turns out, this does work, im just a big idiot. for lua_sethook i need to use LUA_MASKLINE instead of LUA_HOOKLINE, This literally fixed everything"^^ . . . "0"^^ . . "0"^^ . "<p>This operation is called <em>flattening</em>. It turns &quot;nested&quot; lists like <code>{{'text'}, {'something', 'string'}, {'thing'}}</code> into a &quot;flat&quot; list <code>{'text', 'something', 'string', 'thing'}</code>. A deep flattening can straightforwardly be written as follows:</p>\n<pre class="lang-lua prettyprint-override"><code>function flatten(v)\n local res = {}\n local function flatten(v)\n if type(v) ~= &quot;table&quot; then\n table.insert(res, v)\n return\n end\n for _, v in ipairs(v) do\n flatten(v)\n end\n end\n flatten(v)\n return res\nend\n</code></pre>\n<p>Usage:</p>\n<pre class="lang-lua prettyprint-override"><code>print(table.unpack(flatten{{'text'}, {'something', 'string'}, {'thing'}})) -- text something string thing \n</code></pre>\n"^^ . . . "0"^^ . "2"^^ . . "1"^^ . . . . . . . "2"^^ . . "1"^^ . "Using Sol2 to expose an interface to Lua and implementing the method in Lua"^^ . "1"^^ . "I want to make a part, created by a script, play a sound"^^ . "0"^^ . . . . . "<p>Based on the link provided by @Barmar and some playing around, below is a working solution for anyone who may run into this problem. Getting the indices correct took some trial-and-error, so hopefully this saves people time in the future. Based on Lua 5.4:</p>\n<p>Lua</p>\n<pre><code>name = &quot;id of entry&quot;\narray1 = {1.1, 1.2, 1.3}\narray2 = {2.1, 2.2, 2.3, 2.4}\n\nc_function(name, array1, array2)\n</code></pre>\n<p>C/C++</p>\n<pre><code>static int c_function(lua_State* L)\n{\n const char* name = luaL_checkstring(L, 1);\n \n std::vector&lt;double&gt; arr1;\n std::vector&lt;double&gt; arr2;\n\n // array1 - pay attention to use of 2, -1 and 1.\n if (lua_istable(L, 2) != 0)\n {\n unsigned int size = lua_rawlen(L, 2);\n arr1.resize(size);\n \n for (unsigned int i = 0; i &lt; size; i++)\n {\n lua_rawgeti(L, 2, i + 1); // Lua uses 1 based indices.\n arr1[i] = lua_tonumber(L, -1);\n lua_pop(L, 1);\n }\n }\n\n // array2 - pay attention to use of 3, -1 and 1.\n if (lua_istable(L, 3) != 0)\n {\n unsigned int size = lua_rawlen(L, 3);\n arr2.resize(size);\n \n for (unsigned int i = 0; i &lt; size; i++)\n {\n lua_rawgeti(L, 3, i + 1); // Lua uses 1 based indices.\n arr2[i] = lua_tonumber(L, -1);\n lua_pop(L, 1);\n }\n }\n\n Calculate(name, arr1, arr2);\n\n return 0;\n}\n\nvoid Calculate(const char* name, const std::vector&lt;double&gt;&amp; arr1, const std::vector&lt;double&gt;&amp; arr2)\n{\n // Do stuff here.\n}\n</code></pre>\n"^^ . "boost"^^ . . . . . "neovim-plugin"^^ . . . . "Please edit your comment to add the modified code where you swapped the variable, and defined the hit variable."^^ . "0"^^ . . . . "Lua variable ambient invoked by another file"^^ . "0"^^ . . . "Generating tables with unique addresses"^^ . . . "Hi, @Ivan, I sent the body of the POST request and the response of the API. I’ll get an image of it not working once I get out of school."^^ . . . . . . "@Md.SaifulIslam It's really tricky to handle all types of errors. I have updated my answer with more information."^^ . . . "2"^^ . . . . . "boost-spirit"^^ . . . . "0"^^ . . . . "Wouldn’t a Highlight be better than a selectionbox?"^^ . "computercraft"^^ . . . "<p>Since <code>require</code> is just a variable and therefore can be reassigned just like any other variables, I <em>think</em> you can monkeypatch it as follow:</p>\n<pre class="lang-lua prettyprint-override"><code>local _require = require\n\nrequire = function(name)\n local modified_name = name:gsub('__base__', 'C:/Temp')\n print(modified_name)\n\n return _require(modified_name)\nend\n</code></pre>\n<p>Try it:</p>\n<pre class="lang-lua prettyprint-override"><code>local bar = require('__base__/bar')\nprint(bar)\n\n-- 'C:/Temp/bar'\n-- table: 0x1ffffff\n</code></pre>\n"^^ . "0"^^ . . "1"^^ . . . "`SDL_AddTimer(interval, wrapper, &const_cast<std::function<void()> &>(fn));` ends up passing the address of a potentially temporary functor to `wrapper` - this is completely unsafe and most likely broken. You need to store the functor elsewhere, where its lifetime is guaranteed to last at least until `wrapper` is called, and pass that address instead (or use a different approach in general). Also you will most likely need `sol::function` to ensure the Lua GC does not collect the temporary function expression before it will be used"^^ . . "0"^^ . "Did you try moving `love.graphics.draw(pause, 235, 100, center)` to the bottom of the `render()` function?"^^ . . . "Hit and Double function gets called repeatedly- on one press"^^ . "2"^^ . . . "0"^^ . . . "2"^^ . "0"^^ . . "1"^^ . . "<p>Thanks, Ivo, my bad.</p>\n<pre><code>local function getCircumcircle (x1, y1, x2, y2, x3, y3)\n local d = 2*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))\n local t1, t2, t3 = x1*x1+y1*y1, x2*x2+y2*y2, x3*x3+y3*y3\n local x = (t1*(y2-y3)+t2*(y3-y1)+t3*(y1-y2))/d\n local y = (t1*(x3-x2)+t2*(x1-x3)+t3*(x2-x1))/d\n local radius = math.sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y))\n return x,y,radius\nend\n</code></pre>\n"^^ . . . . "1"^^ . . "1"^^ . "@Ivan I've added an image of it not working and what the console responds with (couldn't get the image, and the score is the positive score. you can try here: https://www.roblox.com/games/9429848079/Toxicity-Filter"^^ . . . . . . "0"^^ . "0"^^ . . "0"^^ . . . "1"^^ . "<p>I know how to define a Go function and set it global (the Double example from the docs). But what, if the argument of this function should be a pre-defined table?</p>\n<pre class="lang-lua prettyprint-override"><code>function calling_this_function_would_be_required(predefined_table)\n print(predefined_table[&quot;something&quot;])\nend\n</code></pre>\n<p>The IMAP server Dovecot does provide something like the above: <a href="https://doc.dovecot.org/configuration_manual/authentication/lua_based_authentication/#examples" rel="nofollow noreferrer">https://doc.dovecot.org/configuration_manual/authentication/lua_based_authentication/#examples</a></p>\n<p>And I would like to also provide pre-defined functions with a table (or even user data). But I really have no idea on how to achieve this.</p>\n<p>Having a table set global is easy (L.SetGlobal(...)), but how do I add it to a expected function?</p>\n<p>Adding some function in Go</p>\n<pre class="lang-golang prettyprint-override"><code>func CallMe(L *lua.LState) {\n // How do I add a table as argument??\n}\n\nfunc Foo() {\n L := NewState()\n defer L.Close()\n\n t := L.NewTable()\n t.RawSetString(&quot;example&quot;, lua.LString(&quot;some_value&quot;))\n\n // I do not want a global table. I would like an expected Lua function that has _this_ table as argument\n L.SetGlobal(&quot;predefined_table&quot;, t)\n\n // Not even sure with his...\n L.SetGlobal(&quot;calling_this_function_is_required&quot;, L.NewFunction©llMe)) \n}\n</code></pre>\n<p>If someone could enlight me a bit that would be great :-) Thanks in advance</p>\n"^^ . . . . "2"^^ . . . . "boost-spirit-x3"^^ . "<p>I expect to parse Lua syntax through x3,The Complete Syntax of Lua: <a href="https://www.lua.org/manual/5.3/manual.html#9" rel="nofollow noreferrer">https://www.lua.org/manual/5.3/manual.html#9</a></p>\n<p>My question is, in this definition, <code>[auto const expdef=simexp | (simexp&gt;&gt;binop&gt;&gt;simexp) | (unop&gt;&gt;simexp);]</code></p>\n<p>Why not choose <code>(simexp&gt;&gt;binop&gt;&gt;simexp)</code> when it fails。</p>\n<p>I have the following results:</p>\n<p><strong>output:</strong></p>\n<pre class="lang-xml prettyprint-override"><code>&lt;chunk&gt;\n &lt;try&gt;\\n function Lu&lt;/try&gt;\n &lt;block&gt;\n &lt;try&gt;\\n function Lu&lt;/try&gt;\n &lt;stat&gt;\n &lt;try&gt;\\n function Lu&lt;/try&gt;\n &lt;funcname&gt;\n &lt;try&gt; LuaPrint(str)\\n &lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt; LuaPrint(str)\\n &lt;/try&gt;\n &lt;success&gt;(str)\\n pr&lt;/success&gt;\n &lt;attributes&gt;[L, u, a, P, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;Name&gt;\n &lt;try&gt; LuaPrint(str)\\n &lt;/try&gt;\n &lt;success&gt;(str)\\n pr&lt;/success&gt;\n &lt;attributes&gt;[L, u, a, P, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;(str)\\n pr&lt;/success&gt;\n &lt;/funcname&gt;\n &lt;funcbody&gt;\n &lt;try&gt;(str)\\n pr&lt;/try&gt;\n &lt;parlist&gt;\n &lt;try&gt;str)\\n pri&lt;/try&gt;\n &lt;namelist&gt;\n &lt;try&gt;str)\\n pri&lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt;str)\\n pri&lt;/try&gt;\n &lt;success&gt;)\\n print(&lt;/success&gt;\n &lt;attributes&gt;[s, t, r]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;)\\n print(&lt;/success&gt;\n &lt;/namelist&gt;\n &lt;success&gt;)\\n print(&lt;/success&gt;\n &lt;/parlist&gt;\n &lt;block&gt;\n &lt;try&gt;\\n print(&quot;&lt;/try&gt;\n &lt;stat&gt;\n &lt;try&gt;\\n print(&quot;&lt;/try&gt;\n &lt;label&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/label&gt;\n &lt;functioncall&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;prefixexp&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;var&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;attributes&gt;[p, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/var&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/prefixexp&gt;\n &lt;args&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;explist&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;exp&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;simexp&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;literal_string&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;attributes&gt;[[, i, n, , l, u, a, ], :]&lt;/attributes&gt;\n &lt;/literal_string&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;/simexp&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;/exp&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;/explist&gt;\n &lt;tableconstructor&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/tableconstructor&gt;\n &lt;literal_string&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/literal_string&gt;\n &lt;fail/&gt;\n &lt;/args&gt;\n &lt;prefixexp&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;var&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;attributes&gt;[p, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/var&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/prefixexp&gt;\n &lt;fail/&gt;\n &lt;/functioncall&gt;\n &lt;varlist&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;var&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;attributes&gt;[p, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/var&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/varlist&gt;\n &lt;fail/&gt;\n &lt;/stat&gt;\n &lt;retstat&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/retstat&gt;\n &lt;stat&gt;\n &lt;try&gt;\\n print(&quot;&lt;/try&gt;\n &lt;label&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/label&gt;\n &lt;functioncall&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;prefixexp&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;var&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;attributes&gt;[p, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/var&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/prefixexp&gt;\n &lt;args&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;explist&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;exp&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;simexp&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;literal_string&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;attributes&gt;[[, i, n, , l, u, a, ], :]&lt;/attributes&gt;\n &lt;/literal_string&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;/simexp&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;/exp&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;/explist&gt;\n &lt;tableconstructor&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/tableconstructor&gt;\n &lt;literal_string&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/literal_string&gt;\n &lt;fail/&gt;\n &lt;/args&gt;\n &lt;prefixexp&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;var&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;attributes&gt;[p, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/var&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/prefixexp&gt;\n &lt;fail/&gt;\n &lt;/functioncall&gt;\n &lt;varlist&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;var&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;attributes&gt;[p, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/var&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/varlist&gt;\n &lt;fail/&gt;\n &lt;/stat&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/block&gt;\n &lt;fail/&gt;\n &lt;/funcbody&gt;\n &lt;fail/&gt;\n &lt;/stat&gt;\n &lt;retstat&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/retstat&gt;\n &lt;stat&gt;\n &lt;try&gt;\\n function Lu&lt;/try&gt;\n &lt;funcname&gt;\n &lt;try&gt; LuaPrint(str)\\n &lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt; LuaPrint(str)\\n &lt;/try&gt;\n &lt;success&gt;(str)\\n pr&lt;/success&gt;\n &lt;attributes&gt;[L, u, a, P, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;Name&gt;\n &lt;try&gt; LuaPrint(str)\\n &lt;/try&gt;\n &lt;success&gt;(str)\\n pr&lt;/success&gt;\n &lt;attributes&gt;[L, u, a, P, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;(str)\\n pr&lt;/success&gt;\n &lt;/funcname&gt;\n &lt;funcbody&gt;\n &lt;try&gt;(str)\\n pr&lt;/try&gt;\n &lt;parlist&gt;\n &lt;try&gt;str)\\n pri&lt;/try&gt;\n &lt;namelist&gt;\n &lt;try&gt;str)\\n pri&lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt;str)\\n pri&lt;/try&gt;\n &lt;success&gt;)\\n print(&lt;/success&gt;\n &lt;attributes&gt;[s, t, r]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;)\\n print(&lt;/success&gt;\n &lt;/namelist&gt;\n &lt;success&gt;)\\n print(&lt;/success&gt;\n &lt;/parlist&gt;\n &lt;block&gt;\n &lt;try&gt;\\n print(&quot;&lt;/try&gt;\n &lt;stat&gt;\n &lt;try&gt;\\n print(&quot;&lt;/try&gt;\n &lt;label&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/label&gt;\n &lt;functioncall&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;prefixexp&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;var&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;attributes&gt;[p, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/var&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/prefixexp&gt;\n &lt;args&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;explist&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;exp&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;simexp&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;literal_string&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;attributes&gt;[[, i, n, , l, u, a, ], :]&lt;/attributes&gt;\n &lt;/literal_string&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;/simexp&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;/exp&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;/explist&gt;\n &lt;tableconstructor&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/tableconstructor&gt;\n &lt;literal_string&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/literal_string&gt;\n &lt;fail/&gt;\n &lt;/args&gt;\n &lt;prefixexp&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;var&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;attributes&gt;[p, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/var&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/prefixexp&gt;\n &lt;fail/&gt;\n &lt;/functioncall&gt;\n &lt;varlist&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;var&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;attributes&gt;[p, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/var&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/varlist&gt;\n &lt;fail/&gt;\n &lt;/stat&gt;\n &lt;retstat&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/retstat&gt;\n &lt;stat&gt;\n &lt;try&gt;\\n print(&quot;&lt;/try&gt;\n &lt;label&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/label&gt;\n &lt;functioncall&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;prefixexp&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;var&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;attributes&gt;[p, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/var&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/prefixexp&gt;\n &lt;args&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;explist&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;exp&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;simexp&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;literal_string&gt;\n &lt;try&gt;&quot;[in lua]:&quot; .. tostr&lt;/try&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;attributes&gt;[[, i, n, , l, u, a, ], :]&lt;/attributes&gt;\n &lt;/literal_string&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;/simexp&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;/exp&gt;\n &lt;success&gt; .. tostring(str))\\n &lt;/success&gt;\n &lt;/explist&gt;\n &lt;tableconstructor&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/tableconstructor&gt;\n &lt;literal_string&gt;\n &lt;try&gt;(&quot;[in lua]:&quot; .. tost&lt;/try&gt;\n &lt;fail/&gt;\n &lt;/literal_string&gt;\n &lt;fail/&gt;\n &lt;/args&gt;\n &lt;prefixexp&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;var&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;attributes&gt;[p, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/var&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/prefixexp&gt;\n &lt;fail/&gt;\n &lt;/functioncall&gt;\n &lt;varlist&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;var&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;Name&gt;\n &lt;try&gt;print(&quot;[in lua]:&quot; ..&lt;/try&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;attributes&gt;[p, r, i, n, t]&lt;/attributes&gt;\n &lt;/Name&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/var&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/varlist&gt;\n &lt;fail/&gt;\n &lt;/stat&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/block&gt;\n &lt;fail/&gt;\n &lt;/funcbody&gt;\n &lt;fail/&gt;\n &lt;/stat&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n &lt;/block&gt;\n &lt;success&gt;(&quot;[in lua]:&quot; .. tost&lt;/success&gt;\n&lt;/chunk&gt;\nparse fail!\nProgram ended with exit code: 0\n</code></pre>\n<p><strong>Here is my test code:</strong></p>\n<pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt;\n#include &lt;iomanip&gt;\n#include &lt;string&gt;\n#include &lt;map&gt;\n#include &lt;vector&gt;\n#include &lt;list&gt;\n#include &lt;numeric&gt;\n#include &lt;fstream&gt;\n\n#define BOOST_SPIRIT_DEBUG 1\n#define BOOST_SPIRIT_X3_DEBUG 1\n\n#include &lt;boost/spirit/home/x3.hpp&gt;\n#include &lt;boost/spirit/home/x3/support/ast/position_tagged.hpp&gt;\n#include &lt;boost/spirit/home/x3/support/ast/variant.hpp&gt;\n#include &lt;boost/spirit/home/x3/support/utility/error_reporting.hpp&gt;\n#include &lt;boost/spirit/home/x3/support/utility/annotate_on_success.hpp&gt;\n#include &lt;boost/fusion/include/adapt_struct.hpp&gt;\n#include &lt;boost/fusion/include/std_pair.hpp&gt;\n#include &lt;boost/fusion/include/io.hpp&gt;\nnamespace x3 = boost::spirit::x3;\n\nnamespace ast {\n\nusing unop = x3::unused_type;\nusing binop = x3::unused_type;\nusing fieldsep = x3::unused_type;\nusing field = x3::unused_type;\nusing fieldlist = x3::unused_type;\nusing tableconstructor = x3::unused_type;\nusing parlist = x3::unused_type;\nusing funcbody = x3::unused_type;\nusing functiondef = x3::unused_type;\nusing args = x3::unused_type;\nusing functioncall = x3::unused_type;\nusing prefixexp = x3::unused_type;\nusing exp = x3::unused_type;\nusing explist = x3::unused_type;\nusing namelist = x3::unused_type;\nusing var = x3::unused_type;\nusing varlist = x3::unused_type;\nusing funcname = x3::unused_type;\nusing label = x3::unused_type;\nusing retstat = x3::unused_type;\nusing stat = x3::unused_type;\nusing block = x3::unused_type;\nusing chunk = x3::unused_type;\n\nusing boost::fusion::operator&lt;&lt;;\n}\n\n//BOOST_FUSION_ADAPT_STRUCT(antgroup::ast::person_attr,f_name,l_name);\n\nnamespace parse {\n\nstruct x3_base_handle {\n template &lt;typename Iterator, typename Exception, typename Context&gt;\n x3::error_handler_result on_error(Iterator&amp; first, Iterator const&amp; last , Exception const&amp; x, Context const&amp; context){\n// std::string message = std::string(&quot;Error! here:&quot;) + *x.where() + &quot;, Expecting:&quot; + x.which() ;\n// std::cerr &lt;&lt; message &lt;&lt; std::endl;\n return x3::error_handler_result::fail;\n }\n template &lt;typename T, typename Iterator, typename Context&gt;\n inline void on_success(Iterator const&amp; first, Iterator const&amp; last, T&amp; ast, Context const&amp; context){\n if((last - first) &gt; 0) {\n// auto value = x3::_val(context);\n// auto where = x3::_where(context);\n// auto attr = x3::_attr(context);\n// auto pass = x3::_pass(context);\n// std::cout &lt;&lt; &quot;success:&quot; &lt;&lt; std::string(first,last) &lt;&lt; std::endl;\n }\n }\n};\n\nstruct unop_class : x3_base_handle{};\nstruct binop_class : x3_base_handle{};\nstruct fieldsep_class : x3_base_handle{};\nstruct field_class : x3_base_handle{};\nstruct fieldlist_class : x3_base_handle{};\nstruct tableconstructor_class : x3_base_handle{};\nstruct parlist_class : x3_base_handle{};\nstruct funcbody_class : x3_base_handle{};\nstruct functiondef_class : x3_base_handle{};\nstruct args_class : x3_base_handle{};\nstruct functioncall_class : x3_base_handle{};\nstruct prefixexp_class : x3_base_handle{};\nstruct exp_class : x3_base_handle{};\nstruct explist_class : x3_base_handle{};\nstruct namelist_class : x3_base_handle{};\nstruct var_class : x3_base_handle{};\nstruct varlist_class : x3_base_handle{};\nstruct funcname_class : x3_base_handle{};\nstruct label_class : x3_base_handle{};\nstruct retstat_class : x3_base_handle{};\nstruct stat_class : x3_base_handle{};\nstruct block_class : x3_base_handle{};\nstruct chunk_class : x3_base_handle{};\n\n\nauto const unop = x3::rule&lt;unop_class,ast::unop&gt;{&quot;unop&quot;};\nauto const binop = x3::rule&lt;binop_class,ast::binop&gt;{&quot;binop&quot;};\nauto const fieldsep = x3::rule&lt;fieldsep_class,ast::fieldsep&gt;{&quot;fieldsep&quot;};\nauto const field = x3::rule&lt;field_class,ast::field&gt;{&quot;field&quot;};\nauto const fieldlist = x3::rule&lt;fieldlist_class,ast::fieldlist&gt;{&quot;fieldlist&quot;};\nauto const tableconstructor = x3::rule&lt;tableconstructor_class,ast::tableconstructor&gt;{&quot;tableconstructor&quot;};\nauto const parlist = x3::rule&lt;parlist_class,ast::parlist&gt;{&quot;parlist&quot;};\nauto const funcbody = x3::rule&lt;funcbody_class,ast::funcbody&gt;{&quot;funcbody&quot;};\nauto const functiondef = x3::rule&lt;functiondef_class,ast::functiondef&gt;{&quot;functiondef&quot;};\nauto const args = x3::rule&lt;args_class,ast::args&gt;{&quot;args&quot;};\nauto const functioncall = x3::rule&lt;functioncall_class,ast::functioncall&gt;{&quot;functioncall&quot;};\nauto const prefixexp = x3::rule&lt;prefixexp_class,ast::prefixexp&gt;{&quot;prefixexp&quot;};\nauto const exp = x3::rule&lt;exp_class,ast::exp&gt;{&quot;exp&quot;};\nauto const explist = x3::rule&lt;explist_class,ast::explist&gt;{&quot;explist&quot;};\nauto const namelist = x3::rule&lt;namelist_class,ast::namelist&gt;{&quot;namelist&quot;};\nauto const var = x3::rule&lt;var_class,ast::var&gt;{&quot;var&quot;};\nauto const varlist = x3::rule&lt;varlist_class,ast::varlist&gt;{&quot;varlist&quot;};\nauto const funcname = x3::rule&lt;funcname_class,ast::funcname&gt;{&quot;funcname&quot;};\nauto const label = x3::rule&lt;label_class,ast::label&gt;{&quot;label&quot;};\nauto const retstat = x3::rule&lt;retstat_class,ast::retstat&gt;{&quot;retstat&quot;};\nauto const stat = x3::rule&lt;stat_class,ast::stat&gt;{&quot;stat&quot;};\nauto const block = x3::rule&lt;block_class,ast::block&gt;{&quot;block&quot;};\nauto const chunk = x3::rule&lt;chunk_class,ast::chunk&gt;{&quot;chunk&quot;};\n\n\nstruct literal_string_class : x3_base_handle{};\nauto const literal_string = x3::rule&lt;literal_string_class, std::string&gt;{&quot;literal_string&quot;};\nauto const literal_string_def = (x3::lexeme['&quot;' &gt;&gt; +(x3::char_ - '&quot;') &gt;&gt; '&quot;']) | (x3::lexeme['\\'' &gt;&gt; +(x3::char_ - '\\'') &gt;&gt; '\\'']);\nBOOST_SPIRIT_DEFINE(literal_string);\n\ntemplate &lt;typename Tag&gt;\nstatic auto make_sym(std::initializer_list&lt;char const*&gt; elements) {\n x3::symbols&lt;x3::unused_type&gt; instance;\n for (auto el : elements)\n instance += el;\n return instance;\n}\n\nstatic auto const reserve_keywords = make_sym&lt;struct reserve_keywords_class&gt;({&quot;and&quot;,&quot;break&quot;,&quot;do&quot;,&quot;else&quot;,&quot;elseif&quot;,&quot;end&quot;,&quot;false&quot;,&quot;for&quot;,&quot;function&quot;,&quot;goto&quot;,&quot;if&quot;,&quot;in&quot;,&quot;local&quot;,&quot;nil&quot;,&quot;not&quot;,&quot;or&quot;,&quot;repeat&quot;,&quot;return&quot;,&quot;then&quot;,&quot;true&quot;,&quot;until&quot;,&quot;while&quot;});\n\nstruct Name_class : x3_base_handle{};\nauto const Name = x3::rule&lt;Name_class,std::string&gt;{&quot;Name&quot;};\nauto const Name_def = ((x3::ascii::char_(&quot;a-zA-Z&quot;) | x3::ascii::char_('_')) &gt;&gt; *(x3::ascii::char_(&quot;0-9a-zA-Z&quot;) | x3::ascii::char_('_'))) - reserve_keywords;\nBOOST_SPIRIT_DEFINE(Name);\n\nstruct simexp_class : x3_base_handle{};\nauto const simexp = x3::rule&lt;simexp_class&gt;{&quot;simexp&quot;};\nauto const simexp_def = x3::lit(&quot;nil&quot;) | &quot;false&quot; | &quot;true&quot; | x3::uint64 | x3::double_ | literal_string | &quot;...&quot; | functiondef | prefixexp | tableconstructor ;\nBOOST_SPIRIT_DEFINE(simexp);\n\n\n//https://www.lua.org/manual/5.3/manual.html#9\nauto const unop_def = x3::ascii::char_('-') | x3::lit(&quot;not&quot;) | x3::ascii::char_('#') | x3::ascii::char_('~');\nauto const binop_def = x3::ascii::char_('+') | x3::ascii::char_('-') | x3::ascii::char_('*') | x3::ascii::char_('/') | x3::lit(&quot;//&quot;) | x3::ascii::char_('^') | x3::ascii::char_('%') | x3::ascii::char_('&amp;') | x3::ascii::char_('~') | x3::ascii::char_('|') | x3::lit(&quot;&gt;&gt;&quot;) | x3::lit(&quot;&lt;&lt;&quot;) | x3::lit(&quot;..&quot;) | x3::ascii::char_('&lt;') | x3::lit(&quot;&lt;=&quot;) | x3::ascii::char_('&gt;') | x3::lit(&quot;&gt;=&quot;) | x3::lit(&quot;==&quot;) | x3::lit(&quot;~=&quot;) | x3::lit(&quot;and&quot;) | x3::lit(&quot;or&quot;);\nauto const fieldsep_def = x3::lit(&quot;,&quot;) | x3::lit(&quot;;&quot;);\nauto const field_def = (&quot;[&quot; &gt;&gt; exp &gt;&gt; &quot;]&quot; &gt;&gt; &quot;=&quot; &gt;&gt; exp) | (Name &gt;&gt; &quot;=&quot; &gt;&gt; exp) | exp;\nauto const fieldlist_def = (field &gt;&gt; *(fieldsep &gt;&gt; field)) | (field &gt;&gt; *(fieldsep &gt;&gt; field) &gt;&gt; fieldsep);\nauto const tableconstructor_def = x3::lit(&quot;{&quot;) &gt;&gt; &quot;}&quot; | x3::lit(&quot;{&quot;) &gt;&gt; fieldlist &gt;&gt; &quot;}&quot;;\nauto const parlist_def = namelist | (namelist &gt;&gt; &quot;,&quot; &gt;&gt; &quot;...&quot;) | &quot;...&quot;;\nauto const funcbody_def = (&quot;(&quot; &gt; parlist &gt; &quot;)&quot; &gt; block &gt; &quot;end&quot;) | (x3::lit(&quot;(&quot;) &gt; &quot;)&quot; &gt; block &gt; &quot;end&quot;);\nauto const functiondef_def = &quot;function&quot; &gt;&gt; funcbody;\nauto const args_def = (&quot;(&quot; &gt;&gt; explist &gt;&gt; &quot;)&quot;) | (x3::lit(&quot;(&quot;) &gt;&gt; &quot;)&quot;) | tableconstructor | literal_string;\nauto const functioncall_def = (prefixexp &gt;&gt; args) | (prefixexp &gt;&gt; &quot;:&quot; &gt;&gt; Name &gt;&gt; args);\nauto const prefixexp_def = var | functioncall | (&quot;(&quot; &gt; exp &gt; &quot;)&quot;);\nauto const exp_def = simexp | (simexp &gt;&gt; binop &gt;&gt; simexp) | (unop &gt;&gt; simexp);\nauto const explist_def = exp &gt;&gt; *(&quot;,&quot; &gt;&gt; exp); // exp % &quot;,&quot;\nauto const namelist_def = Name &gt;&gt; *(&quot;,&quot; &gt;&gt; Name);\nauto const var_def = Name | (prefixexp &gt;&gt; &quot;[&quot; &gt;&gt; exp &gt;&gt; &quot;]&quot;) | (prefixexp &gt;&gt; &quot;.&quot; &gt;&gt; Name);\nauto const varlist_def = var &gt;&gt; *(&quot;,&quot; &gt;&gt; var);\nauto const funcname_def = (Name &gt;&gt; *(&quot;.&quot; &gt;&gt; Name) &gt;&gt; &quot;:&quot; &gt;&gt; Name) | (Name &gt;&gt; *(&quot;.&quot; &gt;&gt; Name));\nauto const label_def = &quot;::&quot; &gt;&gt; Name &gt;&gt; &quot;::&quot;;\nauto const retstat_def = (&quot;return&quot; &gt;&gt; explist &gt;&gt; &quot;;&quot;) | (&quot;return&quot; &gt;&gt; explist) | &quot;return&quot; | (x3::lit(&quot;return&quot;) &gt;&gt; &quot;;&quot;);\nauto const stat_def = x3::lit(&quot;;&quot;) | &quot;break&quot; | (&quot;goto&quot; &gt; Name) | (&quot;do&quot; &gt; block &gt; &quot;end&quot;) | (&quot;while&quot; &gt; exp &gt; &quot;do&quot; &gt; block &gt; &quot;end&quot;) | (&quot;repeat&quot; &gt; block &gt; &quot;until&quot; &gt; exp) | (&quot;if&quot; &gt; exp &gt; &quot;then&quot; &gt; block &gt; *(&quot;elseif&quot; &gt; exp &gt; &quot;then&quot; &gt; block) &gt; &quot;else&quot; &gt; block &gt; &quot;end&quot;) | (&quot;if&quot; &gt; exp &gt; &quot;then&quot; &gt; block &gt; *(&quot;elseif&quot; &gt; exp &gt; &quot;then&quot; &gt; block) &gt; &quot;end&quot;) | (&quot;for&quot; &gt; Name &gt; &quot;=&quot; &gt; exp &gt; &quot;,&quot; &gt; exp &gt; &quot;do&quot; &gt; block &gt; &quot;end&quot;) | (&quot;for&quot; &gt; Name &gt; &quot;=&quot; &gt; exp &gt; &quot;,&quot; &gt; exp &gt; &quot;,&quot; &gt; exp &gt; &quot;do&quot; &gt; block &gt; &quot;end&quot;) | (&quot;for&quot; &gt; namelist &gt; &quot;in&quot; &gt; explist &gt; &quot;do&quot; &gt; block &gt; &quot;end&quot;) | (&quot;function&quot; &gt; funcname &gt; funcbody) | (x3::lit(&quot;local&quot;) &gt; &quot;function&quot; &gt; Name &gt; funcbody) | (&quot;local&quot; &gt; namelist) | (&quot;local&quot; &gt; namelist &gt; &quot;=&quot; &gt; explist) | label | functioncall | (varlist &gt; &quot;=&quot; &gt; explist);\nauto block_def = (*(stat) &gt;&gt; retstat) | *(stat);\nauto chunk_def = block;\n\n\nBOOST_SPIRIT_DEFINE(chunk,block,stat,retstat,label,funcname,varlist,var,namelist,explist,exp,prefixexp,functioncall,args,functiondef,funcbody,parlist,tableconstructor,fieldlist,field,fieldsep,binop,unop);\n\n}\n\n//local,nil,true,false,end,then,if,elseif,not,and,or,function\n\n\nint main(int argc,const char *argv[]) {\n \n std::string lua_src_content = R&quot;(\n function LuaPrint(str)\n print(&quot;[in lua]:&quot; .. tostring(str))\n end\n )&quot;;\n \n typedef std::string::const_iterator iterator_type;\n iterator_type iter = lua_src_content.begin();\n iterator_type end = lua_src_content.end();\n ast::chunk out;\n bool r = x3::phrase_parse(iter, end, parse::chunk, x3::ascii::space, out);\n if(r &amp;&amp; (iter == end)){\n std::cout &lt;&lt; &quot;parse success!&quot; &lt;&lt; std::endl;\n }else{\n std::cerr &lt;&lt; &quot;parse fail!&quot; &lt;&lt; std::endl;\n }\n \n return 0;\n}\n\n</code></pre>\n<p>Can correctly parse Lua's syntax.</p>\n<p><code>x3::phrase_parse</code> returns true.</p>\n<p><code>(r &amp;&amp; (iter == end))</code> is true.</p>\n"^^ . . "3"^^ . "2"^^ . "0"^^ . . . . . "<p>It's unfortunately not very easy to discover in the neovim helpfiles (yet), but abbreviations can be set from lua by using <code>vim.keymap.set</code> or <code>nvim_set_keymap</code>, just like normal mappings. The special modes <code>&quot;ia&quot;</code>, <code>&quot;ca&quot;</code> or <code>&quot;!a&quot;</code> are the equivalent of <code>iabbrev</code>, <code>cabbrev</code> or both.</p>\n<p>These are shown in <code>:h nvim_set_keymap</code> (v0.10.0):</p>\n<pre><code> Parameters:\n • {mode} Mode short-name (map command prefix: &quot;n&quot;, &quot;i&quot;, &quot;v&quot;, &quot;x&quot;, …)\n or &quot;!&quot; for :map!, or empty string for :map. &quot;ia&quot;, &quot;ca&quot; or\n &quot;!a&quot; for abbreviation in Insert mode, Cmdline mode, or both,\n respectively\n</code></pre>\n<p>What you want to do can be achieved with:</p>\n<pre><code>:=vim.keymap.set(&quot;ia&quot;, &quot;r80=&quot;, &quot;repeat('=', 80)&quot;, { expr = true })\n</code></pre>\n"^^ . . . . . "1"^^ . "1"^^ . . . "3"^^ . . "@Armali <"`,6<,futb=!;/2f*:=> If you include a "" in there, it becomes ""`,6<,futb=!;/2f*:=" as\n\nThe leading "" is redundant. Is this grammatically correct?"^^ . . . . . . . . . . . . "list"^^ . "1"^^ . . "Doesn't Lua tell you _what's wrong with this syntax_? And what do you mean by _"" is redundant_?"^^ . . . . "1"^^ . "<p>I am in the process of converting FluentD with Fluent-bit to ship logs from K8S to S3. I need some help with tag_rewrite and pushing logs to the correct path in S3.</p>\n<p>FluentD config:</p>\n<pre><code> &lt;record&gt;\n# environment ${record[&quot;kubernetes&quot;][&quot;namespace_name&quot;]}\n# pod ${record[&quot;kubernetes&quot;][&quot;pod_name&quot;]}\n# podid ${record[&quot;kubernetes&quot;][&quot;pod_id&quot;]}\n# container ${record[&quot;kubernetes&quot;][&quot;container_name&quot;]}\n# &lt;/record&gt;\n# &lt;/filter&gt;\n# &lt;match **&gt;\n# @type s3\n# s3_bucket logs.bucket.us-east-1.domain.com\n# s3_region us-east-1\n# s3_object_key_format %Y/%m/%d/${environment}/${container}/${container}-${environment}-%Y%m%d-%H%M-${podid}-%{index}.%{file_extension}\n# store_as text\n</code></pre>\n<p>Fluentbit Config:</p>\n<pre><code> [INPUT]\n Name tail\n Tag s3logs.*\n Path /var/log/containers/*.log\n parser cri\n multiline.parser cri \n Mem_Buf_Limit 5MB\n Skip_Long_Lines On\n Skip_Empty_Lines On\n Refresh_Interval 10\n [FILTER]\n Name kubernetes\n Match s3logs.*\n Merge_Log On\n K8S-Logging.Parser On\n K8S-Logging.Exclude On\n Keep_Log Off\n Labels Off \n Annotations Off \n [FILTER]\n Name record_modifier\n Match s3logs.*\n Record cluster_name ${CLUSTER}\n [FILTER]\n name lua\n alias set_std_keys\n match s3logs.*\n script /fluent-bit/scripts/s3_path.lua\n call set_std_keys\n [FILTER]\n name rewrite_tag\n match s3logs.*\n rule $log ^.*$ s3.$namespace_name.$app_name.$container_name.$pod_id true \n\n outputs: |\n [OUTPUT]\n Name s3\n Match s3logs.*\n bucket logs.bucket.us-east-1.domain.com\n region us-east-1\n s3_key_format /%Y/%m/%d/$TAG[1]/$TAG[2]/$TAG[3]/$TAG[3]-$TAG[1]-%Y%m%d-%H%M-${podid}.txt\n store_dir /var/log/fluentbit-s3-buffers\n total_file_size 256MB\n upload_timeout 2m\n use_put_object On\n preserve_data_ordering On\n</code></pre>\n<p>S3 Lua script - based on my reading you have to use a LUA script to extract K8S metada:</p>\n<pre><code>function set_std_keys(tag, timestamp, record)\n\n -- Pull up cluster\n if (record[&quot;cluster_name&quot;] ~= nil) then\n record[&quot;cluster_name&quot;] = record[&quot;cluster_name&quot;]\n else\n record[&quot;cluster_name&quot;] = &quot;mycluster&quot;\n end\n\n if (record[&quot;kubernetes&quot;] ~= nil) then\n kube = record[&quot;kubernetes&quot;]\n\n -- Pull up namespace\n if (kube[&quot;namespace_name&quot;] ~= nil and string.len(kube[&quot;namespace_name&quot;]) &gt; 0) then\n record[&quot;namespace_name&quot;] = kube[&quot;namespace_name&quot;]\n else\n record[&quot;namespace_name&quot;] = &quot;default&quot;\n end\n\n -- Pull up container name\n if (kube[&quot;container_name&quot;] ~= nil and string.len(kube[&quot;container_name&quot;]) &gt; 0) then\n record[&quot;container_name&quot;] = kube[&quot;container_name&quot;]\n end\n\n -- Pull up pod id\n if (kube[&quot;pod_id&quot;] ~= nil and string.len(kube[&quot;pod_id&quot;]) &gt; 0) then\n record[&quot;pod_id&quot;] = kube[&quot;pod_id&quot;]\n end\n\n -- Pull up app name (Deployment, StateFuleSets, DaemonSet, Job, CronJob etc)\n if (kube[&quot;labels&quot;] ~= nil) then\n labels = kube[&quot;labels&quot;]\n\n if (labels[&quot;app&quot;] ~= nil and string.len(labels[&quot;app&quot;]) &gt; 0) then\n record[&quot;app_name&quot;] = labels[&quot;app&quot;]\n elseif (labels[&quot;app.kubernetes.io/instance&quot;] ~= nil and string.len(labels[&quot;app.kubernetes.io/instance&quot;]) &gt; 0) then\n record[&quot;app_name&quot;] = labels[&quot;app.kubernetes.io/instance&quot;]\n elseif (labels[&quot;k8s-app&quot;] ~= nil and string.len(labels[&quot;k8s-app&quot;]) &gt; 0) then\n record[&quot;app_name&quot;] = labels[&quot;k8s-app&quot;]\n elseif (labels[&quot;name&quot;] ~= nil and string.len(labels[&quot;name&quot;]) &gt; 0) then\n record[&quot;app_name&quot;] = labels[&quot;name&quot;]\n end\n else\n record[&quot;app_name&quot;] = record[&quot;app_name&quot;]\n end\n end\n\n return 2, timestamp, record\n end \n</code></pre>\n<p>shipping logs via FluentD goes to the correct path in s3 for example: <code>2023/10/14/namespace/container_name/container-name-namespace_name-2023-10-14-UUID.txt</code></p>\n<p>shipping logs via Fluentbit goes to the wrong path in s3 for example:\n<code>2023/10/14/var/log/containers/containers-var-20231014-0759-.log-object00N1PX3n</code></p>\n<p>How can i get the logs from Fluentbit to be shipped to the correct. I'm sure it's just a configuration issue, but I've been through the Fluentbit docs, sought help on Slack, even scrolled through GitHub, but to no avail.</p>\n"^^ . . "2"^^ . "0"^^ . "1"^^ . "1"^^ . . "1"^^ . . . "0"^^ . "<p>I need help!\nthis bug:\n<code>[ script:oxmysql] Error: teleport-custom was unable to execute a query! [ script:oxmysql] Query: INSERT INTO player_locations (player_id, x, y, z) VALUES (?, ?, ?, ?) [ script:oxmysql] [&quot;license:405702e0a3ae0630efaa0e0520c2ae1d40de74b6&quot;,null,1.4739839571120683e-8,0] [ script:oxmysql] Unknown column 'NaN' in 'field list' </code></p>\n<p>and this is the code(server.lua):</p>\n<pre><code>-- Save player's location to the database\nRegisterCommand('savelocation', function(source, args, rawCommand)\nlocal x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1)))\nlocal playerId = GetPlayerIdentifier(source, 0)\n\n -- Check if x, y, or z are NaN (not a number) and replace them with 0\n if not x or not tonumber(x) then\n x = 0.0\n end\n if not y or not tonumber(y) then\n y = 0.0\n end\n if not z or not tonumber(z) then\n z = 0.0\n end\n \n local query = &quot;INSERT INTO player_locations (player_id, x, y, z) VALUES (@player_id, @x, @y, @z)&quot;\n local params = {\n ['@player_id'] = playerId,\n ['@x'] = x,\n ['@y'] = y,\n ['@z'] = z\n }\n \n exports.oxmysql:execute(query, params, function(affectedRows)\n if affectedRows &gt; 0 then\n TriggerClientEvent('chatMessage', source, '^2Location saved!')\n else\n TriggerClientEvent('chatMessage', source, '^1Error saving location!')\n end\n end)\n\nend, false)\n\\`\n\\-- Teleport the player to a random saved location\nRegisterCommand('teleporttolocation', function(source, args, rawCommand)\nlocal playerId = GetPlayerIdentifier(source, 0)\n\n local query = &quot;SELECT * FROM player_locations WHERE player_id = @player_id ORDER BY RAND() LIMIT 1&quot;\n local params = {\n ['@player_id'] = playerId\n }\n \n exports.oxmysql:fetch(query, params, function(result)\n if result and type(result) == 'table' and result[1] then\n local x, y, z = tonumber(result[1].x), tonumber(result[1].y), tonumber(result[1].z)\n if x and y and z then\n local playerPed = GetPlayerPed(-1)\n SetEntityCoords(playerPed, x, y, z, true, true, true)\n TriggerClientEvent('chatMessage', source, '^2Teleported to a saved location!')\n else\n TriggerClientEvent('chatMessage', source, '^1Invalid coordinates in the database!')\n end\n else\n TriggerClientEvent('chatMessage', source, '^1No saved locations found or database error!')\n end\n end)\n\nend, false)\n\n</code></pre>\n<p>I tried to use multipole Ai software's(chatGPT, Barde...) but that didn't help\nwhat is the problem and how to fix it?\nI will appreciate your assistance</p>\n<p>I couldnt fix it,\nI will appreciate your assistance</p>\n"^^ . . "0"^^ . "0"^^ . "Your Lua VM does not have `setmetatable` global variable. Something is wrong with Lua VM initialization. Try to run successfully minimal Lua program `print(setmetatable)` - it must print non-nil value."^^ . "Got it. So, I am going to change my approach and store the fn on the class instead of passing it as void *. Thanks!"^^ . "2"^^ . . . . . "why can't i disable vscode hover (with the lua extension enabled)"^^ . "You may not add new keys while traversing the table. Your `probe` function currently exhibits undefined behavior."^^ . . "0"^^ . "0"^^ . "2"^^ . "mysql"^^ . . . "<p>Using a temporary table:</p>\n<pre class="lang-lua prettyprint-override"><code>local function reverse(...)\n local n = select(&quot;#&quot;, ...)\n local t = {...}\n -- Reverse the table\n for i = 1, n/2 do\n local j = n - i + 1\n t[i], t[j] = t[j], t[i]\n end\n return unpack(t, 1, n)\nend\n</code></pre>\n<p>or using a helper function which picks the <code>n</code>-th element, prepends that to a new vararg, and recurses until <code>n = 0</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>local function h(n, ...)\n if n == 0 then return end\n return select(n, ...), h(n - 1, ...)\nend\nlocal function reverse(...)\n return h(select(&quot;#&quot;, ...), ...)\nend\n</code></pre>\n"^^ . "0"^^ . . . "docker"^^ . . "2"^^ . . "0"^^ . "0"^^ . . . . . . . "<p>I see you're using the CFrame.lookAt function, if you read the documentation, you can find out the following:</p>\n<blockquote>\n<p>Returns a new CFrame with the position of at and facing towards lookAt, optionally specifying the upward direction (up) with a default of (0, 1, 0).</p>\n</blockquote>\n<p>And if you read a little bit more up:</p>\n<blockquote>\n<p>At high pitch angles (around 82 degrees), you may experience numerical instability. If this is an issue, or if you require a different &quot;up&quot; vector, use CFrame.fromMatrix() to more accurately construct the CFrame. Additionally, if lookAt is directly above pos (pitch angle of 90 degrees), the &quot;up&quot; vector switches to the X axis.</p>\n</blockquote>\n<p>This would mean it is expected behavior, as the numerical instability, combined with the velocity settings in your bodygyro, cause this flinging.</p>\n<p>As the documentation describes, you want to look into CFrame.fromMatrix to construct a proper CFrame. If that doesn't work, you also want to check if modifying the up vector manually works.</p>\n"^^ . "0"^^ . . "1"^^ . . . "1"^^ . . . "redis"^^ . . . . . "0"^^ . . . . "vector"^^ . . "0"^^ . . . . "1"^^ . "3"^^ . "1"^^ . "1"^^ . "0"^^ . . "What do you mean "this script is broken"? My proposed `probe` implementation fixes the issue that your current code is relying on undefined behavior: ["The behavior of next is undefined if, during the traversal, you assign any value to a non-existent field in the table"](https://www.lua.org/manual/5.1/manual.html#pdf-next). It does not fix any other issues; others have already told you how to fix those. It complements rather than substitutes the existing answers."^^ . . "1"^^ . . . "<p>I'm trying to insert spaces in a table to make ASCII art but everytime I try to do so, lua considers this string: &quot; &quot; as empty despite having a space in it.</p>\n<p>No matter what I do, lua won't allow me to use a string containing only spaces. (Yes, even multiple spaces). How can I fix this?</p>\n"^^ . . "0"^^ . . . "go"^^ . . . "0"^^ . . . . "0"^^ . "1"^^ . "Having an issue with Gyros on roblox"^^ . . "0"^^ . . . "1"^^ . . "0"^^ . "I swapped the variable "diferencia" for "hit", which stands for raycast.Position, as you've told me. However, it does not work, either. although the grey ball no longers clips trough the floor, it keeps appearing in random places and NOT where I shot at. And by the way, startPosition is the place where the raycast starts from, this being the tip of the weapon I'm holding."^^ . . "0"^^ . . . . "1"^^ . "-1"^^ . . . . . . . . "<p>I'm trying to figure out the interaction between Lua and C where a C function takes multiple inputs, one being a Lua array. Other articles on StackOverflow cover only an array being passed in to C, where the C code uses <code>-1</code> to index the array.</p>\n<p><strong>Note 1:</strong> I am not a Lua expert.</p>\n<p><strong>Note 2:</strong> I mentioned that other posts do not cover the complication of indices. I offered a solution below which covers it and makes it clear. Do not flag this without understanding the full context. Many may not like my Note 2, but many users know flagging is an issue.</p>\n<p>Lua</p>\n<pre><code>name = &quot;id string&quot;\nrandom_array = {1.2, 1.3, 1.4}\nc_function(name, random_array, 3) -- 3 is the size of array.\n</code></pre>\n<p>C</p>\n<pre><code>static int c_function(lua_State* L)\n{\n const char* name = luaL_checkstring(L, 1);\n int size = luaL_checkinteger(L, 3);\n double data[size];\n\n // How do I get array values from 'L' into 'data'?\n\n Calculate(name, data, size);\n return 0;\n}\n\nvoid Calculate(const char* name, double* data, int size)\n{\n // Existing function which acts on the data.\n // This function cannot change.\n}\n</code></pre>\n"^^ . . . . . "<p>Converting my <a href="https://stackoverflow.com/questions/77389377/image-not-loading-over-others-in-pause-state?noredirect=1#comment136434574_77389377">comment</a> to an answer...</p>\n<p>Drawing occurs in layers from bottom to top, so moving the pause drawing code after other entities you're drawing should place it in a layer above them:</p>\n<pre class="lang-lua prettyprint-override"><code>-- ...\nfor k, pair in pairs(self.pipePairs) do\n pair:render()\nend\n\nlove.graphics.setFont(flappyFont)\nlove.graphics.print('Score: ' .. tostring(self.score), 8, 8)\n\nself.bird:render()\n\nif self.pause then -- moved down to bottom\n love.graphics.draw(pause, 235, 100, center)\nend\n-- ...\n</code></pre>\n"^^ . . . "<p>If you are interested in dropping down a level, the Lua C API provides <a href="https://www.lua.org/manual/5.4/manual.html#lua_insert" rel="nofollow noreferrer"><code>lua_insert</code></a> and <a href="https://www.lua.org/manual/5.4/manual.html#lua_rotate" rel="nofollow noreferrer"><code>lua_rotate</code></a> (5.3+), both of which can be used to manipulate the stack directly.</p>\n<p>An example using the former:</p>\n<pre><code>#include &lt;lua.h&gt;\n\nstatic int reverse(lua_State *L)\n{\n int n = lua_gettop(L);\n for (int i = 1; i &lt; n; i++)\n lua_insert(L, i);\n return n;\n}\n\nint luaopen_reverse(lua_State *L)\n{\n lua_pushcfunction(L, reverse);\n return 1;\n}\n</code></pre>\n<pre class="lang-lua prettyprint-override"><code>local reverse = require 'reverse'\n\nprint(reverse(1, 2, 3, 4))\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>4 3 2 1\n</code></pre>\n<hr />\n<p>(<em>The following focuses on the Lua 5.4 API, but should be applicable to Lua 5.3 as well. Note that in Lua 5.3+, <code>lua_insert</code> is a macro around <code>lua_rotate</code>.</em>)</p>\n<p>Interestingly, there is an internal API function called <a href="https://www.lua.org/source/5.4/lapi.c.html#reverse" rel="nofollow noreferrer"><code>reverse</code></a>, used by <code>lua_rotate</code>, which performs this task very efficiently across a stack segment.</p>\n<p>If one has the ability to change the source code for their installation, then it is possible to modify <a href="https://www.lua.org/source/5.4/lapi.c.html" rel="nofollow noreferrer"><em>src/lapi.c</em></a> with the following function,</p>\n<pre><code>/* reverse the entire stack segment */\nLUA_API void lua_reverse (lua_State *L)\n{\n lua_lock(L);\n int n = lua_gettop(L);\n if (n &gt; 1)\n reverse(L, index2stack(L, 1), index2stack(L, n));\n lua_unlock(L);\n}\n</code></pre>\n<p><a href="https://www.lua.org/source/5.4/lua.h.html" rel="nofollow noreferrer"><em>src/lua.h</em></a> with the following protoype,</p>\n<pre><code>LUA_API void (lua_reverse) (lua_State *L);\n</code></pre>\n<p><a href="https://www.lua.org/source/5.4/lbaselib.c.html" rel="nofollow noreferrer"><em>src/lbaselib.c</em></a> with the following function,</p>\n<pre><code>static int luaB_reverse (lua_State *L) {\n lua_reverse(L);\n return lua_gettop(L);\n}\n</code></pre>\n<p>and add</p>\n<pre><code>{&quot;reverse&quot;, luaB_reverse},\n</code></pre>\n<p>to the <a href="https://www.lua.org/source/5.4/lbaselib.c.html#base_funcs" rel="nofollow noreferrer"><code>base_funcs</code></a> array in <a href="https://www.lua.org/source/5.4/lbaselib.c.html" rel="nofollow noreferrer"><em>src/lbaselib.c</em></a>, to get access to an efficient, global <code>reverse</code> function:</p>\n<pre class="lang-none prettyprint-override"><code>Lua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio\n&gt; reverse('hello', 'world', 42)\n42 world hello\n</code></pre>\n<p>(<em>and a <code>lua_reverse</code> C API function, of course.</em>)</p>\n"^^ . . . . "Show code. There are several ways to pass user data to Lua..."^^ . "generate"^^ . . "NeoVim nested require throws errors"^^ . "please provide the errors"^^ . "mediawiki-templates"^^ . "0"^^ . . "Lua script to execute commands after pressing a few keys"^^ . . . "<p>I am working to convert from Vim to NeoVim and am trying to transfer commands from my init.vim and .<code>vimrc</code> files to my lua files. I had a command in my <code>.vimrc</code> file that would recognize the term r80= meant that the value of r80= should be replaced with 80 = characters. The command in my <code>.vimrc</code> file was</p>\n<pre><code>iab &lt;expr&gt; r80= repeat('=', 80)\n</code></pre>\n<p>I have the following structure for my <code>nvim</code> file in <code>.config</code></p>\n<pre><code>nvim\n├── after\n│   └── plugin\n│   ├── colors.lua\n│   ├── fugitive.lua\n│   ├── harpoon.lua\n│   ├── lsp.lua\n│   ├── telescope.lua\n│   ├── treesitter.lua\n│   └── undotree.lua\n├── init.lua\n├── lua\n│   └── core\n│   ├── init.lua\n│   ├── packer.lua\n│   ├── remap.lua\n│   └── set.lua\n└── plugin\n └── packer_compiled.lua\n</code></pre>\n<p>Within the <code>nvim/core/set.lua</code> file I have tried the following</p>\n<pre><code>vim.cmd(&quot;iab &lt;expr&gt; r80= repeat('=', 80)&quot;)\n</code></pre>\n<p>However this does not appear to work. How can I embed this functionality into Neovim with lua files?</p>\n"^^ . "0"^^ . . "1"^^ . . "<p>in many older games, a system called subpixels was used. theyd calculate collision on a scale smaller than the actual pixels (for example to 0.1 pixels instead of 1 pixel) and when drawing theyd simply use the floor of the x and y values. this allows way more precision and smoothness.\nthis tutorial series has alot of great advice, though its for another platform i still go back to it for help: <a href="https://www.youtube.com/playlist?list=PLy4zsTUHwGJIc90UaTKd-wpIH12FCSoLh" rel="nofollow noreferrer">https://www.youtube.com/playlist?list=PLy4zsTUHwGJIc90UaTKd-wpIH12FCSoLh</a>\nthis article also seems very useful, though i havent read through it all: <a href="http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/" rel="nofollow noreferrer">http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/</a></p>\n"^^ . . "Lua scrip: mpv-cut. change location for cut videos"^^ . . . "0"^^ . "1"^^ . . . . "Thx! Apparently I had tmux binding on those keys."^^ . "0"^^ . "Lua "attempt to index a nil value": indexing nested tables, where several tables might be not existing (using __index and __newindex metamethod)"^^ . "0"^^ . "0"^^ . . "1"^^ . "0"^^ . . "fivem"^^ . . "0"^^ . "sandbox"^^ . . . "<pre><code> &quot;endpoint&quot;: &quot;/apps/{id}&quot;,\n &quot;output_encoding&quot;: &quot;no-op&quot;,\n &quot;method&quot;: &quot;GET&quot;,\n &quot;backend&quot;: [\n {\n &quot;host&quot;: [\n &quot;http://xxx.yyy.zz:8888&quot;\n ],\n &quot;url_pattern&quot;: &quot;/apps/{id}&quot;,\n &quot;extra_config&quot;: {\n &quot;modifier/lua-backend&quot;: {\n &quot;sources&quot;: [\n &quot;/etc/krakend/Hello.lua&quot;\n ],\n &quot;post&quot;: &quot;local r = response.load(); printPostBody(r:body());&quot;,\n &quot;allow_open_libs&quot;: true\n }\n }\n }\n ]\n }, \n</code></pre>\n<p>My Hello.lua:</p>\n<pre><code>local mylua = require(&quot;cjson&quot;)\n\nfunction printPostBody(body)\n print(body);\nend\n</code></pre>\n<p>When i add this part: <code>local mylua = require(&quot;cjson&quot;)</code> i got this error:</p>\n<pre><code>2023/10/08 09:36:23 [Recovery] 2023/10/08 - 09:36:23 panic recovered:\nruntime error: slice bounds out of range [-1:]\n/usr/local/go/src/runtime/panic.go:153 (0xf3dc7e)\n/go/pkg/mod/github.com/krakendio/binder@v0.0.0-20230413105421-1bbe94e65f45/error.go:140 (0x1971f64)\n/go/pkg/mod/github.com/krakendio/binder@v0.0.0-20230413105421-1bbe94e65f45/binder.go:27 (0x1970866)\n/go/pkg/mod/github.com/krakendio/binder@v0.0.0-20230413105421-1bbe94e65f45/error.go:201 (0x1972397)\n/go/pkg/mod/github.com/krakendio/binder@v0.0.0-20230413105421-1bbe94e65f45/binder.go:43 (0x19707ee)\n/go/pkg/mod/github.com/krakendio/binder@v0.0.0-20230413105421-1bbe94e65f45/binder.go:26 (0x1970785)\n/go/pkg/mod/github.com/krakendio/krakend-lua/v2@v2.1.2/proxy/proxy.go:75 (0x1979793)\n/go/pkg/mod/github.com/luraproject/lura/v2@v2.3.0/proxy/balancing.go:77 (0x13080a8)\n/go/pkg/mod/github.com/luraproject/lura/v2@v2.3.0/proxy/http.go:113 (0x130db84)\n/go/pkg/mod/github.com/luraproject/lura/v2@v2.3.0/router/gin/endpoint.go:50 (0x1bbf674)\n/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x1bb49c1)\n/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/recovery.go:102 (0x1bb49ac)\n/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x1bb3ae6)\n/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/logger.go:240 (0x1bb3ac9)\n/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x1bb296a)\n/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:620 (0x1bb25f1)\n/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:576 (0x1bb211c)\n/usr/local/go/src/net/http/server.go:2936 (0x128a0b5)\n/usr/local/go/src/net/http/server.go:1995 (0x1285251)\n/usr/local/go/src/runtime/asm_amd64.s:1598 (0xf761a0)\n</code></pre>\n"^^ . "What exactly do you mean by "how could I get each individual string as an index"? Do you want to "flatten" the table to `{'text', 'something', 'string', 'thing'}`?"^^ . . . . "Sequences of two button presses. Logitech G Hub lua script"^^ . . . . . . "@LorahAttkins the `(.+)` means that it will match everything that is at least length 1. That means that will match E.G. `/tmp/project1/client_config.json` but not `/tmp/project1/_config.json`"^^ . . . . "<p>You are checking if those exist as keys. You should be checking if they exist as values. You can change the function to this</p>\n<pre><code>function inTable(t,e)\n for k,v in pairs(t) do\n if v == e then\n return true\n end\n end\n return false\nend\n</code></pre>\n<p>Also, in case you didn't know</p>\n<pre><code>local table_ = {&quot;A&quot;,&quot;B&quot;}\n</code></pre>\n<p>is equivalent to</p>\n<pre><code>local table_ = {[1] = &quot;A&quot;, [2] = &quot;B&quot;}\n</code></pre>\n"^^ . . . . . . . . . "dictionary"^^ . . "1"^^ . . . "<p>This table is structured like this:</p>\n<pre><code>local t = {\n [&quot;track&quot;] = &quot;one#two#three&quot;,\n {\n [&quot;track&quot;] = &quot;four&quot;\n }, -- [1]\n}\n</code></pre>\n<p>The first step is to replace the &quot;track&quot; key with the &quot;aura&quot; key. For this purpose I created this function</p>\n<pre><code>local function probe(tbl)\n for k, v in pairs(tbl) do\n if type(v) == &quot;table&quot; then\n probe(v)\n elseif type(v) == &quot;string&quot; and k == &quot;track&quot; then\n tbl[&quot;aura&quot;] = tbl[k]\n tbl[k] = nil\n end\n end\nend\n</code></pre>\n<p>running the <code>probe(t)</code> command the table becomes</p>\n<pre><code>{\n [&quot;aura&quot;] = &quot;one#two#three&quot;,\n {\n [&quot;aura&quot;] = &quot;four&quot;,\n }, -- [1]\n}\n</code></pre>\n<p>The second step consists in creating as many tables of the form { [&quot;aura&quot;] = word } as there are tokens in the string &quot;one#two#three&quot;. For this purpose I created the function</p>\n<pre><code>local function updateDB(tbl, depth)\n if depth &gt; 0 then \n local d = depth \n for k, v in pairs(tbl) do\n if type(v) ~= 'table' then \n if k == 'aura' then\n local count = 1\n for word in v:gmatch((&quot;[^%s]+&quot;):format(&quot;#&quot;)) do\n tbl[count] = { [&quot;aura&quot;] = word }\n count = count + 1\n end\n tbl[k] = nil \n end\n else \n d = d - 1\n updateDB(v, d)\n end\n end\n end\nend\n</code></pre>\n<p>The final table I get is this</p>\n<pre><code>{\n {\n aura= &quot;one&quot;,\n }, -- [1]\n {\n aura= &quot;two&quot;,\n }, -- [2]\n {\n aura= &quot;three&quot;,\n }, -- [3]\n}\n</code></pre>\n<p>But &quot;four&quot; value is gone away</p>\n"^^ . . . . . . . "1"^^ . "1"^^ . "0"^^ . "The function call works, Lua is capable to call "set" fine. The problem is on the line "(*fn)();", which crashes because the fn is invalid. "(*fn)();" WORKS when I use it with a C++ lambda."^^ . "0"^^ . "2"^^ . . . . . . . "0"^^ . . . . . "<p>Does b need to be like this or can you simply modify a.lua like so?</p>\n<pre><code>local a = {}\n\nfunction a.new(x, y)\n x = x or 0\n y = y or 0\n local b = {}\n b.x = x\n b.y = y\n b.z = 'Static'\n return b\nend\n-- b.lua\nd = {}\n\ntable.insert(d, a.new(1, 2))\ntable.insert(d, a.new(2, 3))\n\nfor k, v in pairs(d) do\n print(k, v.x, v.y)\nend\n</code></pre>\n"^^ . "data-manipulation"^^ . . . "0"^^ . "0"^^ . "1"^^ . . "0"^^ . . . . . "2"^^ . . . "wireshark"^^ . . "@UliSchlachter You were right, check my answer."^^ . "0"^^ . . . . "0"^^ . "I don't know much about Roblox, but I assume the sound would stop when you `:Destroy` it? If you need to destroy it, perhaps do that after it finished via the `Ended` event. Or possibly `PlayOnRemove` can be used? (This might be needed if the parent ends up being destroyed before the sound finishes anyway.)"^^ . . "0"^^ . "2"^^ . . . . "0"^^ . "<p>So, I've got a script which when picks a remoteEvent, fired by a local script when firing a raycast, creates a part where the raycast hit (raycast.Position, labelled as &quot;impacto&quot;)</p>\n<pre><code>local remoteEvent = script.Parent.esquirlaEvent\nlocal ruido = script.Parent.ruidoEvent\nlocal tool = script.Parent\nlocal debris = game:GetService(&quot;Debris&quot;)\nlocal material = Enum.Material\n\nremoteEvent.OnServerEvent:Connect(function(player, startPosition, impacto, colordobjeto, materialdobjeto)\n\n local function crearescombros(startPosition, impacto)\n\n local visual = Instance.new(&quot;Part&quot;)\n visual.Name = &quot;esquirla&quot;\n visual.Parent = game.Workspace.esquirlas\n visual.Anchored = true\n visual.CanCollide = false\n visual.Transparency = .5\n visual.Shape = Enum.PartType.Ball\n \n if materialdobjeto ~= material.Metal then\n visual.Size = Vector3.new(2, 2, 2)\n visual.Material = material.Plastic\n \n elseif materialdobjeto == Enum.Material.Metal then\n visual.Size = Vector3.new(1, 1, 1)\n visual.Material = material.Neon\n \n end\n \n \n if materialdobjeto == Enum.Material.Concrete then\n visual.BrickColor = BrickColor.new(&quot;Medium stone grey&quot;)\n \n elseif materialdobjeto == Enum.Material.Brick then\n visual.BrickColor = colordobjeto\n \n elseif materialdobjeto == Enum.Material.Metal then\n visual.BrickColor = BrickColor.new(&quot;New Yeller&quot;)\n \n elseif materialdobjeto == Enum.Material.Grass then\n visual.BrickColor = BrickColor.new(&quot;Brown&quot;)\n \n end\n\n visual.CFrame = CFrame.lookAt(impacto, startPosition)\n\n \n wait(.1)\n visual.Transparency = .8\n \n debris:AddItem(visual, 0.2)\n end\n \n\n \n crearescombros(startPosition, impacto)\nend)\n</code></pre>\n<p>Well, I'd like this part instance, visual, play a sound.</p>\n<p>I've tried creating a sound istance inside of the local function, but it doesn't work all that good. Although the sound DOES play when &quot;visual&quot; appears, it stops playing as soon as the part dissapears, 0.2 seconds, cutting the audio midway, making it bothering.\nThis is the attempt:</p>\n<pre><code>\nlocal remoteEvent = script.Parent.esquirlaEvent\nlocal ruido = script.Parent.ruidoEvent\nlocal tool = script.Parent\nlocal debris = game:GetService(&quot;Debris&quot;)\nlocal material = Enum.Material\n\nremoteEvent.OnServerEvent:Connect(function(player, startPosition, impacto, colordobjeto, materialdobjeto)\n\n local function crearescombros(startPosition, impacto)\n\n local visual = Instance.new(&quot;Part&quot;)\n visual.Name = &quot;esquirla&quot;\n visual.Parent = game.Workspace.esquirlas\n visual.Anchored = true\n visual.CanCollide = false\n visual.Transparency = .5\n visual.Shape = Enum.PartType.Ball\n \n if materialdobjeto ~= material.Metal then\n visual.Size = Vector3.new(2, 2, 2)\n visual.Material = material.Plastic\n \n elseif materialdobjeto == Enum.Material.Metal then\n visual.Size = Vector3.new(1, 1, 1)\n visual.Material = material.Neon\n \n end\n \n \n if materialdobjeto == Enum.Material.Concrete then\n visual.BrickColor = BrickColor.new(&quot;Medium stone grey&quot;)\n \n elseif materialdobjeto == Enum.Material.Brick then\n visual.BrickColor = colordobjeto\n \n elseif materialdobjeto == Enum.Material.Metal then\n visual.BrickColor = BrickColor.new(&quot;New Yeller&quot;)\n \n elseif materialdobjeto == Enum.Material.Grass then\n visual.BrickColor = BrickColor.new(&quot;Brown&quot;)\n \n end\n\n visual.CFrame = CFrame.lookAt(impacto, startPosition)\n \n local sonido = Instance.new(&quot;Sound&quot;)\n sonido.Parent = visual\n sonido.SoundId = &quot;rbxassetid://15179448200&quot;\n sonido:Play()\n sonido.Volume = 5\n sonido.MaxDistance = 50\n \n wait(.1)\n visual.Transparency = .8\n \n sonido:Destroy()\n \n debris:AddItem(visual, 0.2)\n end\n \n\n \n crearescombros(startPosition, impacto)\nend)\n</code></pre>\n<p>Any help is aprecciated and will be taked in count.</p>\n"^^ . . "0"^^ . "1"^^ . . . . "0"^^ . . . . . . "<p>The &quot;traversing JSON&quot; functionality is useful here.</p>\n<pre><code>local json = require&quot;json&quot;\nlocal s = [[\n{\n &quot;data&quot;: {\n &quot;id&quot;: 1,\n &quot;attributes&quot;: {\n &quot;name&quot;: &quot;John&quot;,\n &quot;details&quot;: {\n &quot;age&quot;: 30,\n &quot;address&quot;: {\n &quot;street&quot;: &quot;123 Main St&quot;,\n &quot;city&quot;: &quot;Anytown&quot;\n }\n }\n }\n }\n}\n]]\nlocal Person = {}\n\njson.traverse(s,\n function (path, json_type, value, pos, pos_last)\n local path_str = table.concat(path, &quot;/&quot;)\n print(&quot;DEBUG:&quot;, path_str, json_type, value, pos, pos_last)\n if json_type == &quot;number&quot; or json_type == &quot;string&quot; then\n Person[path[#path]] = value\n end\n end\n)\n\nprint&quot;RESULT&quot;\nfor k,v in pairs(Person) do\n print(k, v)\nend\n</code></pre>\n<p>Output:</p>\n<pre class="lang-none prettyprint-override"><code>DEBUG: object nil 1 nil\nDEBUG: data object nil 14 nil\nDEBUG: data/id number 1 28 28\nDEBUG: data/attributes object nil 51 nil\nDEBUG: data/attributes/name string John 70 75\nDEBUG: data/attributes/details object nil 98 nil\nDEBUG: data/attributes/details/age number 30 119 120\nDEBUG: data/attributes/details/address object nil 146 nil\nDEBUG: data/attributes/details/address/street string 123 Main St 173 185\nDEBUG: data/attributes/details/address/city string Anytown 211 219\nRESULT\nname John\nstreet 123 Main St\ncity Anytown\nage 30\nid 1\n</code></pre>\n<p>The library is <a href="https://github.com/Egor-Skriptunoff/json4lua" rel="nofollow noreferrer">here</a></p>\n"^^ . . "image not loading over others in pause state"^^ . . . "1"^^ . . "1"^^ . . . . . . . . "1"^^ . . "<p><strong>Problem:</strong>\nIterating an array of structs in Lua and manipulating the data, that is than used in C++ later on.</p>\n<p><strong>Backstory:</strong>\nI did some performance testing this week and I am kind of disappointed by the performance of Lua.\nMy struggle began while integrating Lua as a scripting interface to my game engine. I started using luabridge for simplicity but quickly switched to sol2 because of some convenience features. Then I measured the performance for the first time an was quiet shocked by how bad it was.</p>\n<p><strong>Testcase:</strong>\nI extracted a standalone testcase (see Code:) to compare native C++ performance to sol2 performance. Still the same bad results. Then I also added another testcase that uses plain Lua and just Light Userdata to do the same thing. Performance is a little better but far from good as shown below.</p>\n<p><strong>Timings:</strong></p>\n<pre class="lang-none prettyprint-override"><code>C++ elapsed time: 0.002736s\nSol (Container) elapsed time: 0.999166s\nLua (Light Userdata) elapsed time: 0.338946s\n</code></pre>\n<p><strong>Question:</strong>\nIs this something to expect or is there any chance to get close to native C++ performance for a usecase like this?</p>\n<p><strong>Info:</strong></p>\n<ul>\n<li>LuaJit (latest master branch)</li>\n<li>sol2 (latest master branch)</li>\n<li>Compiler: MSVC19</li>\n<li>OS: Windows 11</li>\n</ul>\n<p><strong>Code:</strong></p>\n<pre class="lang-cpp prettyprint-override"><code>#define SOL_ALL_SAFETIES_ON 0\n#define SOL_USING_CXX_LUAJIT 1\n#include &lt;sol/sol.hpp&gt;\n#include &lt;chrono&gt;\n\n\nstruct Transform\n{\n float position_x;\n float position_y;\n float position_z;\n float scale_x;\n float scale_y;\n float scale_z;\n};\n\nTransform* p_transforms = nullptr;\n\n\nstd::vector&lt;Transform*&gt; GetTransformPointerArray( int32_t count )\n{\n std::vector&lt;Transform*&gt; transform_pointers( count );\n for( int i = 0; i &lt; transform_pointers.size(); ++i )\n transform_pointers[ i ] = &amp;p_transforms[ i ];\n\n return transform_pointers;\n}\n\n\nvoid c_Update( int32_t count )\n{\n for( int i = 0; i &lt; count; ++i )\n {\n Transform* p_transform = &amp;p_transforms[ i ];\n\n p_transform-&gt;position_x += 0.01f;\n p_transform-&gt;scale_x += 0.01f;\n }\n}\n\n\nvoid c_perf_test( int32_t iterations, int32_t count )\n{\n auto start = std::chrono::high_resolution_clock::now();\n\n for( int i = 0; i &lt; iterations; ++i )\n c_Update( count );\n\n auto end = std::chrono::high_resolution_clock::now();\n std::chrono::duration&lt;double&gt; elapsed_seconds = end - start;\n double elapsed = elapsed_seconds.count();\n\n printf( &quot;C++ elapsed time: %fs\\n&quot;, elapsed );\n}\n\n\nvoid sol_perf_test( int32_t iterations, int32_t count )\n{\n sol::state lua;\n lua.open_libraries();\n\n lua.new_usertype&lt;Transform&gt;( &quot;Transform&quot;,\n &quot;position_x&quot;, &amp;Transform::position_x,\n &quot;position_y&quot;, &amp;Transform::position_y,\n &quot;position_z&quot;, &amp;Transform::position_z,\n &quot;scale_x&quot;, &amp;Transform::scale_x,\n &quot;scale_y&quot;, &amp;Transform::scale_y,\n &quot;scale_z&quot;, &amp;Transform::scale_z );\n\n lua.script( R&quot;(\n function Update( transforms )\n for i = 1, #transforms, 1 do\n local transform = transforms[i]\n\n local position_x = transform.position_x\n local scale_x = transform.scale_x\n\n position_x = position_x + 0.01\n scale_x = scale_x + 0.01\n\n transform.position_x = position_x\n transform.scale_x = scale_x\n end\n end\n )&quot; );\n\n sol::function update_func = lua[ &quot;Update&quot; ];\n\n std::vector&lt;Transform*&gt; transform_pointers = GetTransformPointerArray( count );\n\n auto start = std::chrono::high_resolution_clock::now();\n\n for( int i = 0; i &lt; iterations; ++i )\n update_func( transform_pointers );\n\n auto end = std::chrono::high_resolution_clock::now();\n std::chrono::duration&lt;double&gt; elapsed_seconds = end - start;\n double elapsed = elapsed_seconds.count();\n\n printf( &quot;Sol (Container) elapsed time: %fs\\n&quot;, elapsed );\n}\n\n\nstatic int get_light_transform_array( lua_State* L )\n{\n lua_pushlightuserdata( L, p_transforms );\n return 1;\n}\n\n\nstatic int get_light_transform( lua_State* L )\n{\n Transform* p_transforms = (Transform*) lua_touserdata( L, 2 );\n int index = luaL_checkint( L, 3 );\n\n lua_pushlightuserdata( L, &amp;p_transforms[ index - 1 ] );\n return 1;\n}\n\n\nstatic int get_position_x( lua_State* L )\n{\n Transform* p_transform = (Transform*) lua_touserdata( L, 2 );\n lua_pushnumber( L, p_transform-&gt;position_x );\n return 1;\n}\n\n\nstatic int set_position_x( lua_State* L )\n{\n Transform* p_transform = (Transform*) lua_touserdata( L, 2 );\n p_transform-&gt;position_x = lua_tonumber( L, 3 );\n return 0;\n}\n\n\nstatic int get_scale_x( lua_State* L )\n{\n Transform* p_transform = (Transform*) lua_touserdata( L, 2 );\n lua_pushnumber( L, p_transform-&gt;scale_x );\n return 1;\n}\n\n\nstatic int set_scale_x( lua_State* L )\n{\n Transform* p_transform = (Transform*) lua_touserdata( L, 2 );\n p_transform-&gt;scale_x = lua_tonumber( L, 3 );\n return 0;\n}\n\n\nstatic void create_transform_library( lua_State* L )\n{\n static const struct luaL_Reg transform_library[] = {\n {&quot;GetLightTransformArray&quot;, get_light_transform_array},\n { &quot;GetLightTransform&quot;, get_light_transform},\n { &quot;GetPositionX&quot;, get_position_x},\n { &quot;SetPositionX&quot;, set_position_x},\n { &quot;GetScaleX&quot;, get_scale_x},\n { &quot;SetScaleX&quot;, set_scale_x},\n { NULL, NULL}\n };\n\n luaL_openlib( L, &quot;Transform&quot;, transform_library, 0 );\n}\n\n\nvoid lightuserdata_perf_test( int32_t iterations, int32_t count )\n{\n lua_State* p_lua = luaL_newstate();\n luaL_openlibs( p_lua );\n\n create_transform_library( p_lua );\n\n int status = luaL_dostring( p_lua, R&quot;(\n function Update( count )\n local transforms = Transform:GetLightTransformArray()\n\n for i = 1, count, 1 do\n local light_transform = Transform:GetLightTransform( transforms, i )\n local position_x = Transform:GetPositionX( light_transform )\n local scale_x = Transform:GetScaleX( light_transform )\n\n position_x = position_x + 0.01\n scale_x = scale_x + 0.01\n\n Transform:SetPositionX( light_transform, position_x )\n Transform:SetScaleX( light_transform, scale_x )\n end\n end\n )&quot; );\n\n if( status != 0 )\n {\n printf( &quot;Error: %s\\n&quot;, lua_tostring( p_lua, -1 ) );\n return;\n }\n\n auto start = std::chrono::high_resolution_clock::now();\n\n for( int i = 0; i &lt; iterations; ++i )\n {\n lua_getglobal( p_lua, &quot;Update&quot; );\n lua_pushinteger( p_lua, count );\n lua_pcall( p_lua, 1, 0, 0 );\n }\n\n auto end = std::chrono::high_resolution_clock::now();\n std::chrono::duration&lt;double&gt; elapsed_seconds = end - start;\n double elapsed = elapsed_seconds.count();\n\n printf( &quot;Lua (Light Userdata) elapsed time: %fs\\n&quot;, elapsed );\n\n lua_close( p_lua );\n}\n\n\nint main( int argc, char* argv[] )\n{\n int32_t iterations = 1000;\n int32_t count = 5000;\n\n p_transforms = new Transform[ count ];\n memset( p_transforms, 0, sizeof( Transform ) * count );\n\n c_perf_test( iterations, count );\n sol_perf_test( iterations, count );\n lightuserdata_perf_test( iterations, count );\n\n delete[] p_transforms;\n return 0;\n}\n</code></pre>\n"^^ . "0"^^ . "0"^^ . . . "What could be causing my robbing bank script to increment faster than a second each time I rob. (Roblox LuaU)"^^ . . . "<p>I am kinda new to lua and I been using it to code some random scripts for a game. On my adventure, I am facing a strange situation with lua variable ambients.</p>\n<p>I have declared the following variable:</p>\n<pre><code> local spawnWaterZone = {\n vector3(3529.44, 3697.76, 20.99),\n vector3(3520.59, 3674.07, 20.99),\n }\n</code></pre>\n<p>and I have the following piece of code:</p>\n<pre><code>&lt;!-- language:lua--&gt;\nRegisterNetEvent('humaneHeist:guardsN', function(spawnzoneData)\n spawnzone = spawnzoneData.arg1\n guardsN = spawnzoneData.arg2\n for i=guardsN, 1, -1 do\n guardID = CreatePed(30, -1275859404, spawnzone[i], 0, true, false)\n print(spawnzone[i] .. ' is the coords')\n allGuards[#allGuards+1] = guardID\n end\n TriggerClientEvent('humaneHeist:guards', -1, allGuards)\nend)\n</code></pre>\n<p>I am invoking the function above from another file. In this file, I have defined the Data structure I am sending to the function and the arg1 variable aswell</p>\n<p>read it:</p>\n<pre><code>arg1 = 'spawnWaterZone',\n</code></pre>\n<p>the thing is, when I execute the code calling the argument passed in the function call, it doesn't loop through the vectors in my local variable 'spawnWaterZone' named the same as the arg1. In fact, the spawnzone[i] is nil.</p>\n<p>but if i simply define</p>\n<pre><code>RegisterNetEvent('humaneHeist:guardsN', function(spawnzoneData)\n spawnzone = spawnWaterZone\n</code></pre>\n<p>the loop works normally and go through the vectors.</p>\n<p>Any ideas on why it happens?</p>\n"^^ . "0"^^ . "0"^^ . "visual-studio-code"^^ . "Thanks again, it parsed required 8 bytes, but dissection stops there and it does not proceed with the original dissection flow (i.e. my_proto.dissector). I get the below in wireshark: "[Packet size limited during capture: RTCP truncated]". Any idea on how to proceed with original dissector?"^^ . . . "0"^^ . "1"^^ . "<p>It's now been several days I mess with Lua to make a node.js server connecting to it via WebSockets. Despite the pain I got as I really never touched Lua before, I managed to do a lot of progress, but now, I'm stuck.\nI'm trying to install lua-http with luarocks. I managed to install all dependencies but 2 and I just don't get what to do for them. Those are cqueues and luaossl.\nWhen I tried to install them separately, I noticed they both need some ssl files, and this is where I got in lot of trouble. I installed SSL via OpenSSL, and I also downloaded the source so it can get the includes, but there are files I can't find, and I even never heard of before (although I learned what they exactly are during my researches, I couldn't get more about them)</p>\n<p>I'm currently stuck there:</p>\n<pre><code>\n&gt; luarocks install cqueues CRYPTO_INCDIR=C:\\external\\include CRYPTO_LIBDIR=&quot;C:\\Program Files\\OpenSSL-Win64&quot;\nInstalling https://luarocks.org/cqueues-20200726.54-0.src.rock\n\nError: Could not find library file for CRYPTO\n No file libcrypto.dll.a in C:\\Program Files\\OpenSSL-Win64\n No file crypto.dll.a in C:\\Program Files\\OpenSSL-Win64\n No file libcrypto.a in C:\\Program Files\\OpenSSL-Win64\n No file cygcrypto.dll in C:\\Program Files\\OpenSSL-Win64\n No file libcrypto.dll in C:\\Program Files\\OpenSSL-Win64\n No file crypto.dll in C:\\Program Files\\OpenSSL-Win64\n No file crypto.lib in C:\\Program Files\\OpenSSL-Win64\nYou may have to install CRYPTO in your system and/or pass CRYPTO_DIR or CRYPTO_LIBDIR to the luarocks command.\nExample: luarocks install cqueues CRYPTO_DIR=/usr/local\n</code></pre>\n<p>So I'm here to call for help. Thank you very much!</p>\n"^^ . "<p>I'm using os.getenv() to retrieve environment variables to be used by the lua block</p>\n<p>for example</p>\n<pre><code> set_by_lua_block $csp_header {\n local frameSrc = &quot;frame-src 'self' '*.mywebsite.com'&quot; .. (os.getenv(&quot;EXTRA_FRAME_SRC&quot;) or &quot;&quot;)\n}\n</code></pre>\n<p>Things are working as expected when my application is deployed.</p>\n<p>However, I want to conditionally read different 404 page based on also the environment variable. In other words, I want to choose different error_page 404 location based on os.getenv('condition').</p>\n<p>Something like if (os.getenv(var) return /error-pages/404.html, else return error-pages/404-2.html)</p>\n<pre><code>server {\n error_page 404 /error-pages/404.html\n}\n</code></pre>\n<p>Could someone explain how can this be done using lua?</p>\n"^^ . . "0"^^ . . . . . "mousemove"^^ . . "0"^^ . . . . "2"^^ . . "0"^^ . . . . . . "@ESkri Don't chunks always only have one upvalue?"^^ . . "0"^^ . "0"^^ . "<p>Executing the MakeFile of LuaHPDF (<a href="https://github.com/jung-kurt/luahpdf/blob/master/Makefile" rel="nofollow noreferrer">this one</a>), it complains that <code>#include &lt;hpdf.h&gt;</code> directive has failed. I've installed it (v. 2.3.0) using <code>apt</code> . Despite of a hpdf.so taking place in the system, no header (hpdf.h) was added. This means such installation wasn't have effect.</p>\n<p>I'm working with Debian 11 and lua 5.4.</p>\n<p>How to install hpdf in my computer in order to such header being reachable to <code>gcc</code>? Should I create one by my self? If yes, how to do it?</p>\n<p>Thanks in advance.</p>\n"^^ . . . "The printout for type(myData) right after the light of assignment is "userdata"."^^ . . "1"^^ . "Hello, It seems you send me to the right track. However I am still missing something. My monitor resolution is 2560x1440. I tried to convert it using this, but it moves too much. I used 1280x720 as conversion and is almost ok, but depending on the starting position is goes slighly different. I dont belive is from the rounding .. it may be. Ist there anything else I am missing ? Thank you! https://pastebin.com/ereb6XVe"^^ . . . "1"^^ . "1"^^ . . . "<p><a href="https://i.sstatic.net/YO1qu.png" rel="nofollow noreferrer">enter image description here</a></p>\n<p>I want suggestions in the command, like shown in the screenshot. When i am typing &quot;:term&quot; it is not showing suggestions.\nI am using the base NvChad configuration on my windows system. <a href="https://github.com/NvChad/NvChad" rel="nofollow noreferrer">github</a>\nFYI I am new to neovim/vim, so I might not know the basic terminologies. Before this config, i used a different one which had suggestions for commands. it used to show multiple options for the words.</p>\n<p>i am expecting suggestion for commands.</p>\n"^^ . . "1"^^ . "0"^^ . . "1"^^ . "2"^^ . "installing neovim plugins on windows"^^ . . "0"^^ . . . "@CeriseLimón hi, i edited the question and uploaded a screenshot https://i.sstatic.net/Wlq5h.png"^^ . . "0"^^ . . "1"^^ . . . . . . . "1"^^ . "Finally! Running LuaHPDF! Following this guide I could resolve other issues. In gerenal, installing via apt lacing libraries following the example form: -lpng error-> libpng-dev.\n\nThe suffix "-dev" was the great new to me!\n\nThank you for your decisive help!"^^ . . . . "macvim"^^ . . . . "<p>If you're going to use a Tween, don't put it into a for-loop. When two Tweens try to manipulate the same properties, they start to cancel each other out.</p>\n<p>So just put all the resizing logic into one tween and make it take the full length of time :</p>\n<pre class="lang-lua prettyprint-override"><code>local BURN_RATE = 1.0 -- studs/second\nlocal cigLength = bit.Size.X\nlocal tweenInfo = TweenInfo.new(cigLength * BURN_RATE) -- take more time based on how long the cig is\n\nlocal goal = {\n Size = Vector3.new(0, bit.Size.Y, bit.Size.Z),\n Position = (bit.Position - Vector3.new(cigLength / 2, 0, 0)),\n}\nlocal tween = TweenService:Create(bit, tweenInfo, goal)\ntween:Play()\n\n-- TODO : if the tool is put away, simply cancel the tween\n</code></pre>\n"^^ . "<p>I'm trying to map my F12 key to compile and run code in neovim using the term command. I've been able to get it to work for java files, but only if I opened nvim from the same location as the file I'm running. Otherwise I get an error like this:</p>\n<pre><code>Error: could not find or load main class CSC-101.Proj.4.Hangman\nCaused by: Java.lang.NoClassDefFoundError: Hangman (wrong name: CSC-101/Proj/4/Hangman)\n\n[process exited 1]\n</code></pre>\n<p>When I try with python, even when I run it from the same working directory I get nothing but:</p>\n<pre><code>[process exited 0]'\n</code></pre>\n<p>Which I don't understand because when I type &quot;:term python3 %&quot; in nvim, it works perfectly.\nHere is the function I'm using:</p>\n<pre><code>funcs.run_code = function()\n local filename = vim.fn.expand(&quot;%&quot;)\n local basename = vim.fn.expand(&quot;%:r&quot;)\n local filetype = vim.bo.filetype\n local cmd = nil\n if filetype == &quot;python&quot; then\n cmd = &quot;term: python3 &quot;..filename\n elseif filetype == &quot;java&quot; then\n cmd = &quot;term: javac &quot;..filename..&quot; &amp;&amp; java &quot;..basename\n end\n if cmd then\n vim.cmd(&quot;w&quot;)\n vim.cmd(cmd)\n else\n print(&quot;No interpreter or compiler defined for filetype: '&quot;..filetype..&quot;'&quot;)\n end\nend\n</code></pre>\n<p>Thanks!</p>\n"^^ . . "Ouf, didn't see that either ^^ But in any case, please never modify the question like this, as it is then no longer a question. If you feel like the question does not help anyone else you can delete it altogether."^^ . "We unfortunately can hardly debug proprietary software. Is there any particular reason to use QLua rather than running a proper Lua inside [Termux](https://play.google.com/store/apps/details?id=com.quseit.qlua5pro2&hl=zh)?"^^ . "0"^^ . . "3"^^ . . "<p>I have a script in ServerScriptService and I do a 60 second countdown while the game is happening:</p>\n<pre><code>for i = 60, 0, -1 do\n status.Value = &quot;Game: &quot;..i\n wait(1)\nend\n</code></pre>\n<p>How do I run the game's code at the same time? In lua you apparently can't at the same time so what do I do? How do I run the game's code while it's happening?</p>\n<p>I tried this:</p>\n<pre><code>while true do\n while wait(0.1) do\n if (spawnCheese and #cheeseTable &lt; 100) then\n local c = cheese:Clone()\n c.Parent = workspace\n local spacing = 2\n c.Position = Vector3.new(math.random(-spawnArea.Size.X/spacing,spawnArea.Size.X/spacing),2, math.random(-spawnArea.Size.Z/spacing, spawnArea.Size.Z/spacing))\n table.insert(cheeseTable, c)\n collectCheese(c)\n end\n end \nend\n</code></pre>\n<p>but it only runs for one frame before or after the countdown.</p>\n"^^ . . "0"^^ . . . . "<p>(this is roblox studio by the way) I run the following script:</p>\n<p>local tower = script.Parent\nlocal enemy = workspace.Enemy</p>\n<p>local distance = tower.Position - enemy.Position</p>\n<p>print(distance)</p>\n<p>It says: &quot;Position is not a valid member of Model &quot;Workspace.Tower&quot;&quot;</p>\n<p>Tower is just a union of simple parts</p>\n<p>This script is the child of the Tower</p>\n<p>Position is a property of Tower</p>\n<p>Tower is named Tower</p>\n<p>Enemy is named Enemy</p>\n<p>it is .Postion, not .position</p>\n<p>I'm not sure what to do. Any ideas?</p>\n<p>I expected the difference between the Tower Position and the Enemy position to appear in the Output as a print.</p>\n<p>What happened was nothing appeared in the Output besides the error message.</p>\n"^^ . . . "The iterator function could return more than two values, btw. For example consider `("aaa"):gmatch"(a)(a)(a)"`."^^ . "1"^^ . . "0"^^ . . . . . "parsing"^^ . "<p>This is a well-known Minetest &quot;footgun&quot;. The table passed to <code>set_player_privs</code> is treated as a <em>set</em> of privileges. Unlike <code>ObjRef:set_properties</code>, <code>set_player_privs</code> is not &quot;incremental&quot;: It does not &quot;modify&quot; the player privileges, it <em>replaces</em> (&quot;sets&quot;) them.</p>\n<p>Let's look at the first example:</p>\n<pre class="lang-lua prettyprint-override"><code>minetest.set_player_privs(&quot;singleplayer&quot;, {interact = false})\n</code></pre>\n<p>Minetest treats the table as a <em>set</em>: It only looks at the keys. The only key is <code>interact</code>, so it sets the privileges of singleplayer to a <em>just <code>interact</code></em>.</p>\n<p>Similarly, in</p>\n<pre class="lang-lua prettyprint-override"><code>local privs = minetest.get_player_privs(&quot;singleplayer&quot;)\nprivs.interact = false\nminetest.set_player_privs(&quot;singleplayer&quot;, privs)\n</code></pre>\n<p><code>interact</code> is still a table key; it <em>does not matter</em> that its value is <code>false</code> (or <code>&quot;foobar&quot;</code>, or <code>42.101</code>...) - Minetest only looks at the keys, never at the values. So the new set will contain all previous privileges as keys, as well as <code>interact</code>. This will grant <code>interact</code> if the player doesn't already have it.</p>\n<p>To revoke <code>interact</code>, you need to remove it from the table by setting it to <code>nil</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>local privs = minetest.get_player_privs(&quot;singleplayer&quot;)\nprivs.interact = nil\nminetest.set_player_privs(&quot;singleplayer&quot;, privs)\n</code></pre>\n<p>Similarly, to grant <code>interact</code>, you just add it to the table by setting it to a non-<code>nil</code> value (ideally <code>true</code>):</p>\n<pre class="lang-lua prettyprint-override"><code>local privs = minetest.get_player_privs(&quot;singleplayer&quot;)\nprivs.interact = true\nminetest.set_player_privs(&quot;singleplayer&quot;, privs)\n</code></pre>\n"^^ . "0"^^ . . . . . . . "1"^^ . . . "If you must do this, you will need to use some lua-based implementation or call some c-library to perform decompression using LuaJIT FFI. But with all due respect, compression being a computationally intensive operation, it may slow down APISIX's ability to handle traffic."^^ . "0"^^ . . . . . "<p>Hello i am new here and i dont know anything about coding. I want to make a model disapear/transparent with proximity prompt. Anybody can help?</p>\n<p>I tried with click detector but nothing happened. Then tried with WaitForChild &quot;proximity prompt&quot; again nothing happened. Even proximity prompt UI not appear.</p>\n"^^ . "edit: i gave your question a further reading and it seems like you've already got down the first half of this problem. my bad! i skim over text! i still do recommend trying to write code yourself, chatgpt is cool but if you need to do something as hyperspecific as what you're asking then i think you're better off learning. also, sorry for the "do you know what a for loop is", i just realized you mentioned using recursion so you know that already whoops"^^ . "Custom Pandoc Writer/Filter: Output BulletList as BBCode"^^ . "1"^^ . "2"^^ . "0"^^ . "using colons between elements in the path makes the game think you are trying to call functions. Use periods : `game.Workspace.Part:Destroy()`"^^ . "2"^^ . "0"^^ . . . . . "Pathfinding script"^^ . . . "Create Channel discord.js"^^ . . . "3"^^ . "Their code: ``local players = game:WaitForChild("Players")\n\nlocal function createLeaderboard(player)\n local stats = Instance.new("Folder")\n stats.Name = "leaderstats"\n local cash = Instance.new("IntValue", stats)\n cash.Name = "Cash"\n stats.Parent = player\nend\n\nplayers.PlayerAdded:connect(createLeaderboard)``"^^ . . . . . . "You should recalculate the remaining distance on every step."^^ . "Teachers, I have a question about Logitech g-hub"^^ . . . . "Something is really weird. It turns out if I execute the script in ZeroBrane using the two green right arrow button (F6) then it runs without any issues, but if I run in debug mode using the one green arrow button (F5) then it fails with the abovementioned error."^^ . . . . "0"^^ . . . "<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>local DataStore,DataStore2,DataStore3,DataStore4,DataStore5,DataStore6\ngame.Players.PlayerAdded:Connect(function(plr)\n while not DataStore6 do task.wait()end\n local leaderstats = Instance.new("Folder", plr)\n leaderstats.Name = "leaderstats"\n local plrstats = Instance.new("Folder", plr)\n plrstats.Name = "Multipliers"\n local cash = Instance.new("IntValue", leaderstats)\n cash.Name = "Jump"\n cash.Value = DataStore:GetAsync(plr.UserId) or 1\n local cash1 = Instance.new("IntValue", leaderstats)\n cash.Name = "Run"\n cash.Value = DataStore5:GetAsync(plr.UserId) or 1\n local cash2 = Instance.new("IntValue", leaderstats)\n cash.Name = "Climb"\n cash.Value = DataStore6:GetAsync(plr.UserId) or 1\n local Upgrade = Instance.new("IntValue", plrstats)\n Upgrade.Name = "ClimbMultiplier"\n Upgrade.Value = DataStore4:GetAsync(plr.UserId) or 1\n local multi = Instance.new("IntValue", plrstats)\n multi.Name = "RunMultiplier"\n multi.Value = DataStore2:GetAsync(plr.UserId) or 1\n local cost = Instance.new("IntValue", plrstats)\n cost.Name = "JumpMultiplier"\n cost.Value = DataStore3:GetAsync(plr.UserId) or 1\n cash.Changed:Connect(function()\n DataStore:SetAsync(plr.UserId, cash.Value)\n end)\n Upgrade.Changed:Connect(function()\n DataStore4:SetAsync(plr.UserId, Upgrade.Value)\n end)\n cost.Changed:Connect(function()\n DataStore3:SetAsync(plr.UserId, cost.Value)\n end)\n multi.Changed:Connect(function()\n DataStore2:SetAsync(plr.UserId, multi.Value)\n end)\n cash1.Changed:Connect(function()\n DataStore5:SetAsync(plr.UserId, cash1.Value)\n end)\n cash2.Changed:Connect(function()\n DataStore6:SetAsync(plr.UserId, cash2.Value)\n end)\nend)\ngame.Players.PlayerRemoving:Connect(function(plr)\n DataStore:SetAsync(plr.UserId, plr.leaderstats.Cash.Value)\n DataStore4:SetAsync(plr.UserId, plr.Multipliers.Upgrade.Value)\n DataStore3:SetAsync(plr.UserId, plr.Multipliers.Cost.Value)\n DataStore2:SetAsync(plr.UserId, plr.Multipliers.multi.Value)\n DataStore5:SetAsync(plr.UserId, plr.leaderstats.cash1.Value)\n DataStore6:SetAsync(plr.UserId, plr.leaderstats.cash2.Value)\nend)\nDataStore = game:GetService("DataStoreService"):GetDataStore("ValueSave")\nDataStore2 = game:GetService("DataStoreService"):GetDataStore("ValueSave2")\nDataStore3 = game:GetService("DataStoreService"):GetDataStore("ValueSave3")\nDataStore4 = game:GetService("DataStoreService"):GetDataStore("ValueSave4")\nDataStore5 = game:GetService("DataStoreService"):GetDataStore("ValueSave5")\nDataStore6 = game:GetService("DataStoreService"):GetDataStore("ValueSave6")\nif script:IsDescendantOf(workspace)then error(tick())end</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . . "0"^^ . . "I'm trying to reproduce your error but i'm not able to, could you provide your output of\n`:echo stdpath('config')` inside neovim?"^^ . . "sorting"^^ . "0"^^ . "@ESkri it uses a trimmed down version of Lua 5.1 - certain features are missing"^^ . "1"^^ . "editor"^^ . . "0"^^ . . "0"^^ . . . . . "Team a player on button click (roblox studio)"^^ . . . . . "lua"^^ . . . "Sublime Text: embedding Lua code in html with highlighting"^^ . "i fixed lol i stared the code for 10 minutes and realize i accidentally delete the return response i feel pain right now"^^ . . . . . "0"^^ . . . "Thanks, I'll give it a try when I get to the storage part. Your example seems to manually include my example string though, unless I misunderstand and that should work for the full text block: Does it automatically match all cases without having to do a loop through every line? My hope was the pattern matching could identify spaces following a newline before any other character (`<space>` in every pattern of the form `\\n<space>*`) and replace all of them in one go."^^ . . . . . . "<p>keep your config but go to <code>~/.local/share/</code> and delete the nvim folder, then restart your terminal, start nvim and it should load up lazyvim.</p>\n"^^ . . "0"^^ . "<p>I'm trying to use lua with my c++ program and when I look up for how to use multiple lua script with I found this result <a href="https://stackoverflow.com/a/61684333/22979136">https://stackoverflow.com/a/61684333/22979136</a><br />\nI modified this result and eventualy end up with this</p>\n<pre class="lang-lua prettyprint-override"><code>local file_env = {}\nlocal file_chunk = {}\n\nfunction AddScript(ScriptLocation, index, Nd)\n file_env[index] = setmetatable({}, {__index = _G})\n file_chunk[index] = loadfile(ScriptLocation)\n\n _ENV = file_env[index]\n\n file_chunk[index]()\n\n file_env[index].InitNode(Nd)\n file_env[index].Start()\nend\n\nfunction UpdateScript(index)\n print(file_env[index])\n file_env[index].Update()\nend\n</code></pre>\n<p>but there is some issue<br />\nwhen I call the &quot;UpdateScript&quot; function in my c++ program I get no result and &quot;print(file_env[index])&quot; just gives me the &quot;nill&quot; result<br />\nhow can I fix this?</p>\n<p>I tried to call the &quot;UpdateScript&quot; function inside the &quot;AddScript&quot; function but that didnt seem to help</p>\n"^^ . "Logitech Lua detect double click or hold"^^ . "2"^^ . "<pre><code>local tower,enemy=script.Parent,workspace.Enemy \nlocal distance=(tower:GetBoundingBox().p-enemy.Humanoid.Torso.Position).magnitude\nprint(distance)\n</code></pre>\n"^^ . . "1"^^ . "still not working"^^ . . . . . "@tehtmi Thank you so much. I rechecked the apk and indeed found an encryption function."^^ . "or maybe the url"^^ . . . "Hey, Thanks a lot for your quick reply. This worked. I couldn't find this information in Lua documentation. Probably worth writing small article about it ;) Anyways, thanks again."^^ . . "0"^^ . "2"^^ . . "0"^^ . "пункт 1 выполнил? проверить можно, нажав кнопку P в игре, это должно дать такой же эффект, как и выстрел левой кнопкой мыши. после того, как сможешь кнопкой P стрелять, ставь скрипт"^^ . . . . "0"^^ . . "0"^^ . "0"^^ . "0"^^ . "0"^^ . . . . "unluac"^^ . . "0"^^ . . . . "0"^^ . . . . . . . . . "0"^^ . "2"^^ . "0"^^ . "<p>I want to use os.date() to output the current full date so I can automatically input it into a converter to Warhammer's Imperial Date system.</p>\n<p>At the moment I have os.date() outputting to a table but I have no idea how to actually set each individual value of it to a variable. Really I only need the year, month, and day, preferably as numbers and not spelled out. I planned to set them as global variables then toss them straight into my converter. How would I go about doing that?</p>\n<p>Here's what I'm working with.</p>\n<pre><code>dtable = setmetatable(os.date('!*t'), {__call = function(self) self.tz=os.date('%z') self.ampam = os.date('%p') return self end})\ndtable = dtable()\ndir = function(tab) for k, v in pairs(tab) do print(k, '=&gt;', v) end end\n</code></pre>\n"^^ . . . . . "0"^^ . . "1"^^ . . "0"^^ . "How to automating title and filename synchronization in Quarto Markdown with Lua filters?"^^ . "0"^^ . "multidimensional-array"^^ . . "0"^^ . "0"^^ . . "0"^^ . . "0"^^ . . "its roblox lua lol"^^ . "1"^^ . "No, is not anchored, I checked the model and the only thing that is anchored is the humanoid that the anchor cannot be removed."^^ . "1"^^ . . . "0"^^ . . "1"^^ . "0"^^ . . . "1"^^ . . "я так и сделал , после этого он выстреливает один и ведет мышь вниз это окей. Но мне надо чтобы он постоянно кликал по левай кнопкой мышы и вел вниз"^^ . . . . . "Model not cloning"^^ . . . . "How to pass an arbitrary iterator as a function argument?"^^ . "<p>I grouped parts together as a Model and it's not cloning, here's my code</p>\n<pre><code>local space = workspace.Space --the model\n\nwhile wait(1) do\nfor i = 1, 10, 1 do\n local s = space:Clone()\n s.Parent = workspace\n s:MoveTo(Vector3.new(space.Fl.Position.x+i, space.Fl.Position.y, space.Fl.Position.Z))\n print(i)\n wait()\n end\nend\n</code></pre>\n"^^ . . . . "1"^^ . "<p>I printed a value using <code>print(v)</code> and got <code>7:0</code>.</p>\n<p>I can't find any reference to a representation format with a colon-zero at the end. (or with a colon-number)</p>\n<p>I am not looking for help to change the way a value is displayed. I am looking for an explanation of why this value is being displayed this way. Is it indicating that the value is not quite an integer? Is the value of a special, high-precision type?</p>\n<pre><code>lua -v -e 'a=&quot;2&quot; ; b=1 ; c=a*b ; print( c, type(c), tostring(c) ) ;'\nLua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio\n2:0 number 2:0\n</code></pre>\n<p>This is QLua 5.3.5 under Android.</p>\n<p>Lua 5.4.2 under Windows (lua-5.4.2_Win32_bin.zip, probably from SourceForge) does not do this: It just prints &quot;2&quot;.</p>\n"^^ . "4"^^ . . . "What *exactly* is *QLua*? The SO tag [tag:qlua] is sparse, and searching for this term brings up conflicting results (seeing results for ML-related topics, Android apps, Qt-bindings, etc.). I see a listing for an Android app, but the Lua version in its description does not appear to match yours."^^ . . "I want suggestions in the command line in Neovim - NvChad"^^ . . "1"^^ . . . "<p>First of all, I apologize for using a term from another language, but it's the only one I know to describe what I need.</p>\n<p>I have a C++ engine, and I 'inject' some 'classes' so that the script can create an instance of the engine and run, and this works very well.</p>\n<p>However, I would like to know if there is a way to 'insert typing' into the Lua language server so that in my text editor, the types of the engine are recognized? (image)</p>\n<p><a href="https://i.sstatic.net/hCue2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hCue2.png" alt="" /></a></p>\n"^^ . . "0"^^ . . "0"^^ . . . . "@JosephSible - Debug library is not helpful here. That solution doesn't work if Lua program is compiled to bytecode with debug info stripped (because upvalue names are stripped too, and you never know which one is the "_ENV")"^^ . . . "0"^^ . "0"^^ . . . . "Thanks for reply.\n\nAwesome. Now it works. I really appreciate it.\n\nAt the moment I didn't realise that inserting `function () thing:do_something() end` is possible.\n\nNow I only need to tweak some things and hopefuly the code will work."^^ . . . . "<p>I'm making a <em>cigarette</em> in Roblox and I want it to work correctly</p>\n<p>it made the <em>cig</em> resize to the front.</p>\n<p>you can get it yourself here:\n<a href="https://filetransfer.io/data-package/qKBHvHxS#link" rel="nofollow noreferrer">https://filetransfer.io/data-package/qKBHvHxS#link</a></p>\n<p>and for people who want the code all you really need to see is this:</p>\n<pre><code>for i = bit.Size.X, 0, -0.1 do\n local tweenInfo = TweenInfo.new(0.1)\n local goal = {}\n goal.Size = Vector3.new(i, bit.Size.Y, bit.Size.Z)\n local tween = TweenService:Create(bit, tweenInfo, goal)\n tween:Play()\n wait(0.1)\n bit.CFrame = bit.CFrame + bit.CFrame.LookVector * -0.1\nend\n</code></pre>\n<p>But seriously, I do recommend downloading the RBXM file and actually testing it.</p>\n<p>Also its a tool, so this accounts for rotations.</p>\n"^^ . . "-1"^^ . . "Why doesnt my accessory attach to the player in roblox?"^^ . "0"^^ . "<p>I'm not sure what language that is but the proper JSon body for the request should be something like this</p>\n<p>You defiantly have prompt and stop_sequences wrong.</p>\n<pre><code>{\n &quot;prompt&quot;: &quot;Write a poem about an adventure in an underwater castle\\n\\n&quot;,\n &quot;model_name&quot;: &quot;models/text-bison-001&quot;,\n &quot;temperature&quot;: 0.7,\n &quot;candidate_count&quot;: 1,\n &quot;top_k&quot;: 40,\n &quot;top_p&quot;: 0.95,\n &quot;max_output_tokens&quot;: 1024,\n &quot;stop_sequences&quot;: []\n}\n</code></pre>\n<h1>candidate_count</h1>\n<p>you have candidate_count set to three which means that <code>HttpService:JSONDecode(response.Body).candidates</code> is an array.</p>\n<p>It may be failing on that</p>\n"^^ . . "0"^^ . . . . . . . "4"^^ . "0"^^ . . . . . "0"^^ . "1"^^ . "libharu"^^ . . . . . "0"^^ . . "changed to save string instead of go struct, works thanks"^^ . . "0"^^ . . "The Humanoid does not move"^^ . . . . . . . "local Response = " " .. string.gsub(HttpService:JSONDecode(response.Body).candidates[1].output, "\\n", " ")"^^ . . . . "1"^^ . "just do:\nscript.Parent.Triggered:Connect(function(player)\n money = _G.publicPlayerSession.Money\n level = _G.publicPlayerSession.Level\n print(money)\n print(level)"^^ . . . . . . . . . . "arrays"^^ . . . "<p>I'm making a code editor in a game engine powered by Lua. Its menu system has the unfortunate limitation that tab characters aren't supported in fields, each tab gets converted to a space. I wish to ensure the resulting scripts are tabbed accordingly. Unless the engine lifts this limitation, I'll have to manually use an expression to undo the conversion effects.</p>\n<p>What is the pattern matching I can use to convert each space to a tab, but only for spaces located at the beginning of each line before any other character? For example: <code>&lt;space&gt;&lt;space&gt;if(a&lt;space&gt;==&lt;space&gt;b)&lt;space&gt;then</code> must become <code>&lt;tab&gt;&lt;tab&gt;if(a&lt;space&gt;==&lt;space&gt;b)&lt;space&gt;then</code></p>\n<p>The text is stored in a local variable, with however it stores newlines naturally as when you copy multi-line text to the clipboard: I should be able to fix my issue by running it through the conversion process before writing it back to a text file. If you know please share how to achieve the opposite as well (tabs to spaces) as it may be safer to do that myself when loading the text into the menu than letting the interface strip tabs for me.</p>\n"^^ . . "logitech"^^ . "0"^^ . "<p>As TAEFFED told me to do in the comments + chat, I deleted my <code>~/.local/share/nvim</code> directory. I then went and relaunched nvim and Lazy loaded just as expected. Thank you sir!</p>\n"^^ . . "1"^^ . . . "0"^^ . . . "0"^^ . "1"^^ . . "2"^^ . . "<p>&quot;Tap&quot; event listeners don't have event phases. If you wanna control phases you should use &quot;touch&quot; listener. It's fine to remove your object like this;</p>\n<pre><code>local function popBalloon( event )\n local tappedBalloon = event.target\n display.remove(tappedBalloon)\nend\n</code></pre>\n<p>Also your game loop only works once because performWithDelay's third argument is 1 by default, if you want to create balloons repeatedly, use;</p>\n<pre><code>gameLoopTimer = timer.performWithDelay( 500, gameLoop, 0 )\n</code></pre>\n<p>You can also remove the object from your table in popBalloon function. First create an index counter globally;</p>\n<pre><code>local index = 1\n</code></pre>\n<p>Give your index to balloon and also increment it;</p>\n<pre><code>newBalloon.index = index\nindex = index + 1\n</code></pre>\n<p>Now back to your popBalloon function, you can see tapped balloon's index by tappedBalloon.index so you can manage your table there.</p>\n"^^ . . . . . . . . "cjson.encode do the same thing as json.Marshal. \n\ndecode-> modify -> encode -> save, yes this is what i do, but failed to get the inviteInfo['routeVersion'] after decode"^^ . "As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . "0"^^ . . . . . . "0"^^ . . "c++"^^ . "Proximity Prompt can be clicked but does nothing in roblox studio"^^ . . "0"^^ . . . "0"^^ . . . "ROBLOX - why isn't a boolValue being created in the player's Character?"^^ . . . . . . . . . . . . "Splitting an os.date() table into multiple variables?"^^ . "0"^^ . "0"^^ . "0"^^ . . "1"^^ . . . "0"^^ . . . . "0"^^ . "1"^^ . . . "i change the v1beta3 into v1beta2 nothing change except for an error"^^ . "tween"^^ . . "1"^^ . . . "pico-8"^^ . "0"^^ . . . "1"^^ . . "0"^^ . . "0"^^ . . "substring"^^ . "1"^^ . "0"^^ . "1"^^ . "0"^^ . "<p>I am trying to create a data-mask/redact plugin for APISIX in Lua. I have tried writing a custom plugin based on the following <a href="https://apisix.apache.org/blog/2023/07/20/data-mask-plugin/" rel="nofollow noreferrer">article</a> and I have also tried using the out-of-the-box plugin <a href="https://apisix.apache.org/docs/apisix/plugins/response-rewrite/" rel="nofollow noreferrer">response-rewrite</a> provided by APISIX.\nIn both cases I am receiving the response turned into complete gibberish, in the following manner:\n<a href="https://i.sstatic.net/ahOdu.png" rel="nofollow noreferrer">Postman response screenshot</a>\nThe expected response would be a json like:\n{\n&quot;success&quot;: {},\n&quot;timeStamp&quot;: &quot;2023-12-01 10:03:12.0&quot;,\n&quot;version&quot;: &quot;21.2.0.0&quot;\n}</p>\n<p>The code being used to filter response:</p>\n<pre><code>function _M.body_filter(conf, ctx)\n if conf.filters then\n\n local body = core.response.hold_body_chunk(ctx)\n if not body then\n return\n end\n \n local err\n for _, filter in ipairs(conf.filters) do\n body, _, err = re_gsub(body, filter.regex, filter.replace, &quot;jo&quot;)\n\n if err ~= nil then\n core.log.error(&quot;regex \\&quot;&quot; .. filter.regex .. &quot;\\&quot; substitutes failed:&quot; .. err)\n end\n end\n\n ngx.arg[1] = body\n return\n end\n\nend\n</code></pre>\n<p>I tried to log the response body:</p>\n<pre><code> local body = core.response.hold_body_chunk(ctx)\n if not body then\n return\n end\n core.log.error(body)\n</code></pre>\n<p>the log also shows random non ascii characters, so the problem is not occurring during substitution, rather it's happening in the way we get response body itself.</p>\n"^^ . "`c` in your example should be the number `2.0`; we should expect `print(2.0)` to give the same result. (Hard to discriminate numbers, but e.g. `math.type(c)=="float" and c==2`) ("2" in Lua 5.4 is expected as coercion in arithmetic contexts is handled differently.) Lua doesn't specify how numbers are printed unless you do the string conversion explicitly, but a normal implementation explicitly adds "." via `localeconv()->decimal_point[0]` here. In the C locale, we expect `.` to be the decimal separator. Maybe possible it for the font to display this strangely or other weird downstream behavior."^^ . . . . . . . . . "0"^^ . "<p>You can do it like this way...</p>\n<pre><code>#!/usr/local/bin/lua\n-- dtref.lua\nlocal raindate, raintime, dtab, conv = arg[1] or [[19-JAN-38]], arg[2] or [[03.14]], {}, &quot;&quot;\n-- DEBUG! - Disable os library\nos = nil\n\ndtab[&quot;day&quot;] = tonumber(raindate:sub(1, 2))\ndtab[&quot;month&quot;] = tonumber((raindate:gsub(&quot;%u+&quot;, {[&quot;JAN&quot;] = &quot;01&quot;,\n[&quot;FEB&quot;] = &quot;02&quot;,\n[&quot;MAR&quot;] = &quot;03&quot;,\n[&quot;APR&quot;] = &quot;04&quot;,\n[&quot;MAY&quot;] = &quot;05&quot;,\n[&quot;JUN&quot;] = &quot;06&quot;,\n[&quot;JUL&quot;] = &quot;07&quot;,\n[&quot;AUG&quot;] = &quot;08&quot;,\n[&quot;SEP&quot;] = &quot;09&quot;,\n[&quot;OCT&quot;] = &quot;10&quot;,\n[&quot;NOV&quot;] = &quot;11&quot;,\n[&quot;DEC&quot;] = &quot;12&quot;})):sub(4, 5))\ndtab[&quot;year&quot;] = tonumber((&quot;20%s&quot;):format(raindate:sub(8,9)))\ndtab[&quot;hour&quot;] = tonumber(raintime:sub(1, 2))\ndtab[&quot;min&quot;] = tonumber(raintime:sub(4, 5))\ndtab[&quot;sec&quot;] = 0 \n \n-- If os Library is present use it else use string.format() \nif os ~= nil then \n print(&quot;os.date()&quot;)\n conv = os.date(&quot;%Y-%m-%dT%H:%M:00.000000Z&quot;, os.time(dtab)) \nelse \n print(&quot;string.format()&quot;)\n conv = (&quot;%d-%d-%dT%d:%d:00.000000Z&quot;):format(dtab.year, dtab.month, dtab.day, dtab.hour, dtab.min) \nend \n \nif #arg == 0 then \n print(conv) \nelseif #arg == 2 then \n print(conv) \nend \n \nreturn(conv)\n</code></pre>\n<p>Example of use when os Library is disabled...</p>\n<pre><code>€ chmod +x dtref.lua\n€ ./dtref.lua\nstring.format()\n2038-1-19T3:14:00.000000Z\n€ ./dtref.lua 24-DEC-99 23.59\nstring.format()\n2099-12-24T23:59:00.000000Z\n</code></pre>\n<p>Known *nix Bug (Y2K38) when using os Library: Cant get Date above 19. Jan 2038 04:14 here (CET)<br />\n(At UTC 03:14:07)</p>\n<pre><code>€ ./dtref.lua 19-JAN-38 04.14\nos.date()\n2038-01-19T04:14:00.000000Z\n€ ./dtref.lua 19-JAN-38 04.15\nos.date()\n/usr/local/bin/lua: ./dtref.lua:28: time result cannot be represented in this installation\nstack traceback:\n [C]: in function 'os.time'\n ./dtref.lua:28: in main chunk\n [C]: in ?\n</code></pre>\n<p>( I change hardcoded values as a warning and border :-) )</p>\n"^^ . . . . "3"^^ . "<p>Redis converts Lua table to array reply, and you MUST ensure that your Lua table is an array, i.e. index (table key) starting with 1.</p>\n<p>However, in your case, <code>t[1]</code> is nil, and Redis takes it as an empty array.</p>\n<p>In order to fix the problem, you need to convert <code>t</code> to an array:</p>\n<pre><code>-- Your original code generating table `t`\n\n-- Then convert `t` to an array.\nlocal res = {}\nfor k, v in pairs(t) do\n res[#res + 1] = v\nend\nreturn res\n</code></pre>\n"^^ . "0"^^ . "Currently there is nothing _to_ sort, as you have associative-array type tables (arbitrarily ordered keys and values). Are you saying you want to convert `Data` into an array-like table (one with numerical indices), which is sorted by multiple conditions?"^^ . . "<p>Well you first need to understand code structure. There exist Scripts (for the server), LocalScripts (for the client), and ModuleScripts (to import from either).</p>\n<p>ModuleScripts can exist anywhere, because they only exist to be imported by a Script or LocalScript. LocalScripts can only exist in a few places, and Workspace is not one of them, unless parented to a player’s character. Off the top of my head, they can only exist in the following places:</p>\n<ul>\n<li>ReplicatedFirst</li>\n<li>StarterCharacterScripts (replicated into the player’s character in Workspace)</li>\n<li>StarterPlayerScripts</li>\n<li>StarterGui</li>\n</ul>\n<p>In your case, you’d want to use a regular Script. If you want it to occur only on the client, you’d want to put your LocalScript in any of those places (although, StarterPlayerScripts would be best practice for this scenario)</p>\n<p>See: <a href="https://create.roblox.com/docs/scripting/scripts" rel="nofollow noreferrer">https://create.roblox.com/docs/scripting/scripts</a></p>\n"^^ . "I must clarify that the traffic from the client to APISIX and APISIX to the upstream is decoupled, so you can absolutely use non-GZIP processing of the traffic in your internal network, and when APISIX sends the response to the client, it will automatically perform the compression.\nHow to: as you did, remove the `Accept-Encoding` header from the request to make the internal service think that the client is not accepting gzip requests; next turn on APISIX's gzip plugin, which will compress the response when it is sent to the client. (It uses gzip module on Nginx, which is a C implementation)"^^ . . "0"^^ . "1"^^ . "I'm limited to using Lua 5.1 as the code is for a game, and they currently use that.\n\nAs for the code with the `table.sort(collapsed` that's similar to what I was doing, expect I didn't have an if, everything else was the same however.\n\nI will give that a try."^^ . . . "<pre><code>local _,victim = pcall(nearestenemy)\n</code></pre>\n"^^ . . . "2"^^ . . "<p>I'd like to convert this markdown list (<code>list.md</code>):</p>\n<pre class="lang-markdown prettyprint-override"><code>- Europe\n - Germany\n - Berlin\n - Hamburg\n\n</code></pre>\n<p>To the following output (BBCode):</p>\n<pre><code>[list]\n [*]Europe\n [list]\n [*]Germany\n [list]\n [*]Berlin\n [*]Hamburg\n [/list]\n [/list]\n[/list]\n</code></pre>\n<p>And wrote this script (<code>list.lua</code>):</p>\n<pre class="lang-lua prettyprint-override"><code>function processBulletList (bl)\n inner = bl:walk {\n BulletList = processBulletList,\n Plain = function (p) return string.format('\\n[*]%s', pandoc.utils.stringify(p)) end,\n }\n return pandoc.RawBlock('markdown', string.format('[list]\\n%s\\n[/list]', inner))\nend\n\nfunction Writer (doc, opts)\n local filter = {\n BulletList = processBulletList\n }\n return pandoc.write(doc:walk(filter))\nend\n</code></pre>\n<p>I run <code>pandoc</code> as follows:</p>\n<pre><code>$ pandoc list.md -t list.lua -o list.txt\n</code></pre>\n<p>Which results in <code>list.txt</code>:</p>\n<pre><code>[list]\nBulletList [[Plain [SoftBreak,Str &quot;[*]Europe&quot;],RawBlock (Format &quot;markdown&quot;) &quot;[list]\\nBulletList [[Plain [SoftBreak,Str \\&quot;[*]Germany\\&quot;],RawBlock (Format \\&quot;markdown\\&quot;) \\&quot;[list]\\\\nBulletList [[Plain [SoftBreak,Str \\\\\\&quot;[*]Berlin\\\\\\&quot;]],[Plain [SoftBreak,Str \\\\\\&quot;[*]Hamburg\\\\\\&quot;]]]\\\\n[/list]\\&quot;]]\\n[/list]&quot;]]\n[/list]\n</code></pre>\n<p>This contains everything that is needed, but I have two major issues:</p>\n<ol>\n<li>The tree is not converted to plain text.</li>\n<li>There is a lot of escaping with <code>\\</code>.</li>\n</ol>\n<p>I guess the two problems are related. However, I have no clue what's going on. It looks like <code>walk</code> does not traverse the tree as I'd like it to.</p>\n<p>Can anybody tell me what I got wrong?</p>\n"^^ . . . "0"^^ . . . . "Where does `request` come from and why isn't it `HttpService:RequestAsync` ? How do you authenticate yourself? Did you debug, e.g., printed the raw answer of the request?"^^ . . . "0"^^ . . . . "0"^^ . "Yes, but I fixed that by doing compact if `IF (X == 0 OR X == 128) INBOUNDS = FALSE`"^^ . . . . "1"^^ . . . . "Nginx Lua module for redirecting based on proxy and access headers"^^ . "3"^^ . . . "0"^^ . "<p>I am trying this code</p>\n<pre><code>local player = game.Players.LocalPlayer\nscript.Parent.MouseClick:Connect(function()\n -- Change team color to &quot;Really Blue&quot;\n player.TeamColor = BrickColor.new(&quot;Really blue&quot;)\n\n -- Kill the player\n local character = player.Character\n if character then\n local humanoid = character:FindFirstChild(&quot;Humanoid&quot;)\n if humanoid then\n humanoid.Health = 0\n end\n end\nend)\n\n</code></pre>\n<p>But for some reason when I press the button I do not get teamed.\nI am new to coding the language is lua (roblox studio)</p>\n<p>I've tried changing the color a couple times to different things all same result.</p>\n"^^ . . . . . "2"^^ . "when i tried this and run the update function on my program the results were the same i think my problem is that this function does not set the tables in the script it only changes the value in the function and i dont know how to fix this"^^ . . "0"^^ . "1"^^ . . . "0"^^ . . . "Result is `/Users/wmoorby/.config/nvim` so my nvim is pointing to the correct location to be picking up the config"^^ . . "this is how everything works only through button 4"^^ . . "<p>The <code>pairs</code> function returns 3 values:</p>\n<ol>\n<li>The <code>next</code> function</li>\n<li>The table</li>\n<li>The initial key <code>nil</code></li>\n</ol>\n<p>The <code>for-in</code> statement uses the 3 values in an equivalent process as follows:</p>\n<pre><code>local f, t, k = pairs(x)\nlocal v\n\nrepeat\n k, v = f(t, k)\n if k then\n -- for body\n end\nuntil not k\n</code></pre>\n<p>Since the 3rd value is always <code>nil</code>, if you want the <code>walk</code> function to be effective on <code>pairs</code>, you need at least 2 arguments:</p>\n<pre><code>function walk(itor, t)\n for n,i in itor, t do \n print(n, i[1]+i[#i]) end end\n</code></pre>\n<p>You need 3 if you want it to be effective on any iterator functions.</p>\n"^^ . . . . . "0"^^ . . "1"^^ . . . . . "2"^^ . . "-1"^^ . . . "0"^^ . . . "optimization"^^ . . . . "0"^^ . . . . . "<p>How to Change nvim-tree's &quot;s&quot; Keymap to &quot;ss&quot; in Neovim and Issues with Disabling &quot;s&quot; Keymap?</p>\n<p>I'm working with the <code>nvim-tree</code> plugin in Neovim and am trying to change the default keymap for opening the system file viewer from &quot;s&quot; to &quot;ss&quot;. I've attempted the following steps, but haven't been successful yet:</p>\n<ol>\n<li><p>I tried to unmap the original &quot;s&quot; key by using:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.api.nvim_set_keymap(&quot;n&quot;, &quot;s&quot;, &quot;&lt;nop&gt;&quot;, {noremap = true, silent = true})\n</code></pre>\n</li>\n<li><p>Then, I tried to set up a custom attachment function to map &quot;ss&quot; to the desired action:</p>\n<pre class="lang-lua prettyprint-override"><code>local function my_on_attach(bufnr)\n local api = require &quot;nvim-tree.api&quot;\n\n local function opts(desc)\n return { desc = &quot;nvim-tree: &quot; .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }\n end\n\n -- default mappings\n api.config.mappings.default_on_attach(bufnr)\n\n -- custom mappings\n vim.keymap.del(&quot;n&quot;, &quot;s&quot;)\nend\n\n-- pass to setup along with your other options\nrequire(&quot;nvim-tree&quot;).setup {\n ---\n on_attach = my_on_attach,\n ---\n}\n</code></pre>\n</li>\n</ol>\n<p>Despite these attempts, the &quot;s&quot; key is still performing its original action, and I haven't been able to map &quot;ss&quot; to the function that &quot;s&quot; was performing. I also encountered an error when trying to modify the <code>nvim-tree</code> settings directly, as it mentioned &quot;Unknown option: view.mappings&quot;.</p>\n<p>Can anyone advise me on what I might be doing wrong or what I should do to successfully remap &quot;s&quot; to &quot;ss&quot; in <code>nvim-tree</code> and disable the original &quot;s&quot; keymap?</p>\n"^^ . "0"^^ . . . . . . "<p>I'm making a tower defense game, towers fight enemies. Towers have range and if they find and enemy near its range, it attacks it. My problem is that my tower start killing enemies normally, then gets this error message &quot;Humanoid is not a valid member of &quot;.</p>\n<p>The tower script to find the closest enemy</p>\n<pre><code>local Tower = script.Parent\nlocal enemies = game.Workspace.enemies\nlocal range = 20\nlocal target= nil\nlocal Animator = Tower.Humanoid.Animator\nlocal Attack = Animator:LoadAnimation(Tower.AttackAnim)\n\n function nearestenemy()\n for i, enemy in ipairs(enemies:GetChildren()) do\n local distance = (Tower.HumanoidRootPart.Position - enemy.HumanoidRootPart.Position).Magnitude\n \n if (distance &lt; range) and (enemy.Humanoid.Health &gt; 0) then\n target = enemy\n range = distance\n end \n end\n \n range = 20\n \n if target then\n return target.Humanoid\n else\n return nil\n end\n end\n\n while true do\n local victim = nearestenemy()\n if victim then\n victim:TakeDamage(3)\n end\n task.wait(.5)\n end\n</code></pre>\n<p>the enemies despawn after 0.6 seconds of dying</p>\n<p>Please Help!</p>\n<p>I looked into the forums, nothing worked\nI made the tower not target dead enemies, no change\nI Checked if the enemies even had a humanoid, nothing worked (The specific enemy is cloned from an orginal clone enemy with a humanoid)</p>\n"^^ . . "The code given is not really correct because it uses ```t[v] = v``` for index key defining and has only be corrected to: ```t[i] = v```"^^ . "<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>local Players=Game.Players\n\nlocal function NEWGAME()\n\nrepeat players=Players:players()until#players&gt;1 or not Players.PlayerAdded:Wait()\ntable.foreachi(players,function(i,v)getfenv()["player"..i]=table.remove(players,math.random(1,#players))end)\n\n for i = 10, 0, -1 do\n status.Text = "Starting in "..i\n wait(1)\n end\n print("Player 1 is "..tostring(player1))\n print("Player 2 is "..tostring(player2))\n\nend;status=Instance.new("Hint",Workspace)NEWGAME()</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . "0"^^ . "0"^^ . . "Standard Lua uses lowercase keywords."^^ . . "1"^^ . "0"^^ . . "Lua formatting returns unexpected results"^^ . . "0"^^ . . . . "0"^^ . . . "0"^^ . "discord"^^ . . . . . "Can't reproduce (Lua 5.3.4 on Windows) -- it prints `2.0 number 2.0` for me... Looks like it's printing a colon instead of dot as a decimal separator."^^ . "Lua sorting a table twice by different fields"^^ . "0"^^ . "0"^^ . "why can't get value from lua in redis"^^ . . "How do you run the script? Simple `lua execute.lua` (or another filename)? Do you by any chance change `os` at any point?"^^ . "1"^^ . "<p>can anybody fix this logitech ghub autoclicker? i want the script to turn on/off when the back button is pressed, and when pressed once while holding the left mouse button, it clicks all the time until the button is released</p>\n<pre><code>local counter = 0\nfunction OnEvent(event, arg)\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 4 then\n counter = counter+1\n if counter % 2 == 1 then\n clickingEnabled = true\n else\n clickingEnabled = false\n end\n end\n while clickingEnabled and IsMouseButtonPressed(1) do\n PressMouseButton(1)\n Sleep(10)\n ReleaseMouseButton(1)\n Sleep(10)\n end\nend\n</code></pre>\n"^^ . "4"^^ . "2"^^ . . . "0"^^ . . . . "0"^^ . "<p>I am new to Lua scripting and facing issues while creating Set in Lua. I am trying to store unique elements in Lua Set using below code but it isn't working as expected.</p>\n<pre><code>local function test() \n local t1 = {11,11,22,33,33,44,55,66,77,88,99}\n local t = {}\n for i, v in ipairs(t1)\n do\n t[v] = v\n end\n return t\nend\n</code></pre>\n<p>This function is supposed to return unique elements from <code>t1</code> but it's returning empty array. I think I am doing something wrong but can't figure out what. Can someone help?</p>\n<p>Read lot about Lua Sets still couldn't figure out issue. Tried running script locally in docker with different modifications/approaches but nothing helped</p>\n"^^ . . . . . . . . "0"^^ . "1"^^ . . . . . . . . . . . "0"^^ . . . "0"^^ . . . . "Some Lua environments (such as a game scripting environment) deliberately remove potentially dangerous functions from the Lua standard library, such as file access or command execution."^^ . "<p>How do you make sure there's two people at least in the game before proceeding and how do you pick two random ones that are not the same?</p>\n<p>I'm guessing something like</p>\n<pre><code>local players = game.Players:GetPlayers()\nlocal status = game.ReplicatedStorage.Status\n\nwhile true do\n for i = 10, 0, -1 do\n status.Value = &quot;Starting in &quot;..i\n wait(1)\n end\n \n local player1 = players[math.random(1,#players)]\n local player2 = players[math.random(1, #players)]\n \n print(&quot;Player 1 is &quot;..tostring(player1))\n print(&quot;Player 2 is &quot;..tostring(player2))\nend\n</code></pre>\n<p>But not quite, because the two players can be accidentally the same, and I haven't done a check to make sure there's at least two players</p>\n"^^ . . . . . "2"^^ . . "1"^^ . "0"^^ . "<p>On Debian, you must also install the <a href="https://packages.debian.org/bullseye/libhpdf-dev" rel="nofollow noreferrer"><code>libhpdf-dev</code></a> package to get the <em>development files</em> (headers) necessary to compile <a href="https://github.com/jung-kurt/luahpdf/tree/master" rel="nofollow noreferrer">LuaHPDF</a> (and then link against <a href="https://packages.debian.org/bullseye/libhpdf-2.3.0" rel="nofollow noreferrer"><code>libhpdf-2.3.0.so</code></a>).</p>\n<p>This is a general pattern when compiling from source.</p>\n<p>Note that this will only solve an initial problem, as LuaHPDF targets Lua 5.2, and will not compile under Lua 5.4, as there have been breaking changes (very common between Lua versions).</p>\n<p>You'll either need to compile and link against Lua 5.2, or port the source to Lua 5.4.</p>\n<p>That said, the only issue I ran into when compiling is that Lua 5.4 dropped the <code>LUA_QS</code> and <code>LUA_QL</code> macros from <a href="https://www.lua.org/source/5.2/luaconf.h.html#LUA_QS" rel="nofollow noreferrer"><em>luaconf.h</em></a> (present most recently in Lua 5.3 <a href="https://www.lua.org/source/5.3/luaconf.h.html#LUA_QS" rel="nofollow noreferrer">for compatibility</a>). Adding them back near the top of <a href="https://github.com/jung-kurt/luahpdf/blob/master/hpdf.c" rel="nofollow noreferrer"><em>hpdf.c</em></a></p>\n<pre><code>#define LUA_QL(x) &quot;'&quot; x &quot;'&quot;\n#define LUA_QS LUA_QL(&quot;%s&quot;)\n</code></pre>\n<p>does get this to compile cleanly, though I cannot comment on the stability of the library with this basic patch.</p>\n<hr />\n<p><sup>For complete transparency, I tested this on <a href="https://getsol.us/" rel="nofollow noreferrer">Solus</a>, where <a href="http://libharu.org/" rel="nofollow noreferrer"><em>libHaru</em></a> is available as <a href="https://solus.pkgs.org/rolling/solus-shannon-x86_64/libharu-2.3.0-1-1-x86_64.eopkg.html" rel="nofollow noreferrer"><code>libharu</code></a> and <a href="https://solus.pkgs.org/rolling/solus-shannon-x86_64/libharu-devel-2.3.0-1-1-x86_64.eopkg.html" rel="nofollow noreferrer"><code>libharu-devel</code></a>. The <em>process</em> should be the same on Debian, even if the names are different - I just don't have a Debian machine on hand.</sup></p>\n"^^ . "Thank you for contributing to the Stack Overflow community. This may be a correct answer, but it’d be really useful to provide additional explanation of your code so developers can understand your reasoning. This is especially useful for new developers who aren’t as familiar with the syntax or struggling to understand the concepts. **Would you kindly [edit] your answer to include additional details for the benefit of the community?**"^^ . "0"^^ . "2"^^ . "0"^^ . . "1"^^ . . "2"^^ . . "Thank you! Can you explain how?"^^ . . "0"^^ . "Probably not the cause of your problem but Exuberant Ctags has been abandoned a while ago. Consider switching to [Universal Ctags](https://ctags.io)."^^ . . . . "0"^^ . . . . "0"^^ . "2"^^ . . "<p>I have made a leaderstats script with 2 Folders and 6 stats. when i test the game none of the stats are loading in. Here is the script:</p>\n<pre><code>local DataStore = game:GetService(&quot;DataStoreService&quot;):GetDataStore(&quot;ValueSave&quot;)\nlocal DataStore2 = game:GetService(&quot;DataStoreService&quot;):GetDataStore(&quot;ValueSave2&quot;)\nlocal DataStore3 = game:GetService(&quot;DataStoreService&quot;):GetDataStore(&quot;ValueSave3&quot;)\nlocal DataStore4 = game:GetService(&quot;DataStoreService&quot;):GetDataStore(&quot;ValueSave4&quot;)\nlocal DataStore5 = game:GetService(&quot;DataStoreService&quot;):GetDataStore(&quot;ValueSave5&quot;)\nlocal DataStore6 = game:GetService(&quot;DataStoreService&quot;):GetDataStore(&quot;ValueSave6&quot;)\n\ngame.Players.PlayerAdded:Connect(function(plr)\n\n\n local leaderstats = Instance.new(&quot;Folder&quot;, plr)\n leaderstats.Name = &quot;leaderstats&quot;\n\n local plrstats = Instance.new(&quot;Folder&quot;, plr)\n plrstats.Name = &quot;Multipliers&quot;\n\n local cash = Instance.new(&quot;IntValue&quot;, leaderstats)\n cash.Name = &quot;Jump&quot;\n cash.Value = DataStore:GetAsync(plr.UserId) or 1\n \n local cash1 = Instance.new(&quot;IntValue&quot;, leaderstats)\n cash.Name = &quot;Run&quot;\n cash.Value = DataStore5:GetAsync(plr.UserId) or 1\n \n local cash2 = Instance.new(&quot;IntValue&quot;, leaderstats)\n cash.Name = &quot;Climb&quot;\n cash.Value = DataStore6:GetAsync(plr.UserId) or 1\n\n local Upgrade = Instance.new(&quot;IntValue&quot;, plrstats)\n Upgrade.Name = &quot;ClimbMultiplier&quot;\n Upgrade.Value = DataStore4:GetAsync(plr.UserId) or 1\n \n local multi = Instance.new(&quot;IntValue&quot;, plrstats)\n multi.Name = &quot;RunMultiplier&quot;\n multi.Value = DataStore2:GetAsync(plr.UserId) or 1\n\n local cost = Instance.new(&quot;IntValue&quot;, plrstats)\n cost.Name = &quot;JumpMultiplier&quot;\n cost.Value = DataStore3:GetAsync(plr.UserId) or 1\n\n cash.Changed:Connect(function()\n DataStore:SetAsync(plr.UserId, cash.Value)\n end)\n\n Upgrade.Changed:Connect(function()\n DataStore4:SetAsync(plr.UserId, Upgrade.Value)\n end)\n\n cost.Changed:Connect(function()\n DataStore3:SetAsync(plr.UserId, cost.Value)\n end)\n \n multi.Changed:Connect(function()\n DataStore2:SetAsync(plr.UserId, multi.Value)\n end)\n \n cash1.Changed:Connect(function()\n DataStore5:SetAsync(plr.UserId, cash1.Value)\n end)\n \n cash2.Changed:Connect(function()\n DataStore6:SetAsync(plr.UserId, cash2.Value)\n end)\nend)\n\ngame.Players.PlayerRemoving:Connect(function(plr)\n DataStore:SetAsync(plr.UserId, plr.leaderstats.Cash.Value)\n DataStore4:SetAsync(plr.UserId, plr.Multipliers.Upgrade.Value)\n DataStore3:SetAsync(plr.UserId, plr.Multipliers.Cost.Value)\n DataStore2:SetAsync(plr.UserId, plr.Multipliers.multi.Value)\n DataStore5:SetAsync(plr.UserId, plr.leaderstats.cash1.Value)\n DataStore6:SetAsync(plr.UserId, plr.leaderstats.cash2.Value)\nend)\n</code></pre>\n<p>After I join, there is no error in the output. What is wrong with this script? What can I do to fix it? Please help.</p>\n<p>I needed to add these words to post my problem.</p>\n"^^ . . "data-masking"^^ . . . . . . . . "<p>I have commentted out all of my vimrc file, in my macOS (<code>22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64 arm Darwin</code>), it cannot find tag with the folloing commands and source</p>\n<pre><code>$ cat x.lua\nfunction test ()\nend\n$ ctags -R x.lua\n$ cat tags\n!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;&quot; to lines/\n!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/\n!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/\n!_TAG_PROGRAM_NAME Exuberant Ctags //\n!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/\n!_TAG_PROGRAM_VERSION 5.8 //\ntest x.lua /^function test ()$/;&quot; f\n\n$ vim -t test\n# vim reports the error like &quot;E257: cstag: Tag not found&quot;\n</code></pre>\n<p>If I removed the space after the function name <code>test</code>, like <code>function test()</code>, then it could work.</p>\n<p>I also test this in my EC2 ubuntu, it could work even tough there is a space after the function name <code>test</code>.</p>\n<p>I dont know how to debug after this, I also asked it to ChatGPT 3.5, but it could not resolve this.</p>\n"^^ . "try seting candidate_count to 1"^^ . "print(os.setlocale()) --> C.UTF-8"^^ . "0"^^ . . "0"^^ . . "See e.g. https://www.sublimetext.com/docs/syntax.html. I'd recommend grabbing Lua and HTML grammar files, and then figuring out how to "include" Lua in HTML; the [including other files](https://www.sublimetext.com/docs/syntax.html#including-other-files) basically already has the example you want (albeit with JS `<script>` rather than Lua)."^^ . "0"^^ . "1"^^ . "2"^^ . "0"^^ . "1"^^ . . . . "ROBLOX - Why isn't my while loop working?"^^ . . . "0"^^ . "3"^^ . . . "candidateCount set to 1"^^ . "<p>The current date and time format we're getting from the device is (DD-MON-YY) <strong>07-NOV-23</strong> and (HH.MM) <strong>16.30</strong>.</p>\n<p>SO we need to re-format as <strong>&quot;2023-11-07T16:30:00.000000Z</strong> before pushing into the payload.</p>\n<p>We tried below LUA\n<code>local a=self.value['raindate'].value\\nlocal b=self.value['raintime'].value\\nvalue=string.format('%sT%s',a,b)</code>\nand the result was <strong>23-NOV-23T16:30</strong></p>\n<p>we're trying to achieve the output as <strong>2023-11-07T16:30:00.000000Z</strong></p>\n<p>Requesting anyone help on this? Thanks in advance</p>\n"^^ . "<p>To get more experience i suggest to play around with this...</p>\n<pre><code>dtable = setmetatable(os.date('*t', os.time({year = 1965, month = 8, day = 9, hour = 10, min = 45, sec = 33})), {__call = function(self) self.tz=os.date('%z') self.ampam = os.date('%p') return self end, __index = {dir = function(self) print(self) for key, val in pairs(self) do print(key, '=&gt;', val) end end}})\n</code></pre>\n<p>...this adds the dir function as method.<br />\nAlso you have to know that <code>ampam</code> depends on the locale...</p>\n<pre><code>&gt; dtable = setmetatable(os.date('*t', os.time({year = 1965, month = 8, day = 9, hour = 10, min = 45, sec = 33})), {__call = function(self) self.tz=os.date('%z') self.ampam = os.date('%p') return self end, __index = {dir = function(self) print(self) for key, val in pairs(self) do print(key, '=&gt;', val) end end}})\n&gt; os.setlocale('en_US.UTF8', 'time')\nen_US.UTF8\n&gt; dtable():dir()\ntable: 0x566035c0\nsec =&gt; 33\nmin =&gt; 45\nhour =&gt; 10\nampam =&gt; AM\nyear =&gt; 1965\nday =&gt; 9\nisdst =&gt; false\nyday =&gt; 221\nwday =&gt; 2\nmonth =&gt; 8\ntz =&gt; +0100\n&gt; os.setlocale('de_DE.UTF8', 'time')\nde_DE.UTF8\n&gt; dtable():dir()\ntable: 0x566047b0\nsec =&gt; 33\nmin =&gt; 45\nhour =&gt; 10\nampam =&gt; \nyear =&gt; 1965\nday =&gt; 9\nisdst =&gt; false\nyday =&gt; 221\nwday =&gt; 2\nmonth =&gt; 8\ntz =&gt; +0100\n&gt; os.setlocale('ja_JP.utf8', 'time')\nja_JP.utf8\n&gt; dtable:dir()\ntable: 0x565c1cc0\nyear =&gt; 1965\nwday =&gt; 2\nyday =&gt; 221\nhour =&gt; 10\nmonth =&gt; 8\nmin =&gt; 45\nisdst =&gt; false\nsec =&gt; 33\nday =&gt; 9\n&gt; dtable():dir()\ntable: 0x565c1cc0\nyear =&gt; 1965\nwday =&gt; 2\nyday =&gt; 221\nhour =&gt; 10\nampam =&gt; 午前\nmonth =&gt; 8\ntz =&gt; +0100\nmin =&gt; 45\nisdst =&gt; false\nsec =&gt; 33\nday =&gt; 9\n</code></pre>\n<p>(On Linux bash i getting the locale strings with: <code>locale -a</code>)<br />\n...and OS and Lua Version (maybe) in this case:</p>\n<pre><code>&gt; os.execute('uname -a')\nLinux Microknoppix 5.2.5-64 #10 SMP PREEMPT Sat Aug 3 20:57:52 CEST 2019 x86_64 GNU/Linux\n&gt; _VERSION\nLua 5.4\n</code></pre>\n"^^ . . . . "1"^^ . . . . . "0"^^ . . "lua use gsub or match for end substring deletion?"^^ . "Why am I able to adjust "vertical_speed" with all mouse buttons instead of only button "9"?"^^ . . . . "<p>The problem with the script that's out now is that I hope it will continue to be pressed randomly while I'm pressing the button. But if I keep pressing this button &quot;8,&quot; it will only be pressed once. I hope that if I hold the button &quot;8&quot; down, it will continue to be randomly pressed while I hold it down. And I hope it stops if I let go of the button. What scripts do I need to fix?</p>\n<pre><code>EnablePrimaryMouseButtonEvents(true)\n\nfunction OnEvent(event, arg)\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 8 then\n repeat\n PressMouseButton(1)\n Sleep(math.random(70,120))\n PressKey(&quot;q&quot;,&quot;s&quot;)\n Sleep(math.random(70,120))\n ReleaseMouseButton(1)\n ReleaseKey(&quot;q&quot;,&quot;s&quot;)\n until not IsMouseButtonPressed(8)\n end\nend\n</code></pre>\n<p>If I press the &quot;8&quot; button just once and touch it, I hope it keeps clicking randomly and continuously. And hope the macro stops once I press the button &quot;8&quot; again.</p>\n<p>I'd really appreciate it if you could answer me.</p>\n<p>I tried to delete &quot;repeat&quot;, but when I deleted it, I got an error, so I can't do this or that. And I tried to change it to</p>\n<pre><code>&quot;PressAndReleaseMouseButton()&quot;\n</code></pre>\n<p>but not only did I get a random value, but rather the speed of pressing the button was faster.</p>\n"^^ . . "1"^^ . "0"^^ . . . "0"^^ . . . . "string"^^ . "tags"^^ . . "Also possible that Lua is not adding the `.` itself if its normal decimal formatting doesn't produce something that looks like an integer, but it will normally use `sprintf` with `%.14g` here which will produce "2" and it will add the ".0" as described above. In any case, I think this seems like quite surprising behavior."^^ . . . "0"^^ . . "0"^^ . . . "1"^^ . . "0"^^ . "0"^^ . . . "How to resize a cylinder from one end and move it backwards in Roblox"^^ . "1"^^ . "nginx"^^ . . "1"^^ . "1"^^ . . . . "0"^^ . "0"^^ . . . . "0"^^ . . "0"^^ . . "1"^^ . "1"^^ . . . . "Can't run /usr/bin/demo from lua scripts"^^ . "2"^^ . . . "<p>I'm experimenting with Lua OOP (Object Oriented Programming) but I'm experiencing some issues.</p>\n<p>Here is a sample code with comments:</p>\n<pre class="lang-lua prettyprint-override"><code>Object = {string = &quot;Default&quot;}\n\nfunction Object:new()\n local o = {}\n setmetatable(o, {__index = self})\n -- o.string = &quot;Default&quot;\n return o\nend\n\nfunction Object:SayHi(input)\n if input == nil then\n input = &quot;&quot;\n else\n local temp = input\n input = &quot; &quot; .. temp\n end\n print(&quot;Hi!&quot; .. input)\nend\n\nfunction Object:CallHiFunct()\n local temp = &quot;Called from CallHiFunct&quot;\n self:SayHi(temp)\nend\n\nfunction Object:PrintString()\n print(self.string) -- Variable named string from Object\nend\n\nobject1 = Object:new() -- Returns new metatable to object1\nobject1:SayHi() -- Prints Hi!\nobject1:CallHiFunct() -- Prints Hi! Called from CallHiFunct\nobject1:PrintString() -- Prints Default\n\nprint()\nprint()\n\nfunct_object1 = object1.SayHi\nfunct_object1() -- Prints Hi!\n\nfunct2_object1 = object1.PrintString\nfunct2_object1() -- Error: attempt to index a nil value (local 'self')\n\nfunct2_object1 = object1:PrintString() -- if object1:PrintString Error: function arguments expected near 'funct2_object1'\nfunct2_object1() -- Error: attempt to call a nil value (global 'funct2_object1')\n</code></pre>\n<p>I'm trying to save a function from an object/table but I'm having problems with <code>self</code> being <code>nil</code>.</p>\n<p>How can I properly do this to keep the function with the object?</p>\n<p>.</p>\n<p>The reason why I'm doing this is because I'm using a function specified in a library which accepts function as an argument.</p>\n<p>I think something like this:</p>\n<pre><code>function Example(funct)\n funct() -- calls it here\nend\n</code></pre>\n<p>To be exact the function is actually:\n<code>GUI:AddButton(arguments...):AddEventHandler(event, funct)</code></p>\n<p>(<code>event</code>: when it is activated, <code>funct</code>: to call when activated)</p>\n<p>but I'm not exactly sure what is inside.</p>\n<p>Anyway. Ignoring this library is it possible to save a function from an &quot;object&quot; to variable to be called from this variable?</p>\n<p>(I was unable to find any answer. I it already has been asked then link the question with the answers please.)</p>\n<p>Thanks.</p>\n"^^ . "0"^^ . . "<p>I am very sure that is because the model or one of the members has the <code>Archivable</code> property turned off, try using</p>\n<pre><code>space.Archivable = true\nlocal s = space:Clone()\nspace.Archivable = false\n</code></pre>\n"^^ . . . . . . . . "1"^^ . "1"^^ . . . "0"^^ . . . . . . . . "0"^^ . "3"^^ . . . "автоклик неработает"^^ . "0"^^ . "Just wanted to mention that it might get you banned unless you have a verified 18+ account and mark the game as 18+"^^ . "plugins"^^ . . . . "nvim "failed to run config for nvim-dap", loader.lua:369 attemp to call field 'setup' (a nil value)"^^ . . . . . . . "0"^^ . "prompt"^^ . . . "3"^^ . . "<p>I believe you want to make a &quot;creator tag&quot; to parent to the player that attacks somone with their name as a value, and when that person dies it tells who killed who. Like this</p>\n<pre><code>local Handle = Tool.Handle\nlocal Damage = 10\n\nHandle.Touched:Connect(function(Hit)\n local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)\n if Player then\n Hit.Parent.Humanoid:TakeDamage(Damage)\n local Tagged = Instance.new(&quot;ObjectValue&quot;)\n Tagged.Name = &quot;creator&quot;\n Tagged.Value = Player\n Tagged.Parent = Hit.Parent.Humanoid\n game.Debris:AddItem(Tagged, 2)\n end\nend)\n</code></pre>\n<p>So it sets a tag to a certain player and then in a server script in ServerScriptService that checks when a player dies.</p>\n<pre><code>game.Players.PlayerAdded:Connect(function(Player)\n \n Player.CharacterAdded:Connect(function(Character)\n Character.Humanoid.Died:Connect(function()\n if Character.Humanoid:FindFirstChild(&quot;creator&quot;) then\n local Player = Character.Humanoid.creator.Value\n local Leaderstats = Player.leaderstats\n Leaderstats.Kills.Value += 1\n end\n end)\n end)\nend)\n</code></pre>\n"^^ . . . . . "syntax-error"^^ . "Neovim init.lua sourcing not working when trying to install Lazy.nvim"^^ . . . "I didn't test your code. But if you want bold and large test as a title, I guess it might be much better to edit the Latex macro used for setting the title than hard coding it in your YAML file. This might also influence any Lua filter because you wouldn't have to remove those Latex commands."^^ . "0"^^ . . . . . "0"^^ . . . . . . . . . . "autoclick does not work, and caps lock"^^ . . "1"^^ . . . . . "0"^^ . . . "0"^^ . . . "0"^^ . "1"^^ . "0"^^ . . "I surmise the issue you're facing is due to **the order of Nginx phases**. The `rewrite_by_lua_block` runs before the `proxy_pass`, so the headers from the upstream server are not yet available."^^ . "0"^^ . . "2"^^ . . "Hi Mike, I can see the 2nd option working. Thanks for the help. Can we also add or minus the timezone here. For ex. the current time mention in the result is 16.30 can we make the code for the particular timezone like adding or subtracting the hours by 5 hours 30 mins"^^ . . . . "1"^^ . . . "0"^^ . . . "<p>Use <code>^</code> to match the beginning of the string</p>\n<pre><code>string.gsub(' if(a == b) then', '^ +', function (spaces)\n return ('\\t'):rep(#spaces)\nend)\n</code></pre>\n"^^ . . . "ROBLOX - How do I run my code at the same time as this?"^^ . "1"^^ . . . . . "As not aware of actual usecase, while saving in redis if you are passing the actual struct and not byte, then waht does `cjon.encode` achieve i fail to understand. i guess encoding also just return `jsonString`. so encoding is not needed. now let's say some field if struct you want to modify atomically, then first you have `decode`-> modify -> `encode` -> save."^^ . "0"^^ . . . "1"^^ . . . "string-formatting"^^ . "pandoc md -> latex write lua-filter to change latex-macro used for caption"^^ . "<p><code>table:function(arguments)</code> is purely syntactic sugar for <code>table.function(table, arguments)</code>.</p>\n<p>(<em>In the body of the function definition <code>table</code> is the implicit <code>self</code>, when defined with colon syntax.</em>)</p>\n<p>As you have seen, this assignment</p>\n<pre class="lang-lua prettyprint-override"><code>funct2_object1 = object1.PrintString\n</code></pre>\n<p>does not carry any information about <code>object1</code> with it, and so this function call</p>\n<pre class="lang-lua prettyprint-override"><code>funct2_object1()\n</code></pre>\n<p>errors out, looking for an <em>explicit</em> first argument to fill the role of <code>self</code>.</p>\n<p>If you had called <code>funct2_object1(object1)</code> the function would behave as expected.</p>\n<hr />\n<p>Given this callback-style function</p>\n<pre class="lang-lua prettyprint-override"><code>function Example(funct)\n funct() -- calls it here\nend\n</code></pre>\n<p>it sounds like what you want is to create a <em>closure</em> around your OOP-style call, which you can do by enclosing it with a function (anonymous or otherwise).</p>\n<p>For example:</p>\n<pre class="lang-lua prettyprint-override"><code>local Object = {}\n\nfunction Object:new(data)\n return setmetatable({ data = data }, { __index = self })\nend\n\nfunction Object:do_something()\n print('Hello from', self, self.data)\nend\n\nlocal thing = Object:new(42)\n\n----\n\nlocal function Example(funct)\n funct()\nend\n\nExample(function ()\n thing:do_something()\nend)\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>Hello from table: 0x55c65be628c0 42\n</code></pre>\n"^^ . . "<p>If you are using Windows, I highly recommend using the WSL on it, which is more suitable to use the terminal-based applications.</p>\n"^^ . . "Thanks, it’s always the silliest little mistakes."^^ . . . . . "<p>Even if the script is a localscript or serverscript, your code won't work.\nAlternatively, you can add a BoolValue in StarterCharacterScripts.</p>\n"^^ . . . "1"^^ . . . . "<p>ok... i solve my problem. the problem is on my self. i forgot to add the</p>\n<pre><code>return response\n</code></pre>\n<p>which is stupid on my side lol</p>\n<p>here's the fixed code</p>\n<pre class="lang-lua prettyprint-override"><code>--google palm--\n--roblox lua\n\nlocal Players = game:GetService(&quot;Players&quot;);\nlocal HttpService = game:GetService(&quot;HttpService&quot;);\nlocal LocalPlayer = Players.LocalPlayer;\nlocal RequestFunctiom = request;\nlocal function MakeRequest(Prompt)\n local success, response = pcall(function()\n return RequestFunctiom({\n Url = &quot;https://generativelanguage.googleapis.com/v1beta2/models/text-bison-001:generateText?key=KEY_HERE&quot;,\n Method = &quot;POST&quot;,\n Headers = {\n [&quot;Content-Type&quot;] = &quot;application/json&quot;,\n },\n Body = HttpService:JSONEncode({\n prompt = {\n text = Prompt\n },\n temperature = 0.7,\n candidateCount = 1,\n topP = 0.95,\n topK = 5,\n maxOutputTokens = 100,\n stopSequences = {&quot;Human:&quot;, &quot;Ai:&quot;},\n })\n })\n end)\n print(response)\n return response\nend\nprint(&quot;MakeRequest sending&quot;)\nprint(&quot;test1&quot;)\nlocal HttpRequest = MakeRequest(&quot;Human: Hello how are you today \\n\\nAI:&quot;);\n--wait(3) -- if this added the local Response will errored the error is &quot;attempt to index nil with the Body&quot;\nlocal Response = &quot;. &quot; .. string.sub(HttpService:JSONDecode(HttpRequest[&quot;Body&quot;]).candidates[1].output, 2);\nprint(Response)\n</code></pre>\n"^^ . . "im new to lua so how could i fix that"^^ . . . . "0"^^ . "discord.js"^^ . "1"^^ . "<p>Your code needs to be a script, <strong>not</strong> a local script.</p>\n<p>A local script runs on client side, meaning that it only affects the client.</p>\n<p>Just change this to a script (which runs on server side) in <code>ServerScriptService</code>.\nWhich will need a couple of adjustments\nHere's the code:</p>\n<pre class="lang-lua prettyprint-override"><code>--this runs when a player connects to the server\ngame:GetService(&quot;Players&quot;).PlayerAdded:Connect(function(player)\n --create the BoolValue\n local BoolValue = Instance.new(&quot;BoolValue&quot;)\n --this runs when the player's character is created\n --this is used so that the BoolValue parent is the character and not null\n player.CharacterAdded:Connect(function(character: Model)\n --Move the BoolValue to the character!\n BoolValue.Parent = character\n end)\nend)\n</code></pre>\n<p>Basically, client side (local scripts) only run on the client (only the player)</p>\n<p>And server side (scripts) run for everyone on the server</p>\n<p>And another way to do this is by creating an instance of BoolValue and moving it into <code>StarterCharacterScripts</code> <em>(which also works)</em></p>\n"^^ . "2"^^ . . . . . . "<p>im not sure if the title is the correct question, i have very little programming knowledge but i know exactly what i want to accomplish, not how to ask what to do, so ill just give an example.</p>\n<pre><code>mX = {\n{X,0,0,0,X},\n{0,X,0,X,0},\n{0,0,X,0,0},\n{0,X,0,X,0},\n{X,0,0,0,X},\n}\n\nmY = {\n{X,0,0,0,X},\n{0,X,0,X,0},\n{0,0,X,0,0},\n{0,X,0,0,0},\n{X,0,0,0,0},\n}\n</code></pre>\n<p>i want to be able to combine them horizontally so i can make a bigger array, but wrap the input once it reaches a certain column count, for instance if i wanted to make</p>\n<pre><code>mZ = mX, mY, mX, mY, mX, mY, mX\n\nmZ = {\n{X,0,0,0,X,X,0,0,0,X,X,0,0,0,X,X,0,0,0,X,X,0,0,0,X},\n{0,X,0,X,0,0,X,0,X,0,0,X,0,X,0,0,X,0,X,0,0,X,0,X,0},\n{0,0,X,0,0,0,0,X,0,0,0,0,X,0,0,0,0,X,0,0,0,0,X,0,0},\n{0,X,0,X,0,0,X,0,0,0,0,X,0,X,0,0,X,0,0,0,0,X,0,X,0},\n{X,0,0,0,X,X,0,0,0,0,X,0,0,0,X,X,0,0,0,0,X,0,0,0,X},\n{X,0,0,0,X,X,0,0,0,X,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n{0,X,0,X,0,0,X,0,X,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n{0,0,X,0,0,0,0,X,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n{0,X,0,X,0,0,X,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n{X,0,0,0,X,X,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n}\n</code></pre>\n<p>ive tried using chatgpt but i dont know how to word what i want to do correctly and giving it an example didnt really help much, i successfully got it to make something that can result in combining horizontally but as soon as i try to implement wrapping it to a new &quot;row&quot; of matrices it stops understanding what im trying to do.\nive tried using table.insert but it breaks my matrix somehow when i try to use it, regardless i dont think it would be useful for a matrix.\ni gave up on trying to do this in a neat way and was going to just make a recursive function to manually add the values from one matrix to another but it seemed to shift existing values in the matrix over when i tried to add values expanding it.</p>\n<p>edit 1:\ni managed to make a function with table insert to add the matrices together but using the matrices as arguments in the function ends up not using them seperately as i would assume but instead directly uses the matrices themselves, so if i use arguments A and B in a function that are tied to mX and mY respectively, instead of copying the matrices to A and B it just uses mX and mY</p>\n<p>edit 2:\ni managed to get something working good enough the day after i posted this, as it works good enough for what im doing i probably wont improve it for a while, it doesnt wrap and start on the left when it goes to a new &quot;row&quot; but instead puts the next part into the center, which oddly enough works out perfectly</p>\n<pre><code> k = 0\nfunction catcat(kot,meow)\n if #kot[1 + k] &gt;= 77 then\n k = k + 6\n end\n for i=1,#meow do\n for ii=1, #meow[i] do\n table.insert(kot[i + k],meow[i][ii])\n end\nend\nend\n\nmKOT = {{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}{}}\n</code></pre>\n<p>i ran into a couple problems when combining matrices of different height, but since it isnt an immiediate issue im not worried about it, different length works fine, height is the main issue.</p>\n"^^ . "0"^^ . "It's certainly possible, but you'll have to edit the grammar files."^^ . "<p>In my case, I solve this issue by installing <code>dap.core</code> plugin. In Lazyvim GUI, press <code>x</code>, move cursor down to <code>dap.core</code> and press <code>x</code> again. Restart Nvim to take the effect.</p>\n"^^ . "<pre><code>game.Players.PlayerAdded:Wait()\nwait()game.Players:players()[1].leaderstats.isKing.Value=&quot;Yes&quot;\ngame.Players.PlayerRemoving:Connect(function()\ngame.Players:players()[1].leaderstats.isKing.Value=&quot;Yes&quot;\nend)\n</code></pre>\n"^^ . "0"^^ . . . "<p>You forgot to put the <code>stat</code> object in leaderstats</p>\n<p>this is easily fixed by this line of code:</p>\n<pre class="lang-lua prettyprint-override"><code>stat.Parent = leaderstats\n</code></pre>\n<p>Oh and by the way, use <code>game:GetService(&quot;Players&quot;)</code> instead of <code>game:WaitForChild(&quot;Players&quot;)</code> as this is more clean</p>\n"^^ . . . "0"^^ . . "3"^^ . . . "0"^^ . . . "lua-5.4"^^ . . "0"^^ . . . . "4"^^ . "redaction"^^ . . . "0"^^ . "1"^^ . . "1"^^ . . "0"^^ . "0"^^ . . "physics"^^ . . . . . "<p>My question was: What does &quot;7:0&quot; mean as the representation of a number whose value is at least close to 7.</p>\n<p>The answer seems to be: It's a quirk of QLua.</p>\n<p>I tried <a href="https://www.jdoodle.com/execute-lua-online/" rel="nofollow noreferrer">the online parser at JDoodle</a>:</p>\n<ul>\n<li>the 5.3 versions all produced &quot;2.0&quot;</li>\n<li>the 5.4 version produced &quot;2&quot;</li>\n</ul>\n<p>If I pursue this, I think it will have to be with the people associated with QLua.</p>\n"^^ . . "<p>I am involved in the development of a startup and our team is faced with the following problem. We have several lua environments in our C++ application, one environment runs on sol3, and the other is implemented using a regular lua code without any auxiliary libraries. Previously, 2 of these environments worked independently of each other, but now it is necessary to make that an environment with a normal implementation needs functionality that is in written using sol3. How can we access from one environment to another and use all its functionality? Maybe it is possible to combine them somehow? Any ideas will help, thanks a lot</p>\n<p>I tried using lua_State* m_state from sol3 to another environment but it didn't help</p>\n"^^ . . . . . "1"^^ . . "Sorry I didn't get that. Do you mean how am I testing it? Actually I was running it on Redis server. Saved logic from this function to lua file(`test.lua`), loaded it on Redis server using `script load` and executed it using `evalsha` command"^^ . . . "0"^^ . . . . . "1"^^ . "-2"^^ . . . . "1"^^ . . "0"^^ . "0"^^ . "Aside from the fact that I want nothing to do with Termux, I think I ended up with QLua after downloading several. QLua was the one I was able to use from the command line."^^ . . "0"^^ . . "1"^^ . . "0"^^ . "Yup, when I source my `init.lua`.\n\n\n╰─❯ source init.lua\n\ninit.lua:1: number expected"^^ . "0"^^ . "1"^^ . . "luabridge"^^ . . . . . . . . . "1"^^ . . "0"^^ . . . . "I'll explain.. So, we have a sensor device which sends the current date and time in IST (+5.30) (we cannot change the time in that). For ex. when the device send time as 19.30 hours, by lua can we change it to 14.00 (i.e. +0.00)?"^^ . . "Lua Set in Redis is not working as expected"^^ . . . . . "Thanks for your answer. Unfortunatley, your suggestion of a LaTeX solution is impossible due to following reasons: 1. `\\sidecaption` itself uses the `\\caption` command inside its definition, so you cannot simply replace one with the other, but 2. even if you save the `caption` command (e.g. with `\\let` or `\\NewCommandCopy`) and use the saved version inside `\\sidecaption`, it will not work since `\\caption` istn't a simple macro. It relies on many conditions and sub-macros in the backend. See my edit."^^ . . "<p>I'd like to embed Lua code in html by putting it between tags while having SUblime Text's syntax highlight and autocomplete for both languages, the way it automatically does with html/PHP. Is it possible?</p>\n<p>Something like this:</p>\n<pre><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n &lt;head&gt;&lt;title&gt;Test&lt;/title&gt;&lt;/head&gt;\n &lt;body&gt;\n &lt;? local n = 3 ?&gt;\n &lt;h1&gt;Test number &lt;? print(n) ?&gt;&lt;/h1&gt;\n &lt;/body&gt;\n&lt;/html&gt;\n</code></pre>\n"^^ . . . . "methods"^^ . . "Yes you need to do a loop through every line, you can use another gsub to split the text into lines. By the way the pattern you found cannot match spaces at the beginning of the text such as this `' if(a == b) then'`, lua cannot use a pattern like `(^|\\n)` to match this situation."^^ . . "after adding the () and setting `arg[1] = "file1"`, im still getting arg[1] is a nil value when using jukebox.lua"^^ . "How to get the functionality of one lua environment from another"^^ . . . . . "0"^^ . . . . . . "0"^^ . "<p>I'd like to permanently set the <a href="https://neovim.io/doc/user/options.html#%27scroll%27" rel="nofollow noreferrer">scroll</a> option in my Neovim config to a set value, but the option doesn't persist when I set it in my init.lua file.</p>\n<p>~/.config/nvim/init.lua:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.o.scroll = 20\n</code></pre>\n<p>The docs have this to say about the scroll property:</p>\n<p><em>&quot;Will be set to half the number of lines in the window when the window size changes. This may happen when enabling the status-line or 'tabline' option after setting the 'scroll' option&quot;</em></p>\n<p>I haven't changed the status-line or tabline options, and I've tried setting scroll at the bottom of my config file. I suspect the size of the window is being changed at some point which is resetting the scroll property.</p>\n<p>Is there a workaround for this? Or something I'm missing?</p>\n<p><a href="https://gist.github.com/Bdeering1/98965b0b93150e0e38528b3ebf633d79" rel="nofollow noreferrer">My config file</a> for reference (based on the <a href="https://github.com/nvim-lua/kickstart.nvim" rel="nofollow noreferrer">kickstart</a> config):</p>\n"^^ . "0"^^ . "1"^^ . . "Is [this](https://play.google.com/store/apps/details?id=com.quseit.qlua5pro2&hl=zh) the "QLua" you are referring to?"^^ . "0"^^ . "1"^^ . . . . "2"^^ . . . . "0"^^ . . "0"^^ . "Programming knowledge aside, can you at least describe _mathematically_ what you want to achieve? The programmatic solution probably won't look too different from a mathematical definition (sans optimisation, but we can still optimise once we have something that works at least). I can't quite tell from your examples what your concatenation operator is supposed to, and where/why it would "wrap"."^^ . . . "0"^^ . "-1"^^ . . . . . "concatenation"^^ . . "0"^^ . . . . . "<p>I'm aware of the Humanoid.Died connect event, but how do you know who(what player) killed the enemy? And where would you run the Humanoid.Died event?</p>\n"^^ . . . . . . "Thnaks! I thought about that and will clearly help - I willl.\nOut of curiositywhy is needed ?"^^ . . . . "0"^^ . "<p>The code works completely, but I need it to work on button 1?. I changed the buttons for place 5 to 1, it doesn’t work.</p>\n<pre><code>EnablePrimaryMouseButtonEvents(true)\n\nfunction OnEvent(event, arg)\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 5 then\n repeat\n MoveMouseRelative(0,10)\n Sleep(15)\n PressAndReleaseMouseButton(1)\n Sleep(15)\n until not IsMouseButtonPressed(5) \n end\nend.\n</code></pre>\n"^^ . . . . . "0"^^ . . . . "2"^^ . "yaml"^^ . "<p>you need to match each date and time element, get the numeric value of the month,\nset it all as a table and then convert it to a formatted string:</p>\n<pre><code>local a='07-NOV-23' --self.value['raindate'].value\nlocal b='16.30' --self.value['raintime'].value\n\nlocal dd, mm, yy = string.match(a,'(%d+)%-(%w+)%-(%d+)')\nlocal hour, min = string.match(b,'(%d+)%.(%d+)')\n\nlocal months = { [&quot;jan&quot;]=1, [&quot;feb&quot;]=2, [&quot;mar&quot;]=3, [&quot;apr&quot;]=4, [&quot;may&quot;]=5, [&quot;jun&quot;]=6, \n [&quot;jul&quot;]=7, [&quot;aug&quot;]=8, [&quot;sep&quot;]=9, [&quot;oct&quot;]=10, [&quot;nov&quot;]=11, [&quot;dec&quot;]=12 }\nlocal month = months[string.lower(mm)]\n\n-- 1) with os library: \nlocal t = {year='20'..yy, month=month, day=dd,hour =hour , min=min, sec=0 }\nprint (os.date (&quot;%Y-%m-%dT%X.000000Z&quot;,os.time(t)) )\n-- 2) or simply:\nprint( string.format('20%d-%02d-%02dT%02d:%02d:00.000000Z', yy,month, dd, hour, min ) )\n\n-- 2023-11-07T16:30:00.000000Z\n</code></pre>\n"^^ . "<p>Someone in the engine chat provided the answer I was looking for, which upon testing I can confirm works just as intended. For anyone who needs this here's the conversion function to pass the string through:</p>\n<pre><code>local function tabify(str)\n return str:gsub(&quot;%f[^\\n]() + ()&quot;, function(i, j) return (&quot;\\t&quot;):rep(j - i) end)\nend\n</code></pre>\n"^^ . "0"^^ . . . "Position is not a valid member of Model "Workspace.Tower""^^ . . "What Lua version is used in WOW? `print(_VERSION)`"^^ . . . . . . . . . "proximity"^^ . . . "0"^^ . . . . "1"^^ . "Unable to specify a table object to a event listener in Lua"^^ . "1"^^ . "0"^^ . . . . . "0"^^ . . "1"^^ . . . . . "1"^^ . "lua-table"^^ . . . . . . . "0"^^ . "logitech-gaming-software"^^ . . . . "0"^^ . "1"^^ . . . . . "<p><a href="https://github.com/gelguy/wilder.nvim" rel="nofollow noreferrer">wilder.nvim</a> may be what you're looking for. As you type it'll give you lsp-style suggestions. A preview, as well as installation instructions are on the GitHub page. I believe NvChad uses packer, so use that installation.</p>\n"^^ . "1"^^ . . "world-of-warcraft"^^ . "0"^^ . . "4"^^ . . . . . . "0"^^ . . "still can't figure it out still not working"^^ . "Part not deleting idk why nothing happens"^^ . "bbcode"^^ . "1"^^ . . . . . "matrix"^^ . "2"^^ . "Cool! Searching '/test' works for me. And at last I use `universal ctags` in my macOS to resolve this problem, ty!"^^ . . "13"^^ . . "0"^^ . . . "0"^^ . "0"^^ . "3"^^ . "Thank you for contributing to the Stack Overflow community. This may be a correct answer, but it’d be really useful to provide additional explanation of your code so developers can understand your reasoning. This is especially useful for new developers who aren’t as familiar with the syntax or struggling to understand the concepts. **Would you kindly [edit] your answer to include additional details for the benefit of the community?**"^^ . "0"^^ . "roblox"^^ . . "<p>In nginx I want to redirect the user based on access and proxy headers. When I put it to the response header, they are shown correctly in the browser. But when using in lua to redirect with an <code>if</code> it does not.</p>\n<p>For user with access app creates string <code>isprotectedfalse</code> and for guests I get <code>isprotected</code></p>\n<pre><code> add_header X-User-Access-Flag $userinfo$arg_limit$upstream_http_x_doc_protection; #this works\n if ($http_x_user_access_flag = &quot;isprotected&quot;) { #this doesnt\n return 302 $scheme://$http_host$uri?limit=true;\n }\n</code></pre>\n<p>and similar code but in lua:</p>\n<pre><code> rewrite_by_lua_block {\n local params = ngx.req.get_uri_args()\n local limit = params[&quot;limit&quot;]\n local headers = ngx.resp.get_headers()\n local useraccesss = headers[&quot;X-User-Access-Flag&quot;]\n if useraccesss == &quot;isprotected&quot; and limit == nil then\n local delimiter = (ngx.var.is_args == &quot;&quot; or ngx.var.is_args == nil) and &quot;?&quot; or &quot;&amp;&quot;\n local new_url = ngx.var.request_uri .. delimiter .. &quot;limit=true&quot; \n return ngx.redirect(new_url)\n end\n }\n\n</code></pre>\n<p>why is it not redirecting as expected?</p>\n<p>Edit:\nFrom using <code>header_filter_by_lua_block</code></p>\n<p>I have managed to access them from <code>ngx.var['upstream_http_x_user_access_flag']</code> which is used before the lua block to set X-User-Access-Flag (from proxy_pass). But sadly server errors on redirection try (headers sent). Seems at this point headers are already sent (but I am still able to set a custom header there which does work?! so this is confusing...)</p>\n<p>I can not access such <code>ngx.var</code> from <code>rewrite_by_lua_block</code> as this has not performed <code>proxy_pass</code> yet. How could I access this variables <code>after</code> <code>auth</code> + <code>proxy_pass</code> and redirect based on aquired headers?</p>\n"^^ . "0"^^ . . . "<p>I am trying to create a local function in Lua (GHUB) to move the mouse to a specific coordiinates on the screen.\nHowever the pointer moves suddenly at the end of the function call ... and does not even go to the right position.\nAlso .. is there anyway I can debug Lua ... in GHUB is practically impossible from what I see. Not even syntax errors.</p>\n<p>Thank you!</p>\n<pre><code>local function MouseMoveToSlower(x, y, speed)\n current_x, current_y = GetMousePosition()\n distance = math.sqrt((x - current_x)^2 + (y - current_y)^2)\n steps = math.floor(distance / speed)\n\n for i = 1, steps do\n new_x = current_x + (x - current_x) * i / steps\n new_y = current_y + (y - current_y) * i / steps\n MoveMouseRelative(new_x - current_x, new_y - current_y)\n Sleep(math.random(102,125))\n end\nend\n</code></pre>\n"^^ . "iterator"^^ . . . . "tostring"^^ . . . . "Same idea, `<lauxlib.h>` is the header file describing Lua's auxiliary library. Install one of `libluaX.Y-dev` (e.g., [`liblua5.3-dev`](https://packages.debian.org/bullseye/liblua5.3-dev)) to make sure its on your system. Note that the makefile [for *LuaHPF*](https://github.com/jung-kurt/luahpdf/blob/master/Makefile#L7) looks specifically for Lua 5.2, whereas the makefile [for *lhpdf-fix*](https://github.com/lhf/lhpdf-fix/blob/main/Makefile#L6) looks specifically for Lua 5.4. Edit these paths where appropriate so that the compiler can find the correct files."^^ . "1"^^ . . . . . "How to Change nvim-tree's "s" Keymap to "ss" in Neovim and Issues with Disabling "s" Keymap?"^^ . . . . . . . "0"^^ . . . "0"^^ . . . . . . "0"^^ . . . . . . . . . . "3"^^ . . . "0"^^ . . . "<p>Either use 'coroutine' or 'spawn' function to run the countdown part of your code. You can find out more about threading on Roblox documentation website.</p>\n"^^ . "@JosephSible - Yes."^^ . "neovim"^^ . . "0"^^ . . . . . . . . . . . . . "are u still getting the `init.lua:1: number expected` error? I've been trying to reproduce it but I just can't seem to get it, it must be coming from somewhere"^^ . . "1"^^ . "I looked at `:checkhealth` as well, no issues with config there, but it shows lazy.nvim` and states there are no issues, but the Lazy UI never appears, so it clearly isn't loading properly"^^ . "0"^^ . . "<p>Are you familiar with for loops? It's safe to assume so since you are already working with matrices, but if you aren't then I would suggest looking them up. From my knowledge, which is far from infallible, there isn't a simple way to do this other than writing a for loop.</p>\n<p>First off, the main thing you need to work on is how to join two tables toghether. I would do this by writing<br>\n<code>for i=1,#table2,1 do</code> <br> <code>table1[#table1+1]=table2[i]</code><br><code>end</code><br>assuming your tables are 1-indexed.<br>This will go through table2 and add each item to the end of table1.<br>Use another for-loop to do this vertically. <br>There are definately more optimized ways of doing this, but since it appears as though you're still learning i think you should focus on getting the basics down.</p>\n<p>Now, the wrapping might prove a bit harder. If you reach a certain line point, you will want to create 5 (in this case) new tables in mZ. I'm not super certain about the specifics, whether you want the wrap only between matrices or just whether a certain column is reached. In both cases, it should be a simple conditional.</p>\n<p>I would personally use a &quot;pointer&quot; to indicate the top line of the currently-modified matrix.</p>\n"^^ . "<p>I have the following simple script, where I first require the lib which I have implemented on the C++ side. The latter has a MyData class defined with an API method GetNumPoints that returns the size of the data points stored in the class (the first input arg in the constructor, and the second arg is the number of points).</p>\n<p>In the below Lua script if I have the SomeMethod() call commented out then it runs through and the output is &quot;<em><strong>userdata (2)</strong></em>&quot;. But as soon as I remove the comments and run even the empty method in the script then I get the error seen in the attached image. Any idea what's happening here?</p>\n<pre><code>require &quot;SciApiLuaExtLib&quot;\n\nlocal myData = MyData({0.1, 0.2}, 2)\nprint(type(myData) .. &quot; (&quot; .. myData:GetNumPoints() .. &quot;)&quot;)\n\nfunction SomeMethod()\nend\n\n--SomeMethod()\n</code></pre>\n<p>By the way on line 127 of the namespace.h file (as seen in the attached image) of the Lua Bridge there is the following C++ line:</p>\n<p><code>assert (lua_isuserdata (L, 1)); // warn on security bypass</code></p>\n<p>I use ZeroBrane for debugging (if that helps anyhow).</p>\n<p><a href="https://i.sstatic.net/emPal.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/emPal.png" alt="enter image description here" /></a></p>\n"^^ . . . . . . . . "GHUB Lua - Slow Mouse Movement Function"^^ . . . . . . . . "passing an argument through assert(loadfile(play.lua))(argument) doesnt assign anything to arg[1] inside play.lua"^^ . . "3"^^ . . . . . . "by far of what i saw, when the tower cant target anything and an enemy gets on its range, it causes the error"^^ . . . "markdown"^^ . "<pre><code>model = workspace.Model\nmodel:Destroy(Instance.new(&quot;ClickDetector&quot;,model).MouseClick:Wait())\n</code></pre>\n"^^ . "1"^^ . "parameter-passing"^^ . . . . . . . . . "Nice! You give a better panorama about how the whole thing works. But now, complains that no lauxlib.h wasn't found. I've tried to resolve this, in some way, analogously to your answer but with no success. Do you have some suggestion? NOTE: executing lhpdf-fix the same issue was triggered."^^ . "and my code: ``function Onplrjoined(plr)\n \n local leaderstats = Instance.new("Folder")\n leaderstats.Parent = plr\n leaderstats.Value = 0\n leaderstats.Name = "leaderstats"\n \n local stat = Instance.new("IntValue", leaderstats)\n stat.Name = "Coins"\n stat.Value = 0\n \nend\n\nlocal players = game:WaitForChild("Players")\n\nplayers.PlayerAdded:Connect(Onplrjoined)``"^^ . . "caption"^^ . . "2"^^ . . . "0"^^ . . "1"^^ . . "configuration"^^ . . "<p>Most likely you forgot to add an attachment for the accessory. Without attachment it will just fall off.</p>\n"^^ . "0"^^ . "0"^^ . "palm-api"^^ . . "Using multiple Lua scripts with c++"^^ . . . . "apache-apisix"^^ . . . "1"^^ . . . "<p>I have a script <code>play.lua</code> that uses a filename as an argument in order to play the notes written on each line of the file. Im trying to write a script <code>jukebox.lua</code> that will run <code>play.lua</code> with various arguments based on an input, but the global argument table wont hold the arguments i assign using <code>loadfile</code></p>\n<p>play.lua (section that errors)</p>\n<pre><code>local name = &quot;file &quot; .. arg[1]\n\nfor line in io.lines(arg[1]) do\n--[[note playing code]]--\nprint(&quot;.&quot;)\n end\n</code></pre>\n<p>My first attempt looked like this, but would return an error saying <code>arg[1]</code> was the nil value when trying to assign <code>arg[1]</code> to a variable in <code>play.lua</code></p>\n<p>jukebox.lua</p>\n<pre><code>assert(loadfile(&quot;play.lua&quot;))(&quot;file1&quot;)\n</code></pre>\n<p>Then I tried assigning <code>arg[1]</code> in <code>jukebox.lua</code></p>\n<pre><code>arg[1] = &quot;file1&quot;\nassert(loadfile(&quot;play.lua&quot;)\n</code></pre>\n<p>this ran the code with no errors, but using\n<code>lua jukebox.lua</code> would play nothing and print nothing while <code>lua play.lua file1</code> would play the file as normal and would <code>print(&quot;.&quot;)</code> for each line in the file file1.\nI also tried <code>dofile</code> and <code>require</code> with similar results</p>\n<p>My question: Is writing <code>assert(loadfile(&quot;play.lua&quot;))(&quot;file1&quot;)</code> in the script not identical to writing <code>lua play.lua file1</code> in the console?</p>\n<p>Edit: I made a new script play1.lua with the entirety of the code provided below.</p>\n<p>play.lua</p>\n<pre><code>local name = &quot;file &quot; .. arg[1]\n\nfor line in io.lines(arg[1]) do\nprint(&quot;.&quot;)\n end\n</code></pre>\n<p>jukebox.lua</p>\n<pre><code>arg[1] = &quot;file1&quot;\nassert(loadfile(&quot;play.lua&quot;))()\n</code></pre>\n"^^ . . . . "Can you please provide a minimal example of how you call these functions from C++ which results in this error?"^^ . . . . . . . . . . . . "0"^^ . "Thanks Mike this helps a lot, but in our edge we can't use function or os library, so we're still stuck :("^^ . "0"^^ . "2"^^ . "0"^^ . "0"^^ . . . . . "0"^^ . . . . . "0"^^ . . "1"^^ . "1"^^ . . . . . . . . . . . . "java"^^ . . "0"^^ . "I don't think it's trying to use a colon instead of a period as a decimal separator: In the original program, the same column that displayed "7:0" also displayed "2.333"."^^ . . . "<p>So I have a local king variable and I wanna set the player to it. But how do I detect the first player to join and prevent other people from being king? And if the player leaves how do I get the second person who joined to become king?</p>\n<p>I wrote this:</p>\n<p>local king</p>\n<p>while wait(1) do\nfor i = 1, #game.Players:GetPlayers(), 1 do\nif (game.Players:GetPlayers()[i].leaderstats.isKing.Value == &quot;Yes&quot;) then return end\nend</p>\n<pre><code>for i, v in pairs(game.Players:GetPlayers()) do\n if (v.leaderstats.isKing.Value == &quot;&quot;) then\n v.leaderstats.isKing.Value = &quot;Yes&quot;\n end\nend\n</code></pre>\n<p>end</p>\n<p>But clearly this will make everyone become king</p>\n<p>So I wrote this</p>\n<pre><code>local king\n \n while wait(1) do\n for i = 1, #game.Players:GetPlayers(), 1 do\n if (game.Players:GetPlayers()[i].leaderstats.isKing.Value == &quot;Yes&quot;) then return end\n end\n \n for i, v in pairs(game.Players:GetPlayers()) do\n if (v.leaderstats.isKing.Value == &quot;&quot;) then\n v.leaderstats.isKing.Value = &quot;Yes&quot;\n end\n end\n end\n</code></pre>\n<p>But it makes player 1 AND 2 become king, but not player 3. It should only be player 1</p>\n<p>So I put the for loop after the king set loop and it fixed that, but how do I make it so when the king leaves the second player will become king?</p>\n"^^ . "0"^^ . ""Type hints" for Lua"^^ . . "0"^^ . "Neovim scroll option not persisting from config"^^ . . "Since Postman is also receiving such output, you might want to look into if the data isn't being binary serialized/deserialized. Check the initiator of the site you're capturing and see if the javascript contains an unpacker."^^ . . . . . . . . . "logitech ghub autoclicker lua fix"^^ . . "<p>I use lua to save. the data to redis.<br />\n<code>redis.call('SET', KEYS[1], cjson.encode(ARGV[1]))</code></p>\n<p>ARGV<a href="https://i.sstatic.net/6MLLc.png" rel="nofollow noreferrer">1</a> is the go struct.</p>\n<p><a href="https://i.sstatic.net/Wlq5h.png" rel="nofollow noreferrer">The go code to pass the struct to redis lua</a></p>\n<p>here is my struct looks like</p>\n<pre><code>type InviteInfo struct {\n...\nMaxPeers int32 `json:&quot;maxPeers&quot;`\nRouteVersion int32 `json:&quot;routeVersion&quot;`\n...\n}\n</code></pre>\n<p>and use below lua to query the data.</p>\n<pre><code>local data = redis.call('GET', KEYS[1])\n\n -- Parse JSON\n local inviteInfo = cjson.decode(data)\n\n -- Compare routeVersion\n if tonumber(inviteInfo['routeVersion']) ~= tonumber(ARGV[1]) then\n return &quot;route version mismatch&quot;\n end\n</code></pre>\n<p>the inviteInfo['routeVersion'] is always nil</p>\n<p>I expect the inviteInfo['routeVersion'] should be number value instead of nil.</p>\n<p>I tried the lua in local redis and works, weird why don't work in staging..\n<a href="https://i.sstatic.net/6MLLc.png" rel="nofollow noreferrer">enter image description here</a></p>\n<p><strong>Update, issue fixed</strong></p>\n<p>the previous flow is</p>\n<ol>\n<li>pass go struct to lua -&gt; cjson.encode -&gt; save</li>\n<li>get data from redis -&gt; cjson.decode -&gt; invite.routeVersion (this don't work) -&gt; save</li>\n</ol>\n<p>changed to</p>\n<ol>\n<li>go struct -&gt; json.marshal -&gt; pass string to lua -&gt; save</li>\n<li>get data from redis -&gt; cjson.decode -&gt; invite.routeVersion (this works) -&gt; save</li>\n</ol>\n<p><strong>The difference</strong>.<br />\ni queried the saved data in redis.<br />\npreviously the saved data looks like {\\&quot;routeVersion\\&quot;:1}.<br />\nafter change, the saved data looks like {&quot;routeVersion&quot;}</p>\n"^^ . . . "the document is kinda confusing ngl"^^ . . . . . . . "1"^^ . "13"^^ . "0"^^ . "minecraft"^^ . . . "3"^^ . . . "1"^^ . "filter"^^ . . . "Well, why don't you do just that? (1) check that there are at least two players; (2) repeat picking two random players until the two players aren't the same; alternatively, you could just remove one player from the list (say, swapping it to the end), then pick the other player from the remaining players - then they can't be the same player."^^ . . . . "@Luatic I think that is the same QLua."^^ . . . . . . . . . . "0"^^ . "To convert time stamp in lua"^^ . . "Hello! Welcome to StackOverflow! If you can add some of your code to your question with as much information as possible including your setup in the game, I'd be curious to look into this.\nPlease read up on [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) as it really helps other users of the site to understand your question. Thanks!"^^ . "1"^^ . "See also https://github.com/lhf/lhpdf-fix"^^ . "0"^^ . . . . . . . "0"^^ . . "<p>Below is a sample table structure of what I am wanting to sort.</p>\n<pre><code>Data = {\n [&quot;C1_RN1::F1&quot;] = {\n [&quot;class&quot;] = &quot;Hunter&quot;,\n [&quot;name&quot;] = &quot;C1&quot;,\n [&quot;faction&quot;] = &quot;Faction&quot;,\n [&quot;race&quot;] = &quot;Human&quot;,\n [&quot;realm&quot;] = &quot;RN1&quot;,\n },\n [&quot;C2_RN1::F1&quot;] = {\n [&quot;class&quot;] = &quot;Priest&quot;,\n [&quot;name&quot;] = &quot;C2&quot;,\n [&quot;faction&quot;] = &quot;Faction&quot;,\n [&quot;race&quot;] = &quot;Undead&quot;,\n [&quot;realm&quot;] = &quot;RN1&quot;,\n },\n [&quot;C3_RN1::F1&quot;] = {\n [&quot;class&quot;] = &quot;Hunter&quot;,\n [&quot;name&quot;] = &quot;C3&quot;,\n [&quot;faction&quot;] = &quot;Faction&quot;,\n [&quot;race&quot;] = &quot;Human&quot;,\n [&quot;realm&quot;] = &quot;RN1&quot;,\n }\n}\n</code></pre>\n<p>So for example I would like to sort by <code>race</code> alphabetically, and sort all the &quot;Human&quot; race characters by <code>class</code> also alphabetically, and sort any other &quot;races&quot; also by alphabetically independent of another &quot;race&quot;.</p>\n<p>I know how to sort by just one by dumping all the character names into a 2nd table with the same keys as the <code>data</code> table, and then comparing data in the <code>data</code> table using <code>table.sort</code> and a that compares data with the less than operator such as <code>data[a].race &lt; data[b].race</code>.</p>\n<p>This is the function I tried to use to a basic sort, but this doesn't work using Lua 5.1, i get an error saying there should be an <code>=</code> after the <code>&lt;</code>.</p>\n<pre><code>local function SortThis()\n local temp = {}\n\n for c in pairs(Data) do\n table.insert(temp, c);\n end\n\n table.sort(temp, function(a, b)\n return Data[a].race &lt; RestXP_Data[b].race;\n end)\nend\n</code></pre>\n"^^ . . . "0"^^ . . "Define "most performant". How long are your strings?"^^ . "0"^^ . . . . . . . "<p>So first, make sure your Proximity Prompt is inside a part, if it isn't inisde a part, here is how to create one :</p>\n<p>1 - Press CTRL + I</p>\n<p>2 - Select &quot;Part&quot;</p>\n<p>Now select your part in the explorer. When you put your mouse pointer on it, a &quot;+&quot; button should appear. Click on it then search for &quot;ProximityPrompt&quot; and click on it.</p>\n<p>Once this is done, select your proximty prompt, and put your mouse pointer on it, then press the &quot;+&quot; button. Search for &quot;Script&quot; (NOT local script) and click on it.</p>\n<p>It should now open the script, if it don't, double click on the script you created.</p>\n<p>Now you can make a script like this to delete a model :</p>\n<pre><code>script.Parent.Triggered:Connect(function(player)\n if game.Workspace:FindFirstChild(&quot;MyModel&quot;) then -- Change MyModel to the model / part name\n game.Workspace.MyModel:Destroy() -- Change MyModel to the model / part name you want to destroy\n print(&quot;Destroyed the model&quot;)\n elseif not game.Workspace:FindFirstChild(&quot;MyModel&quot;) then\n print(&quot;Couldn't find the model to destroy.&quot;)\n end\nend)\n</code></pre>\n<p>If you want to make the model transparent, you can use this script :</p>\n<pre><code>script.Parent.Triggered:Connect(function(player)\n if game.Workspace:FindFirstChild(&quot;MyModel&quot;) then -- Change MyModel to the model / part name\n for i, part in pairs(game.Workspace:FindFirstChild(&quot;MyModel&quot;):GetDescendants()) do\n if part.ClassName == &quot;Part&quot; then\n part.Transparency = 1\n print(&quot;Made a model part transparent&quot;)\n end\n end\n elseif not game.Workspace:FindFirstChild(&quot;MyModel&quot;) then\n print(&quot;Couldn't find the model to make transparent.&quot;)\n end\nend)\n</code></pre>\n<p>I hope this help !</p>\n"^^ . . "0"^^ . "0"^^ . . "2"^^ . . . "1"^^ . . "1"^^ . "1"^^ . . . . . . "1"^^ . "EnablePrimaryMouseButtonEvents (true);\nfunction OnEvent(event,arg)\n if IsKeyLockOn("CapsLock")then\n if IsMouseButtonPressed(1) then\n repeat\n MoveMouseRelative(0,30)\n Sleep(10)\n PressAndReleaseKey("P") \n Sleep(10)\n PressAndReleaseKey("P")\nSleep(10)\n until not IsMouseButtonPressed(1)\n end\nend\n\n end"^^ . . "1"^^ . . "<p>This code doesn't work i have everything variabled already tried a script crashhandler, in the variables i typed in the right path so idk why it doesn't work any Help? ROBLOX STUDIO!</p>\n<pre><code>local Objective = game.StarterGui.BtnLbl.RealObjective\n\nwait(5)\nObjective.Text = &quot;Explore the Home&quot;\nwait(15)\nObjective.Text = &quot;What is that?&quot;\nwait(4)\nObjective.Text = &quot;RUN!!!&quot;\nObjective.TextColor3 = Color3.new(1, 0, 0)\n</code></pre>\n<p>I am using a serverside script!</p>\n<p>So like i said i tried a script crashhandler but everything worked fine, i was expecting that it would change my Text after 5 seconds to &quot;Explore the Home&quot; then after 15 seconds &quot;What is that?&quot; then after 4 seconds &quot;RUN!!&quot; with the Text being Red, I am using a serverside script!</p>\n"^^ . "The [equality operator](https://www.lua.org/manual/5.4/manual.html#3.4.4) in Lua is `==`. I would expect the same in Pico-8's environment."^^ . "0"^^ . . "1"^^ . "I corrected the answer, with an example without os library"^^ . "0"^^ . . . "0"^^ . . . "1"^^ . "<p>I have a similiar issue with neodev. It should work if you remove neodev from the config. Don't ask me why it's not working :D</p>\n"^^ . "0"^^ . . "@lukeflo You might be right, and I should have to stick to LaTeX by chainging a LaTeX template to achieve what I want to get."^^ . . . "0"^^ . "You'd still need `type(myData)` printed to see what the value is when it fails. It does look like some sort of stack corruption, but I don't have any explanation for how the code that you're adding *after* the error can influence it."^^ . "3d"^^ . "0"^^ . "<p>The variables will not update dynamically when the table's content change.</p>\n"^^ . . . "Seemingly random non ascii characters in response body when using APISIX plugin to rewrite response"^^ . . . "<p>The issue is that you are changing the text in the StarterGUI.</p>\n<p>Every time a player joins, the StarterGUI is cloned into their GUI. The issue is that each player has their own copy that is not affected by the StarterGUI once it has been changed.</p>\n<p>What you’ll want to do (if you really want to do it on server) is make a function that loop through every player’s GUI and changes it, something like this:</p>\n<pre><code>local function updateText(text)\n for i, plr in game:GetService(“Players”):GetPlayers() do\n plr.PlayerGui.BtnLbl.RealObjective.Text = text\n end\nend\n</code></pre>\n"^^ . . . . "0"^^ . "0"^^ . . "0"^^ . "<h5>Question</h5>\n<p>If I write a generic <code>walk</code> routine, why can I pass in my own iterators but not <code>pairs</code>?</p>\n<h5>Example</h5>\n<p>Here's a simple walk that does something for each item in <code>src</code>.</p>\n<pre class="lang-lua prettyprint-override"><code>function walk(src)\n for n,i in src do \n print(n, i[1]+i[#i]) end end\n</code></pre>\n<p>If I call this with <code>walk(items(x))</code> then <code>walk</code> works fine.</p>\n<pre class="lang-lua prettyprint-override"><code>function items(lst, n)\n n=0\n return function()\n if lst and n &lt; #lst then\n n=n+1\n return n,lst[n] end end end\n\nx={\n {1,2},\n {3,4},\n {5,6},\n {5,6}}\n\nwalk(items(x)) --&gt; prints out (1,3),(2,7),(3,11),etc\n</code></pre>\n<p>But I try the same with <code>pairs(x)</code>, I get a crash.</p>\n<pre class="lang-lua prettyprint-override"><code>walk(pairs(x))\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>lua: x.lua: bad argument #1 to 'for iterator' (table expected, got nil)\nstack traceback:\n [C]: in function 'next'\n x.lua:7: in function 'walk'\n x.lua:31: in main chunk\n [C]: in ?\n</code></pre>\n<p>So what is different about <code>pairs</code> and my own iterator <code>items</code>?</p>\n"^^ . . "3"^^ . "0"^^ . "1"^^ . . . . "0"^^ . "0"^^ . . "0"^^ . . . . . . "0"^^ . "<p>In Lua, an environment is an internal property of a function.<br />\nSo, replace</p>\n<pre><code> file_chunk[index] = loadfile(ScriptLocation)\n\n _ENV = file_env[index]\n</code></pre>\n<p>with</p>\n<pre><code> file_chunk[index] = loadfile(ScriptLocation, &quot;t&quot;, file_env[index])\n</code></pre>\n<p>to embed environment into a function on its creation.<br />\nYou will be unable to set this function's environment later.</p>\n"^^ . . . . . "1"^^ . "Have you tried using `ipairs` instead of `pairs`? Also both your "regiments" have the exact same minimum and maximum rankIds, so I'm not sure which result you'd actually consider to be correct"^^ . "config"^^ . . . . "-1"^^ . . . "0"^^ . "html"^^ . "+Buzzyy, this is a custom thing for me and my friends, so I hope it doesn't get me banned."^^ . "1"^^ . . . . . "0"^^ . . . . . . "0"^^ . . . . . . . "0"^^ . "Yes, they have a humanoid and the first few enemies on the track die before the error occurs"^^ . "0"^^ . . "0"^^ . "Can you explain what you mean? (Also sorry for answering so late I didn't have acces to my account)"^^ . . . "1"^^ . . "<p>You have to use the <code>MoveTo</code> function on the agent humanoid not on the path variable. E.g <code>Agent:MoveTo(Position)</code></p>\n<p>Edit:\nInstead of passing passing the path instance you have to loop through the points by calling the <code>GetWayPoints()</code> method on the path instance.</p>\n<pre class="lang-lua prettyprint-override"><code>local PathFindingService = game:GetService(&quot;PathfindingService&quot;)\nlocal Agent = script.Parent\nAgentRadius = 2 -- Settings Agent\nAgentHeight = 5 \nAgentCanJump = false\nAgentCanClimb = false\nAgentSlope = 10\nAgentMaxAcceleration = 1000\nAgentMaxSpeed = 16 \nAgentArrivalDistance = 1 -- end settings agent\nprint(type(PathFindingService))\nwhile true do\n if Agent~= nil then\n local destination= Vector3.new(math.random(-40,40), -8, math.random(-40, 40))\n print(true)\n local path = PathFindingService:CreatePath()\n local waypoints = path:ComputeAsync(Agent.HumanoidRootPart.Position,destination)\n if path.Status == Enum.PathStatus.Success then\n local waypoints = path:GetWaypoints()\n for _, waypoint in pairs(waypoints) do\n Agent.Humanoid:MoveTo(waypoint.Position)\n --print(waypoint.Position)\n end\n end\n end\n wait(5)\nend\n\n</code></pre>\n"^^ . . . . . . . "1"^^ . . . . "<p>In Warcraft Vanilla 1.12 Lua there's no built-in support for (&quot;foo %s&quot;):format(&quot;xyz&quot;) (there's only format(&quot;foo %s&quot;, &quot;xyz&quot;)).</p>\n<p>So I thought to add a polyfill of sorts like so:</p>\n<pre class="lang-lua prettyprint-override"><code>\nlocal _format = assert(format or string.format) -- vanilla-wow-lua does have format on the global scope so we can use it here\nlocal _getmetatable = assert(getmetatable)\nlocal _setmetatable = assert(setmetatable)\n\nlocal _stringMetatable = _getmetatable(string)\nif not _stringMetatable then\n _stringMetatable = { __index = {} } -- standard-lua returns a metatable but wow-lua returns nil\n _setmetatable(string, _stringMetatable)\nend\n\nfunction _stringMetatable:format2(formatString, ...)\n if not unpack then\n return _format(self, formatString, ...) -- official lua\n end\n\n return _format(self, formatString, unpack(arg)) -- warcraft\nend\n\n_stringMetatable.__index.format2 = _stringMetatable.format2\n</code></pre>\n<p>This gets loaded just fine both in official lua (<a href="https://www.lua.org/cgi-bin/demo" rel="nofollow noreferrer">https://www.lua.org/cgi-bin/demo</a>) and on the World of Warcraft 1.12. However if we try to use it like so:</p>\n<pre class="lang-lua prettyprint-override"><code>local foobar = (&quot;foo %s&quot;):format2(&quot;abc&quot;)\nprint(foobar)\n</code></pre>\n<p>This only works on the official lua. Warcraft throws an error which says &quot;attempt to index a string value&quot;.</p>\n<p>If I switch over to function-call style then it works on both standard-lua and wow-lua:</p>\n<pre class="lang-lua prettyprint-override"><code>local foobar = string.format2(&quot;foo %s&quot;, &quot;abc&quot;)\nprint(foobar)\n</code></pre>\n<p>I can't understand why Warcraft fails to cooperate in this regard when it comes to strings. Any ideas on how to fix this?</p>\n"^^ . "0"^^ . "1"^^ . "<p>I have to use windows for college reasons, but would like to use neovim as a text editor. I was attempting to install the m4xshen/autoclose plugin using vim-plug, but while I can download the plugin just fine with PlugInstall, it doesn't actually work, and I get an error every time I open neovim.</p>\n<p>Here's my init.vim file:</p>\n<pre><code>call plug#begin()\n\nPlug 'windwp/nvim-autopairs'\n\nlua require(&quot;nvim-autopairs&quot;).setup {}\n\ncall plug#end()\n</code></pre>\n<p>and here is the error that I'm getting:</p>\n<pre><code>Error detected while processing C:\\Users\\eidhn\\AppData\\Local\\nvim\\init.vim:\nline 6:\nE5108: Error executing lua [string &quot;:lua&quot;]:1: module 'nvim-autopairs' not found:\n no field package.preload['nvim-autopairs']\n no file '.\\nvim-autopairs.lua'\n no file 'C:\\Program Files\\Neovim\\bin\\lua\\nvim-autopairs.lua'\n no file 'C:\\Program Files\\Neovim\\bin\\lua\\nvim-autopairs\\init.lua'\n no file '.\\nvim-autopairs.dll'\n no file 'C:\\Program Files\\Neovim\\bin\\nvim-autopairs.dll'\n no file 'C:\\Program Files\\Neovim\\bin\\loadall.dll'\nstack traceback:\n [C]: in function 'require'\n [string &quot;:lua&quot;]:1: in main chunk\n</code></pre>\n"^^ . . . "If you are not allowed to index a string then the critical feature is missed."^^ . . . "Are you sure you're reffering to the right model? Do the models have a humanoid?"^^ . . "But the creation of a writer seems to be a real possibility. I'll check this out ASAP. If you could provide such a solution, I would appreciate it very much!"^^ . . "0"^^ . . "1"^^ . . . "I spent hours trying to figure out why neovim wasn't loading the init.lua script...\nThis solution got things working properly.\n\nThanks!"^^ . . . "How to save a function of an Object/table to a variable to be called from this variable in Lua?"^^ . . . . . . . "It looks like strings are encrypted. This seems non-standard, (I think luajava just links against native PUC-Rio Lua. Andlua looks like a Lua port, but I didn't see a bytecode loader (and would doubt an open source project would add encryption like this anyway)). You would have to break the encryption via cryptanalysis or reverse engineering an application that can do the decryption. (Also debugging information is stripped which unluac is bad at handling, but that has nothing to do with the strings.)"^^ . . . . . . . . . . "0"^^ . . . . . "0"^^ . "0"^^ . . . . "0"^^ . . . . . . . . "Error: Humanoid is not a valid member of model"^^ . . "<p>What to do in lua if I want to pass a value to foo(), pass it's return to bar(), pass it's return to baz() etc?</p>\n<p>Exhibit A (pseudocode):</p>\n<pre><code>backwards(code(reading(like(not(do(I))))))\n</code></pre>\n<p>Exhibit B (pseudocode):</p>\n<pre><code>local all = foo(...)\nlocal this = bar(all)\nlocal variables = baz(this)\nlocal obscure_a_simple_idea = quux(variables)\n</code></pre>\n<p>In F# this code (<a href="https://fsharpforyou.github.io/chapters/learning_the_language/function_composition/piping.html" rel="nofollow noreferrer">source</a>)</p>\n<pre><code>let numbers = [0..100]\nlet evenNumbers = List.filter isEven numbers\nlet doubledNumbers = List.map double evenNumbers\nList.iter printNumber doubledNumbers\n</code></pre>\n<p>can be rewritten like this:</p>\n<pre><code>[0..100]\n|&gt; List.filter isEven\n|&gt; List.map double\n|&gt; List.iter printNumber\n</code></pre>\n<p>In clojure this code (<a href="https://clojure.org/guides/threading_macros" rel="nofollow noreferrer">source</a>)</p>\n<pre><code>(defn calculate []\n (reduce + (map #(* % %) (filter odd? (range 10)))))\n</code></pre>\n<p>Can be written like this</p>\n<pre><code>(defn calculate* []\n (-&gt;&gt; (range 10)\n (filter odd? ,,,)\n (map #(* % %) ,,,)\n (reduce + ,,,)))\n</code></pre>\n<p>I am aware that <a href="https://fennel-lang.org/reference#------and---threading-macros" rel="nofollow noreferrer">fennel has threading macros</a>. What I would like to know: what can I do in lua? Did I miss a language feature? Is there some well-known ideom I am not aware of? Am I stuck choosing between exhibit A, exhibit B, or migrating to fennel?</p>\n"^^ . "<p>I'm following a Solar2d tutorial (<a href="https://docs.coronalabs.com/guide/programming/index.html" rel="nofollow noreferrer">https://docs.coronalabs.com/guide/programming/index.html</a>) and I'm trying to combine the first couple of lessons into a balloon popping game. I would like to have balloon-objects in a table and tapping would cause a balloon to disappear. I added the event listener where I'm defining everything else with my balloons. However tapping doesn't do anything. My questions are:</p>\n<ol>\n<li>How can I make a tap remove the balloon image?</li>\n<li>Where should I add code to remove a tapped balloon from table? Is a for-loop inside gameloop?</li>\n</ol>\n<p>Thanks in advance!</p>\n<pre><code>`-----------------------------------------------------------------------------------------\n--\n-- main.lua\n--\n-----------------------------------------------------------------------------------------\n\n--prep the physics\nlocal physics = require(&quot;physics&quot;)\nphysics.start()\nphysics.setGravity(0, -20)\n\n--seed the random number generator\nmath.randomseed( os.time() )\n\n--prep the graphic groups\nlocal backGroup = display.newGroup()\nlocal mainGroup = display.newGroup()\nlocal uiGroup = display.newGroup()\n\n--prep variables\nlocal newBalloon\nlocal tappedBalloon\nlocal balloonTable = {}\n\n--load background\nlocal background = display.newImageRect(backGroup, &quot;pictures/mainGroup/background.png&quot;, 360, 570)\nbackground.x = display.contentCenterX\nbackground.y = display.contentCenterY\n\n--load boundaries\nlocal border = display.newImageRect(mainGroup, &quot;pictures/mainGroup/border.png&quot;, 281, 35)\nborder.x = display.contentCenterX\nborder.y = display.contentHeight-440\nphysics.addBody( border, &quot;static&quot; )\n\nlocal function popBalloon( event )\n local tappedBalloon = event.target\n if event.phase == &quot;began&quot; then\n display.remove(tappedBalloon)\n --removing balloon from table?\n end\nend\n\n\n--creating and storing balloons\nlocal function createBalloon ()\n local newBalloon = display.newImageRect(mainGroup, &quot;pictures/mainGroup/balloon2.png&quot;, 118, 118)\n if newBalloon then\n table.insert(balloonTable, newBalloon)\n physics.addBody( newBalloon, &quot;dynamic&quot;, { radius=50, bounce=0.2 } )\n --newBalloon.isBullet = true\n newBalloon.alpha = 0.8\n newBalloon.myName = &quot;balloon&quot;\n newBalloon:addEventListener(&quot;tap&quot;, popBalloon)\n end\n \n local placement = math.random(3)\n\n if (placement == 1) then\n newBalloon.x = math.random( display.contentWidth )\n newBalloon.y = math.random( 250,500 )\n elseif ( placement == 2 ) then\n newBalloon.x = math.random( display.contentWidth )\n newBalloon.y = math.random( 250,500 )\n elseif ( placement == 3 ) then\n newBalloon.x = math.random( display.contentWidth )\n newBalloon.y = math.random( 250,500 )\n end\nend\n\nlocal function gameLoop()\n createBalloon()\nend\n\ngameLoopTimer = timer.performWithDelay( 500, gameLoop)`\n</code></pre>\n<p>I tried having the event listener outside the balloon creation but resulted in a &quot;nil value&quot; error code.</p>\n"^^ . "python"^^ . "0"^^ . . "Leaderboard not working even though i have looked over many posts"^^ . "0"^^ . . . . . . "decompiling"^^ . . "1"^^ . "PaLM API json not workings"^^ . "0"^^ . . . "0"^^ . . . "vim"^^ . . . . . "1"^^ . . . . . . . "0"^^ . "Are you saying that adding the function call *after* the line it fails on changes the behavior? I'd find this very strange. In any case, the assert clearly indicates that the value that is at the top of the stack is *not* userdata, so something corrupts the stack. Can you split the print statement and print the *type* separately from GetNumPoints call, so we can see what the type is when it fails (and not just when it succeeds)."^^ . "1"^^ . "0"^^ . . "1"^^ . . . . . . "Please upload the original file (Lua bytecode) you are trying to decompile. It might happen that this file is additionally obfuscated."^^ . . "1"^^ . "проверь по каждому из пунктов: 1) можно стрелять ЛКМ, 2) можно стрелять кнопкой P, 3) при нажатой ЛКМ можно стрелять кнопкой P, 4) при нажатой кнопке P можно стрелять ЛКМ. какие пункты работают, какие нет?"^^ . . . "@mandy8055 I already wrote regarding this point in the question itself."^^ . . . . "1"^^ . . . . "1"^^ . "<p><code>:Workspace</code> doesn't exist, instead try to replace it by</p>\n<p><code>.Workspace</code>. With these changes the script should looks like this : <code>game.Workspace.Part:Destroy()</code>.</p>\n<p>Hope this help !</p>\n"^^ . "0"^^ . "edited, even made a new script with nothing else but the above code to make sure `arg` or `...` were not used anywhere else."^^ . . "arguments"^^ . . . "0"^^ . . "Edit the question to show how the `InviteInfo` value is passed to the Redis server."^^ . . "1"^^ . "pandoc"^^ . "is it go instead of lua, right? \nyes, this should works. But my use case need do some logic in lua to make these commands atomic, the actual lua script is more complex than the posted one."^^ . . . . "How do I fix this PICO-8 error? ')' expected near '='"^^ . . . . . . "0"^^ . . . . "0"^^ . . . . "How do I set the first player in the game to be king and no one else? (ROBLOX)"^^ . . "0"^^ . "0"^^ . . . "I just edited my answer. Try running the code."^^ . "CC: Tweaked with ThermalDynamics' ducts move from storage chests to a deposit chest"^^ . . "How do I make an Auto Clicker Macro in Lua script inside Logitech ghub? please"^^ . . . "javascript"^^ . "<p>vim.cmd pretty much executes the argument just like if you were typing it in the command bar (with an implicit preceding colon). It seems you’re executing “:term: python3” instead of “:term python3”. The terminal is trying to execute &quot;: python3&quot; and obviously failing. Remove the colon and you should be good.</p>\n<p><a href="https://neovim.io/doc/user/lua.html#vim.cmd()" rel="nofollow noreferrer">https://neovim.io/doc/user/lua.html#vim.cmd()</a></p>\n"^^ . . . . "0"^^ . . "quarto"^^ . . "<p>&quot;DPI shift&quot; action can be assigned to any physical mouse button.<br />\nSo, I don't know which button you are talking about.</p>\n<p>Assuming you want to simulate key &quot;A&quot; press when mouse button 5 (&quot;Forward&quot;) is pressed:</p>\n<pre><code>function OnEvent(event, arg)\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 5 then\n PressAndReleaseKey(&quot;A&quot;)\n end\nend\n\n</code></pre>\n"^^ . . . "0"^^ . . "2"^^ . . "can I bind 2 lua_State to lualanes? If not, then probably this method will not work, because how can I use the functions from the second environment?"^^ . . "0"^^ . "function"^^ . . . . . "0"^^ . . . . . "<p>I'm trying to grow berries on a tree but it's not working</p>\n<pre><code>local berries = {}\nlocal growTime = 3\nlocal grew = false\n\nwhile grew == false do\n wait(growTime)\n\n for i = 1, 3, 1 do\n local berry = Instance.new(&quot;Part&quot;)\n berry.Shape = Enum.PartType.Ball\n berry.BrickColor = BrickColor.new(&quot;Really red&quot;)\n end\n grew = true\nend\n</code></pre>\n<p>It doesn't even run, what's wrong? The script is on a localScript(child of a tree, and the tree is a child of the workspace area)</p>\n"^^ . . . . "0"^^ . . . "0"^^ . . . . . . "Switching to `ipairs` didn't really help. Instead it pulled no data so it displayed the default GUI. As for the IDs, they aren't really relevant to each other as the *group* IDs are different."^^ . . . "0"^^ . "<p>I'm working on a Roblox overhead GUI and I'm using a moduleScript for the values. It currently pulls a random value of its liking instead of abiding to the parameters.</p>\n<p>The (relevant) part of the script executing:</p>\n<pre><code>local userRankInGroup = plr:GetRankInGroup(32494019)\n \n for _, division in pairs(config) do\n local groupIdToCheck = division[&quot;Group Id&quot;]\n if userRankInGroup and userRankInGroup &gt;= division[&quot;Minimum RankId&quot;] and userRankInGroup &lt;= division[&quot;Maximum RankId&quot;] then\n clonedUI.DivRank.Text = division[&quot;Regiment Name&quot;]\n clonedUI.DivRankShadow.Text = division[&quot;Regiment Name&quot;]\n clonedUI.regimentFrame.regimentIcon.Image = division[&quot;Image Id&quot;]\n clonedUI.regimentFrame.BackgroundColor3 = division[&quot;Regiment Color&quot;]\n print(&quot;Overhead GUI for&quot;.. plr ..&quot;has loaded successfully.&quot;)\n break\n else \n end\n end \n</code></pre>\n<p>The moduleScript:</p>\n<pre><code>local regiments = {\n \n \n [&quot;Office of The Inspector General&quot;] = {\n [&quot;Regiment Name&quot;] = &quot;OIG&quot;,\n [&quot;Group Id&quot;] = 32921091,\n [&quot;Image Id&quot;] = &quot;http://www.roblox.com/asset/?id=14412072617&quot;,\n [&quot;Regiment Color&quot;] = Color3.new(0.435294, 0.372549, 0.0117647),\n [&quot;Minimum RankId&quot;] = 5,\n [&quot;Maximum RankId&quot;] = 250,\n \n },\n \n \n [&quot;Naval Special Warfare Command&quot;] = {\n [&quot;Regiment Name&quot;] = &quot;NSWC&quot;,\n [&quot;Group Id&quot;] = 32954415,\n [&quot;Image Id&quot;] = &quot;http://www.roblox.com/asset/?id=15186922222&quot;,\n [&quot;Regiment Color&quot;] = Color3.new(0.129412, 0.129412, 0.129412),\n [&quot;Minimum RankId&quot;] = 5,\n [&quot;Maximum RankId&quot;] = 250,\n\n },\n\n }\n \n \nreturn regiments\n</code></pre>\n<p>I tried pulling <code>local userRankInGroup = plr:GetRankInGroup(32494019)</code> down <em>after</em> <code>if userRankInGroup and userRankInGroup &gt;= division[&quot;Minimum RankId&quot;] and userRankInGroup &lt;= division[&quot;Maximum RankId&quot;] then</code> as I think that's where the problem lies. But then it just didn't return any value and just gave me the blank option.</p>\n"^^ . . . . "<p>I figured out that my resulting list was processed again. So I decided to work around that in the <code>Plain</code> clause upon walking the tree. I also only return strings now as plain text instead of wrapping it in pandoc elements again:</p>\n<pre class="lang-lua prettyprint-override"><code>function map(xs, f)\n local ys = {}\n for i,x in pairs(xs) do\n ys[i] = f(x)\n end\n return ys\nend\n\nfunction startswith(str, sub)\n return string.sub(str, 1, string.len(sub)) == sub\nend\n\nfunction processBulletList (bl)\n inner = bl:walk {\n BulletList = function (bl) processBulletList(bl.content) end,\n Plain = function (p)\n str = pandoc.utils.stringify(p)\n if startswith(str, '[list]') then\n return p\n else\n return string.format('[*] %s', str)\n end\n end,\n }\n return string.format('[list]%s[/list]', pandoc.utils.stringify(inner))\nend\n\nfunction Writer (doc, opts)\n local filter = {\n BulletList = processBulletList\n }\n return pandoc.write(doc:walk(filter), 'plain')\nend\n</code></pre>\n<p>The output looks as follows:</p>\n<pre><code>[list][*] Europe[list][*] Germany[list][*] Berlin[*]\nHamburg[/list][/list][/list]\n</code></pre>\n"^^ . . . . "nvim: compile/run code based on filetype in function from keymap using lua"^^ . . . "1"^^ . . . "2"^^ . . "@lhf well, not very, considering it is a path, maybe 100-150 chars."^^ . "0"^^ . . . "1"^^ . . . . . . . . . "Pulling GroupId from moduleScript"^^ . "Is it anchored?"^^ . . . "<p>I haven't used <code>NeoVim</code> in quite a while so excuse my poor explanation, but essentially my autocomplete A.K.A <code>LSP</code> No longer works.</p>\n<p>I use <code>LSP Zero</code> and a custom completions config that has worked for me up until now, but no longer works.</p>\n<p>Here is the section within my <code>plugins.lua</code> file which uses <code>packer.nvim</code></p>\n<pre class="lang-lua prettyprint-override"><code>-- LSP Configuration\n use({\n &quot;VonHeikemen/lsp-zero.nvim&quot;,\n branch = &quot;v1.x&quot;,\n requires = {\n -- LSP Support\n { &quot;neovim/nvim-lspconfig&quot; }, -- Required\n { &quot;williamboman/mason.nvim&quot; }, -- Optional\n { &quot;williamboman/mason-lspconfig.nvim&quot; }, -- Optional\n\n -- Autocompletion\n { &quot;hrsh7th/nvim-cmp&quot; }, -- Required\n { &quot;hrsh7th/cmp-nvim-lsp&quot; }, -- Required\n { &quot;hrsh7th/cmp-buffer&quot; }, -- Optional\n { &quot;hrsh7th/cmp-path&quot; }, -- Optional\n { &quot;saadparwaiz1/cmp_luasnip&quot; }, -- Optional\n { &quot;hrsh7th/cmp-nvim-lua&quot; }, -- Optional\n { &quot;onsails/lspkind.nvim&quot; },\n\n -- Snippets\n { &quot;L3MON4D3/LuaSnip&quot; }, -- Required\n { &quot;rafamadriz/friendly-snippets&quot; }, -- Optional\n },\n })\n</code></pre>\n<p>And my <code>completion.lua</code> file</p>\n<pre class="lang-lua prettyprint-override"><code>local luasnip = require(&quot;luasnip&quot;)\nlocal cmp = require(&quot;cmp&quot;)\nlocal lspkind = require(&quot;lspkind&quot;)\n\ncmp.setup({\n formatting = {\n format = lspkind.cmp_format({\n with_text = true, -- do not show text alongside icons\n maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)\n\n -- The function below will be called before any actual modifications from lspkind\n -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))\n before = function(entry, vim_item)\n return vim_item\n end,\n }),\n },\n\n snippet = {\n expand = function(args)\n require(&quot;luasnip&quot;).lsp_expand(args.body)\n end,\n },\n mapping = {\n [&quot;&lt;C-p&gt;&quot;] = cmp.mapping.select_prev_item(),\n [&quot;&lt;C-n&gt;&quot;] = cmp.mapping.select_next_item(),\n [&quot;&lt;C-d&gt;&quot;] = cmp.mapping.scroll_docs(-4),\n [&quot;&lt;C-f&gt;&quot;] = cmp.mapping.scroll_docs(4),\n [&quot;&lt;C-Space&gt;&quot;] = cmp.mapping.complete(),\n [&quot;&lt;C-e&gt;&quot;] = cmp.mapping.close(),\n [&quot;&lt;CR&gt;&quot;] = cmp.mapping.confirm({\n behavior = cmp.ConfirmBehavior.Replace,\n select = true,\n }),\n [&quot;&lt;Tab&gt;&quot;] = function(fallback)\n if cmp.visible() then\n cmp.select_next_item()\n elseif luasnip.expand_or_jumpable() then\n luasnip.expand_or_jump()\n else\n fallback()\n end\n end,\n [&quot;&lt;S-Tab&gt;&quot;] = function(fallback)\n if cmp.visible() then\n cmp.select_prev_item()\n elseif luasnip.jumpable(-1) then\n luasnip.jump(-1)\n else\n fallback()\n end\n end,\n },\n sources = {\n { name = &quot;nvim_lsp&quot; },\n { name = &quot;luasnip&quot; },\n { name = &quot;neorg&quot; },\n },\n})\n</code></pre>\n<p>I have tried re-installing my full config from <code>GitHub</code> and it doesn't seem as if I need to update anything but I'm not 100% on that. It has been a while since my last use of <code>NeoVim</code> so excuse my poor wording, any help is appreciated.</p>\n<p>The <code>GitHub</code> that holds my config:</p>\n<p><a href="https://github.com/kawaleo/kawaleo.nvim/tree/config" rel="nofollow noreferrer">https://github.com/kawaleo/kawaleo.nvim/tree/config</a></p>\n"^^ . . . "1"^^ . "1"^^ . . . . "0"^^ . "ROBLOX - how to pick two random players"^^ . . "2"^^ . "1"^^ . . "1"^^ . . . "0"^^ . . . . . "2"^^ . "<p>I have written a custom latex <code>.cls</code> file to establish a typesetting workflow for the scientific journals of my research institute. The texts should be written in Markdown and then be processed with <code>pandoc</code> to LaTeX.</p>\n<p>I already have an elaborated pandoc template to produce the LaTeX preambel etc. So far its working great.</p>\n<p>But for the figures I need the caption from the Markdown file to be set with <code>\\sidecaption</code> instead of <code>\\caption</code> in LaTeX, as well as with an optional argument (short-caption) for the image attribution in the list of figures.</p>\n<p>To get the latter working I use the following template from a GitHub discussion in the <a href="https://github.com/jgm/pandoc/issues/7915#issuecomment-1427113349" rel="nofollow noreferrer">pandoc repo</a>:</p>\n<pre class="lang-lua prettyprint-override"><code>PANDOC_VERSION:must_be_at_least '3.1'\n\nif FORMAT:match 'latex' then\n function Figure(f)\n local short = f.content[1].content[1].attributes['short-caption']\n if short and not f.caption.short then\n f.caption.short = pandoc.Inlines(short)\n end\n return f\n end\nend\n</code></pre>\n<p>That works without any flaws.</p>\n<p>But now I need to figure out how to change the LaTeX macro used for the caption. The older <a href="https://github.com/jgm/pandoc/issues/7915#issuecomment-1039370851" rel="nofollow noreferrer">approach of pre pandoc version 3.0 posted</a> by @tarleb is really intuitive and I could have easily adapted it to my needs. But since pandoc 3.0 there is the new <a href="https://github.com/jgm/pandoc/releases?page=2" rel="nofollow noreferrer"><em>complex figures</em></a> approach and, so far, I couldn't figure out how to change the LaTeX macro used for the captions with this new behaviour.</p>\n<p>I tried something like that (Adapted from <a href="https://stackoverflow.com/a/71296595/19647155">here</a>:</p>\n<pre class="lang-lua prettyprint-override"><code>if FORMAT:match 'latex' then\n function RawBlock (raw)\n local caption = raw.text:match('\\\\caption')\n if caption then\n raw:gsub('\\\\caption', '\\\\sidecaption')\n end\n return raw\n end\nend\n</code></pre>\n<p>But nothing happened.</p>\n<p>The main challenge for me are my more-or-less non-existing lua skills. I just never had to use it for my daily tasks. I thought about using <code>awk</code> or <code>sed</code> to edit the <code>.tex</code> file itself using a regex-substitution, but that should remain an absolute stopgap, since it makes the whole workflow less portable.</p>\n<p>Thus, I'm hoping for a hint/a solution in form of a pandoc-lua script which 1. helps me to achieve the goal, and 2. improve my understanding of lua and the <em>complex figures</em> approach for similar future tasks.</p>\n<p><strong>Edit</strong></p>\n<p>The plain LaTeX solution suggested by Julien is not a real option. The <code>\\caption</code> macro is very complex in the backend and cannot be copied on the fly via <code>\\let</code>, <code>\\NewCommandCopy</code> or something similar. Even after doing so with e.g. <code>\\NewCommandCopy{\\oldcaption}{\\caption}</code> and then setting <code>\\RenewDocumentCommand{\\caption}{o m}{\\sidecaption[#1]{#2}}</code> nothing changes and the definition of <code>\\caption</code>, checked with <code>\\meaning</code> or something similar, stays the same as before (even <code>\\DeclareDocumentCommand</code> doesn't work).</p>\n<p>In the end, it might be possible to somehow change the <code>\\caption</code> macro itself. But the effort might not be worth the result (and its more of a question for TeX.SE).</p>\n<p>There must be a simpler solution using Lua. Maybe the writer option also suggested by Julien is worth a try. But for that, my missing Lua skills remain as an obstacle. Right now, I'm using a sed script, which works just fine. But it limits the usage to Unix-Systems. Thus, a plain pandoc solution still is the goal to go.</p>\n"^^ . "I dont know how the Thermal Dynamics API works, but i do know that you can interact with storage tile entities directly with a wired modem, and the api is pretty straightforward. Im not sure how different the specs for the modem API were in the older versions, but for the newer versions i had made a quick script to automate a small factory using nothing but wired modems. If you're interested i can try to find it..."^^ . "0"^^ . . . . "<p>It seems like <code>nvim-dap</code> is trying to call the field <code>config</code>, but it's not defined. Worked for me to just add an empty function for this <code>config</code> field.</p>\n<pre class="lang-lua prettyprint-override"><code>{\n &quot;mfussenegger/nvim-dap&quot;,\n config = function() end,\n},\n</code></pre>\n"^^ . . "0"^^ . "0"^^ . . . . "spring-data-redis"^^ . "<p>Let's have a <code>/file/path/name</code> and we need to get the parent directory of that file in the most performant way. What is the most optimal way to strip the filename from that string?</p>\n<p>My ideas:</p>\n<ul>\n<li><code>gsub('[^/]+$','')</code></li>\n<li><code>gsub('/[^/]+$','/')</code></li>\n<li><code>match('^.+/')</code></li>\n</ul>\n"^^ . . . . . . . . "0"^^ . . . "Maybe you can adapt the script from the roblox forum to [get the Owner’s UserId](https://devforum.roblox.com/t/how-to-detect-game-owner/308169) and mark it with an [attribute](https://create.roblox.com/docs/studio/instance-attributes)."^^ . "0"^^ . "You need something like lualanes to send messages between two Lua VMs. But probably you may rebuild the architecture of your application to find a simpler solution."^^ . . . "1"^^ . . . . "hpdf not found by LuaHPDF MakeFile (but I've already installed it)"^^ . "1"^^ . ""You will be unable to set this function's environment later." You can, with the debug library: [Recreating setfenv() in Lua 5.2](https://stackoverflow.com/a/14554565/7509065)"^^ . "1"^^ . "0"^^ . . "How does the kill script work? If it’s all based on a “giver” script (the script is in the weapon and damages the other player) then you can just check the parent of the tool, for example."^^ . . "I have done that but now, it says I can't get do "GetWayPoints" on the instance (probably the path),what do I do"^^ . . . "<p>So I started working with the PICO-8 web version this week, and I wanted to make a simple dungeon crawling game. I started working on the code and got the player sprite moving left and right. The next step was to keep the player on the screen.</p>\n<p>So I began by using a boolean variable to keep track of whether the player was touching the edge of the screen: <code>INBOUNDS</code>. Then I tried using an if statement to determine whether the <code>x</code> coordinate was in the limits:</p>\n<pre><code> -- CHECK IF PLAYER IS IN THE SCREEN\n IF (X = 0 OR X = 128)\n INBOUNDS = FALSE\n END\n</code></pre>\n<p>When the program ran, however, I got an error in the console that read:</p>\n<pre><code>SYNTAX ERROR LINE 22 (TAB 0)\n IF (X = 0 OR X = 128)\n')' EXPECTED NEAR '='\n</code></pre>\n<p>Here is the link to the cartridge file: <a href="https://drive.google.com/file/d/1H0snkt8oza1tXiy0__kTVUX7DMYvdJSr/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1H0snkt8oza1tXiy0__kTVUX7DMYvdJSr/view?usp=sharing</a></p>\n<p>If you need any more info, please ask.</p>\n<p>Thanks!</p>\n"^^ . "<p>I am getting the following error when I startup nvim, not sure why?</p>\n<p>&quot;<strong>nvim &quot;failed to run config for nvim-dap&quot;, loader.lua:369 attemp to call field 'setup' (a nil value)</strong>&quot;</p>\n<p>I started off using lazyvim, and my lua config has the following entry</p>\n<pre class="lang-lua prettyprint-override"><code>{ &quot;mfussenegger/nvim-dap&quot; },\n</code></pre>\n<p>I managed to setup JS/TypeScript debugging and it seems to be working fine. I just want this startup error message fix.</p>\n<p><a href="https://i.sstatic.net/7p6Zy.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7p6Zy.png" alt="NeoVIM nvim-dap error" /></a></p>\n"^^ . . "0"^^ . "0"^^ . . . "2"^^ . . . "<p>When parsing your file, <code>ctags</code> created a <code>test </code> tag, <em>note the trailing space</em>, not a <code>test</code> tag. This is probably because the default parser for Lua doesn't expect optional whitespace between the name of the function and the opening parenthesis.</p>\n<p>Since the actual tag is <code>test </code>, a search for <code>test</code> with <code>-t test</code> or <code>:tag test</code> won't work because the search is <em>literal</em>. You would have to…</p>\n<ul>\n<li>search for <code>test </code>, with the space, in Vim: <code>:tag test </code>,</li>\n<li>or search for the regexp <code>test</code>: <code>:tag /test</code></li>\n</ul>\n<p>inside Vim, or:</p>\n<ul>\n<li>search for the regexp <code>test</code> from your shell: <code>$ vim -t /test</code>.</li>\n</ul>\n<p>See <code>:help tag-regexp</code>.</p>\n<p>If you can't remove that extraneous space from your code, which would be the real solution, here, you can tell ctags to search for new tags with a bit of regexp (see <code>$ man ctags</code>) or try <a href="https://ctags.io/" rel="nofollow noreferrer">Universal Ctags</a>, as mentioned in the comments, which might or might not be smarter than Exuberant Ctags in this particular scenario.</p>\n"^^ . . . . . . . . . "1"^^ . "[As of Lua 5.4, `for`-loops even support a fourth "closing value"](https://www.lua.org/manual/5.4/manual.html#3.3.5). (This is important for iterators like `io.lines`, which have to release a resource once the loop is exited (be that through `error`, `return`, `break`, `goto` or whatnot).) You could do `function walk(...) for n, i in ... do` to deal with this (and a fifth value, should it be added in the future ;)) concisely."^^ . . "0"^^ . . "Minetest: Revoking and granting player privileges"^^ . . . "0"^^ . . . . . . . . . "0"^^ . . . "Can't you just do `year=dtable.year`, `month=dtable.month`, etc.? Where are you stuck?"^^ . . . . . "0"^^ . "<p><code>MoveMouseRelative</code> expects distance in <code>1 pixel</code> units (screen width = 1920 units)<br />\n<code>GetMousePosition</code> returns distance in <code>(screen_size)/64K</code> units (screen width = 65536 units)<br />\nYou should convert values correctly.</p>\n"^^ . . . "0"^^ . . . . . . "1"^^ . . . "1"^^ . "3"^^ . "4"^^ . . . . "1"^^ . . . ""I'm sure it's something very obvious that I can't see" thank you, I knew I was blind."^^ . "Nothing is inside `if event == "MOUSE_BUTTON_PRESSED" and arg == 9 then`; `elseif` closes it."^^ . . . . "The code given is correct; `test` does not return an empty table when called. We can't reproduce your issue because it's somewhere else."^^ . . . . "1"^^ . . . "1"^^ . . . "2"^^ . . . . . . . "Thank you for fixing that problem, but now I have a new one "unable to cast instance to vector 3" (in my first version I was pretty dumb and should have seen that a path can't move)"^^ . . . . "<p>Since <code>core.response.hold_body_chunk</code> receives the raw response body, it does receive cases that contain non-alphabets and symbols.</p>\n<p>For example, when gzip is used between upstream and APISIX, it will receive the compressed raw response body, APISIX will not decompress automatically for you.</p>\n<p>You need to check if this is the case (including but not limited to gzip)</p>\n"^^ . . . "4"^^ . "0"^^ . "Ok so i got it working now but how does my code vs another persons code compare?"^^ . . . . . . . . "What is "n:0" as a number representation?"^^ . "0"^^ . "2"^^ . "0"^^ . "0"^^ . "neovim-plugin"^^ . . "0"^^ . "@WcThunder remember the p is lower in the `Getwaypoints`"^^ . . "Replace `local name = "file " .. arg[1]` with `local arg = {...}; local name = "file " .. arg[1]`"^^ . . . . . . . . . . . "@Oka I will add my function to the question, albeit the function doesn't work it gives lua errors, but I'll explain that also."^^ . "EnablePrimaryMouseButtonEvents (true);\nfunction OnEvent(event,arg)\n if IsKeyLockOn("CapsLock")then\n if IsMouseButtonPressed(4) then\n repeat\n MoveMouseRelative(0,30)\n Sleep(10)\n PressAndReleaseMouseButton(1)\n Sleep(10)\nPressAndReleaseMouseButton(1)\nSleep(10)\n until not IsMouseButtonPressed(4)\n end\nend\n\n end"^^ . . . . "1"^^ . "0"^^ . "0"^^ . "Neovim LSP Not working after not using for a few months. (LSP Zero)"^^ . . . . . . "<p>I have a proximity prompt that when I hold &quot;e&quot; it should display a shopkeeper and print your level and money in the chat but it doesn't do anything like that. When I press and hold &quot;E&quot; it does nothing.\nhere is my code for the proximity part:</p>\n<pre><code>local Players = game:GetService(&quot;Players&quot;)\n\nlocal shopMan = game.ReplicatedStorage.shopMan\nlocal clonedShopMan = shopMan:Clone()\nlocal username = Players.Name\nlocal money = _G.publicPlayerSession.Money\nlocal level = _G.publicPlayerSession.Level\nlocal purchased = false\n\nfunction loadData()\n \n if level == 1 then\n --new stand for free\n elseif level == 2 then\n --stand with another worker\n end\nend\n\nscript.Parent.Triggered:Connect(function(player)\n print(money)\n print(level)\n if level &gt; 0 then\n purchased = true\n loadData()\n else\n purchased = false\n end\n \n if purchased == false then\n if money &gt;= 150 then\n money -= 150\n level += 1\n clonedShopMan.Parent = workspace.Stand\n script.Parent:Destroy()\n end\n end\nend)\n</code></pre>\n<p>I tried change some of the code like removing player from the function and trying to change variable names but nothing was working I had the same result</p>\n"^^ . . "0"^^ . . "Lua: Convert spaces at the beginning of each line to tabs"^^ . . . "zerobrane"^^ . . "I didn't understand the question, just change the 'hour' and 'min' values"^^ . "i think local Response have an problem because it yield idk why"^^ . "This answer is missing an explanation"^^ . . . "1"^^ . "<p>You can’t set a models’ position directly. You would either need to use :MoveTo(vector3) or :PivotToCFrame(cframe) on the model to move it.</p>\n"^^ . . "0"^^ . . . . . . "computercraft"^^ . "<p>game:WORKSPACE:Part:Destroy()</p>\n<p>what is the issue</p>\n<p>I want the part to destroy there is only one part I don't know what the issue is, if someone could help me, I'd be grateful, probably get the point by looking at the script too.</p>\n"^^ . . "1"^^ . . . . "Garbled characters encountered when decompiling Lua"^^ . "Wouldn't that be a case for [definition files](https://luals.github.io/wiki/definition-files/) - assuming you are using LuaLS (which I guess since you wrote "Lua language server")"^^ . . "1"^^ . . . . "1"^^ . "Roblox Lua Story Text Code does not change the text locally on the device?"^^ . "0"^^ . . . . "0"^^ . . . . . "0"^^ . "coronasdk"^^ . . . "1"^^ . "<p>You can't change a player's team on the Client (in a LocalScript) so you'll want to use RemoteEvents to change the player's team.</p>\n<p>First, add a RemoteEvent to ReplicatedStorage.</p>\n<p>Then, the LocalScript should look something like this:</p>\n<pre><code>local rs = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal player = game.Players.LocalPlayer\nscript.Parent.MouseClick:Connect(function()\n rs.Event:FireServer()\nend)\n</code></pre>\n<p>Now, for the serverscript:</p>\n<pre><code>local rs = game:GetSerivce(&quot;ReplicatedStorage&quot;)\nrs.Event.OnServerEvent:Connect(function(plr)\n player.TeamColor = BrickColor.new(&quot;Really blue&quot;)\n local character = plr.Character\n if character then\n local humanoid = character:FindFirstChild(&quot;Humanoid&quot;)\n if humanoid then\n humanoid.Health = 0\n end\n end\nend\n</code></pre>\n"^^ . . . "0"^^ . . . "pdf"^^ . . . . "0"^^ . . "4"^^ . "0"^^ . . . "0"^^ . . . . . "1"^^ . "0"^^ . . "I think I found the problem and it appears to be with my interpreter. Im not sure how the console im using differs from using lua on linux, but using your code worked perfectly when i tried it on linux. Ill probably take my question to a forum more specific to my application. Regardless, I learned a lot more about what is happening to arg[] when running a script and i greatly appreciate your explanations."^^ . . . . "@shingo I didn't know you could do that. I probably can, yes. Thanks."^^ . . "0"^^ . "0"^^ . . . "0"^^ . "0"^^ . . . . "@Friedrich yea, after I switched to Universal Ctags, it worked as expected."^^ . . "How to thread, pipe or compose functions in lua?"^^ . "<ol>\n<li><p>In the game, in the &quot;Controls Settings&quot;, introduce alternative key for &quot;Shoot&quot; action.<br />\nFor example, let it be keyboard key <kbd>P</kbd>.<br />\nSo, now in the game you can shoot either using Left Mouse Button or using Keyboard key <kbd>P</kbd>.<br />\nOf course, you will use LMB for manual shooting as usually, but your GHub script will use <kbd>P</kbd>.</p>\n</li>\n<li><p>Make sure:</p>\n<ul>\n<li>you can shoot with Left Mouse Button (as usual);</li>\n<li>you can shoot with key <kbd>P</kbd>;</li>\n<li>you can shoot with key <kbd>P</kbd> while Left Mouse Button is pressed;</li>\n</ul>\n</li>\n<li><p>Set the script:</p>\n</li>\n</ol>\n<pre><code>local is_active\n\nfunction OnEvent(event, arg)\n if event == &quot;PROFILE_ACTIVATED&quot; then\n EnablePrimaryMouseButtonEvents(true)\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 4 then\n is_active = not is_active\n elseif is_active and event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 then\n while \n PressKey(&quot;P&quot;)\n Sleep(10)\n ReleaseKey(&quot;P&quot;)\n Sleep(10)\n until not IsMouseButtonPressed(1) \n end\nend\n</code></pre>\n<hr />\n<p><strong>Method #2</strong><br />\nIf your game lacks ability to set an alternative key.</p>\n<ol>\n<li><p>Make sure mouse button 5 is ignored by the game.<br />\nThe game must do nothing when you press it while playing.</p>\n</li>\n<li><p>In GHub, assign &quot;Left click&quot; action to some mouse button you usually never use.<br />\nFor example, button #8.<br />\nThis way MB8 will act as a spare Left Click, just in case something wrong happen with your LMB (if script goes wrong for some reason).</p>\n</li>\n<li><p>Set the script.</p>\n</li>\n</ol>\n<pre><code>local is_active\n\nfunction OnEvent(event, arg)\n if event == &quot;PROFILE_ACTIVATED&quot; then\n EnablePrimaryMouseButtonEvents(true)\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 4 then\n is_active = not is_active\n elseif event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 then\n PressMouseButton(1)\n if is_active then\n repeat\n Sleep(10)\n ReleaseMouseButton(1)\n Sleep(10)\n PressMouseButton(1)\n until not IsMouseButtonPressed(5) \n end\n elseif event == &quot;MOUSE_BUTTON_RELEASED&quot; and arg == 1 then\n ReleaseMouseButton(1)\n elseif event == &quot;PROFILE_DEACTIVATED&quot; then\n ReleaseMouseButton(1)\n end\nend\n</code></pre>\n<ol start="4">\n<li>In GHub, assign &quot;Forward&quot; action to physical LMB. (&quot;Forward&quot; is the default action for mouse button 5). Probably GHub will ask you &quot;are you sure&quot;, say &quot;yes&quot;.</li>\n</ol>\n"^^ . "0"^^ . . "<p>The Lua standalone interpreter both puts the command-line arguments into the global <code>arg</code> and passes them to the chunk that it calls. In other words, when you do <code>lua play.lua file1</code>, something like this happens:</p>\n<pre><code>arg = {&quot;file1&quot;}\nassert(loadfile(&quot;play.lua&quot;))(&quot;file1&quot;)\n</code></pre>\n<p>And the script can then use either the varargs syntax <code>...</code> or the global <code>arg</code> to access them. Your <code>play.lua</code> uses the latter. <code>assert(loadfile(&quot;play.lua&quot;))(&quot;file1&quot;)</code> gives an error because it's only setting up the former. <code>assert(loadfile(&quot;play.lua&quot;))</code> isn't doing anything because it's only loading the chunk, not actually calling it. Adding an extra set of empty parentheses, i.e., <code>assert(loadfile(&quot;play.lua&quot;)<b>()</b></code>, will fix that, and in combination with you setting <code>arg[1]</code>, will make it work.</p>\n"^^ . . . . "Why don't you just benchmark your ideas? I would expect the `match` to be fastest."^^ . . "0"^^ . "1"^^ . "hi @shawn if my answer helped in fixing the issue, please mark it answered or helpful. thanks."^^ . . . . "formatting"^^ . "<ol>\n<li><p>In the game, in the &quot;Controls Settings&quot;, introduce alternative key for &quot;Shoot&quot; action.<br />\nFor example, let it be keyboard key <kbd>P</kbd>.<br />\nSo, now in the game you can shoot either using Left Mouse Button or using Keyboard key <kbd>P</kbd>.<br />\nOf course, you will use LMB for manual shooting as usually, but your GHub script will use <kbd>P</kbd>.</p>\n</li>\n<li><p>The script</p>\n</li>\n</ol>\n<pre><code>EnablePrimaryMouseButtonEvents(true)\n\nfunction OnEvent(event, arg)\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 then\n repeat\n MoveMouseRelative(0,10)\n Sleep(15)\n PressAndReleaseKey(&quot;P&quot;) -- instead of PressAndReleaseMouseButton(1)\n Sleep(15)\n until not IsMouseButtonPressed(1) \n end\nend \n</code></pre>\n"^^ . . . . . "<p>The problem stems from the fact that <code>%.0f</code> does not truncate: It rounds. <code>print((&quot;%.0f&quot;):format(1.5))</code> prints <code>2</code>, not <code>1</code>. This is exactly the case here: You have 1h30m, or 1.5h (the &quot;edge case&quot;). This gets rounded up to two hours by <code>%.0f</code>. What you really want instead is floor division. Simply wrap the division in a <code>math.floor</code>; then you can use <code>%d</code> for integer formatting as well:</p>\n<pre class="lang-lua prettyprint-override"><code>print(string.format(&quot;%dh%dm&quot;, math.floor(s / hours), math.floor((s % hours) / minutes))) -- 1h30m as expected\n</code></pre>\n<p>The second <code>if</code> suffers from the same issue. You should also use a <code>math.floor</code> there. I'm not sure why you expect the <code>0s</code> to be omitted, given that there is no code for it. You'd have to implement that using another <code>if</code>.</p>\n"^^ . . . . . "@TAEFED Whats the best way to completely wipe all nvim config + plugin data so I can start on a completely clean slate to see if that helps?"^^ . . . "0"^^ . "0"^^ . "webserver"^^ . . . . . "2"^^ . "0"^^ . . . . "Yes, there is a sandbox limiting the standard lua api, thanks"^^ . "0"^^ . "1"^^ . "<p>I am authoring a Quarto markdown document, an extension of the Pandoc markdown system, and am crafting a YAML section to generate a PDF. My objective is to assign identical text to both the title and the filename. However, the current requirement to duplicate the text for the <code>title</code> and <code>output-file</code> fields is excessively verbose and cumbersome. Is there a method, perhaps through a Lua filter, to reference the value of <code>title</code> and apply it to <code>output-file</code>?</p>\n<pre><code>---\ntitle: &quot;\\\\Large \\\\textbf{Awesome title but Hanc marginis exiguitas non caperet}&quot;\nformat:\n pdf:\n output-ext: &quot;pdf&quot;\n output-file: &quot;Awesome title but Hanc marginis exiguitas non caperet&quot;\n---\n\nfoo bar\n</code></pre>\n<h1>MWE</h1>\n<p>I have attempted to create a Lua filter named <code>set-output-file.lua</code>, but I am concerned that it may not successfully access the value of <code>meta.format.pdf['output-file']</code>.</p>\n<pre class="lang-lua prettyprint-override"><code>-- file: set-output-file.lua\nfunction Meta(meta)\n if meta.title then\n -- Remove LaTeX commands and special characters to create a valid filename\n local filename = pandoc.utils.stringify(meta.title)\n filename = filename:gsub(&quot;\\\\%a+&quot;, &quot;&quot;):gsub(&quot;[^%w%s]&quot;, &quot;&quot;):gsub(&quot;%s+&quot;, &quot;_&quot;)\n -- Check if format.pdf exists, if not create it\n if not meta.format then meta.format = pandoc.MetaMap({}) end\n if not meta.format.pdf then meta.format.pdf = pandoc.MetaMap({}) end\n -- Set the output-file within the pdf sub-table\n meta.format.pdf['output-file'] = filename\n end\n return meta\nend\n</code></pre>\n<pre><code>---\ntitle: &quot;\\\\Large \\\\textbf{Awesome title but Hanc marginis exiguitas non caperet}&quot;\nformat:\n pdf:\n output-ext: &quot;pdf&quot;\nfilters:\n - set-output-file.lua\n---\n\nfoo bar\n</code></pre>\n"^^ . . . "1"^^ . "1"^^ . . "<p>So I write:</p>\n<pre><code>local BoolValue = Instance.new(&quot;BoolValue&quot;)\nBoolValue.Parent = game:GetService(&quot;Players&quot;).LocalPlayer.Character\n</code></pre>\n<p>In a starter player script (local Script)</p>\n<p>But it's not doing anything seemingly, I can't find a BoolValue in the player's character</p>\n"^^ . "Roblox Studio Proximity Prompt Invisible Model"^^ . "object"^^ . "is it one and only way to do this, because in my game there is no alternative keys"^^ . . . . "vim ctags:tags not found if one space after lua function name"^^ . "<p>Currently there is nothing to sort, as you have <em>associative-array</em> type tables, which will always have arbitrarily ordered keys and values. You can only sort <em>array-like</em> tables (those with numerical indices).</p>\n<p>In your comparison function, simply check if your primary comparison is equal, in which case you move on to your secondary comparison (and then tertiary comparison, etc...). If a key comparison is not equal, return the appropriate result for that key (i.e., <code>&lt;</code> or <code>&gt;</code>).</p>\n<p>Note that <a href="https://www.lua.org/manual/5.4/manual.html#pdf-table.sort" rel="nofollow noreferrer"><code>table.sort</code> is not stable</a>.</p>\n<pre class="lang-lua prettyprint-override"><code>local data = {\n [&quot;C1_RN1::F1&quot;] = {\n [&quot;class&quot;] = &quot;Warrior&quot;,\n [&quot;name&quot;] = &quot;C1&quot;,\n [&quot;faction&quot;] = &quot;Faction&quot;,\n [&quot;race&quot;] = &quot;Human&quot;,\n [&quot;realm&quot;] = &quot;RN1&quot;,\n },\n [&quot;C2_RN1::F1&quot;] = {\n [&quot;class&quot;] = &quot;Priest&quot;,\n [&quot;name&quot;] = &quot;C2&quot;,\n [&quot;faction&quot;] = &quot;Faction&quot;,\n [&quot;race&quot;] = &quot;Undead&quot;,\n [&quot;realm&quot;] = &quot;RN1&quot;,\n },\n [&quot;C3_RN1::F1&quot;] = {\n [&quot;class&quot;] = &quot;Hunter&quot;,\n [&quot;name&quot;] = &quot;C3&quot;,\n [&quot;faction&quot;] = &quot;Faction&quot;,\n [&quot;race&quot;] = &quot;Human&quot;,\n [&quot;realm&quot;] = &quot;RN1&quot;,\n }\n}\n\nlocal collapsed = {}\n\nfor key, value in pairs(data) do\n table.insert(collapsed, value)\nend\n\ntable.sort(collapsed, function (a, b)\n if a.race == b.race then\n return a.class &lt; b.class\n end\n\n return a.race &lt; b.race\nend)\n\nfor _, character in ipairs(collapsed) do\n print(character.name, character.race, character.class)\nend\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>C3 Human Hunter\nC1 Human Warrior\nC2 Undead Priest\n</code></pre>\n<hr />\n<p>If you have a lot of keys to compare, you can loop through them.</p>\n<pre class="lang-lua prettyprint-override"><code>table.sort(collapsed, function (a, b)\n local order = { 'race', 'class', 'realm' }\n\n for _, key in ipairs(order) do\n if a[key] ~= b[key] then\n return a[key] &lt; b[key]\n end\n end\nend)\n</code></pre>\n"^^ . . "1"^^ . "<p>fixed version</p>\n<p>answered my own question. i feel dumb</p>\n<pre class="lang-lua prettyprint-override"><code>--google palm--\n--roblox lua\n\nlocal Players = game:GetService(&quot;Players&quot;);\nlocal HttpService = game:GetService(&quot;HttpService&quot;);\nlocal LocalPlayer = Players.LocalPlayer;\nlocal RequestFunctiom = request;\nlocal function MakeRequest(Prompt)\n local success, response = pcall(function()\n return RequestFunctiom({\n Url = &quot;https://generativelanguage.googleapis.com/v1beta2/models/text-bison-001:generateText?key=KEY_HERE&quot;,\n Method = &quot;POST&quot;,\n Headers = {\n [&quot;Content-Type&quot;] = &quot;application/json&quot;,\n },\n Body = HttpService:JSONEncode({\n prompt = {\n text = Prompt\n },\n temperature = 0.7,\n candidateCount = 1,\n topP = 0.95,\n topK = 5,\n maxOutputTokens = 100,\n stopSequences = {&quot;Human:&quot;, &quot;Ai:&quot;},\n })\n })\n end)\n print(response)\n return response\nend\nprint(&quot;MakeRequest sending&quot;)\nprint(&quot;test1&quot;)\nlocal HttpRequest = MakeRequest(&quot;Human: Hello how are you today \\n\\nAI:&quot;);\n--wait(3) -- if this added the local Response will errored the error is &quot;attempt to index nil with the Body&quot;\nlocal Response = &quot;. &quot; .. string.sub(HttpService:JSONDecode(HttpRequest[&quot;Body&quot;]).candidates[1].output, 2);\nprint(Response) \n\n</code></pre>\n"^^ . . . . . "1"^^ . "How to concatenate matrices in lua with wrapping"^^ . . "redis"^^ . . "<p>The mistake:<br />\n<code>IsMouseButtonPressed(8)</code> is incorrect: this function accepts only 1-5.</p>\n<p>How to fix:<br />\nYou should open GHub application and assign action &quot;Back&quot; to physical button 8.<br />\nAfter that edit your script and use <code>IsMouseButtonPressed(4)</code> instead of 8.<br />\nExplanation: mouse button 4 is &quot;Backward&quot; button, its default action is &quot;Back&quot;, so this way button 8 acts as if it were button 4.<br />\nOf course, your game should ignore button 4 press/release (check your game controls settings to be sure of it).</p>\n"^^ . . . "0"^^ . "<p>I recently wrote a small program where I'm trying to convert a number of seconds into a more human readable format, but I'm having problems when trying to format the output and somehow I end up getting unexpected output. Here is the code</p>\n<pre class="lang-lua prettyprint-override"><code>local minutes, hours = 60, 3600\nlocal s = 5400\n\n-- output is 2h30m when it should be 1h30m\nif s &gt;= hours then\n print(string.format(&quot;%.0fh%.0fm&quot;, s / hours, (s % hours) / minutes))\nend\n\n-- output is 45m0s when it should be 45m\nif s &gt;= minutes then\n print(string.format(&quot;%.0fm%.0fs&quot;, s / minutes, s % minutes))\nend\n</code></pre>\n<p>Even though the amount of seconds (s) is 5400 which is 1 hour and 30 minutes, the first <code>if</code>-statement will ouput 2h30m which is one hour more, whereas the second <code>if</code>-statement prints the correct 90m. If y'all could help me with some ideas or point me in the right direction, I'd be extremely grateful! Have a good one!</p>\n"^^ . . "0"^^ . . "<pre class="lang-lua prettyprint-override"><code>local vertical_speed = 1\n\nfunction OnEvent(event,arg)\n if IsKeyLockOn(&quot;scrolllock&quot;) then\n EnablePrimaryMouseButtonEvents (true)\n\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and IsMouseButtonPressed(3) then\n local frac, x, y = 0, 2\n\n repeat\n Sleep(10)\n x, y, frac = -x, math.modf(frac + vertical_speed)\n MoveMouseRelative(x * 2, y)\n until x &gt; 0 and not IsMouseButtonPressed(1)\n end\n\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 9 then\n\n elseif IsModifierPressed(&quot;lshift&quot;) then\n vertical_speed = vertical_speed + 1\n elseif IsModifierPressed(&quot;lalt&quot;) then\n vertical_speed = 1\n end\n end\nend\n</code></pre>\n<p>I want to be able to increase <code>vertical_speed</code> up with button &quot;9&quot; while holding &quot;shift&quot;, and reset while holding &quot;alt&quot;. The script works except it's adjustable with all mouse buttons instead of only button &quot;9&quot;.</p>\n<p>I'm rather new to Lua, and I'm sure it's something very obvious that I can't see.</p>\n"^^ . "<p>The custom Accessory does not attach to the player and spawns away from him</p>\n<p>Here is my script</p>\n<pre><code>local player = game.Players.LocalPlayer\nplayer.CharacterAdded:Wait()\nlocal human = player.Character:WaitForChild(&quot;Humanoid&quot;)\nlocal asset = game.ReplicatedStorage.UnionAccessory:Clone()\nhuman:AddAccessory(asset)\n</code></pre>\n<p>I was expecting that the player would just have Accessory equiped and would walk with it, but that didnt happen</p>\n"^^ . "0"^^ . . . "3"^^ . . . . . . . . . "<p>In this line, you are using the assignment operator <code>=</code> instead of equality operator <code>==</code>:</p>\n<pre><code>if (x = 0 or x = 128) inbounds = false\n</code></pre>\n<p>And in these lines, you are using bit-wise <code>&amp;</code> operator instead of logical <code>and</code>:</p>\n<pre><code>if (btn(0) &amp; inbounds) x -= 1\nif (btn(1) &amp; inbounds) x += 1\n</code></pre>\n<p>Here is a version close to yours that runs correctly:</p>\n<pre><code>sprite = 8\nx = 1\ny = 1\ntimer = 0.25\ninbounds = true\n\nfunction _update()\n -- clear screen\n cls(1)\n \n -- check if player is in the screen\n if (x == 0 or x == 128) inbounds = false\n \n -- get keypresses\n if (btn(0) and inbounds) x -= 1\n if (btn(1) and inbounds) x += 1\n \n -- draw sprite\n spr(sprite, x, y)\nend\n</code></pre>\n<p>You are clearing the screen and rendering the sprite in the <code>_update</code> function which is (I think) not correct.</p>\n<p>You should only change state in the <code>_update</code> function, and all graphics code (including <code>cls</code> and <code>spr</code>) should be called in the <code>_draw</code> function.</p>\n<p>Here is a slight rewrite which has the correct structure, clamping the player's dimensions to a fixed range using the <code>mid</code> function:</p>\n<pre><code>sprite = 8\nx = 64\ny = 64\n\nfunction _update()\n -- get keypresses\n if (btn(0)) x -= 1\n if (btn(1)) x += 1\n if (btn(2)) y -= 1\n if (btn(3)) y += 1\n\n -- clamp dimensions (factor in size of sprite)\n x = mid(0, x, 127-8)\n y = mid(0, y, 127-8)\nend\n\nfunction _draw()\n cls(1)\n spr(sprite, x, y)\nend\n</code></pre>\n<p>Here's some more info on the <code>mid</code> function: <a href="https://pico-8.fandom.com/wiki/Mid" rel="nofollow noreferrer">https://pico-8.fandom.com/wiki/Mid</a></p>\n<pre><code></code></pre>\n"^^ . . "0"^^ . "2"^^ . . . . "3"^^ . . . "1"^^ . . "если я ставлю букву "P" то код вообще не работает , помоги пожалуйста"^^ . "go"^^ . "addeventlistener"^^ . "<p>The good way to to do it, which will certianly work -</p>\n<p>when you are saving the data in redis, first initialize struct and fill data fields prior saving, use <code>json.Marshal</code> to get bytes and save that in redis using <code>SET</code> command and fetch using <code>GET</code> command you will get the data in <code>bytes</code> and then use <code>json.Unmarshal</code> to retrieve the data.</p>\n<pre><code>local data = redis.call('GET', KEYS[1])\n// data returned here in bytes\ninviteInfo := &amp;InviteInfo {}\nerr = json.Unmarshal(data, inviteInfo)\n if err != nil {\n // log err \n return err\n}\n\n// now you can access data fields of inviteInfo if no err\n\n\n</code></pre>\n<p>Edit 1</p>\n<pre><code>\nwhen saving - \n\ntype InviteInfo struct {\n...\nMaxPeers int32 `json:&quot;maxPeers&quot;`\nRouteVersion int32 `json:&quot;routeVersion&quot;`\n...\n}\n\ninviteInfo := &amp;InviteInfo{\n MaxPeers: 5,\n RouteVersion: 1,\n}\n\ninviteInfoBytes, err := json.Marshall(inviteInfo)\nif err != nil {\n // log err\n}\n\n// method can defer as per library \nfunc (c *Cache) saveInRedis(key string, inviteInfoBytes []byte) error {\n conn, err := c.getConnFromPool()\n if err != nil {\n return err\n }\n defer conn.Close()\n var luaScript = redis.NewScript(1, `\n redis.call('SET', KEYS[1], ARGV[1])\n `)\n\n _, err = luaScript.Do(conn, key, string(inviteInfoBytes))\n\n return err\n}\n\n// atomic modification \nfunc ModifyInviteInfoAtomic(key string, updatedRouteVersion int32) error {\nconn, err := c.getConnFromPool()\n if err != nil {\n return err\n }\n defer conn.Close()\n var luaScript = redis.NewScript(1, `\n local inviteInfo = redis.call('GET', KEYS[1])\n if inviteInfo then:\n local metaData = cjson.decode(inviteInfo)\n if metaData['RouteVersion'] then\n metaData.RouterVersion = ARGV[1]\n local updatedMetaData = cjon.encode(metaData)\n redis.call('SET', KEYS[1], updatedMetaData)\n end\n end\n \n `)\n_, err = luaScript.Do(conn, key, updatedRouteVersion)\n return err\n}\n</code></pre>\n"^^ . . . "Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/256045/discussion-between-taefed-and-mo0rby)."^^ . "0"^^ . "0"^^ . "<p>You are trying to get the guild by using <code>client.guild</code> but <code>guild</code> does not exist on <code>client</code>.</p>\n<p>Looking at your code, I assume that <code>data</code> is the received interaction.</p>\n<p>To create a channel using this interaction object you can do the following:</p>\n<pre><code>data.guild.channels.create(&quot;││&quot; + data.user.username, { \n type: &quot;GUILD_TEXT&quot;, // syntax has changed a bit\n parent: &quot;1157076981159034880&quot;,\n permissionOverwrites: [\n {\n id: role.id,\n allow: [Permissions.FLAGS.VIEW_CHANNEL],\n },\n {\n id: data.id,\n allow: [Permissions.FLAGS.VIEW_CHANNEL],\n },\n {\n id: client.guild.roles.everyone, //To make it be seen by a certain role, user an ID instead\n //allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], //Allow permissions\n deny: ['VIEW_CHANNEL'] //Deny permissions , 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'\n },\n ],\n }); \n</code></pre>\n<p>I hope this answers your question</p>\n"^^ . "2"^^ . "0"^^ . . . . . . . . . . "`MoveMouseRelative` is unexact, Windows "mouse acceleration" feature determines the real number of pixels, it is often different from the argument of `MoveMouseRelative`."^^ . . "2"^^ . "0"^^ . . . . . . . . . . . . . "0"^^ . "<p>So I have this dummy on Roblox Studio welded to a P90 model (a gun). <em><strong>I need this dummy to move, but when I call :MoveTo to the humanoid of this dummy it just does not move</strong></em> Any help is appreciated, Thank You!</p>\n<p>Code:</p>\n<pre><code>local RS = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal npcSettings = require(RS.Settings)\nlocal npcVariables = require(RS.Variables) \n\nlocal NPC = workspace:FindFirstChild(&quot;NPC Gun System&quot;)\n\nlocal NPCRootPart = npcVariables.NPCRootPart\nlocal NPCTorso = npcVariables.NPCTorso\nlocal NPCHumanoid = npcVariables.NPCHumanoid\n\nlocal Players = game:GetService(&quot;Players&quot;)\n\nlocal npcProperties = {\n agroDistance = 100,\n fireRate = 0.1,\n bulletDamage = 15,\n bulletSpeed = 100,\n bulletMag = 50\n}\n\ngame.Players.PlayerAdded:Connect(function(plr)\n\nlocal char = plr.Character or plr.CharacterAdded:Wait()\nlocal hum = char:FindFirstChild(&quot;Humanoid&quot;) \nlocal torso = char:FindFirstChild(&quot;Torso&quot;)\nlocal humRootPart = char:FindFirstChild(&quot;HumanoidRootPart&quot;)\n \n local function chaseTarget()\n NPCHumanoid:MoveTo(humRootPart.Position)\n end\n \n local function Reload()\n npcSettings.Guns.P90.Sounds.ReloadSound:Play()\n --Put an animation here if you wish!\n end\n \n local function fireP90()\n if hum.Health == 0 then return end\n\n local newBullet = npcSettings.Guns.P90.BulletTrail:Clone()\n newBullet.Parent = workspace\n newBullet.CFrame = npcSettings.Guns.P90.Model.FirePart.CFrame * CFrame.new(0, 0, -1)\n newBullet.CFrame = newBullet.CFrame * CFrame.Angles(0, math.rad(90), 0)\n\n local Att0 = Instance.new(&quot;Attachment&quot;)\n Att0.Parent = newBullet\n\n local LinearVelocity = Instance.new(&quot;LinearVelocity&quot;)\n LinearVelocity.Parent = newBullet\n LinearVelocity.MaxForce = math.huge\n LinearVelocity.Attachment0 = Att0\n LinearVelocity.VectorVelocity = npcSettings.Guns.P90.Model.FirePart.CFrame.LookVector * npcProperties.bulletSpeed\n\n game.Debris:AddItem(newBullet, 3)\n\n newBullet.Touched:Connect(function(hit)\n if hit.Parent:FindFirstChild(&quot;HumanoidRootPart&quot;) then\n hum:TakeDamage(npcProperties.bulletDamage)\n newBullet:Destroy()\n end\n end)\n\n npcSettings.Guns.P90.Sounds.GunShotSound:Play()\n npcVariables.isRunning = true\n end\n \n local function checkPositionAndFire()\n if (NPCTorso.Position - torso.Position).Magnitude &lt; npcProperties.agroDistance then\n local RunService = game:GetService(&quot;RunService&quot;)\n\n RunService.Stepped:Connect(function()\n NPCRootPart.CFrame = CFrame.lookAt(NPCRootPart.Position, torso.Position)\n end)\n chaseTarget()\n \n fireP90()\n \n else\n npcVariables.isRunning = false\n end\n end\n \n if torso ~= NPCTorso then \n local bulletsFired = 0\n \n while true do\n task.wait(npcProperties.fireRate)\n \n checkPositionAndFire()\n \n if npcVariables.isRunning == true then\n bulletsFired = bulletsFired + 1\n\n if bulletsFired &gt;= npcProperties.bulletMag then\n if npcVariables.isRunning == true then\n Reload()\n npcVariables.isRunning = false\n end\n bulletsFired = bulletsFired - bulletsFired\n end \n\n if npcSettings.Guns.P90.Sounds.ReloadSound.IsPlaying == true then\n npcSettings.Guns.P90.Sounds.ReloadSound.Ended:Wait()\n end\n end\n end\n end\nend)\n</code></pre>\n<p>Relevant Code:</p>\n<pre><code>local function chaseTarget()\n NPCHumanoid:MoveTo(humRootPart.Position)\n end\n\nlocal function checkPositionAndFire()\n if (NPCTorso.Position - torso.Position).Magnitude &lt; npcProperties.agroDistance then\n local RunService = game:GetService(&quot;RunService&quot;)\n\n RunService.Stepped:Connect(function()\n NPCRootPart.CFrame = CFrame.lookAt(NPCRootPart.Position, torso.Position)\n end)\n chaseTarget()\n \n fireP90()\n \n else\n npcVariables.isRunning = false\n end\n end\n</code></pre>\n<p>I already tried calling another methods and altering its CFrame to make the humanoid of the dummy move, as i said, Im expecting to make the humanoid of the dummy move.</p>\n"^^ . . "0"^^ . "Getting Assertion Failed error when debugging Lua script"^^ . "Adding an additional method to lua's string works in official Lua but it doesn't work on Warcraft 1.12 Lua"^^ . "1"^^ . . "What is your current [locale](https://en.wikipedia.org/wiki/Locale_(computer_software))? Use a program like [`locale`](https://man.openbsd.org/locale.1) from a terminal, or [`print(os.setlocale())`](https://www.lua.org/manual/5.4/manual.html#pdf-os.setlocale) from Lua."^^ . . "0"^^ . . "0"^^ . "0"^^ . "0"^^ . "minetest"^^ . . . . "This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/35501558)"^^ . . . . . . . . . "code-structure"^^ . . . . . . "<p>The lua file was from an apk using <strong>luajava</strong> and <strong>andlua</strong>, lua version seems to be <strong>5.3.3</strong></p>\n<p>After I used <strong>unluac</strong> to decompile and obtain the lua file, I found that all the strings became garbled characters.</p>\n<pre class="lang-lua prettyprint-override"><code>local L0_0, L1_1, L2_2, L3_3, L4_4, L5_5, L6_6, L7_7\nL0_0 = _ENV\nL1_1 = L0_0[&quot;]$&quot;]\nL2_2 = L0_0[&quot;u\\229\\136\\006\\133\\020\\186&quot;]\nL3_3 = &quot;u\\v\\138\\027\\133\\002&quot;\nL2_2 = L2_2(L3_3)\nL3_3 = L0_0[&quot;u\\229\\136\\006\\133\\020\\186&quot;]\nL4_4 = &quot;i\\020\\1460&quot;\nL3_3 = L3_3(L4_4)\nL4_4 = L0_0[&quot;u\\229\\136\\006\\133\\020\\186&quot;]\nL5_5 = &quot;x\\230k\\237`\\247,\\227\\145\\015\\158&quot;\nL4_4 = L4_4(L5_5)\nL5_5 = L4_4\nfunction L6_6(A0_8, A1_9, A2_10, A3_11)\n local L4_12\n L4_12 = L0_0\n return L4_4[&quot;d\\030\\181(\\213x\\241&quot;](A0_8, A1_9, A2_10, A3_11, &quot;m\\031\\1878&quot;)\nend\nL5_5[&quot;k\\028\\176$\\208B\\248\\195&quot;] = L6_6\nfunction L6_6(A0_13, A1_14, A2_15, A3_16)\n local L4_17\n L4_17 = L0_0\n return L4_4[&quot;d\\030\\181(\\213x\\241&quot;](A0_13, A1_14, A2_15, A3_16, &quot;l\\029\\132$\\136&quot;)\nend\nL5_5[&quot;k\\028\\176$\\208B\\248\\193&quot;] = L6_6\nfunction L6_6(A0_18, A1_19, A2_20)\n local L3_21, L4_22, L5_23, L6_24, L7_25\n L3_21 = L0_0\n if A0_18 == &quot;+&quot; then\n A0_18 = &quot;7\\016E\\130\\2115b&quot;\n end\n L4_22 = L4_4[&quot;g\\004\\162&quot;]\n L4_22 = L4_22[&quot;l\\024\\155\\003\\176#\\203E\\240w\\236&quot;]\n L5_23 = A0_18\n L5_23 = L4_22(L5_23)\n if not L4_22 then\n L6_24 = nil\n L7_25 = L5_23\n return L6_24, L7_25\n end\n L6_24, L7_25 = nil, nil\n L5_23 = &quot;|\\2533\\250z\\242z\\181y\\2487\\246|\\252k\\252i\\233&quot;\n for _FORV_11_, _FORV_12_ in L1_1[&quot;o\\005\\133=\\177@&quot;](L4_22) do\n if _FORV_12_[&quot;`\\019\\179\\&quot;\\219]&quot;] == &quot;m\\031\\1878&quot; then\n L6_24, L5_23 = L4_4[&quot;p\\031\\132Y&quot;]()\n else\n L6_24, L5_23 = L4_4[&quot;p\\031\\132[&quot;]()\n end\n if not L6_24 then\n return nil, L5_23\n end\n L6_24[&quot;z\\224v\\017\\138\\003\\154\\031\\130&quot;](L6_24, &quot;{\\225u\\b\\147\\019\\137\\r\\150&quot;, true)\n L7_25, L5_23 = L6_24[&quot;f\\003\\190S&quot;](L6_24, _FORV_12_[&quot;e\\r\\170F&quot;], A1_19)\n if not L7_25 then\n L6_24[&quot;f\\001\\186M\\195&quot;](L6_24)\n else\n L7_25, L5_23 = L6_24[&quot;j\\017\\153)\\170,&quot;](L6_24, A2_20)\n if not L7_25 then\n L6_24[&quot;f\\001\\186M\\195&quot;](L6_24)\n else\n return L6_24\n end\n end\n end\n return nil, L5_23\nend\n</code></pre>\n<p>I tried hard to find the original file of one of the lua files on the Internet, and found that all the strings and methods had become garbled characters.</p>\n<pre class="lang-lua prettyprint-override"><code>local base = _G\nlocal string = require(&quot;string&quot;)\nlocal math = require(&quot;math&quot;)\nlocal socket = require(&quot;socket.core&quot;)\n\nlocal _M = socket\n\n-----------------------------------------------------------------------------\n-- Exported auxiliar functions\n-----------------------------------------------------------------------------\nfunction _M.connect4(address, port, laddress, lport)\n return socket.connect(address, port, laddress, lport, &quot;inet&quot;)\nend\n\nfunction _M.connect6(address, port, laddress, lport)\n return socket.connect(address, port, laddress, lport, &quot;inet6&quot;)\nend\n\nfunction _M.bind(host, port, backlog)\n if host == &quot;*&quot; then host = &quot;0.0.0.0&quot; end\n local addrinfo, err = socket.dns.getaddrinfo(host);\n if not addrinfo then return nil, err end\n local sock, res\n err = &quot;no info on address&quot;\n for i, alt in base.ipairs(addrinfo) do\n if alt.family == &quot;inet&quot; then\n sock, err = socket.tcp4()\n else\n sock, err = socket.tcp6()\n end\n if not sock then return nil, err end\n sock:setoption(&quot;reuseaddr&quot;, true)\n res, err = sock:bind(alt.addr, port)\n if not res then\n sock:close()\n else\n res, err = sock:listen(backlog)\n if not res then\n sock:close()\n else\n return sock\n end\n end\n end\n return nil, err\nend\n</code></pre>\n<p>The Luas file</p>\n<pre><code>G0x1YVMAGZMNChoKBAQECAh4VgAAAAAAAAAAAAAAKHdAAQAAAAAAAAAAAAACCjIAAAAFAAAARwBAAIdAQADBgAAApIAAAcdAQAABwQAA5IAAAQdBQABBAQEAJIEAAUABAAKsAQAASoGBgqxBAABKgQGDrIEAAEqBgYOHQcICpIGAAEqBAYSswQAASoEBhYsBAADLAQAASoGBhUrBAYZKgcOGLAIBAMoBgocsQgEAygECiAcCxAPKAYKIB4LCAkACgAMkggABSgECiSyCAQCKAYKJLMIBAIoBAooHAkUDigGCiAeCwgJAAgADJIIAAUoBgopmAQABJgCAABYAAAAEA10kBAh15YgGhRS6BAd1C4obhQIEBWkUkjAEDHjma+1g9yzjkQ+eBAlrHLAk0EL4wwQJaxywJNBC+MEEBWYDvlMEBHcIiAQHaB+ZF6U1BAdlB7ct2HAECHTujgSTDpEEBnYUmwWSBApLGNCpfdKFQiYTAAgAAAAAAAAEEGztnBW9ZspYx3uqnQOwNAQKYhiUFvcgs13CBAhjF7sowUz/BAV3EpwBBAprDfIn00zqjAwEDXnje/l+vnb6d+p++AQHdRCNAIgAAQAAAAEACAAAAAATAAAAFQAAAAQACwoAAAAFAQAARgHAAIABAADAAYAAAAIAAUACgAGBQgAAZQEAA2YBAAAmAIAAAgAAAAQIZB61KNV48QQFbR+7OAIAAAABAAEEAAAAAAAAAAAAAAAAAAAAAAAXAAAAGQAAAAQACwoAAAAFAQAARgHAAIABAADAAYAAAAIAAUACgAGBQgAAZQEAA2YBAAAmAIAAAgAAAAQIZB61KNV48QQGbB2EJIgCAAAAAQABBAAAAAAAAAAAAAAAAAAAAAAAGwAAADYAAAADABFEAAAAxQAAAB8AQAAeAACAAUAAAAaBwAAHwUACQAEAACTBAAEiQQAAHoAAgIQBAADAAYACpgGAAYQBgABBAQEABkJBAUACAAIkAgEBHoAKgEeDQQYfwMEGHgABgEYDwgBkw4AAQAEAB4ABgAYewACARkPCAGTDgABAAQAHgAGABqJBAAAegACARAMAAIADgAJmA4ABTINCA8HDAgADBIAAZEMAAkwDQwPHQ0MGAASAAGTDAAJAAQAHwAGABuJBAAAegACATINDA2RDAAEegAKATMNDA8ADAAFkw4ABQAEAB8ABgAbiQQAAHoAAgEyDQwNkQwABHgAAgKYBAAEpggAAqoL0fwQCAABAAoACJgKAASYAgAAQAAAABAIrBAg3EEWC0zViBARnBKIEDGwYmwOwI8tF8HfsBBN8/TP6evJ6tXn4N/Z8/Gv8aekEB28FhT2xQAQHYBOzIttdBAVtH7s4BAVwH4RZBAVwH4RbBAp64HYRigOaH4IECnvhdQiTE4kNlgQFZgO+UwQFZQ2qRgQGZgG6TcMEB2oRmSmqLAMAAAABAAEEAQEAAAAAAAAAAAAAAAAAAAAAADoAAABDAAAAAQADBAAAAEUAAACsAAAApgAAASYAgAAAAAAAAgAAAAEAAQEBAAAAADsAAABCAAAAAwAJIQAAAMUAAAAGAcAAQAEAACSBAAFfQEACHgABgAGBAABAAQAAgACAAEAAgAIAAAACI0EAAB4AAIABwQAABgEBASJBAAAeQAKARgHBAIFBAQDGgcEAAAIAAOSBAAEBwgEAnQECA8EBAgBkQYABHgABgEABAAKAAYAAwAEAAWUBgAFmAQAAJgCAAAkAAAAEBXAFhAgEB3ULihuFAgQIYxe7KMFM/wQEbR2JBAZgHasr3AQOeOF5+njucr5Kxl+IAwQJfOtyCYsfnAgEAigTAwAAAAAAAAADAAAAAQEAAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPAAAAWwAAAAEABg0AAABFAAAAhgDAAMuAAAAsAQAAygCBgCxBAADKAAGBC0EAAGyBAAAKQYGBpQCAAaYAAAAmAIAABAAAAAQNf+5/52/9aPxp5WvjBAZiFKks0gQGYQelNdMEB1k0s1f3bQIAAAABAAEBAwAAAABRAAAAUQAAAAAAAwYAAAAFAAAARQCAAEwAwABlAAABZgAAACYAgAABAAAABAZiFKks0gIAAAABAQEAAAAAAAAAAAAAAAAAAAAAAABSAAAAUgAAAAAAAwYAAAAFAAAARQCAAEwAwABlAAABZgAAACYAgAABAAAABAZhB6U10wIAAAABAQEAAAAAAAAAAAAAAAAAAAAAAABUAAAAWQAAAAMABw8AAADFAAAAYkAAAB5AAYAFAYAADAFAAiRBAAEBQQAAJgEAAR4AAYAFAYAADIFAAoABgAAlAYABJgEAACYAgAADAAAABAZmAbpNwxMBAAAAAAAAAAQFdx6cDgIAAAABAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABdAAAAZwAAAAEABg0AAABFAAAAhgDAAMuAAAAsAQAAygCBgCxBAADKAAGBC0EAAGyBAAAKQYGBpQCAAaYAAAAmAIAABAAAAAQNf+5/52/9aPxp5WvjBAZiFKks0gQGYQelNdMEB1k0s1f3bQIAAAABAAEBAwAAAABfAAAAXwAAAAAAAwYAAAAFAAAARQCAAEwAwABlAAABZgAAACYAgAABAAAABAZiFKks0gIAAAABAQEAAAAAAAAAAAAAAAAAAAAAAABgAAAAYAAAAAAAAwYAAAAFAAAARQCAAEwAwABlAAABZgAAACYAgAABAAAABAZhB6U10wIAAAABAQEAAAAAAAAAAAAAAAAAAAAAAABiAAAAZQAAAAMABwwAAADFAAAAYgAAAB5AAYAFAYAADAFAAoABgAAlAYABJgEAAB5AAIABQQAAJgEAASYAgAACAAAABAV3HpwOEwEAAAAAAAAAAgAAAAEBAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG0AAAB7AAAAAgAHDQAAAIUAAADGAMAAC4EAAGwBAAAKQYGAbEEAAApBAYFLQQAArIEAAEqBgYHlAIAB5gAAACYAgAAEAAAABA1/7n/nb/1o/Gnla+MEBmIUqSzSBAZhB6U10wQHWTSzV/dtBQAAAAEAAQEBAwEEAQIDAAAAAG8AAABvAAAAAAADBgAAAAUAAABFAIAATADAAGUAAAFmAAAAJgCAAAEAAAAEBmIUqSzSAgAAAAECAQAAAAAAAAAAAAAAAAAAAAAAAHAAAABwAAAAAAADBgAAAAUAAABFAIAATADAAGUAAAFmAAAAJgCAAAEAAAAEBmEHpTXTAgAAAAECAQAAAAAAAAAAAAAAAAAAAAAAAHIAAAB5AAAAAAAHGwAAAAUAAABFAIAAIQDAAB5AAIBEAAAAZgAAAUZAQAGGgMABxQCAAGSAgAGFAAACjMBAAQABgACkwIAB4gAAAB6AAIAEAQAAQAGAASYBgAEFAYAARgHBAoABAAFkgQABDkEBAgkBgACmAAABJgCAAAUAAAATAAAAAAAAAAAEBG4ajQQKSxjQqX3ShUImBAh15ZoWhRC6BARvF48GAAAAAQIBAQACAAMBAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB9AAAAjgAAAAEABw4AAABFAAAAhAAAAMYAwAALgQAAbAEAAApBgYBsQQAACkEBgUtBAACsgQAASoGBgeUAgAHmAAAAJgCAAAQAAAAEDX/uf+dv/Wj8aeVr4wQGYhSpLNIEBmEHpTXTBAdZNLNX920DAAAAAQABAQEEAwAAAACAAAAAgAAAAAAAAwYAAAAFAAAARQCAAEwAwABlAAABZgAAACYAgAABAAAABAZiFKks0gIAAAABAQEAAAAAAAAAAAAAAAAAAAAAAACBAAAAgQAAAAAAAwYAAAAFAAAARQCAAEwAwABlAAABZgAAACYAgAABAAAABAZhB6U10wIAAAABAQEAAAAAAAAAAAAAAAAAAAAAAACDAAAAjAAAAAAABhsAAAAFAAAARQCAAGIAAAAeQACARAAAAGYAAAFFAAABTADAAMZAwAFkAIEBokAAAB5AAIBmAAABHsACgB+AQAEegAGABQEAAQzBQAIkQQABAQEBAAkBgADmAAABHoAAgAQBAABAAQABJgGAASYAgAAFAAAABAh15ZoWhRC6BApLGNCpfdKFQiYEB2UDtzHOcQQGZgG6TcMTAQAAAAAAAAAEAAAAAQEBAgEAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n</code></pre>\n<p>Can anyone tell me what's going on and how I can get the normal source files?</p>\n"^^ . . . "0"^^ . . . "<p>Lua filters only change Pandoc's AST representation of your document, i.e. before it is then converted to LaTeX. A Raw block filter will not act on Pandoc's LaTeX output, but only on Raw LaTeX blocks that are in the markdown itself.</p>\n<p>A Pandoc solution would be to write a <a href="https://pandoc.org/custom-writers.html" rel="nofollow noreferrer">custom Lua <em>writer</em></a>. The writer would use pandoc.write to generate Pandoc's own LaTeX output (body only) and modify it with regular expressions or Lua patterns. To replace just a command name this is fairly easy, though longer than the third solution below.</p>\n<p>A LaTeX solution is to redefine \\caption as \\sidecaption:</p>\n<pre><code>\\renewcommand{\\caption}{\\sidecaption}\n</code></pre>\n<p>You can keep this in groups ({...}) to ensure that the redefinition only applies locally.</p>\n<p>A hybrid Pandoc/LaTeX solution is a Lua filter that insert LaTeX code to redefine \\caption around figures:</p>\n<pre class="lang-lua prettyprint-override"><code>if FORMAT:match 'latex' then\n function Figure (elem)\n return {\n pandoc.RawBlock('latex','{\\\\renewcommand{\\\\caption}{\\\\subcaption}'),\n elem,\n pandoc.RawBlock('latex','}')\n }\n end\nend\n</code></pre>\n<p>This replaces any 'Figure' block element by a list (succession) of three raw LaTeX blocks. The output should look like:</p>\n<pre><code>{\\renewcommand{\\caption}{\\subcaption}\n... Pandoc's LaTeX for the figure ...\n}\n</code></pre>\n"^^ . . . "0"^^ . "0"^^ . "0"^^ . . . "0"^^ . . . . "0"^^ . . . "fivem"^^ . "sublimetext"^^ . . . . . . . . "0"^^ . . . "ROBLOX - how to tell who killed an enemy"^^ . . "<p>I want to revoke the <code>interact</code> privilege from a player (let's call him <code>singleplayer</code>). I tried</p>\n<pre class="lang-lua prettyprint-override"><code>minetest.set_player_privs(&quot;singleplayer&quot;, {interact = false})\n</code></pre>\n<p>But this revokes <em>all other privileges</em>, and <em>grants</em> <code>interact</code>. I then tried</p>\n<pre class="lang-lua prettyprint-override"><code>local privs = minetest.get_player_privs(&quot;singleplayer&quot;)\nprivs.interact = false\nminetest.set_player_privs(&quot;singleplayer&quot;, privs)\n</code></pre>\n<p>But this does not revoke <code>interact</code>; it even <em>grants</em> <code>interact</code> if the player doesn't already have it.</p>\n<p>For granting the <code>interact</code> privilege, I tried <code>minetest.set_player_privs(&quot;singleplayer&quot;, {interact = true})</code>. This worked, but revoked all other privileges.</p>\n"^^ . "2"^^ . . "environment"^^ . "Sorry for spam, but I want to also note that given that only ".0" floats seems affected, this would make some sense if there is something wrong with the portion of Lua that adds the ".0" explicitly for such numbers (rather than other decimal separators which are produced directly by `sprintf`."^^ . . "<p>My leaderboard</p>\n<pre><code>function Onplrjoined(plr)\n\nlocal leaderstats = Instance.new(&quot;IntValue&quot;)\nleaderstats.Parent = plr\nleaderstats.Value = 0\nleaderstats.Name = &quot;leaderstats&quot;\n\nlocal stat = Instance.new(&quot;IntValue&quot;)\nstat.Name = &quot;Coins&quot;\nstat.Value = 0\n</code></pre>\n<p>end</p>\n<p>local players = game:WaitForChild(&quot;Players&quot;)</p>\n<p>players.PlayerAdded:Connect(Onplrjoined)</p>\n<p>but when i join in it does not show anything\nwhen i join in it does not show anything</p>\n"^^ . "In Lua generally, you don't need to do anything complicated to get `("..."):x`; `string==getmetatable("").__index`; anything added to `string` will be accessible by indexing strings. The `string` table itself doesn't otherwise have any special meaning (ie the metatable of `string` is not the metatable of string values). Note that you can't reassign the string metatable itself without `debug.setmetatable`. Probably there is no string metatable assigned in WoW Lua (which may have been the baseline case in earlier versions of Lua, so it may be a backward compat thing)."^^ . . . "<p>I am new to Neovim s (and vim in general) so I might be missing something obvious. Anyway, I am trying to follow a video to setup a Neovim to replace my IDE (VSCode). This video start with setting up the Lazy plugin manager.</p>\n<p>I've got a super simple setup and I am only trying to install Lazy but my <code>init.lua</code> file is giving me <code>init.lua:1: number expected</code> whenever I try to source it.</p>\n<p>Here's my <code>~/.config/nvim</code> directory:</p>\n<pre><code>╰─❯ tree\n.\n├── init.lua\n└── lua\n ├── config\n │   └── init.lua\n ├── plugins\n └── util\n\n5 directories, 2 files\n</code></pre>\n<p>Here is my <code>~/.config/nvim/init.lua</code></p>\n<pre><code>require(&quot;config&quot;)\n</code></pre>\n<p>And here is my <code>~/.config/nvim/lua/config/init.lua</code></p>\n<pre><code>local lazypath = vim.fn.stdpath(&quot;data&quot;) .. &quot;/lazy/lazy.nvim&quot;\nif not vim.loop.fs_stat(lazypath) then\n vim.fn.system({\n &quot;git&quot;,\n &quot;clone&quot;,\n &quot;--filter=blob:none&quot;,\n &quot;https://github.com/folke/lazy.nvim.git&quot;,\n &quot;--branch=stable&quot;, -- latest stable release\n lazypath,\n })\nend\nvim.opt.rtp:prepend(lazypath)\n\n\nvim.g.mapleader = &quot; &quot; -- Make sure to set `mapleader` before lazy so your mappings are correct\n\n-- Initialise Lazy by installing some basic plugins\nrequire(&quot;lazy&quot;).setup({\n &quot;folke/which-key.nvim&quot;,\n { &quot;folke/neoconf.nvim&quot;, cmd = &quot;Neoconf&quot; },\n &quot;folke/neodev.nvim&quot;,\n})\n</code></pre>\n<p>What is incorrect with my setup? I can't figure it out and don't understand where I am going wrong. This looks just like the video I am watching and the author of that shows the Lazy plugin loaded and working.</p>\n"^^ . "2"^^ . . "0"^^ . . "<p>I have a gigantic chest storage network connected by ThermalDynamics' Dense Itemducts and I was wondering if anyone had a prewritten code (or enough knowledge of Lua) to pull items from the network to a deposit chest so I wouldn't have to sift through hundreds of chests each time I'm looking for something</p>\n<p>I tried local functions defined with (duct, itemName, quantity) but I am not good enough with coding to actually understand why it wasn't pulling from the chests.\nI was expecting it to pull a specific number of specified items from the network to the depot chest next to the computer</p>\n"^^ . . . "2"^^ . . . "2"^^ . . . "0"^^ . "What is the code you are using to tell you that the return value is empty?"^^ . . . . "0"^^ . "0"^^ . "1"^^ . "lua-patterns"^^ . . . "Thanks for that, I looked into it and a request header for Accept-Encoding: gzip was being passed. As a work around I used proxy-rewrite to change that header. Although that works but I would still like to understand how we can decompress data in Lua if you have any pointers? I found some 3rd party libraries but was wondering if there was something provided in any APISIX library?"^^ . . . "0"^^ . . . . . . . . . "0"^^ . . "0"^^ . "@LucRiffault Are you sure you didn't accidentally declare a new `arg` that's `local`? Can you edit your question to include the exact content of both of your files during your latest attempt?"^^ . . "What version of Lua was that code compiled with?"^^ . . "<p>lua version = 5.3.4.\nI want to run os.excute<code>(/usr/bin/demo &amp;)</code> in lua,it will occur <code>attempt to call a nil value (field 'execute')</code>\nBut when I am in <strong>Lua interactive mode</strong>, it is normal to execute os.execute(&quot;/usr/bin/demo &amp;&quot;).</p>\n<ol>\n<li>Does the Lua script have no permission to execute shell instructions?</li>\n<li>Or is there any other better way to execute shell instructions?</li>\n</ol>\n<p>I need it running in lua scripts file</p>\n"^^ . . . . "`hour = hour-5; min=min-30;`"^^ . . "<p>I'm attempting to make a Lua script with Logitechs API that will detect when I hold the dpi shift button on my mouse and then simulate a keypress.</p>\n<p>However, I cant find the right function to tell if that button is pressed or not. Any ideas or recommendations to improve this program would be nice.</p>\n<p>Here is my first attempt at a hold program:</p>\n<pre><code>function OnEvent(G_PRESSED, G5)\n Sleep(500)\n if IsMouseButtonPressed(5) then\n MoveMouseTo(0,0)\n end\n \nend\n</code></pre>\n"^^ . . . . . . . . . . "Leaderstats Isn't Loading in when the Player joins"^^ . "Why you dont use ```os.date()``` for this? Like: ```print(os.date("!%Hh %Mm %Ss", 5400))``` (printing: ```01h 30m 00s```)"^^ . . . "1"^^ . . "Isn't there a `then` missing as well?"^^ . "1"^^ . . "functional-programming"^^ . "0"^^ . . "<p>I need help, sending a message from discord with my bot.js I can create it but I need to do this from a function:</p>\n<pre class="lang-js prettyprint-override"><code>exports('runJS', (data) =&gt; {\n console.log(data.name);\n \n client.channels.cache.get(`ID`).send(data.name);\n \n let role = client.guilds.cache.get(&quot;id&quot;); //member.roles.cache.has\n \n if (data != null) {\n client.guild.channels.create(&quot;││&quot; + data.name, { \n type: &quot;GUILD_TEXT&quot;, // syntax has changed a bit\n parent: &quot;1157076981159034880&quot;,\n permissionOverwrites: [\n {\n id: role.id,\n allow: [Permissions.FLAGS.VIEW_CHANNEL],\n },\n {\n id: data.id,\n allow: [Permissions.FLAGS.VIEW_CHANNEL],\n },\n {\n id: client.guild.roles.everyone, //To make it be seen by a certain role, user an ID instead\n //allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], //Allow permissions\n deny: ['VIEW_CHANNEL'] //Deny permissions , 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'\n },\n ],\n }); \n }\n});\n</code></pre>\n<p>I don't know if I was very clear, but this function receives the values that I need to create the channel, this is the one that works for me with a command in the bot:</p>\n<p>I tried replacing <code>message.guild.channels.create</code> with <code>client.guild.channels.create</code> but it didn't work, I get an error like guild is not a function or does not exist.</p>\n"^^ . "2"^^ . "0"^^ . . "4"^^ . . "<p>Good news: Lua has first-class functions so pretty much all of this is possible in plain Lua! (It may be more verbose and/or inefficient, though.)</p>\n<p>Let's start with function composition:</p>\n<pre class="lang-lua prettyprint-override"><code>function compose(f, g)\n return function(...)\n return g(f(...))\n end\nend\n</code></pre>\n<p>I've flipped <code>f</code> and <code>g</code> here, so <code>f(g(x))</code> would be equivalent to <code>compose(g, f)(x)</code>.</p>\n<p>Let's write a left fold on a vararg:</p>\n<pre class="lang-lua prettyprint-override"><code>function foldl(f, acc, ...)\n if select(&quot;#&quot;, ...) == 0 then\n return acc\n end\n local l = ...\n return foldl(f, f(acc, l), select(2, ...))\nend\n</code></pre>\n<p>Let's also define the identity function:</p>\n<pre class="lang-lua prettyprint-override"><code>function id(...) return ... end\n</code></pre>\n<p>Now let's take care of Exhibit A:</p>\n<pre class="lang-lua prettyprint-override"><code>function chain(...) return foldl(compose, id, ...) end\nchain(dont, like, reading, code, backwards)(I)\n</code></pre>\n<p>Since chaining is just composition with another order, it returns a function, so the argument is still on the right. If you're not happy with this, you could write yourself a function which takes the argument and does the call, similar to the threading F# / Clojure have to offer:</p>\n<pre class="lang-lua prettyprint-override"><code>function chaincall(arg, ...) return chain(...)(arg) end\n</code></pre>\n<p>Now your Exhibit A becomes <code>chaincall(I, dont, like, reading, code, backwards)</code>.</p>\n<p>Exhibit B is pretty much the same: You can do <code>chain(foo, bar, baz, quux)(...)</code>. <code>chaincall</code> won't work with a vararg as first parameter, though: The vararg would be truncated to its first value.</p>\n<p>Voilà! Essentially we've implemented Clojure's <code>-&gt;&gt;</code> now: <code>chaincall(x, ...)</code> is equivalent to <code>(-&gt;&gt; x ...)</code>.</p>\n<p>F#'s <code>|&gt;</code> is somewhat harder to do, because it requires us to somehow deal with a list of arguments to follow the &quot;threaded&quot; argument per function. One way to do it would be using a &quot;right curry&quot; which appends arguments to a function call:</p>\n<pre class="lang-lua prettyprint-override"><code>function curry_right(f, ...)\n local args, n_curried = {...}, select(&quot;#&quot;, ...)\n return function(...)\n local n = select(&quot;#&quot;, ...)\n local concat = {...}\n for i = 1, n_curried do\n concat[n + i] = args[i]\n end\n return f(table.unpack(concat, 1, n + n_curried))\n end\nend\n</code></pre>\n<p>Then you could just do:</p>\n<pre class="lang-lua prettyprint-override"><code>chaincall(range(0, 100),\n curry_right(List.filter, isEven, numbers),\n curry_right(List.map, double, evenNumbers),\n curry_right(List.iter, printNumber, doubledNumbers))\n</code></pre>\n<p>similar to F# (assuming suitable definitions of <code>range</code> etc.)</p>\n<hr />\n<p>As is often the case in Lua, it gives you the power to implement this yourself, pushing tradeoffs and design decisions on you.</p>\n<p>Even with the simple implementations I have provided, there are discussions to be had:</p>\n<ul>\n<li>How to namespace these functions. For simplicity, I'm just &quot;polluting&quot; the global namespace here.</li>\n<li>How to implement these functions. You could consider directly implementing a <code>compose_multiple</code> using a table of functions, for example. You could consider using the identity function and making a fold which requires a vararg with at least one element.</li>\n<li>How / whether to optimize these functions. I brushed performance concerns aside here.</li>\n</ul>\n<p>A related library worth mentioning is <a href="https://github.com/luafun/luafun" rel="nofollow noreferrer"><code>luafun</code></a>, which provides functions like <code>filter</code> and <code>map</code>. That library also showcases another frequently chosen way of (emulating) this &quot;chaining&quot;: By means of &quot;methods&quot; on &quot;objects&quot; (tables with metatables) which in turn return the objects. For example you could have an &quot;iterator&quot; object. Calling <code>iterator:filter(f)</code> would return a new iterator, on which you could then call <code>map</code>: <code>iterator:filter(f):map(g)</code> etc.</p>\n<hr />\n<p>Using Lua's metatables, you could even get some syntactic sugar. Let's repurpose the right shift operator (<code>f &gt;&gt; g</code>) for &quot;flipped&quot; function composition:</p>\n<pre class="lang-lua prettyprint-override"><code>debug.setmetatable(function()end, {__shr = function(g, f) return function(...) return f(g(...)) end end})\nfunction square(x) return x^2 end\n(square &gt;&gt; print)(4) -- 16.0\n</code></pre>\n<p>(In older Lua versions, you'd have to use a different operator. Also note that this probably isn't the best idea in &quot;serious&quot; code due to performance and readability concerns; such &quot;abuse&quot; of the debug library is usually frowned upon in &quot;serious&quot; code, and many &quot;safe&quot; environments may remove or restrict the <code>debug</code> library altogether. Static analysis tools might also get confused.)</p>\n"^^ . "1"^^ . "@LucRiffault Huh, that is strange. What is the platform that you're using?"^^ . "1"^^ . . . "0"^^ . "0"^^ . . "debugging"^^ . . "<p>I try to make a script for pathfinding but it doesn't work. It says &quot;MoveTo() is not a valid member Path &quot;Instance&quot;&quot; Is it because MoveTo() doesn't work and more importantly, what alternatives do I have?</p>\n<blockquote>\n<pre><code>local PathFindingService = game:GetService(&quot;PathfindingService&quot;)\nlocal Agent = game.Workspace.StarterCharacter.Humanoid\nAgentRadius = 2 -- Settings Agent\nAgentHeight = 5 \nAgentCanJump = false\nAgentCanClimb = false\nAgentSlope = 10\nAgentMaxAcceleration = 1000\nAgentMaxSpeed = 16 \nAgentArrivalDistance = 1 -- end settings agent\nprint(type(PathFindingService))\nwhile true do\n if Agent then\n local destination= Vector3.new(math.random(-571,165),5.5,math.random(-495,361))\n print(true)\n \n if destination then\n \n local path = PathFindingService:CreatePath()\n \n \n if path then\n \n print(true)\n start = Agent.HumanoidRootPart.Position \n if start then\n path:ComputeAsync(start, destination) \n path:MoveTo(Agent) --error\n \n \n else \n print (false)\n end \n \n \n end\n \n \n end\n \n \n end\n \n wait(5)\n \nend\n</code></pre>\n</blockquote>\n"^^ . "<p>There seems to be no easy way to alter or substitute the <code>\\caption</code> macro with a Lua filter converting from Markdown to Latex using pandoc, because the Latex control sequence used for the caption is kind of hardcoded in the <a href="https://github.com/jgm/pandoc/blob/main/src/Text/Pandoc/Writers/LaTeX.hs#L596" rel="nofollow noreferrer">Haskell Latex writer</a>.</p>\n<p>But there is another Lua solution using <code>Lua(la)tex</code> which enables the processing of Lua code directly from within the tex document. Therefore, I included the following lines into my custom Latex template called with the <code>--template</code> flag in pandoc:</p>\n<pre class="lang-lua prettyprint-override"><code>\\ifLuaTeX\n\\usepackage{luacode}\n\\begin{luacode*}\n local count = 0\n function replace_caption_with_sidecaption(line)\n if string.find(line, &quot;\\\\begin{figure}.*&quot;) then\n in_figure_env = true\n end\n\n if string.find(line, &quot;\\\\end{figure}&quot;) then\n in_figure_env = false\n end\n\n if in_figure_env and string.find(line, &quot;^(%s*)\\\\caption&quot;) then\n if count == 0 then\n line = line:gsub(&quot;\\\\caption&quot;, &quot;\\\\sidecaption&quot;, 1)\n local count = count + 1\n end\n end\n return line\n end\n\\end{luacode*}\n\\directlua{luatexbase.add_to_callback(&quot;process_input_buffer&quot;, replace_caption_with_sidecaption, &quot;replace_caption_with_sidecaption&quot;)}\n\\fi\n</code></pre>\n<p>This code substitutes evert <code>\\caption</code> string with <code>\\sidecaption</code> as long as it is located inside a <code>figure</code> environment and there the first macro of the line.</p>\n<p>It works great, but, of course, makes <code>Lualatex</code> the mandatory compilation program.</p>\n"^^ . . "2"^^ . . . "While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/35877080)"^^ . . . . . . . . . . . . "keep your config but go to /Users/wmoorby/.local/share/ and delete the nvim folder,\nthen restart your terminal, start nvim and it should load up lazyvim, you could also delete your lazy-lock.json for good measure"^^ . . . . . "1"^^ . . . "0"^^ . . . "0"^^ . . . . . "0"^^ . . . . "<p>To write and read to and from an open file:</p>\n<p>Whenever you successfully perform any <em>read</em> or <em>write</em> operation on a file - regardless of the <em>mode</em> the file was opened with - the <em>file position indicator</em> for the file will have changed.</p>\n<p>For <code>r+</code> (read extended), the <em>file position indicator</em> is initially set to the start of the file, and both reading and writing are allowed<sup>1</sup>. Starting by reading the entire file then places the indicator at the <em>end of the file</em>. Immediately following this with a write operation will then appear as an append, and the file position indicator will <em>still be at the end of the file</em>. Attempting to read at this point will not return any data from the file - you must first <em>seek</em> to a position with data.</p>\n<p>This can be done with <a href="https://www.lua.org/manual/5.4/manual.html#pdf-file:seek" rel="nofollow noreferrer"><code>file:seek</code></a>. For example,</p>\n<pre class="lang-lua prettyprint-override"><code>file:seek('set')\n</code></pre>\n<p>places the file position indicator at the <em>start</em> of the file.</p>\n<p><sup>1.</sup> Note that because Lua's I/O is a very thin wrapper around C's I/O, we should refer to documentation on <a href="https://en.cppreference.com/w/c/io/fopen" rel="nofollow noreferrer"><code>fopen</code></a> to learn the order in which operations may be performed on a file opened for both reading (input) and writing (output):</p>\n<blockquote>\n<p>In update mode (<code>'+'</code>), both input and output may be performed, but output cannot be followed by input without an intervening call to <a href="https://en.cppreference.com/w/c/io/fflush" rel="nofollow noreferrer">fflush</a>, <a href="https://en.cppreference.com/w/c/io/fseek" rel="nofollow noreferrer">fseek</a>, <a href="https://en.cppreference.com/w/c/io/fsetpos" rel="nofollow noreferrer">fsetpos</a> or <a href="https://en.cppreference.com/w/c/io/rewind" rel="nofollow noreferrer">rewind</a>, and input cannot be followed by output without an intervening call to <a href="https://en.cppreference.com/w/c/io/fseek" rel="nofollow noreferrer">fseek</a>, <a href="https://en.cppreference.com/w/c/io/fsetpos" rel="nofollow noreferrer">fsetpos</a> or <a href="https://en.cppreference.com/w/c/io/rewind" rel="nofollow noreferrer">rewind</a>, unless the input operation encountered end of file. In update mode, implementations are permitted to use binary mode even when text mode is specified.</p>\n</blockquote>\n<p>From this we can see that a call to <code>file:write</code> <em>immediately</em> followed by a call <code>file:read</code> is not actually allowed. You must call <code>file:seek</code> (or <a href="https://www.lua.org/manual/5.4/manual.html#pdf-file:flush" rel="nofollow noreferrer"><code>file:flush</code></a>) in-between writing and reading.</p>\n<hr />\n<p>If you want to open your file a <em>second time</em>, in order to read what you have just written, you must first commit these changes to the file with <code>file:flush</code> (or <code>file:close</code>), as otherwise the data is surely buffered (see also <a href="https://www.lua.org/manual/5.4/manual.html#pdf-file:setvbuf" rel="nofollow noreferrer"><code>file:setvbuf</code></a>).</p>\n<hr />\n<p>Aside: you describe immediately writing to a file after opening it with <code>r+</code> mode as having <em>truncated</em> the file, but what is actually happening is the new data is <em>overwriting</em> the previous data. Only when the new data is at least equal in length to the previous data does it appear as though truncation occurred, otherwise the 'tail' of the previous data will remain.</p>\n"^^ . . . . . . . . . . . . . . "peripherial.call("top", clear)"^^ . . . . . "2"^^ . "Aside: `c_array[lua_tointeger(L, n)]` is an invitation for [undefined behaviour](https://en.cppreference.com/w/c/language/behavior) (when the given index is outside the bounds of your array)."^^ . . . . . . . . "1"^^ . . . "@Matt the `<cmd>` was just an example. There is much more of this notation, like `<c-a>` that does not have such a replacement"^^ . "<p>I'm trying to make a script so that when I press a key the loop starts and when I release it the loop ends.</p>\n<p>However, the loop keeps running infinitely, even when I release the key.</p>\n<pre><code>function OnEvent(event, arg)\n\nif (event == &quot;G_PRESSED&quot; and arg == 1) then\n \n repeat \n\n OutputLogMessage(&quot;Loop&quot;)\n \n if (event == &quot;G_RELEASED&quot; and arg == 1) then break end\n\n until (event == &quot;G_RELEASED&quot; and arg == 1)\n \n OutputLogMessage(&quot;End Loop&quot;)\n\n end\n\nend\n</code></pre>\n"^^ . . . . "1"^^ . . "just an additional thing need to inform - Before encode() method, when I tried to print 'response' , I got the table."^^ . "<p>There seems to be a way to do webrequests in vlc. Maybe you can make a simple php/whatever script that will only return after a timed amount like a second or 10 seconds. You will lose portability in the process however it should work as a delay and it should not be a busy wait. I've used sql &quot;waitfor:&quot; in lua scripts before.</p>\n"^^ . . "Stuck whilst applying the step missing from decoding a PNG file, in Luau (defiltering)"^^ . . . . "1"^^ . . "0"^^ . "0"^^ . . . . . . "<p>I am making roblox system, where you buy developer products. When you buy it, it sends HTTP request to my server. Then it returns JSON. The JSON looks like this:</p>\n<pre><code>{\n &quot;Code&quot;: 404,\n &quot;Response&quot;: &quot;Not Found&quot;\n}\n</code></pre>\n<p>(it is ok that the code is 404, it should be) Now if the json [&quot;Code&quot;] value is not 200, the function should return Enum.ProductPurchaseDecision.NotProcessedYet. I think it does, but even after it roblox says the purchase was successful. But I dont want it. I want it that if the API returns something else than 200, the purchase cant be successful. Here is my code</p>\n<pre><code>local Players = game:GetService(&quot;Players&quot;)\nlocal MarketplaceService = game:GetService(&quot;MarketplaceService&quot;)\nlocal HTTPService = game:GetService(&quot;HttpService&quot;)\n\nlocal for1monthid = --productid\n\nMarketplaceService.ProcessReceipt = function(receiptInfo)\n local plr = Players:GetPlayerByUserId(receiptInfo.PlayerId)\n if not plr then\n return Enum.ProductPurchaseDecision.NotProcessedYet\n end\n if receiptInfo.ProductId == for1monthid then\n local url = &quot;https://api.endpoint.com&quot;\n local data = {\n userid = plr.UserId\n }\n data = HTTPService:JSONEncode(data)\n local response = HTTPService:PostAsync(url, data, Enum.HttpContentType.ApplicationJson, false)\n response = HTTPService:JSONDecode(response)\n if response[&quot;Code&quot;] == 200 then\n print(response[&quot;Code&quot;])\n return Enum.ProductPurchaseDecision.PurchaseGranted\n else\n print(response[&quot;Code&quot;])\n return Enum.ProductPurchaseDecision.NotProcessedYet\n end\n end\nend\n</code></pre>\n"^^ . . . . "1"^^ . . . . . "tex"^^ . "Thanks so much for the detailed explanation of what is going on. I had none of this on my radar.\nAlso thanks for the alternatives to my function^^ I*ll probably implement them once everything else works."^^ . "@ben, the error is telling you that `data` is a number, not a table. So when you try to get any property out of `data`, like `data.CoinsAmount`, your code is like, "hey man, this is a number. I can't do that.". Perhaps when you were testing, you saved a number just to see if it would work. Now, instead of returning your nicely formatted table of values, it is still returning that old number the you were using for testing. Try commenting out the `CoinsStore:GetAsync(UID)` logic for one run, then turn it back on and see if the issue persists."^^ . . . "<p><code>combo</code> is declared as a local variable inside the event handler, so every time it receives an event, it starts <code>combo</code> at 0. Instead, <code>combo</code> and <code>startTime</code> should be declared outside of the function.</p>\n<p>Some other small things are that <code>tick()</code> <a href="https://devforum.roblox.com/t/luau-recap-june-2020/632346" rel="nofollow noreferrer">will be deprecated soon</a> so <code>os.time()</code> should be used instead. Additionally, <code>combo = combo + 1</code> can be shortened to <code>combo += 1</code>, and <code>game:GetService(&quot;{serviceName}&quot;)</code> is <a href="https://devforum.roblox.com/t/gameplayers-vs-gamegetserviceplayers-whats-the-difference/334593/7" rel="nofollow noreferrer">recommended</a> over <code>game.{serviceName}</code>. Below, <code>lastHit</code> is used instead of <code>startTime</code> since it tracks the time of the last hit.</p>\n<p>The script after all these fixes:</p>\n<pre class="lang-lua prettyprint-override"><code>local combo = 0\nlocal lastHit = os.time()\n\ngame:GetService(&quot;ReplicatedStorage&quot;).Remotes.M1.OnServerEvent:Connect(function(player, Mouse)\n print(&quot;Received M1 from the Client&quot;)\n combo += 1\n\n if os.time() - lastHit &gt;= 2 then\n combo = 0\n end\n\n lastHit = os.time()\n\n if combo == 3 then\n print(&quot;M1 Combo!&quot;)\n combo = 0\n end\n\n print(combo)\nend)\n</code></pre>\n"^^ . . . "meson-build"^^ . "<p>I am trying to use a Lua script to generate LaTeX commands. Here is a minimal lua script:</p>\n<pre><code>my_array = {\n cmdone = {1, 2},\n cmdtwo = {2, 3}\n}\n\ncmd_template = &quot;\\\\newcommand*{\\\\%s}{number one: %s, number two: %s}&quot;\n\nfunction mkcommands()\n for k, v in pairs(my_array) do\n -- print(string.format(cmd_template, k, v[1], v[2]))\n tex.print(string.format(cmd_template, k, v[1], v[2]))\n end\nend\n</code></pre>\n<p>And here is the TeX file:</p>\n<pre><code>\\documentclass[12pt]{article}\n\n\\usepackage{luacode}\n\n\\begin{luacode}\ndofile(&quot;test.lua&quot;)\nmkcommands()\n\\end{luacode}\n\n%\\newcommand*{\\cmdtwo}{number one: 2, number two: 3}\n%\\newcommand*{\\cmdone}{number one: 1, number two: 2}\n\n\\begin{document}\n\n\\cmdone\n\n\\cmdtwo\n\n\\end{document}\n</code></pre>\n<p>When I run <code>lualatex test.tex</code>, I get <code>Undefined control sequence l. 15 \\cmdone</code>.</p>\n<p>What am I doing wrong? Can this even be done?</p>\n<p>I used the commented &quot;print&quot; command in the lua code to show that what was being generated looked correct. I then pasted the generated <code>\\newcommand</code> commands into the TeX file to verify that they were working--producing the expected output</p>\n<pre><code>number one: 1, number two: 2 number one: 2, number two: 3\n</code></pre>\n<p>But it seems the <code>print()</code> and <code>tex.print</code> commands are producing different output.</p>\n"^^ . . . . "0"^^ . "The whole purpose of "cmd" is NEVER to execute the RHS as "normal". Otherwise, prefer "colon" notation."^^ . . . . . . . . . "0"^^ . . "1"^^ . "The question is not Lua-specific. The same problem should exist in C. Lua functions are just wrappers around C standard library functions. BTW, their behavior depends on: 1) your OS and 2) CRT library Lua is built with."^^ . . . . . . . . "0"^^ . . . "<p>I'm using nvchad neovim setup with typescript lsp. Lsp works just fine and opens me list with suggestions to autocomplete, but only when I start typing something. What I want to be able to do is to trigger this suggestions list to pop up by pressing some hotkey</p>\n<p>There is how it looks like</p>\n<p><a href="https://i.sstatic.net/scPBR.png" rel="nofollow noreferrer">No typing</a></p>\n<p><a href="https://i.sstatic.net/uztXz.png" rel="nofollow noreferrer">Started typing</a></p>\n<p>I don't know if it useful, but I use next plugins for lsp:</p>\n<ul>\n<li>nvim-lspconfig</li>\n<li>mason.nvim</li>\n<li>mason-lspconfig.nvim</li>\n</ul>\n<p>Also nvchad configuration has auto setup for nvim-cmp and LuaSnip plugins. I didn't configure them manually</p>\n"^^ . . "1"^^ . "<p>I recently started working on pktgen and got everything set up in Centos 7.9 on a server. Pktgen it self is running fine and lua is also working fine in system. Pktgen is able to detect and loading lua saying &quot;lua enabled&quot; and &quot;Dependency lua found: YES 5.1.4 (cached)&quot; but shows &quot;lua_enabled: -Denable_lua=false&quot;. Also I edited the meson_option.txt to &quot;option('enable_lua', type: 'boolean', value: true, description: 'Enable Lua support')&quot; and rebuild with &quot;meson -Denable_lua=true --reconfigure build&quot;. Still when I run the test hello world lua script with the following command inside pktgen console:\n<code>./usr/local/bin/pktgen -- -m &quot;[2:4].0&quot;</code>\n<code>script test/hello-world.lua</code>\nI get the error:</p>\n<blockquote>\n<blockquote>\n<blockquote>\n<p>User State for CLI not set for Lua, please build with Lua enabled</p>\n</blockquote>\n</blockquote>\n</blockquote>\n<p><strong>meson_options.txt</strong></p>\n<pre><code>option('enable_lua', type: 'boolean', value: true, description: 'Enable Lua support')\noption('enable_gui', type: 'boolean', value: false, description: 'build the gui')\noption('enable_docs', type: 'boolean', value: false, description: 'build documentation')\noption('enable-avx', type: 'boolean', value: true, description: 'Try to compile with AVX support')\noption('enable-avx2', type: 'boolean', value: false, description: 'Try to compile with AVX2 support')\noption('only_docs', type: 'boolean', value: false, description: 'Only build documentation')\n</code></pre>\n<p><strong>meson.build</strong></p>\n<pre><code>project('pktgen', 'C',\n version: run_command(find_program('cat', 'more'),\n files('VERSION'), check:false).stdout().strip(),\n\n license: 'BSD',\n default_options: [\n 'buildtype=release',\n 'default_library=static',\n 'warning_level=3',\n 'werror=true'\n ],\n meson_version: '&gt;= 0.47.1'\n)\n\npktgen_conf = configuration_data()\n\n# set up some global vars for compiler, platform, configuration, etc.\ncc = meson.get_compiler('c')\n\ntarget = target_machine.cpu_family()\nif (target != 'riscv64')\n add_project_arguments('-march=native', language: 'c')\nendif\n\nif get_option('enable-avx') and cc.has_argument('-mavx')\n add_project_arguments('-mavx', language: 'c')\nendif\nif get_option('enable-avx2') and cc.has_argument('-mavx2')\n add_project_arguments('-mavx', language: 'c')\nendif\nadd_project_arguments('-DALLOW_EXPERIMENTAL_API', language: 'c')\nadd_project_arguments('-D_GNU_SOURCE', language: 'c')\n\n# enable extra warnings and disable any unwanted warnings\nwarning_flags = [\n '-Wno-pedantic',\n '-Wno-format-truncation',\n]\nforeach arg: warning_flags\n if cc.has_argument(arg)\n add_project_arguments(arg, language: 'c')\n endif\nendforeach\n\nlua_dep = dependency('', required: false)\n\nif get_option('enable_lua')\n message('&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; Lua enabled &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;')\n add_project_arguments('-DLUA_ENABLED', language: 'c')\n\n lua_names = ['lua', 'lua-5.3', 'lua5.3', 'lua-5.4', 'lua5.4']\n foreach n:lua_names\n lua_dep = dependency(n, required: false)\n if not lua_dep.found()\n lua_dep = cc.find_library(n, required: false)\n endif\n if lua_dep.found()\n break\n endif\n endforeach\n if not lua_dep.found()\n error('unable to find Lua')\n endif\nendif\n\nif get_option('only_docs')\n subdir('tools')\n subdir('doc')\nelse\n dpdk = dependency('libdpdk', required: true)\n # message('prefix: ' + get_option('prefix') + ' libdir: ' + get_option('libdir'))\n\n dpdk_libs_path = join_paths(get_option('prefix'), get_option('libdir'))\n # message('DPDK lib path: ' + dpdk_libs_path)\n\n dpdk_bond = cc.find_library('librte_net_bond', dirs: [dpdk_libs_path], required: false)\n\n subdir('tools')\n\n subdir('lib')\n\n subdir('app')\n\n subdir('doc')\nendif\n</code></pre>\n<p><strong>Make output</strong></p>\n<pre><code>$ make\n&gt;&gt;&gt; Use 'make help' for more commands\\n\n./tools/pktgen-build.sh build\n&gt;&gt; SDK Path : /home\n&gt;&gt; Install Path : /home/pktgen-dpdk-pktgen-23.03.0\n&gt;&gt; Build Directory : /home/pktgen-dpdk-pktgen-23.03.0/Builddir\n&gt;&gt; Target Directory : usr/local\n&gt;&gt; Build Path : /home/pktgen-dpdk-pktgen-23.03.0/Builddir\n&gt;&gt; Target Path : /home/pktgen-dpdk-pktgen-23.03.0/usr/local\n\n Build and install values:\n lua_enabled : -Denable_lua=false\n gui_enabled : -Denable_gui=false\n\n&gt;&gt;&gt; Ninja build in '/home/pktgen-dpdk-pktgen-23.03.0/Builddir' buildtype=release\nmeson -Dbuildtype=release -Denable_lua=false -Denable_gui=false /home/pktgen-dpdk-pktgen-23.03.0/Builddir\nDirectory already configured.\n\nJust run your build command (e.g. ninja) and Meson will regenerate as necessary.\nIf ninja fails, run &quot;ninja reconfigure&quot; or &quot;meson --reconfigure&quot;\nto force Meson to regenerate.\n\nIf build failures persist, run &quot;meson setup --wipe&quot; to rebuild from scratch\nusing the same options as passed when configuring the build.\nTo change option values, run &quot;meson configure&quot; instead.\nninja: Entering directory `/home/pktgen-dpdk-pktgen-23.03.0/Builddir'\n[0/1] Regenerating build files.\nThe Meson build system\nVersion: 0.55.1\nSource dir: /home/pktgen-dpdk-pktgen-23.03.0\nBuild dir: /home/pktgen-dpdk-pktgen-23.03.0/Builddir\nBuild type: native build\nProgram cat found: YES\nUsing 'PKG_CONFIG_PATH' from environment with value: '/usr/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/opt/rh/devtoolset-8/root/usr/lib64/pkgconfig'\nWARNING: PKG_CONFIG_PATH environment variable has changed between configurations, meson ignores this. Use -Dpkg_config_path to change pkg-config search path instead.\nUsing 'PKG_CONFIG_PATH' from environment with value: '/usr/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/opt/rh/devtoolset-8/root/usr/lib64/pkgconfig'\nWARNING: PKG_CONFIG_PATH environment variable has changed between configurations, meson ignores this. Use -Dpkg_config_path to change pkg-config search path instead.\nProject name: pktgen\nProject version: 23.03.0\nC compiler for the host machine: cc (gcc 8.3.1 &quot;cc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)&quot;)\nC linker for the host machine: cc ld.bfd 2.30-55\nHost machine cpu family: x86_64\nHost machine cpu: x86_64\nCompiler for C supports arguments -mavx: YES (cached)\nCompiler for C supports arguments -mavx2: YES (cached)\nCompiler for C supports arguments -Wno-pedantic -Wpedantic: YES (cached)\nCompiler for C supports arguments -Wno-format-truncation -Wformat-truncation: YES (cached)\nDependency libdpdk found: YES 23.03.0 (cached)\nLibrary librte_net_bond found: YES\nProgram python3 found: YES (/usr/bin/python3)\nLibrary rte_net_i40e found: YES\nLibrary rte_net_ixgbe found: YES\nLibrary rte_net_ice found: YES\nLibrary rte_bus_vdev found: YES\nDependency threads found: YES unknown (cached)\nLibrary numa found: YES\nLibrary pcap found: YES\nLibrary dl found: YES\nLibrary m found: YES\nProgram doxygen found: YES\nProgram generate_doxygen.sh found: YES\nProgram generate_examples.sh found: YES\nProgram doxy-html-custom.sh found: YES\nConfiguring doxy-api.conf using configuration\nProgram sphinx-build found: YES\nBuild targets in project: 12\n\nFound ninja-1.10.2 at /usr/bin/ninja\nninja: no work to do.\n&gt;&gt;&gt; Ninja install to '/home/pktgen-dpdk-pktgen-23.03.0/usr/local'\nninja: Entering directory `/home/pktgen-dpdk-pktgen-23.03.0/Builddir'\n[0/1] Installing files.\nInstalling app/pktgen to /home/pktgen-dpdk-pktgen-23.03.0/usr/local/bin\nInstalling /home/pktgen-dpdk-pktgen-23.03.0/doc/source/custom.css to /home/pktgen-dpdk-pktgen-23.03.0/usr/local/share/doc/dpdk/_static/css\n</code></pre>\n<p>Any help is greatly appreciated, thanks in advance.</p>\n<p>Edit:\n<strong>meson -Denable_lua=true --reconfigure build</strong></p>\n<pre><code>meson -Denable_lua=true --reconfigure build\nThe Meson build system\nVersion: 0.55.1\nSource dir: /home/pktgen-dpdk-pktgen-23.03.0\nBuild dir: /home/pktgen-dpdk-pktgen-23.03.0/build\nBuild type: native build\nProgram cat found: YES\nUsing 'PKG_CONFIG_PATH' from environment with value: '/usr/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/opt/rh/devtoolset-8/root/usr/lib64/pkgconfig'\nWARNING: PKG_CONFIG_PATH environment variable has changed between configurations, meson ignores this. Use -Dpkg_config_path to change pkg-config search path instead.\nUsing 'PKG_CONFIG_PATH' from environment with value: '/usr/lib64/pkgconfig:/usr/local/lib64/pkgconfig:/opt/rh/devtoolset-8/root/usr/lib64/pkgconfig'\nWARNING: PKG_CONFIG_PATH environment variable has changed between configurations, meson ignores this. Use -Dpkg_config_path to change pkg-config search path instead.\nProject name: pktgen\nProject version: 23.03.0\nC compiler for the host machine: cc (gcc 8.3.1 &quot;cc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)&quot;)\nC linker for the host machine: cc ld.bfd 2.30-55\nHost machine cpu family: x86_64\nHost machine cpu: x86_64\nCompiler for C supports arguments -mavx: YES (cached)\nCompiler for C supports arguments -Wno-pedantic -Wpedantic: YES (cached)\nCompiler for C supports arguments -Wno-format-truncation -Wformat-truncation: YES (cached)\nMessage: &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; Lua enabled &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;\nDependency lua found: YES 5.1.4 (cached)\nDependency libdpdk found: YES 23.03.0 (cached)\nLibrary librte_net_bond found: YES\nProgram python3 found: YES (/usr/bin/python3)\nLibrary rte_net_i40e found: YES\nLibrary rte_net_ixgbe found: YES\nLibrary rte_net_ice found: YES\nLibrary rte_bus_vdev found: YES\nDependency threads found: YES unknown (cached)\nLibrary numa found: YES\nLibrary pcap found: YES\nLibrary dl found: YES\nLibrary m found: YES\nProgram doxygen found: YES\nProgram generate_doxygen.sh found: YES\nProgram generate_examples.sh found: YES\nProgram doxy-html-custom.sh found: YES\nConfiguring doxy-api.conf using configuration\nProgram sphinx-build found: YES\nBuild targets in project: 12\n\nFound ninja-1.10.2 at /usr/bin/ninja\n</code></pre>\n"^^ . "`coroutine.wrap(handle)(client)` is basically the same as `handle(client)` - coroutines don't do what you think they do. Apparently you can use the [`select`](https://stackoverflow.com/questions/16004612/how-do-i-use-socket-select) function to handle several sockets at the same time."^^ . . . "2"^^ . . . . . . . . . "0"^^ . "1"^^ . "<ol>\n<li>If the variable is in the TAB menu then <code>Stats</code> is supposed to be named <code>leaderstats</code></li>\n<li>If the variable is a Gui then change the text in the gui</li>\n</ol>\n"^^ . "3"^^ . . . . "<p>You can do this with a Lua filter by using the <a href="https://www.envoyproxy.io/docs/envoy/v1.28.0/configuration/http/http_filters/lua_filter#dynamic-metadata-object-api" rel="nofollow noreferrer">Dynamic Metadata object API</a>. Here's an example below that will:</p>\n<ul>\n<li>read the <code>x-my-header</code> header from the request</li>\n<li>set a header <code>x-my-header-is-a</code> in the response according to <code>x-my-header</code> value:\n<ul>\n<li>if <code>x-my-header</code> is <code>A</code>, it will set <code>x-my-header-is-a: true</code></li>\n<li>otherwise, it will set <code>x-my-header-is-a: false</code></li>\n</ul>\n</li>\n</ul>\n<p>The trick here is to use the Dynamic Metadata struct to share things between <code>envoy_on_request</code> and <code>envoy_on_response</code>.</p>\n<p>With <code>/etc/lua/filter.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>function envoy_on_request(request_handle)\n -- store &quot;x-my-header&quot; in the dynamic metadata\n request_handle:streamInfo():dynamicMetadata():set(&quot;envoy.filters.http.lua&quot;,\n &quot;x-my-header&quot;, request_handle:headers():get(&quot;x-my-header&quot;)\n )\nend\n\nfunction envoy_on_response(response_handle)\n -- retrieve &quot;x-my-header&quot; from the dynamic metadata\n local my_header = response_handle:streamInfo():dynamicMetadata():get(&quot;envoy.filters.http.lua&quot;)[&quot;x-my-header&quot;]\n \n -- insert your custom logic here; in this dummy example, set &quot;x-my-header-is-a&quot; according to &quot;x-my-header&quot;\n if my_header == &quot;A&quot; then\n response_handle:headers():add(&quot;x-my-header-is-a&quot;, &quot;true&quot;)\n else\n response_handle:headers():add(&quot;x-my-header-is-a&quot;, &quot;false&quot;)\n end\nend\n</code></pre>\n<p>You can use it in your envoy config like this:</p>\n<pre class="lang-yaml prettyprint-override"><code>http_filters:\n - name: envoy.filters.http.lua\n typed_config:\n &quot;@type&quot;: type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua\n default_source_code:\n filename: /etc/lua/filter.lua\n # other filters\n</code></pre>\n<p>I've tested it with envoy v1.28.0, and it works perfectly:</p>\n<pre class="lang-bash prettyprint-override"><code>$ # test 1, no &quot;x-my-header&quot; header in the request\n$ curl -s -I localhost:8080 | grep &quot;x-my-header-is-a&quot;\nx-my-header-is-a: false\n\n$ # test 2, header &quot;x-my-header&quot; = &quot;A&quot; in the request\n$ curl -s -I -H &quot;x-my-header: A&quot; localhost:8080 | grep &quot;x-my-header-is-a&quot;\nx-my-header-is-a: true\n\n$ # test 3, header &quot;x-my-header&quot; != &quot;A&quot; in the request\n$ curl -s -I -H &quot;x-my-header: B&quot; localhost:8080 | grep &quot;x-my-header-is-a&quot; \nx-my-header-is-a: false\n</code></pre>\n<p>Credit also goes to this answer here: <a href="https://github.com/envoyproxy/envoy/issues/4613#issuecomment-701799475" rel="nofollow noreferrer">https://github.com/envoyproxy/envoy/issues/4613#issuecomment-701799475</a>.</p>\n"^^ . "0"^^ . . . . "0"^^ . "<p>Usually, when there are no errors or print messages, it means a few things:</p>\n<ol>\n<li>The script didn't run because it was in a context where It couldn't (This is unlikely here but you can always make sure it isn't the problem)</li>\n<li>Wait for child or an event got stuck on something because it doesn't exist. (Try waiting ~10 ish seconds you might see an orange warning message in the console)</li>\n</ol>\n<p>Here is the revised code, with comments, which may help you find the problem.</p>\n<pre class="lang-lua prettyprint-override"><code>print(&quot;The script ran!&quot;) -- Use this to figure out if the script is in a context where it can run, it probably can.\n\nlocal player = game.Players.LocalPlayer\nlocal character = player.Character or player.CharacterAdded:Wait()\nlocal hum = character:WaitForChild(&quot;Humanoid&quot;)\nlocal animator = hum:WaitForChild(&quot;Animator&quot;)\n\nprint(&quot;Animator was loaded!&quot;) -- Use this to know that :WaitForChild() didn't get stuck looking for character/humanoid/animator\n\nlocal tool = script.Parent\n\nlocal leftPunch = animator:LoadAnimation(script:WaitForChild(&quot;RookieLeftPunch&quot;))\nlocal rightPunch = animator:LoadAnimation(script:WaitForChild(&quot;RookieRightPunch&quot;))\n\nprint(&quot;Animations were loaded!&quot;) -- Use this to know that :WaitForChild() didn't get stuck looking for your animations\n\nlocal currentPunch = 0\n\nlocal debounce = false \n\n-- Using tool.equipped would be unreliable, as it would keep :Connecting tool.Activated every time it is equipped, which is not a good practice.\n-- Tool.activated only runs when the tool is equipped anyway, so it's more efficient\ntool.Activated:Connect(function()\n if debounce then return end\n\n debounce = true\n\n print(&quot;Current punch&quot; .. currentPunch) -- More efficient way to debug and tells you if it's not 1, 2 or 3\n if currentPunch == 0 then\n rightPunch:Play()\n task.wait(0.4)\n elseif currentPunch == 1 then\n leftPunch:Play()\n task.wait(0.4)\n elseif currentPunch == 2 then\n rightPunch:Play()\n task.wait(0.8)\n end\n\n if currentPunch == 2 then\n currentPunch = 0\n else\n currentPunch += 1\n end\n \n -- Safer and more efficient to put a single debounce = false at the end, in case currentPunch isn't 1, 2, or 3 for some reason\n debounce = false\nend)\n</code></pre>\n"^^ . . "<p>So I am making data store for a simulator type game on roblox studio using luau and got this error which i cant crack.</p>\n<p>Heres the code</p>\n<pre><code>local DataStoreService = game:GetService(&quot;DataStoreService&quot;)\nlocal CoinsStore = DataStoreService:GetDataStore(&quot;CoinsStore&quot;)\n\ngame.Players.PlayerAdded:Connect(function(player)\n local stats = Instance.new(&quot;Folder&quot;, player)\n stats.Name = &quot;Stats&quot;\n\n local leaderstats = Instance.new(&quot;Folder&quot;, player)\n leaderstats.Name = &quot;leaderstats&quot;\n\n local Coins = Instance.new(&quot;IntValue&quot;, leaderstats)\n Coins.Name = &quot;Coins&quot;\n\n local Rebirths = Instance.new(&quot;IntValue&quot;, leaderstats)\n Rebirths.Name = &quot;Rebirths&quot;\n\n local StomachMaxSpace = Instance.new(&quot;IntValue&quot;, stats)\n StomachMaxSpace.Name = &quot;StomachMaxSpace&quot;\n\n local Stomach = Instance.new(&quot;IntValue&quot;, stats)\n Stomach.Name = &quot;Stomach&quot;\n \n local UID = player.UserId\n \n --Load Data\n \n local data\n \n \n local success, errormessage = pcall(function()\n \n data = CoinsStore:GetAsync(UID)\n end)\n \n if success then\n Coins.Value = data.CoinsAmount\n StomachMaxSpace.Value = data.StomachCapacity\n Stomach.Value = data.Stomach\n end\n \n \n \nend) \n\n--save data\n\ngame.Players.PlayerRemoving:Connect(function(player)\n local UID = player.UserId\n \n local data = {\n CoinsAmount = player.leaderstats.Coins.Value,\n StomachCapacity = player.Stats.StomachMaxSpace.Value,\n Stomach = player.Stats.Stomach.Value\n } \n \n local success, errormessage = pcall(function()\n CoinsStore:SetAsync(UID, data)\n end)\n \n if success then\n print(&quot;All Data Saved&quot;)\n end\n \n \n \nend)\n</code></pre>\n<p>Please Help me solve the error because I need to get this game out</p>\n<p>Error: ServerScriptService.Script:36: attempt to index number with 'CoinsAmount'</p>\n"^^ . . . "<p>So, this is the thing. In my local script, i've got a global function which recognizes when the user is holding down a key and sets to true a boolean that fires a local function, which is VERY large.</p>\n<p>The local function in question:</p>\n<pre><code>local function pegarunbalazo()\n if cargador ~= 0 and not waza and not alhombro then\n\n -- 78 lines of code, of which some define variables, later...\n \n task.wait (0.1) \n\nend\n</code></pre>\n<p>The global function in question:</p>\n<pre><code> conn = UIS.InputBegan:Connect(function(input, gameProcessedEvent)\n if input.UserInputType == Enum.UserInputType.MouseButton1 then\n if debounce then return end\n\n debounce=true\n triggering = true\n\n while triggering do\n pegarunbalazo()\n \n end\n \n debounce=false\n \n end\n \n end)\n</code></pre>\n<p>How useful is this? does it reduce the memory used? does it make it less eficcent? would it be the same to place the code inside of the local function directly into the global one?</p>\n<p>Any kind of help, suggestion, or fix provided will be aprecciated and taken into account.</p>\n"^^ . . "<p>To solve my <a href="https://stackoverflow.com/questions/77504584/pandoc-md-latex-write-lua-filter-to-change-latex-macro-used-for-caption">concrete question</a> (asked also on the Pandoc mailing list, which, unfortunatley, seems to be down due to spam mails at the moment) regarding using the Latex <code>\\sidecaption</code> command in a figure element exported to Latex, I'm now trying to understand the processing of Lua writers/filters and especially the accessing of field values for Pandoc more generally.</p>\n<p>The main question is, how can I access the values of the <a href="https://pandoc.org/lua-filters.html#type-figure" rel="nofollow noreferrer">fields of a pandoc.Figure</a> to rearrange them in the output through a custom writer; especially the fields <code>content</code> (image), <code>caption</code> and <code>attr</code>. I checked the pandoc docs and some examples from the web, but couldn't find many maybe due to the overhaul for figures in Pandoc 3.0.</p>\n<p>So far I got the following code:</p>\n<pre class="lang-lua prettyprint-override"><code>function Writer (doc, opts)\n local filter = {\n Figure = function (fig)\n local tester = '\\\\begin{figure*}\\n' .. fig.content .. '\\n\\\\end{figure*}\\n' -- or/and fig.caption\n return pandoc.RawBlock('latex', tester)\n end\n }\n return pandoc.write(doc:walk(filter), 'latex', opts)\nend\n</code></pre>\n<p>If I call the writer (together with my custom template) like this <code>pandoc --template=mytemplate -t test-writer.lua ast-test.txt -o ast-test.tex</code>, I get the error <code>bad argument #2 to 'concat' (table expected, got string)</code> for the line containing the code when called with <code>fig.content</code>; and the error <code>attempt to concatenate a table value (field 'caption')</code> when called with <code>fig.caption</code>; for the latter case I also tried <code>fig.caption.long</code> which also results in <code>(table expected, got string)</code>.</p>\n<p>But when I call it without any <code>fig.</code> content, I get an empty <code>{figure*}</code> (starred!) Latex environment in the output file without any error messages. Thus, the method seems to work, but I just can't figure out how to access the field values of the Figure block.</p>\n<p>The test file ast-test.txt only contains a few lines:</p>\n<pre class="lang-markdown prettyprint-override"><code>---\ntitle: A title\n---\n\n# Einleitung\n\nSome text\n\n![caption *to* an image](counter_plot_new_periods.png)\n</code></pre>\n<p><strong>Edit</strong></p>\n<p>I tried an approach using a Lua filter instead of a Lua custom writer (inspired from <a href="https://stackoverflow.com/a/66982937/19647155">this answer</a> by @tarleb):</p>\n<pre class="lang-lua prettyprint-override"><code>function Figure (elem)\n raw_elem = '\\\\begin{figure*}\\n' ..\n '\\\\centering\\n' .. \n '\\\\includegraphics[width=0.9\\\\textwidth]{' .. elem.content .. '}\\n' .. \n '\\\\caption{' .. elem.caption .. '}\\n' .. \n '\\\\end{figure*}'\n return pandoc.RawBlock('latex', raw_elem)\nend\n</code></pre>\n<p>but get the same error. This version also works if I remove the <code>elem.(...)</code> parts and renders the Latex commands correctly in the .tex file. But of course I need the values of the fields from the figure block to get a working Latex document.</p>\n<p><strong>2nd Edit</strong>:</p>\n<p>I played around a little bit more and at least got the content of the caption with <code>pandoc.utils.stringify</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>Figure = function(elem)\n Caption = pandoc.utils.stringify(elem.caption.long)\n local raw_elem = '\\\\begin{figure*}\\n' .. Caption .. '\\n\\\\end{figure*}'\n return pandoc.RawBlock('latex', raw_elem)\nend\n</code></pre>\n<p>This outputs the content of <code>elem.caption.long</code> but, as mentioned in the docs, erases <strong>all</strong> formatting, thus, also the emphasised &quot;to&quot; in the caption.</p>\n<p>Furthermore, this is no solution for the image content of the <code>Figure</code> which is a pandoc function on its own, which should be preserved inside the edited <code>Figure</code> function...</p>\n<hr />\n<p>I appreciate any hint how to access those Figure field values correctly in Lua!</p>\n"^^ . . "0"^^ . . "0"^^ . . . . . "0"^^ . "<p>I believe <code>CoinsStore:GetAsync(UID)</code> is returning a number, if this function is returning an error code, then you might want to check the return value of the function as well before continuing.</p>\n"^^ . . . . "1"^^ . . . "0"^^ . . "0"^^ . "2"^^ . . . . . "<blockquote>\n<p>Could please someone explain how to increase items and arena size?</p>\n</blockquote>\n<p>They are increased automatically. 99% of <code>items_used_ratio</code> and <code>arena_used_ratio</code> is fine so long as <code>quota_used_ratio</code> is low (40% in your case).</p>\n<p><strong>Actually it was a bug in the code that raises the warning, it <a href="https://github.com/tarantool/cartridge/commit/3dfe186d56ac672a72f8663c805a3270847d8b75" rel="nofollow noreferrer">was fixed</a> in <code>cartridge</code> version <code>2.7.9</code>.</strong></p>\n"^^ . . "game-development"^^ . "<p>Exercise 21.4: A variation of the dual representation is to implement objects using proxies (the section called “Tracking table accesses”). Each object is represented by an empty proxy table. An internal table maps proxies to tables that carry the object state. This internal table is not accessible from the outside, but methods use it to translate their self parameters to the real tables where they operate. Implement the Account example using this approach and discuss its pros and cons.</p>\n<pre><code>local AccountProxy = {}\n\n-- Internal table mapping proxies to actual Account tables\nlocal accounts = {}\n\nfunction AccountProxy:new()\n local proxy = {}\n local account = {balance = 0}\n accounts[proxy] = account\n\n setmetatable(proxy, { \n __index = self,\n })\n\n return proxy\nend\n\nfunction AccountProxy:withdraw(v)\n accounts[self].balance = (accounts[self].balance or 0) - v\nend\n\nfunction AccountProxy:deposit(v) \n accounts[self].balance = (accounts[self].balance or 0) + v \nend\n\nfunction AccountProxy:getBalance()\n return accounts[self].balance or 0\nend\n\n-- Example usage\nlocal acc_1 = AccountProxy:new() -- acc_1 is the proxy\n \nacc_1.deposit(100.0) \nprint(acc_1.getBalance()) -- 100.0\nacc_1.withdraw(50.0)\nprint(acc_1.getBalance()) -- 50.0\n</code></pre>\n<p>I get attempt to index a nil value (field '?'). Any suggestion?</p>\n<p>I need encapsulation on Account object and balance as Account's property</p>\n"^^ . . . "0"^^ . . . . . "I would iterate over lines and use some regex, e.g., `^([^{]*){[^{]*}\\s*([0-9\\.]*)\\s*(.*)` or similar. (First capture has excess spaces and Unknown case not handled yet)"^^ . . . . "0"^^ . . . . "I meant the `%` before `\\newcommand` in your tex file."^^ . "0"^^ . . . "0"^^ . "tcpserver"^^ . "Custom highlighting of header in alpha starting screen plugin of nvim not working"^^ . "Well, I'll give it a try and let you know what I find out and I'll accept your answer if it works."^^ . . "1"^^ . "0"^^ . . . . "<p>Alright, so this might seem easy, but it wont stop trying to index nil for character, or it just wont move, or it'll move, but wont kill the targeted player (Theres only one allowed in a server at a time.)</p>\n<p>I will describe what the entity is like before I show the current code that I have for it. This entity is meant to spawn around the player after a long but random amount of time. This monster can phase through walls so the only ways to get away from it is to run far enough away or shine it with a flashlight. This entity has a customizable speed counter that controls how fast it moves (obviously). I keep having errors with its main code so I cant test it out.</p>\n<p>This is the code I have for it.</p>\n<pre><code>local entity = script.Parent\n \nlocal speed = 10\n\nlocal player = game.Players.LocalPlayer \n\nlocal function chasePlayer()\n local humanoid = player.Character:FindFirstChild(&quot;Humanoid&quot;)\n\n if humanoid then\n local targetPosition = humanoid.RootPart.Position\n local direction = (targetPosition - entity.Position).unit\n\n entity.Velocity = direction * speed\n end\nend\n\nentity.Touched:Connect(function(otherPart)\n local character = otherPart.Parent\n local humanoid = character:FindFirstChild(&quot;Humanoid&quot;)\n\n if humanoid then\n humanoid.Health = 0\n end\nend)\n\ngame:GetService(&quot;RunService&quot;).Heartbeat:Connect(chasePlayer)\n</code></pre>\n<p>I would like for someone to correct this code as I have tried countless times to get it to work but have failed miserably.</p>\n<p>I tried defining player and I was expecting it to move the part towards my character and kill it but it didn't do anything even though there were no errors.</p>\n"^^ . . "You could make the callback functions closures (`lua_pushcclosure`) with the data inside the upvalues. To share the upvalues, you would need to unify them with `lua_upvaluejoin`."^^ . . . . "1"^^ . . . . "Aren't you trying to pass on `'average'`?"^^ . . . "0"^^ . . . "Can you copy the relevant info as a quote, inline to the Answer, in case the link becomes broken?"^^ . . . . "What method are you trying to call? What would you expect it to return?"^^ . . . "<p>When I want to edit my neovim config files, it always shows 'Undefined global vim' warning. I don't like it. Although I tried some method to resolve this issue, it still exists.</p>\n<ul>\n<li>My lua lspconfig</li>\n</ul>\n<pre class="lang-lua prettyprint-override"><code>lspconfig.lua_ls.setup(\n {\n on_init = function(client)\n local path = client.workspace_folders[1].name\n if not vim.loop.fs_stat(path .. &quot;/.luarc.json&quot;) and not vim.loop.fs_stat(path .. &quot;/.luarc.jsonc&quot;) then\n client.config.settings =\n vim.tbl_deep_extend(\n &quot;force&quot;,\n client.config.settings.Lua,\n {\n runtime = {\n -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)\n version = &quot;LuaJIT&quot;\n },\n diagnostics = {\n globals = { 'vim' }\n },\n -- Make the server aware of Neovim runtime files\n workspace = {\n library = {vim.env.VIMRUNTIME}\n -- or pull in all of 'runtimepath'. NOTE: this is a lot slower\n -- library = vim.api.nvim_get_runtime_file(&quot;&quot;, true)\n }\n }\n )\n\n client.notify(&quot;workspace/didChangeConfiguration&quot;, {settings = client.config.settings})\n end\n return true\n end\n }\n)\n</code></pre>\n<ul>\n<li>Screenshot\n<a href="https://i.sstatic.net/gz6Qt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gz6Qt.png" alt="enter image description here" /></a></li>\n</ul>\n"^^ . . . . "0"^^ . "0"^^ . "0"^^ . "<p>This what I try:</p>\n<pre><code>local data = {\n {cond1 = 'yes', cond2 = 'yes', nums = 7, results = 'no', average = 9.5},\n {cond1 = 'yes', cond2 = 'no', nums = 12, results = 'no', average = 15},\n {cond1 = 'no', cond2 = 'yes', nums = 18, results = 'yes', average = 26.5},\n {cond1 = 'no', cond2 = 'yes', nums = 35, results = 'yes', average = 36.5},\n {cond1 = 'yes', cond2 = 'yes', nums = 38, results = 'yes', average = 44},\n {cond1 = 'yes', cond2 = 'no', nums = 50, results = 'no', average = 66},\n {cond1 = 'no', cond2 = 'no', nums = 83, results = 'no'},\n}\n\nfunction split_data(data, root_node, branch_node, root_condition_function, branch_condition_function)\n local true_node = {true_value = 0, false_value = 0}\n local false_node = {true_value = 0, false_value = 0}\n\n for _, entry in ipairs(data) do\n if root_condition_function(entry, root_node) then\n if branch_condition_function(entry, branch_node) then\n true_node.true_value = true_node.true_value + 1\n else\n true_node.false_value = true_node.false_value + 1\n end\n else\n if branch_condition_function(entry, branch_node) then\n false_node.true_value = false_node.true_value + 1\n else\n false_node.false_value = false_node.false_value + 1\n end\n end\n end\n\n return true_node, false_node\nend\n\n-- Statement for root node/string node\nlocal function root_string_condition(entry, root_node)\n return entry[root_node] == 'yes'\nend\n\n-- Statement for numeric root node\nlocal function root_numeric_condition(entry, root_node, branch_node)\n local nums = entry[root_node]\n local average = entry[branch_node]\n\n -- Check for nil values\n if nums == nil or average == nil then\n return false\n end\n\n return tonumber(nums) &lt; tonumber(average), tonumber(nums) &gt;= tonumber(average)\nend\n\n-- Statement for branch node\nlocal function branch_condition(entry, branch_node)\n return entry[branch_node] == 'yes'\nend\n\n-- Example usage for string condition\nlocal trueNodeStr, falseNodeStr = split_data(data, 'cond1', 'results', root_string_condition, branch_condition)\n\n-- Print the results for string condition\nprint(&quot;String Condition Results:&quot;)\nprint(string.format(&quot;Cond1 True - True Value: %d, False Value: %d&quot;, trueNodeStr.true_value, trueNodeStr.false_value))\nprint(string.format(&quot;Cond1 False - True Value: %d, False Value: %d&quot;, falseNodeStr.true_value, falseNodeStr.false_value))\n\n-- Example usage for numeric condition\nlocal trueNodeNum, falseNodeNum = split_data(data, 'nums', 'results', root_numeric_condition, branch_condition)\n\n-- Print the results for numeric condition\nprint(&quot;\\nNumeric Condition Results:&quot;)\nprint(string.format(&quot;Nums True - True Value: %d, False Value: %d&quot;, trueNodeNum.true_value, trueNodeNum.false_value))\nprint(string.format(&quot;Nums False - True Value: %d, False Value: %d&quot;, falseNodeNum.true_value, falseNodeNum.false_value))\n</code></pre>\n<p>The results:</p>\n<pre class="lang-none prettyprint-override"><code>String Condition Results:\nCond1 True - True Value: 1, False Value: 3\nCond1 False - True Value: 2, False Value: 1\n\nNumeric Condition Results:\nNums True - True Value: 0, False Value: 0\nNums False - True Value: 3, False Value: 4\n</code></pre>\n<p>Why for Numeric results give incorrect result?</p>\n<p>Expected results:</p>\n<pre class="lang-none prettyprint-override"><code>Numeric Condition Results:\nNums True - True Value: 0, False Value: 1\nNums False - True Value: 3, False Value: 3\n</code></pre>\n"^^ . . . "1"^^ . "2"^^ . . . . . . "lua"^^ . "figure"^^ . "<p>I am attempting to decode PNG files in Luau, and so far I have made great progress, to the point of being able to make out the image in the final, decoded result, despite clearly being incorrect. The one thing I need to fix is the de-filtering (reconstruction) process.</p>\n<p>So far I have correctly parsed the different chunks of the file, and decompressed the IDAT chunk with an external library. I have also converted the raw data to the format I need (a table consisting of numbers between 0-1, 4 for each pixel, each number corresponding to an RGBA channel), but the data is &quot;filtered&quot; before being compressed in order to optimize the compression. This of course means that I need to reverse this process (de-filter) in order to view the correct results.</p>\n<p>For every scanline, I am correctly getting the byte used to determine which <a href="https://www.w3.org/TR/png-3/#9Filter-types" rel="nofollow noreferrer">filter function</a> was used on the scanline. All I need to do is apply the correct function to reverse the filtering per scanline (Recon(x)). To test this, I'm using the test images provided by <a href="http://www.schaik.com/pngsuite/pngsuite_fil_png.html" rel="nofollow noreferrer">PNGSuite</a> (specifically the colored ones), because only one type of filter is used on the entire image, which makes it easier to see the results of each individual de-filtering function.</p>\n<p>Here are the results for each image:</p>\n<ul>\n<li>0 (No Operation):\noutput image is correct!</li>\n</ul>\n<h2><a href="https://i.sstatic.net/4Ef6Z.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4Ef6Z.png" alt="Test image f00n2c08.png after being decoded" /></a></h2>\n<ul>\n<li>1 (Sub)\nimage looks nearly correct, but the red channel is a little weird:</li>\n</ul>\n<h2><a href="https://i.sstatic.net/Kcjc5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Kcjc5.png" alt="Test image f01n2c08.png after being decoded" /></a></h2>\n<ul>\n<li>2 (Up)\nthe shapes in the image resemble the correct result, but it's definitely very wrong:</li>\n</ul>\n<h2><a href="https://i.sstatic.net/IdEDB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/IdEDB.png" alt="Test image f02n2c08.png after being decoded" /></a></h2>\n<ul>\n<li>3 (Average)\nthe number in the image can be seen, but otherwise, it's nearly completely incomprehensible:</li>\n</ul>\n<h2><a href="https://i.sstatic.net/WIcQT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WIcQT.png" alt="Test image f03n2c08.png after being decoded" /></a></h2>\n<ul>\n<li>4 (Paeth Predictor)\nshows patterns similar to Up, but it's also very wrong:</li>\n</ul>\n<h2><a href="https://i.sstatic.net/DaPVX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/DaPVX.png" alt="Test image f04n2c08.png after being decoded" /></a></h2>\n<p>(Note: Although I know it's not a good idea, i don't plan on supporting bit depths below 8, and for testing purposes, I'm only supporting a bit depth of 8, but do plan on supporting 16-bit color later on.)</p>\n<p>(And for any of those familiar with Lua but not with Luau, my code does make heavy use of type annotations and the built-in <em>buffer library</em>. It shouldn't be too hard to figure out how these work, but they are officially documented here if needed):</p>\n<ul>\n<li><a href="https://luau-lang.org/syntax#type-annotations" rel="nofollow noreferrer">https://luau-lang.org/syntax#type-annotations</a></li>\n<li><a href="https://luau-lang.org/library#buffer-library" rel="nofollow noreferrer">https://luau-lang.org/library#buffer-library</a></li>\n</ul>\n<pre class="lang-lua prettyprint-override"><code>-- Util function to query a certain number of bits from the image data bytes\n-- Will be useful if support for bit depths other than 8 are introduced\n-- From here, CurrentPos shall be measured in bits instead of bytes\nCurrentPos = 0\nlocal CurrentBuffer:buffer = DecompressedData\nlocal function GetInt(BitDepth:number):number\n local ByteIndex:number = math.floor(CurrentPos / 8)\n local BitOffset:number = (CurrentPos * BitDepth) % 8\n\n local Int:number = 0\n \n if BitDepth == 8 then\n Int = buffer.readu8(CurrentBuffer, ByteIndex)\n elseif BitDepth == 16 then\n Int = buffer.readu16(CurrentBuffer, ByteIndex)\n elseif BitDepth == 32 then\n Int = buffer.readu32(CurrentBuffer, ByteIndex)\n else\n -- For bit depths less than 8, you need to handle bit-wise extraction\n local Byte:number = buffer.readu8(CurrentBuffer, ByteIndex)\n local Shift:number = 8 - BitDepth - BitOffset\n return bit32.rshift(bit32.band(Byte, bit32.lshift(0xFF, BitOffset)), Shift)\n end\n\n CurrentPos += BitDepth\n return Int\nend\n \n-- Defilter process\n-- Start by splitting the bytes into scanlines\n\n-- How many bytes are in a scanline? (not including the filter byte)\nlocal ScanlineBytes:number = math.floor(ImageStruct.BitDepth * ImageStruct.Size.X / 8) \nlocal PixelBytes:number = 1 -- how many bytes in a single pixel?\nlocal Scanlines:{buffer} = {} -- List of scanlines processed\n\nif ImageStruct.ColorType == 2 then -- Truecolor\n PixelBytes = 3\nelseif ImageStruct.ColorType == 3 then -- Indexed color\n PixelBytes = 1 -- lol....\nelseif ImageStruct.ColorType == 6 then -- Truecolor with alpha\n PixelBytes = 4\nend -- No support for greyscale color types yet sory\nScanlineBytes *= PixelBytes -- The amount of bytes in a scanline is actually the width * how many bytes are in one pixel.\n\n-- For every scanline\nfor Y:number = 1, ImageStruct.Size.Y do\n \n -- Get this scanline's filter byte\n local FilterByte:number = GetInt(8)\n \n -- These should be unfiltered\n --local PreviousScanLine:buffer? = Scanlines[Y - 1] -- Warning: will be null if we are on the first scanline\n local PreviousScanLine:buffer? = nil\n local PreviousByte:number = 0 -- Currently unused variable\n \n local Scanline:buffer = buffer.create(ScanlineBytes)\n local ScanlineUnfiltered:buffer = buffer.create(ScanlineBytes)\n \n -- For every byte on the scanline (defiltering works with bytes, not pixels, so we can disregard bit depth for now)\n for X:number = 0, ScanlineBytes-1, 1 do\n \n -- Get this byte\n local Byte:number = GetInt(8)\n \n --local ByteA:number = PreviousByte\n \n -- Get the byte in the previous pixel (the result should be 0 if we're on the first pixel)\n local ByteA:number = if (X &gt; PixelBytes) then buffer.readu8(Scanline, X - PixelBytes) else 0\n \n -- Get the same byte in the previous scanline (the result should be 0 if we're on the first scanline)\n local ByteB:number = if PreviousScanLine then buffer.readu8(PreviousScanLine, X) else 0\n \n -- Get the byte in the previous pixel on the previous scanline (the result should be 0 if blah blah blah you get the point)\n local ByteC:number = if (PreviousScanLine and (X &gt; PixelBytes)) then buffer.readu8(PreviousScanLine, X - PixelBytes) else 0\n \n -- Apply appropriate defiltering function\n local DefilteredByte:number = m:ApplyDefiltering(FilterByte, Byte, ByteA, ByteB, ByteC) % 256\n\n buffer.writeu8(ScanlineUnfiltered, X, Byte)\n buffer.writeu8(Scanline, X, DefilteredByte)\n --PreviousByte = DefilteredByte\n PreviousByte = Byte\n end\n --GetInt(8)\n PreviousScanLine = ScanlineUnfiltered\n table.insert(Scanlines, Scanline)\nend\n \n \n-- Finally, we need to actually get the pixels\nlocal Pixels:{number} = {}\nfor Y:number = 1, ImageStruct.Size.Y do\n local Scanline:buffer = Scanlines[Y]\n \n -- Set variables used by GetInt (we are reading from the current scanline)\n CurrentBuffer = Scanline\n CurrentPos = 0\n \n for X:number = 1, ImageStruct.Size.X, 1 do\n local R:number, G:number, B:number, A:number\n \n if ImageStruct.ColorType == 2 then -- Truecolor\n R = GetInt(8) / 255\n G = GetInt(8) / 255\n B = GetInt(8) / 255\n A = 1\n elseif ImageStruct.ColorType == 3 then -- Indexed color\n local PaletteIndex:number = GetInt(8)\n local Color:Color3 = ImageStruct.Pallette[PaletteIndex] -- Get the color from the pallette (PLTE)\n R = Color.R\n G = Color.G\n B = Color.B\n A = 1\n elseif ImageStruct.ColorType == 6 then -- Truecolor with alpha\n R = GetInt(8) / 255\n G = GetInt(8) / 255\n B = GetInt(8) / 255\n A = GetInt(8) / 255\n end\n \n table.insert(Pixels, R)\n table.insert(Pixels, G)\n table.insert(Pixels, B)\n table.insert(Pixels, A)\n end\nend\n</code></pre>\n<p>Additionally, here's the function that applies de-filtering to a byte:</p>\n<pre class="lang-lua prettyprint-override"><code>function m:ApplyDefiltering(FilterByte:number, Byte:number, ByteA:number, ByteB:number, ByteC:number)\n if FilterByte == 0 then -- None\n return Byte\n elseif FilterByte == 1 then -- Sub\n return Byte + ByteA\n elseif FilterByte == 2 then -- Up\n return Byte + ByteB\n elseif FilterByte == 3 then -- Average\n -- Average(x) + floor((ByteA + ByteB) / 2)\n return Byte + math.floor((ByteA + ByteB) / 2)\n elseif FilterByte == 4 then -- Paeth Predictor\n local P:number = ByteA + ByteB - ByteC\n local PA:number = math.abs(P - ByteA)\n local PB:number = math.abs(P - ByteB)\n local PC:number = math.abs(P - ByteC)\n local PR:number\n if (PA &lt;= PB) and (PA &lt;= PC) then \n PR = ByteA\n elseif PB &lt;= PC then \n PR = ByteB\n else \n PR = ByteC\n end\n return Byte + PR\n end\nend\n</code></pre>\n"^^ . "0"^^ . . . "0"^^ . . "0"^^ . "1"^^ . "1"^^ . ""why do you spam tag C watchers" because Lua-compatible DLLs can be made with either, and people who have made one with C before are just as likely to have have the answer. This is a question first and foremost about building a DLL that can be used within Lua, using C++ is not important, it's just what Visual Studio has project templates for."^^ . "encapsulation"^^ . . "0"^^ . "3"^^ . "2"^^ . . . . . . . "<p><code>game:GetService(&quot;Players&quot;)</code> is the player service, <code>game:GetService(&quot;Players&quot;):GetPlayers()</code> is a table with all connected players. You want to connect an event to the service, not to that table.</p>\n"^^ . . . "(Roblox) Is the lobby in the same map as the main game?"^^ . "0"^^ . "Access request headers in envoy_on_response"^^ . "1"^^ . "ninja"^^ . . "nvim-lspconfig"^^ . . "1"^^ . . . "1"^^ . "0"^^ . "<p>&quot;cmd&quot; notation is not a replacement but alternative. Usually, the RHS of a mapping is processed as if (well, almost) typed. However, any &quot;cmd&quot;-thing is being processed much like as a script.</p>\n<p>Therefore, you are supposed to strip &quot;cmd&quot; and &quot;cr&quot; off and pass it onto <code>execute</code>, not <code>normal</code>. Of course, after make sure that there is no other <code>&lt;key&gt;</code> notation left.</p>\n"^^ . "0"^^ . "2"^^ . . . "<p>It turns out that my problem was scope. When I used Lua to generate <code>\\newcommand</code> commands inside a <code>\\begin{luacode} ... \\end{luacode}</code> environment, those commands disappeared when the environment ended. The fix was to use <code>\\directlua</code> instead of the environment. With the same Lua file, this TeX file works:</p>\n<pre><code>\\documentclass[12pt]{article}\n\n\\usepackage{luacode}\n\n\\directlua{dofile(&quot;test.lua&quot;)\nmkcommands()}\n\n\\begin{document}\n\n\\cmdone\n\n\\cmdtwo\n\n\\end{document}\n</code></pre>\n"^^ . "0"^^ . . "1"^^ . . "0"^^ . . . . . . . . . . . . "environment-variables"^^ . . . . "No? I meant the string at the 6th to last line."^^ . . . . . "0"^^ . . "Put this script that should be a LocalScript in StarterPlayerScripts and change the paths in the script to WaitForChild('PlayerGui') paths"^^ . . "-1"^^ . . . "2"^^ . "Lua script logitech - start and end a loop when the key is released"^^ . "0"^^ . . . . "file"^^ . . "logic"^^ . . . . "0"^^ . "4"^^ . . "[`unit`](https://create.roblox.com/docs/reference/engine/datatypes/Vector3#Unit) should be upper case. Did you debug whether the heartbeat function is called, and humanoid is not nil? What type of script is this (localscript, modulescript, ...)?"^^ . . "1"^^ . "0"^^ . . "1"^^ . . . "0"^^ . . . . "how to read nested objects(object inside object) in lua file"^^ . . "0"^^ . . . . . . "Which way of `if` it goes? The correct one?"^^ . . . "0"^^ . "your code gave correct results for current data, Nums True - True Value: 0, False Value: 1\nNums False - True Value: 3, False Value: 3. but if i change one of entry value, for example nums = 7 to be nums = 17, its should be gave results: Nums True - True Value: 0, False Value: 0\nNums False - True Value: 3, False Value: 4, but its gave Nums True - True Value: 0, False Value: 2\nNums False - True Value: 3, False Value: 2. why its happend?"^^ . . . . . . . . . "0"^^ . "0"^^ . . "How to make a function repeat in lua, UE4SS"^^ . "0"^^ . . . "0"^^ . . "0"^^ . . . "0"^^ . . . . "1"^^ . "Combo not going any higher than 1, trying to make combat system (roblox)"^^ . . "Love2D does not run in VSC"^^ . . . . . . . . . "0"^^ . . "0"^^ . . "0"^^ . . . . . . . "decoding"^^ . "0"^^ . . . . "0"^^ . "8"^^ . "If you type at a command line `love main.lua`, does it run?"^^ . . . "In both cases it runs the exact same code with slightly different memory locations, the call overhead is neglectable. If the function is large, I would even try to further pull out common parts. But 70 lines still seems reasonable.\nIf you are interested, you can check what's happening under the hood using e.g., https://www.luac.nl/"^^ . "0"^^ . . "0"^^ . . . "So the actual problem is that `peripherial.call("top", "clear")` does not clear the monitor? Text etc is still visible? (notice my fixed clear here, your example wont work)"^^ . "0"^^ . . . . "0"^^ . . . . . . . . . . . . . . "How to check the value from a NumberValue"^^ . . . . . "@kos You still need `:` when calling `deposit`, `withdraw`, or `getBalance` because these methods define and use the `self` parameter."^^ . "<p>While writing Lua script for kong plugin, we are observed that in the encoded body saw the back slashes and when we tried to decode getting error.</p>\n<p>Please help to remove the backslashes to decode successfull</p>\n<p>Below is the snippet we tried</p>\n<pre class="lang-lua prettyprint-override"><code>local json =require &quot;cjson&quot;\n\nbody=json.encode(response)\nutil.application_logging():debug(&quot;encoded body&quot;..util.dump(body))\n</code></pre>\n<p>//Here getting as below</p>\n<pre class="lang-json prettyprint-override"><code>body{\\&quot;mobileno\\&quot;:\\&quot;98765467\\&quot;,\\&quot;pwd\\&quot;:\\&quot;demo123\\&quot;}\n</code></pre>\n<pre class="lang-lua prettyprint-override"><code>body =json.decode(body);\n</code></pre>\n<p>//not getting anything</p>\n"^^ . "How to trigger lsp suggestion popup in neovim?"^^ . "0"^^ . . . . "1"^^ . . "1"^^ . "Then I'm clueless. Maybe share a screenshot of your setup after you called the function, as well as the code snippet you used."^^ . . . . . "sorry my bad, i have miss intepreting the root logic, the statement that should i to apply for root node is each average values compared to all nums value"^^ . "0"^^ . . . "sockets"^^ . "<p>I am writing lua file. In that we have to read the requested body. Below is the sample request body json.</p>\n<pre class="lang-json prettyprint-override"><code>{\n&quot;year&quot;:&quot;2023&quot;,\n&quot;languageId&quot;:&quot;2&quot;,\n&quot;city&quot;:&quot;Banglore&quot;,\n&quot;TheatreInfo&quot;: [\n{\n&quot;tId&quot;:&quot;123&quot;,\n&quot;tname&quot;:&quot;inox&quot;\n},\n{\n&quot;tId&quot;:&quot;124&quot;,\n&quot;tname&quot;:&quot;inox&quot;\n}\n],\n&quot;usecase&quot;:&quot;tdetails&quot;\n}\n</code></pre>\n<p>i tried to read above json in lua file like below.</p>\n<pre><code>local transform_body = {}\ntransform_body[&quot;year&quot;]=body[&quot;year&quot;]\ntransorm_vody[&quot;languageid&quot;]=body[&quot;languageId&quot;]\ntransorm_vody[&quot;city&quot;]=body[&quot;city&quot;]\n</code></pre>\n<p>but how to read for theatreinfo nested object.and theatreinfo may contains one or more entries.</p>\n"^^ . "0"^^ . . . . . "@ESkri it prints the JSON, which is written above. The if statement works, it is being redirected to the else, but the Enum doesn't have any effect looks like"^^ . "Try to remove the first item in array `lua_names = ['lua', ...`"^^ . "lua-userdata"^^ . "make consumer as coroutine and producer as main thread in lua"^^ . "0"^^ . . "Yeah this actually worked, thanks for looking into it and answering"^^ . . . . . "0"^^ . . . . "0"^^ . "0"^^ . "0"^^ . "File handling in lua"^^ . . . . . "1"^^ . . . "error-handling"^^ . . . "0"^^ . "1"^^ . . . . "<p>I'm trying to create a DLL module to be required by a Lua 5.4 script (64-bit Windows). I've created a simple DLL in Visual Studio based on the few examples I was able to find, however when I try to require it, I get the message &quot;error loading module 'testlib' from file 'C:\\lua\\testlib.dll': The specified module could not be found.&quot; This happens when running <code>require('testlib')</code> from the command line, as well as from within an embedded script.</p>\n<p>I started with C++ because that's what Visual Studio had a template for, but if C is more suitable I'll happily switch. This is very much new territory for me.</p>\n<hr />\n<p>This is my code. For initial testing purposes it's just exposing a single function that adds two numbers, but the goal is to receive a string and have the OS's text-to-speech read it out. I'm building with Visual Studio, and the dependency is being resolved by vcpkg.</p>\n<p>This is my first time working with c++, so please let me know if there's any more important information I should include.</p>\n<pre class="lang-cpp prettyprint-override"><code>#include &quot;pch.h&quot;\n\n#include &lt;lua.hpp&gt;\n\nextern &quot;C&quot; {\n static int add(lua_State* L) {\n lua_Number n1 = luaL_checknumber(L, 1);\n lua_Number n2 = luaL_checknumber(L, 2);\n lua_pushnumber(L, n1 + n2);\n return 1;\n }\n\n static const luaL_Reg mylib[] = {\n {&quot;add&quot;, add},\n {NULL, NULL}\n };\n\n __declspec(dllexport) int luaopen_testlib(lua_State* L) {\n luaL_newlib(L, mylib);\n return 1;\n }\n}\n\nBOOL APIENTRY DllMain(HMODULE hModule,\n DWORD ul_reason_for_call,\n LPVOID lpReserved\n)\n{\n switch (ul_reason_for_call)\n {\n case DLL_PROCESS_ATTACH:\n case DLL_THREAD_ATTACH:\n case DLL_THREAD_DETACH:\n case DLL_PROCESS_DETACH:\n break;\n }\n return TRUE;\n}\n</code></pre>\n<p>I've reviewed every existing post I was able to find mentioning this error message, but without luck (almost every example is building for linux, but in my case building for Windows is a requirement).</p>\n<hr />\n<p>edit 1: <a href="https://stackoverflow.com/questions/45008253/c-module-dll-for-lua-using-visual-studio">This other question</a> probably counts as a duplicate, but is unanswered and predates Lua 5.4. The comment &quot;C++ dlls are a very particular kind of beast. If possible I recommed you to stick to C on DLLs unless you really know what you are doing.&quot; indicates I might be better off making this in C. I did try adapting the code, but the result was the same. Despite someone jumping to conclusions and removing the C tag, it is very much relevant, so I've readded it.</p>\n<hr />\n<p>edit 2: This is my attempt at the equivalent C code, based on <a href="https://stackoverflow.com/a/65660774/7520417">this example from 2021</a>. As mentioned in the first edit, I compiled the DLL but received the exact same error message (except with the new file name of course) when running <code>require('testc')</code>.</p>\n<pre class="lang-c prettyprint-override"><code>#include &lt;lua.h&gt;\n#include &lt;lauxlib.h&gt;\n\nstatic int add(lua_State* L) {\n lua_Number n1 = luaL_checknumber(L, 1);\n lua_Number n2 = luaL_checknumber(L, 2);\n lua_pushnumber(L, n1 + n2);\n return 1;\n}\n\nstatic luaL_Reg const mylib[] = {\n {&quot;add&quot;, add},\n {NULL, NULL}\n};\n\n__declspec(dllexport) int luaopen_testc(lua_State* L) {\n luaL_newlib(L, mylib);\n return 1;\n}\n</code></pre>\n<hr />\n<p>edit 3: I was going to accept the answer, but found it had been deleted by a moderator. I'm hesitant to repost the solution, because I'm not sure why it was originally removed. This error appears in a number of places on Stack Overflow, but none of them mention this solution so I'll try to summarize:</p>\n<p>The reason the DLL failed to be loaded was because the lua.dll dependency was missing. <strong>The solution was to copy the lua.dll along with my new module.</strong></p>\n<p>While this seems counterintuitive, the reasoning is that the host Lua runtime does not make the libraries available to the modules it loads.</p>\n<p>So in this case &quot;the specified module&quot; in the error text refers to the dependency, not the module being loaded.</p>\n<p>A comment said this could likely be simplified by statically linking the dependency such that it's compiled/bundled with the module in the same DLL. I haven't confirmed this yet, but it's not necessary to resolve the initial problem, so I still consider this issue solved.</p>\n"^^ . "0"^^ . . . "@luke100000, sorry I didn't get exactly. How to iterate and assign to transform_body."^^ . "0"^^ . "0"^^ . . . "I understand, but the pcall does not ensure that the `CoinsStore:GetAsync(UID)` actually returns an object that has the `.CoinsAmount` member.\n\nThe error occurs at line 36 because I believe the `data` variable is not what you're expecting. You could print the return value right after assigning `data` to check."^^ . . . . "1"^^ . . . . "ServerScriptService.Script:36: attempt to index number with 'CoinsAmount' (Roblox Studio)"^^ . "0"^^ . . "1"^^ . . . . . "1"^^ . "2d array access with lua userdata"^^ . . . "binaryfiles"^^ . "1"^^ . . "0"^^ . "0"^^ . . . . "@Oka So I have to create another index for array ? In this case, how could I do this in C?"^^ . . "0"^^ . "arrays"^^ . . . . . . "logitech"^^ . "0"^^ . . . "1"^^ . . "0"^^ . "0"^^ . . "0"^^ . . . . . . . . "2"^^ . . . . "@Luke100000 , thanks..\nPlease state your recommendation in the code.\n"line:match" shows an error in the line you gave."^^ . . . . . "1"^^ . . . "2"^^ . . "0"^^ . "0"^^ . "no, i pass the condition statement to root node, as you can see if for string function when its pass the statement function to the root node its gaave correct results, but not for numeric statement function."^^ . . "<p>If you want it to target only one specific client that all clients can see moving you will need a RemoteEvent to be fired in a completely different LocalScript (which is protected because cheaters could exploit this, with checks like seeing if they are actually the one the game is really trying to make get chased), because if this is a LocalScript, only one client will see the entity chasing them, while other clients see the entity standing still, also I see you didn't use Humanoid:MoveTo(vector3), instead of using velocities (which are supposed to be vector3) and to fix your issue I would recommend using Part:ApplyImpulse instead of changing velocity.</p>\n<p>Unit is supposed to have uppercase U or it wont work by the way.\nSo thats your solution.</p>\n<p>Here is my version of your code which is fixed.\nKeep in mind only the client can see the entity chasing them, not the other clients.</p>\n<p>Entities are impossible to make (difficult) without them having basic components of a regular Roblox player character.</p>\n<p>If your entity doesn't have components of a regular roblox character, recommend adding now then using this script.</p>\n<pre><code> local entity = script.Parent\n\n local speed = 10\n\n local player = game.Players.LocalPlayer \n\n local function chasePlayer()\n local humanoid = player.Character:FindFirstChild(&quot;Humanoid&quot;)\n if not entity then return end\n if humanoid then\n coroutine.wrap(function()\n local bool = true\n -- add parameters to make this value false when you want it to\n while bool == true do\n wait()\n -- I'm beginning to think this entity doesnt have a humanoid but lets assume it does and this is a part of it's body. \n entity.Parent.Humanoid.WalkSpeed = speed\n if player.Character.Humanoid.RootPart then \n entity.Parent.Humanoid:MoveTo(player.Character.Humanoid.RootPart.Position)\n end\n end\n end)()\n end\n end\n\n entity.Touched:Connect(function(otherPart)\n local character = otherPart.Parent\n local humanoid = character:FindFirstChild(&quot;Humanoid&quot;)\n\n if humanoid then\n humanoid.Health = 0\n end\n end)\n\n chasePlayer()\n\n -- game:GetService(&quot;RunService&quot;).Heartbeat:Connect(chasePlayer) -- ehh i would recommend removing this and replacing it with just chasePlayer() because i added a corountine.wrap() so it'll put pressure on the client and add lag.\n</code></pre>\n"^^ . . . . "0"^^ . . . "<blockquote>\n<p>Does someone knows what I am doing wrong?</p>\n</blockquote>\n<p><code>arr[i][j]</code> does not invoke <code>getmetatable(arr).__index(arr, i, j)</code> as you seem to be expecting it to.</p>\n<p>Rather, it invokes <code>getmetatable(arr).__index(arr, i)[j]</code>. So <code>getmetatable(arr).__index</code>, which resolves to <code>array2d_get</code>, is called with <code>arr, i</code>, <strong>not</strong> <code>arr, i, j</code>, which throws the error you're seeing.</p>\n<p>If this didn't throw an error, the return value of this would be indexed with <code>j</code>.</p>\n<blockquote>\n<p>Any clues on how to make it works?</p>\n</blockquote>\n<p>You might be tempted to try something like <code>arr[i, j]</code>, but unlike some other languages, indexing in Lua only allows exactly a single value; this is a syntax error.</p>\n<p>I see 4 options to fix this:</p>\n<h4>Getter</h4>\n<p>Write a &quot;<code>get</code>&quot; &quot;method&quot; rather than &quot;overloading&quot; <code>[]</code>. That &quot;method&quot; can take parameters <code>i, j</code> then: <code>arr:get(i, j)</code> desugars to <code>getmetatable(arr)[&quot;get&quot;](arr, i, j)</code>. You just need to set the metatable up such that <code>getmetatable(arr)[&quot;get&quot;]</code> resolves to your <code>array2d_get</code> function (for example by setting <code>__index = {get = array2d_get}</code>).</p>\n<p>I would also argue that this is probably cleaner as you add methods to your 2d arrays. Otherwise, something like <code>arr:push(42)</code> will always first have to check whether <code>&quot;push&quot;</code> is a valid index, then resolve to the method if it isn't. This is also not great for performance (of method calls).</p>\n<h4>Array of Arrays</h4>\n<p>Move from your &quot;2d array&quot; userdata back to &quot;1d array of 1d arrays&quot;, then everything will work naturally, albeit with somewhat more memory overhead (and negative implications e.g. for cache locality and GC pressure, so this also comes at a runtime cost).</p>\n<h4>&quot;Row&quot; Type</h4>\n<p>You could make <code>arr[y]</code> return a &quot;row&quot; userdata object for the y-th row (effectively just a fancy pointer) which, when indexed, would give you the x-th element in the row.</p>\n<p>Creating such &quot;row&quot; objects for every indexing operation might be a problem performance-wise, however.</p>\n<h4>Compound Index Type</h4>\n<p>For the sake of completeness, you could also use a table (or a userdata object, or a string, or a closure...) to implement something like <code>arr[{x, y}]</code> or <code>arr[Index2D(x, y)]</code>. If you need performance, this is probably a bad idea as each indexing operation requires creating a garbage table then.</p>\n"^^ . . "1"^^ . . . "1"^^ . . "<p>Have you defined &quot;<code>NumberValue</code>&quot; yet?\nHave you put it in a forever loop with a <code>task.wait(0)</code> line?\nnormally this script would work in workspace</p>\n<pre><code>local NumberValue = workspace.Value --define NumberValue (replace it with where the number value is)\n\nwhile task.wait(0) do --repeat forever but wait a frame each time\n if NumberValue.Value == 5 then\n print(&quot;It worked!&quot;)\n end\nend\n</code></pre>\n"^^ . "<p>im fairly new to lua and working on CFX FiveM, and have made a simple table.insert which calls on a <code>for type, value in pairs(Config.Skills) do</code> This is then refering back to a SQL table which is pulling the data correctly, but the table inserts are showing the same value.</p>\n<p>SQL OUTPUT - <code>{&quot;stamina&quot;:{&quot;RemoveAmount&quot;:-0.3,&quot;Stat&quot;:&quot;MP0_STAMINA&quot;,&quot;Current&quot;:25},&quot;strength&quot;:{&quot;RemoveAmount&quot;:-0.3,&quot;Current&quot;:13,&quot;Stat&quot;:&quot;MP0_STRENGTH&quot;}}</code></p>\n<p>Lua Code</p>\n<pre><code>function SkillMenu()\n FetchSkills()\n Wait(1000)\n RefreshSkills()\n local elements = {}\n for type, value in pairs(Config.Skills) do\n table.insert(elements, {\n type = 'button',\n name = &quot;stamina&quot;,\n label = &quot;Stamina&quot;,\n description = type .. value[&quot;Current&quot;] .. &quot;%&quot;,\n icon = 'fad fa-heartbeat',\n disabled = true\n })\n table.insert(elements, {\n type = 'button',\n name = 'strength',\n label = &quot;Strength&quot;,\n description = type .. value[&quot;Current&quot;] .. &quot;%&quot;,\n icon = 'fad fa-heartbeat',\n disabled = true\n })\n TMC.Functions.OpenMenu({\n namespace = &quot;skillmenu&quot;,\n type = 'openMenu',\n title = &quot;Skill menu&quot;,\n }, elements, function(close, confirmed)\n end, function(selected)\n end, function(change)\n if change.elementChanged == &quot;stamina&quot; then\n TMC.Functions.CloseMenu()\n elseif change.elementChanged == 'strength' then\n TMC.Functions.CloseMenu()\n end\n end)\n end\nend\n</code></pre>\n<p><a href="https://i.sstatic.net/Pg2Ae.png" rel="nofollow noreferrer">What it is outputting</a></p>\n<p>What I am looking to achieve:</p>\n<p>Stamina\nstamina25%</p>\n<p>Strength\nstrength13%</p>\n<p>Thanks in advance</p>\n"^^ . "0"^^ . . . . . . "Memory usage and efficiency are the same (with and without local function). But readability of the code is different."^^ . "c"^^ . . "<p>I am totally new to Lua and can't get my head around this: The following function always returns 99, even if the angleNumber is a 2,3,4 etc.</p>\n<p>Am I overlooking some Lua syntax quirk?</p>\n<pre><code>local function mirroredNumber (angleNumber)\n \n if angleNumber == 2 then\n return 8\n elseif angleNumber == 3 then\n return 7\n elseif angleNumber == 4 then\n return 6\n elseif angleNumber == 6 then\n return 4\n elseif angleNumber == 7 then\n return 3\n elseif angleNumber == 8 then\n return 2\n else\n return 99\n end\nend\n</code></pre>\n<p>I tried with setting a local variable in the if statement and return that in the end which also didn't work so I assume my if/elseif checks are wrong, but I cannot figure out how.</p>\n"^^ . . . "0"^^ . "0"^^ . . . "0"^^ . . "You'd better update your question, add this description and check my update."^^ . . . . "c++"^^ . "0"^^ . "@SupaMaggie70 but how can i run multiple threads / coroutines?"^^ . . . "0"^^ . . . . . "0"^^ . "0"^^ . . "What can I do to stop running the script when I release the left button?"^^ . . "vscode-like suggestions in neovim"^^ . . . "vim"^^ . . . "unreal-engine5"^^ . . . "0"^^ . "Just to be sure, the prints work. If the response["Code"] is 404, it prints 404 and so on"^^ . . . . . "<p>Pretty cloudy question and this is my first time answering on Stackoverflow, but i'll do my best.</p>\n<p>Most games with lobbys put it's games in separate <a href="https://create.roblox.com/docs/en-us/production/publishing/publishing-experiences-and-places" rel="nofollow noreferrer">places</a> so the logic and scripts in the lobby don't add up or interfere with the game's own logic. Because for example the game's logic can make it so player's cameras are 1st person locked, while in the lobby you probably would not want that.</p>\n<p>So generally what you want to do is make the main place a lobby and make the games or the game itself that people can <a href="https://create.roblox.com/docs/reference/engine/classes/TeleportService" rel="nofollow noreferrer">teleport</a> to into it's own different place!</p>\n"^^ . . "<p>I am writing lua file. In that we have to read Array of objects to the requested body. Below is the sample request body json.</p>\n<pre><code>{ \n&quot;year&quot;:&quot;2023&quot;,\n &quot;languageId&quot;:&quot;2&quot;,\n &quot;city:&quot;Banglore&quot;, \n&quot;TheatreInfo&quot;: [ \n { &quot;tId&quot;:&quot;123&quot;, &quot;tname&quot;:&quot;inox&quot; },\n { &quot;tId&quot;:&quot;124&quot;, &quot;tname&quot;:&quot;inox&quot; } \n ],\n &quot;usecase&quot;:&quot;tdetails&quot; \n}\n</code></pre>\n<p>We tried to read above json in lua file like below.</p>\n<pre><code>local transform_body = {};\ntransform_body[&quot;year&quot;]=body[&quot;year&quot;]; \ntransform_body[&quot;languageid&quot;]=body[&quot;languageId&quot;]; \ntransform_body[&quot;city&quot;]=body[&quot;city&quot;];\n</code></pre>\n<p>How do I write a lua script for Array of objects TheatreInfo?</p>\n"^^ . "luajit"^^ . "yes, I tried to do this, the function does not work, and I understand that it cannot call the periphery"^^ . . . "How to replace words in file with dictionary and save it to the file?"^^ . . "1"^^ . "the problem is that any attempt to call the peripheral from the API returns zero"^^ . "0"^^ . "<p>You can define bg &amp; fg of the color groups &quot;AlphaShortcut, AlphaHeader, AlphaHeaderLabel, AlphaButtons, AlphaFooter&quot; in your colorscheme config.</p>\n<p><em>Example using <a href="https://github.com/catppuccin/nvim" rel="nofollow noreferrer">catppuccin</a> colorscheme:</em></p>\n<pre><code>return {\n &quot;catppuccin/nvim&quot;,\n config = function()\n require(&quot;catppuccin&quot;).setup({\n custom_highlights = function(colors)\n return {\n AlphaShortcut = { fg = colors.red, bg = colors.mauve },\n AlphaHeader = { fg = colors.red, bg = colors.mauve },\n }\n end,\n })\n end\n}\n</code></pre>\n"^^ . . . . . . "1"^^ . "<p>I am trying to write a lua library providing 2d arrays with the C api. I have followed the <a href="https://www.lua.org/pil/28.html" rel="nofollow noreferrer">tutorial</a> available on the lua website where it is demonstrated how to implement 1d arrays.\nTo add support for 2d arrays I have simply added a third argument to the get method, but it doesn't seems to be the right way to do it, it seems the third parameter is never sent to the get function.</p>\n<p>Here's the C code:</p>\n<pre class="lang-C prettyprint-override"><code>#include &lt;lauxlib.h&gt;\n#include &lt;lua.h&gt;\n\ntypedef struct Array2d {\n size_t height, width;\n int data[];\n} Array2d;\n\nstatic int array2d_get(lua_State *L) {\n Array2d *arr = lua_touserdata(L, 1);\n size_t x = luaL_checkinteger(L, 2) - 1;\n size_t y = luaL_checkinteger(L, 3) - 1;\n luaL_argcheck(L, arr != NULL, 1, &quot;'array' expected&quot;);\n luaL_argcheck(L, x &gt;= 0 &amp;&amp; x &lt; arr-&gt;width, 2, &quot;x is not in [1,width]&quot;);\n luaL_argcheck(L, y &gt;= 0 &amp;&amp; y &lt; arr-&gt;height, 3, &quot;y is not in [1,height]&quot;);\n lua_pushinteger(L, arr-&gt;data[x + y * arr-&gt;width]);\n return 1;\n}\n\nstatic int array2d_size(lua_State *L) {\n Array2d *arr = lua_touserdata(L, 1);\n luaL_argcheck(L, arr != NULL, 1, &quot;'array' expected&quot;);\n lua_pushinteger(L, arr-&gt;width * arr-&gt;height);\n return 1;\n}\n\nstatic int array2d_new(lua_State *L) {\n size_t width = luaL_checkinteger(L, 1);\n size_t height = luaL_checkinteger(L, 2);\n size_t nbytes = sizeof(Array2d) + width * height * sizeof(int);\n Array2d *arr = lua_newuserdata(L, nbytes);\n arr-&gt;width = width;\n arr-&gt;height = height;\n luaL_getmetatable(L, &quot;lib.arr&quot;);\n lua_setmetatable(L, -2);\n\n for (int i = 0; i &lt; width * height; i++) {\n arr-&gt;data[i] = 0;\n }\n return 1;\n}\n\nstatic const struct luaL_Reg libarr_f[] = {{&quot;new&quot;, array2d_new}, {NULL, NULL}};\nstatic const struct luaL_Reg libarr_m[] = {\n {&quot;__index&quot;, array2d_get}, {&quot;__len&quot;, array2d_size}, {NULL, NULL}};\n\nint luaopen_libarr(lua_State *L) {\n luaL_newmetatable(L, &quot;lib.arr&quot;);\n luaL_setfuncs(L, libarr_m, 0);\n luaL_newlib(L, libarr_f);\n return 1;\n}\n\n</code></pre>\n<p>And here is the lua code:</p>\n<pre class="lang-lua prettyprint-override"><code>local libarr = require &quot;libarr&quot;\nlocal width=3\nlocal height=3\narr = libarr.new(width,height)\nfor i=1,width do\n for j=1,height do\n print(arr[i][j])\n end\nend\n</code></pre>\n<p>And when I run the code I get following message, which shows that the get function never received the third argument:</p>\n<pre><code>lua: main.lua:7: bad argument #3 to 'index' (number expected, got no value)\nstack traceback:\n [C]: in metamethod 'index'\n main.lua:7: in main chunk\n [C]: in ?\n</code></pre>\n<p>Does someone knows what I am doing wrong? Any clues on how to make it works?</p>\n"^^ . . . "1"^^ . . . . "0"^^ . . . . . . "nvim.cmp"^^ . . . . . . . . . "<p>So there is this code that I downloaded from nexus mods:</p>\n<pre><code>local IDA, IDB\nlocal LightComponent\n\nfunction HookNewLight(ContextParam)\n local Context = ContextParam:get()\n\n LightComponent = Context:GetPropertyValue(&quot;PointLight&quot;)\n LightComponent:SetHiddenInGame(true, true) \nend\n\nRegisterHook(&quot;/Script/Engine.PlayerController:ClientRestart&quot;, function(Context, NewPawn)\n if IDA == nil then\n IDA, IDB = RegisterHook(&quot;/Game/Core/Characters/Player/AnathemaPlayerCharacter_BP.AnathemaPlayerCharacter_BP_C:Re ceiveBeginPlay&quot;, HookNewLight)\n end\nend)\n\nfunction ToggleVisibility()\n if(LightComponent and LightComponent:IsValid()) then\n local NewState = LightComponent:IsVisible()\n LightComponent:SetHiddenInGame(NewState, true)\n end\nend\n\nRegisterKeyBind(Key.F3, ToggleVisibility)\n</code></pre>\n<p>It's in lua, getting loaded into an unreal engine 5 game using UE4SS, I was trying to make the ToggleVisibility() function repeat for the script to work properly, using timermanager:</p>\n<pre><code>function CheckVisibility()\nif (LightComponent and LightComponent:IsValid() and LightComponent:IsVisible()) then\n ToggleVisibility()\nend\n-- Schedule the function to be called again after 0.1 seconds\nTimerManager:SetTimer(function() CheckVisibility() end, 0.1, false)\nend\n</code></pre>\n<p>hooking into the actor ticks:</p>\n<pre><code>RegisterHook(&quot;/Script/Engine.Actor:Tick&quot;, CheckVisibility)\n</code></pre>\n<p>,etc but none of them seems to work, usually it gives &quot;attempt to index a nil value&quot; error. I wonder if anyone knows how to make it repeat and could help.</p>\n"^^ . . "0"^^ . . "0"^^ . "0"^^ . "0"^^ . "See in the help. Type `:help nvim_` and press tab to browse through completions. Something like `nvim_replace_termcodes`."^^ . . . . . "It returns the json, the request is done @ESkri"^^ . "<p>Im trying to change the number of visible textlabels when the month has changed but it doesnt change it only stays at the first month that was stated and doesnt change the number of visible textlabels based on the month/days of months</p>\n<pre><code>local player = game.Players.LocalPlayer\nlocal PlayerGUI = player.PlayerGui\nlocal Window = PlayerGUI.Computer.Window\nlocal DateWindow = Window.CalenderWindow\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\n\nlocal DateNumbers = DateWindow.DaysHandler:GetChildren()\n\nlocal DaysInMonth = {\n January = 31,\n February = 28,\n March = 31,\n April = 30,\n May = 31,\n June = 30,\n July = 31,\n August = 31,\n September = 30,\n October = 31,\n November = 30,\n December = 31\n}\n\nlocal Months = ReplicatedStorage.Months:GetChildren()\nlocal CurrentMonth = ReplicatedStorage.CurrentMonth.Value\nlocal monthSwitched = false\n\nfor _, DayLabel in pairs(DateNumbers) do\n local dayNumber = tonumber(DayLabel.Name)\n\n if not monthSwitched and dayNumber &gt; DaysInMonth[CurrentMonth] then\n for _, month in pairs(Months) do\n local daysInCurrentMonth = DaysInMonth[month.Name]\n CurrentMonth = month.Name\n monthSwitched = true\n break\n end\n end\n\n if dayNumber &lt;= DaysInMonth[CurrentMonth] then\n DayLabel.Visible = true\n else\n DayLabel.Visible = false\n end\nend\n</code></pre>\n<p>I tried Using another forloop to try getting the months folder and use that as the current month but it didnt seem to work out.</p>\n"^^ . "0"^^ . . . "Right. Sorry. The commented lines in both files just show where I did tests: printing the output from the Lua file and pasting it into the tex file. The commands worked when pasted in but not when sent via tex.print()."^^ . "1"^^ . "pandoc"^^ . "tcp"^^ . . . "0"^^ . . "0"^^ . . "3"^^ . . "<p>Try this instead of that code, there is no need for that repeat loop but you can add checks to ensure that the code runs at a time when it can.</p>\n<p>Also turn on ResetOnSpawn this will fix your issue.</p>\n<pre><code> local players = game:GetService(&quot;Players&quot;)\n local localplayer = players.LocalPlayer\n local char = localplayer.Character or localplayer.CharacterAdded:Wait() -- Handle character respawn\n local hum = char:WaitForChild(&quot;Humanoid&quot;)\n local cam = game.Workspace.CurrentCamera\n local MenuCamera = game.Workspace.MenuRoom.MenuCamera\n\n hum.Died:Connect(function()\n print(&quot;Death event triggered!&quot;) -- Debugging\n wait(1.5)\n script.Parent.DeathScreen.Visible = true\n\n cam.CameraType = Enum.CameraType.Scriptable\n cam.CFrame = MenuCamera.CFrame\n\n wait(2)\n script.Parent.DeathScreen.Visible = false\n end)\n</code></pre>\n"^^ . . "`mp.option[o] = ...` is *two*, separate index operations ([new]index `o` in the result of indexing `'option'` in `mp`). The second section of [this answer](https://stackoverflow.com/a/77281716/2505965) describes the behaviour of nested indexing (although the context of that question is very different). You need the result of indexing `'option'` in the first table to return a different table (a *proxy*) that has its own `__newindex` metamethod, and then perform the assignment (get the userdata via a separate reference / upvalue)."^^ . "i trying to\n(OpenPeripherial addon)\n\nin API\n glas = peripherial.wrap("top")\nfunction func()\n glas.addBox(args)\nend\n\nin test\n load api\n api.func\n\nwhat i reduce\n\n"attempt to index ? ( a nil value)"^^ . "2"^^ . . "There are a few ways to set up the behaviour described above, so for a solid answer it would be very helpful if you could [edit] your question to include a *proper* [mre] - one that fully *compiles* without error (expected Lua runtime error OK). This means all appropriate `#include` directives, a `main` function, and enough driving code to create a working environment that can be modified with an example (and preferably hard-code your Lua code - i.e., use `luaL_dostring`)."^^ . "If you ask about C++, why do you spam tag C watchers?"^^ . "1"^^ . . . . . . "Can you print the value of `local response` after `HTTPService:PostAsync`?"^^ . "hammerspoon"^^ . "fopen"^^ . . "<p>It really depends different games use different methods the two methods would be:</p>\n<ol>\n<li><p><strong>Have everything, maps and the lobby in the same place.</strong> This approach would make use of moving the players character from one position to another withing the same place. This is relatively simple. However, this method would have its downside when you have a complex game loop/system. It could be quite complex to handle where players are and teleporting the correct players and then respawning the correct players back to the lobby. Also, if you have multiple game loops running simultaneously you could end up with timing and lag issues.</p>\n</li>\n<li><p><strong>The second approach is having each game/map in a different place.</strong> This could make it slightly more difficult to start off with, however if you have a complex game, you would be glad you went through the slightly steep learning curve of handling players and place teleports. It would have the advantage of keeping everything separate and avoiding issues with crossovers and simultaneous running games. It also has the extra advantage that all players on the same map are in the same server, as well as the advantage of making it easier to have different lighting/environment settings for different maps.</p>\n</li>\n</ol>\n<p>So, I would recommend if players separate in your lobby to play different maps you should use different places, but if you game is like Murder Mystery 2 or Arsenal for example you should keep all players in the same place and teleport them to the selected map.</p>\n"^^ . . . . . . . "<p><code>acc_1:deposit(100.0)</code> is syntax sugar for <code>acc_1.deposit(acc_1, 100.0)</code>. The immediate issue you have is that <code>acc_1.deposit</code> is <code>nil</code>. First off, <code>acc_1</code> is empty. This is sort of by design -- it is a <code>proxy</code> returned by <code>AccountProxy:new</code>. Because the key doesn't exist, it will check the metatable. The <code>__index</code> method looks in the corresponding <code>account</code> table, but this only has <code>balance</code>. There is nothing connecting <code>acc_1</code> to <code>AccountProxy.deposit</code>. You could call <code>AccountProxy.deposit(acc_1, 100.0)</code>, but this is not really a traditional object-oriented pattern.</p>\n<p>You want <code>acc_1.deposit</code> to be associated with the actual method, so you must either put <code>deposit</code> directly in <code>acc_1</code>, or else make it accessible via the metatable. I think these are both fine, but I probably prefer the second given that you don't want to access any local variables defined in <code>new</code> from your instance methods. E.g.</p>\n<pre><code>function AccountProxy:new()\n local proxy = {}\n -- ...\n function proxy:deposit()\n -- do the deposit ...\n end\n -- ...\n return proxy\nend\n</code></pre>\n<p>or</p>\n<pre><code>function AccountProxy:new()\n local proxy = {}\n setmetatable(proxy, {\n __index = AccountProxy,\n })\n -- ...\n return proxy\nend\n</code></pre>\n<p>Using the metatable for this purpose could interfere with your existing metatable, but I think your existing metatable is sabotaging your purpose. Supposedly the purpose of the proxy here is encapsulation -- to prevent outside code from accessing <code>balance</code>. The metatable you give just allows any code (inside or outside) to access balance. (Yes, it is the kind of metatable used in the referenced example, but as I see things, it is just an example of forcing access to go through a certain path rather than specifically making that path use metatable.)</p>\n<p>Without the metatable, you need another way to retrieve <code>balance</code> from <code>proxy</code>; and you have already partially implemented this as suggested by the exercise. Given <code>proxy</code>, you can lookup <code>accounts[proxy]</code> e.g.</p>\n<pre><code>function AccountProxy:getBalance()\n return accounts[self].balance or 0\nend\n</code></pre>\n<p>Assuming outside code doesn't have access to <code>accounts</code> (which can be enforced by lexical scoping), it then can't directly interact with <code>balance</code> except through the provided methods.</p>\n<p>(Using <code>accounts</code> is not the only way to do such a mapping or get this kind of encapsulation. I would tend to use closure instead, but I'm not sure if that's a pattern discussed elsewhere.)</p>\n<p>Additional stylistic notes:</p>\n<ul>\n<li><code>AccountProxy:new</code> doesn't use <code>self</code>; things that are conceptually not instance methods may be preferable to just use <code>.</code> instead of <code>:</code>.</li>\n<li>You methods all handle the case that the balance might be <code>nil</code>. I don't necessarily have a problem with this, but I would rather not do it if I know the balance is never <code>nil</code> (which I think is true here).</li>\n</ul>\n"^^ . . . . . "<p>The receiver isn't returning anything, let's add a return.</p>\n<pre class="lang-lua prettyprint-override"><code>function receive(x)\n return coroutine.yield(x)\nend\n</code></pre>\n<p>The receiver only returns one value in your example, let's remove <code>_</code>.</p>\n<pre class="lang-lua prettyprint-override"><code>local x = receive(x)\n</code></pre>\n<p>Then all your consumer, filter etc are one input delayed because you ignore the first x, and then enter the loop.</p>\n"^^ . . ""If no peripheral is connected, returns nil.", are you sure the side is correct and is a valid peripherial?"^^ . . "2"^^ . "I tried this, and it still leads to an error in the C code. "Caught signal 4 (Illegal instruction: illegal operand)". It seems like the Lua function does not return any information, and the error is obscured within the library."^^ . "0"^^ . . . . "okay i cant load scren shoots"^^ . . "dpdk"^^ . . . . "<p>You must use another level of long bracket:</p>\n<pre><code>page = [=[\n &lt;HTML&gt;\n &lt;HEAD&gt;\n &lt;TITLE&gt;An HTML Page&lt;/TITLE&gt;\n &lt;/HEAD&gt;\n &lt;BODY&gt;\n &lt;A HREF=&quot;http://www.lua.org&quot;&gt;Lua&lt;/A&gt;\n [[a text between double brackets]]\n &lt;/BODY&gt;\n &lt;/HTML&gt;\n ]=]\n</code></pre>\n<p>The header says &quot;This first edition was written for Lua 5.0&quot;, this was changed in <a href="https://www.lua.org/manual/5.1/manual.html#7.1" rel="noreferrer">Lua 5.1</a>:</p>\n<blockquote>\n<p>The long string/long comment syntax ([[string]]) does not allow nesting. You can use the new syntax ([=[string]=]) in these cases. (See compile-time option LUA_COMPAT_LSTR in luaconf.h.)</p>\n</blockquote>\n"^^ . "0"^^ . "dll"^^ . "I'm working with a monitor if that's the case"^^ . "how can i fix diagonal movement being faster than normal movement? (lua/love2d)"^^ . . "<p><code>StarterGui</code> replicates to the client as <code>PlayerGui</code>. They'll only see changes as the player if you update the value from there.</p>\n<p>Keep your clock in your server, and then have the clients listen for updates to that object's value. This way, you've got one source of truth for the time.</p>\n<p>Alternatively, if you want to keep using DateTime (which is also fine), you can set up your clock underneath <code>StarterGui</code> as you do here, but change your definition (and your var name appropriately) so that it will reference the <code>PlayerGui</code> after it replicates. Understand, though, that by using this method, you accept that you won't use this value for anything besides the clock GUI. It'll be too prone to losing sync to use it for anything sensitive.</p>\n<pre class="lang-lua prettyprint-override"><code>local gui = script.Parent -- will reference `PlayerGui` after client replication\n\nwhile true do\n local UniversalTime = DateTime.now():ToUniversalTime()\n\n [. . .]\n\n gui.ScreenGui.Frame.Clock.Text = `{Hours}:{Minutes}:{Seconds}`\n \n wait(1)\nend\n\n</code></pre>\n<p><strong>Side note</strong>: I recommend looking into the <a href="https://create.roblox.com/docs/reference/engine/libraries/task" rel="nofollow noreferrer">task library</a> to find better ways of executing this with threading. Specifically, <a href="https://create.roblox.com/docs/reference/engine/libraries/task#spawn" rel="nofollow noreferrer"><code>spawn</code></a>; a simple change that will lead to better practice.</p>\n"^^ . "writer"^^ . . . "How to read/iterate Array of ojects in lua script"^^ . . . . . "<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>local toolPart = script.Parent\nlocal swung = false\nlocal ReplicatedStorage = game:GetService("ReplicatedStorage")\nlocal RemoteEventFolder = ReplicatedStorage.RemoteEvents\nlocal UpdateMoneyEvent = RemoteEventFolder.UpdateMoney\nlocal touchingParts = toolPart.Handle:GetTouchingParts()\nlocal toolPart = script.Parent\n\nMINING_TIME = 1\n\nlocal function onTouch(partTouched)\n -- Check if the touched part is named "Coal"\n if partTouched.Name == "Coal" then\n _+=1;while not __ do __=_ while wait(MINING_TIME)and _&gt;0 do\n UpdateMoneyEvent:FireServer(100) \n print("Tool activated and touching a part named Coal!")\n end;__=___;end\n end\nend\ntoolPart.Handle.Touched:Connect(onTouch)\n toolPart.Handle.TouchEnded:Connect(function()_-=1;end)_=0</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . . "8"^^ . "1"^^ . "2"^^ . . . "Yes, peripherial.isPresent returns "true""^^ . "1"^^ . . . . "1"^^ . . . "0"^^ . . . "function"^^ . "tarantool-cartridge"^^ . . . "4"^^ . . . . . "1"^^ . "0"^^ . . . . . . . . "<p>I'm currently working on my own game engine, which uses C and LuaJIT, and I'm working on scripting for my entity hierarchy. As part of my hierarchy's design, I have a single node struct here, and I use a void pointer to node-specific data.</p>\n<pre class="lang-c prettyprint-override"><code>typedef struct game_node_t game_node;\ntypedef struct game_node_vector_t game_node_vec;\n\nstruct game_node_t {\n const char *name;\n game_node* parent;\n game_node_vec children;\n\n enum GAME_NODE_TYPES type;\n void *data;\n};\n</code></pre>\n<p>However, in my scripts, I want to use metatables for the different node types in order to resemble object-oriented programming, but my current design prevents me from doing this later on:</p>\n<pre class="lang-lua prettyprint-override"><code>game.sound = ffi.metatype(&quot;game_node&quot;, sound_metatable)\ngame.sprite = ffi.metatype(&quot;game_node&quot;, sprite_metatable)\n</code></pre>\n<p>This would give the node types sounds and sprites their specific methods. The resulting error is &quot;cannot change a protected metatable&quot;, which isn't surprising after reading LuaJIT's documentation.</p>\n<p>So far, I've only tried putting this in my cdef:</p>\n<pre><code>typedef struct game_node_t game_sound_node;\ntypedef struct game_node_t game_sprite_node;\n</code></pre>\n<p>And doing this:</p>\n<pre><code>game.sound = ffi.metatype(&quot;game_sound_node&quot;, sound_metatable)\ngame.sprite = ffi.metatype(&quot;game_sprite_node&quot;, sprite_metatable)\n</code></pre>\n<p>This still results in &quot;cannot change a protected metatable&quot;. Are there any design changes or potential workarounds that I should consider?</p>\n"^^ . "json"^^ . "Are there any errors with the code before the `tool.Equipped` statement, if there is it could be stopping the rest of the script from running."^^ . . . . "Right on the money.\nIt was not a number. I added ´´´angleNumber = tonumber(angleNumber)´´´ and it worked.\nThanks!"^^ . . . "1"^^ . "0"^^ . "-2"^^ . "1"^^ . . . . . . . "0"^^ . . . "Developer product successful, even if it should not"^^ . "fennel"^^ . . . "2"^^ . . . . . . "Tarantool Cartridge "Memory is highly fragmented" errors"^^ . . . "1"^^ . . "0"^^ . "tarantool"^^ . "luau"^^ . . "0"^^ . "4"^^ . . "How can i make it so my tool detects whe it's activated because it's not working"^^ . . . . . "1"^^ . "1"^^ . . . . "@IlyaVerbin initial post has been updated"^^ . . "`#include <lua.hpp>` - this is not C. `extern "C"` is also invalid C."^^ . "0"^^ . . . . . "1"^^ . . "2"^^ . "0"^^ . "0"^^ . "0"^^ . . "0"^^ . "1"^^ . . "Lua if statement always goes to else option"^^ . . . "1"^^ . . . "0"^^ . "0"^^ . . . . "1"^^ . "0"^^ . . "0"^^ . . . "0"^^ . . . "1"^^ . "0"^^ . . . "0"^^ . . . "1"^^ . . "0"^^ . "It's not different from how you read any other table. https://www.lua.org/pil/2.5.html\n`body["TheatreInfo"]`, or short `body.TheatreInfo`, just gives you another table, which you can again index."^^ . . ""*How to open the file, find the line (one line has just one word) and save it to other file?*": What is "the file"? In what format (Lua/JSON/text/etc.)? Save *what* to "the other file"? Please edit the question to clarify the problem."^^ . . "0"^^ . . . "0"^^ . . "Your question has been asked and answered already: https://stackoverflow.com/questions/77634753/how-to-read-nested-objectsobject-inside-object-in-lua-file"^^ . . "0"^^ . "<p>My roblox tool has a function to perform when activated but it literally does nothing</p>\n<p>I tried to change it to tool.Deactivated, no change. I added print functions to my function to check if it was working, none of the prints worked, and theres no errors or anything.</p>\n<p>If you want the code, here it is:</p>\n<pre><code>local player = game.Players.LocalPlayer\nlocal character = player.Character or player.CharacterAdded:Wait()\nlocal hum = character:WaitForChild(&quot;Humanoid&quot;)\nlocal animator = hum:WaitForChild(&quot;Animator&quot;)\nlocal tool = script.Parent\n\nlocal leftPunch = animator:LoadAnimation(script:WaitForChild(&quot;RookieLeftPunch&quot;))\nlocal rightPunch = animator:LoadAnimation(script:WaitForChild(&quot;RookieRightPunch&quot;))\n\nlocal currentPunch = 0\n\nlocal debounce = false \ntool.Equipped:Connect(function()\n print(&quot;equipped&quot;)\n tool.Activated:Connect(function()\n if debounce then return end\n\n debounce = true\n if currentPunch == 0 then\n rightPunch:Play()\n task.wait(0.4)\n print(&quot;punched 1&quot;)\n debounce = false\n elseif currentPunch == 1 then\n leftPunch:Play()\n task.wait(0.4)\n print(&quot;punched 2&quot;)\n debounce = false\n elseif currentPunch == 2 then\n rightPunch:Play()\n task.wait(0.8)\n print(&quot;punched 3&quot;)\n debounce = false\n end\n\n if currentPunch == 2 then\n currentPunch = 0\n else\n currentPunch += 1\n end\n end)\n\n\nend)\n\n\n</code></pre>\n"^^ . . "4"^^ . "1"^^ . "1"^^ . . "0"^^ . "2"^^ . . . . . . . "love2d"^^ . "<p>Im making a simulator type game where when you walk on to a certain part, you can sell your stuff. Ive made the code to take away your stuff, but no matter what i do, it just will not do anything.\nThe code sets the stat to zero but it doesnt actually happen in game. The puzzling thing is that there is no errors in the output</p>\n<pre><code>local hitbox = game.Workspace.SellBuildingHitbox\n\nhitbox.Touched:Connect(function(hit)\n \n local plrname = hit.Parent.Name\n\n if game.Players:FindFirstChild(plrname) then\n \n local plr = game.Players:FindFirstChild(plrname)\n \n plr.Stats.Stomach.Value = 0 \n \n \n end\n\nend)\n</code></pre>\n<p>Thanks in advance!</p>\n"^^ . . . "trying to display the table number will do nothing"^^ . . "0"^^ . . . . . "[How to suppress warning: undefined global `vim`?](https://neovim.discourse.group/t/how-to-suppress-warning-undefined-global-vim/1882/4)"^^ . "0"^^ . "0"^^ . . . . "0"^^ . . . "Lua table pairs output showing same value"^^ . . . "ur article is great but i cannot make it to run wth metatables.. take a look at the new post in my question."^^ . . "1"^^ . . . . . . . . "I'm not a lua person. But this is totally wrong. how can you check "dayNumber > DaysInMonth[CurrentMonth]" as meny months have similar day count? eg: January, March, May,... have 31 days. So if your calendar days count is 30 it's always gives you "January"."^^ . . . "Only thing I can say to help not enough context :c"^^ . . . "0"^^ . . . . . . "0"^^ . . . "0"^^ . . . . . "1"^^ . "0"^^ . . . . . . . . "2"^^ . . "Share data(variables) between lua callback functions in C++"^^ . . "2"^^ . "1"^^ . . . . . "Alright, elaborated on the pitfalls in my answer."^^ . . . "The question is too vague but I assume you do not increase the counter at the server side. Make sure all code related to server mechanics are indeed on the server."^^ . . "How to hide Undefined global vim warning in Neovim?"^^ . "0"^^ . . "0"^^ . . . . "1"^^ . "<p>In NvChad, autocompletion is &lt;C-Space&gt; (Control + Space) <a href="https://github.com/NvChad/NvChad/blob/v2.0/lua/plugins/configs/cmp.lua#L76C1-L76C44" rel="nofollow noreferrer">by default</a></p>\n<p><a href="https://github.com/hrsh7th/nvim-cmp" rel="nofollow noreferrer">nvim-cmp</a> is responsible for autocompletion.</p>\n<p>If you want to change the default mapping, you have to add custom plugin options in NvChad (<a href="https://nvchad.com/docs/config/plugins" rel="nofollow noreferrer">source</a>):</p>\n<ul>\n<li>custom/chadrc.lua</li>\n</ul>\n<pre class="lang-lua prettyprint-override"><code>M.plugins = &quot;custom.plugins&quot;\n</code></pre>\n<ul>\n<li>custom/plugins.lua</li>\n</ul>\n<pre class="lang-lua prettyprint-override"><code>local plugins = {\n -- this opts will extend the default opts \n {\n &quot;hrsh7th/nvim-cmp&quot;,\n opts = {\n mapping = {\n [&quot;&lt;C-Space&gt;&quot;] = cmp.mapping.complete(), -- Replace with whatever you want\n },\n },\n },\n}\n\nreturn plugins\n</code></pre>\n<p><em>NOTE: This is true only to NvChad. For configuring with any other neovim config, consult the documentation.</em></p>\n<p>I recommend creating your own config instead of using a ready-made distribution like NvChad. It gives you a deep understanding of neovim configuration. If you don't know where to start, check out <a href="https://github.com/nvim-lua/kickstart.nvim" rel="nofollow noreferrer">kickstart.nvim</a></p>\n"^^ . . . "0"^^ . . "0"^^ . . . . . . . "0"^^ . "I can't make an entity. (Roblox)"^^ . . . . "When I run "lua" command it shows 5.3.6 but in pktgen build it shows 5.1.4."^^ . . "<p>I suggest using a multithreaded library, such as <a href="https://luarocks.org/modules/benoitgermain/lanes" rel="nofollow noreferrer">Lanes</a>. If you only want to use LuaSocket, you need to follow the order below (pseudocode):</p>\n<pre><code>while 1 do\n server:accept()\n ...\n for i,client in ipairs(clients) do\n client:receive()\n ...\n client:send()\n ...\n end\nend\n</code></pre>\n<p>You can use <code>socket.select</code> to filter out the clients that have already received data or ready to send data, thus avoiding having to loop through all clients each time:</p>\n<pre><code>local recvt, sendt, err = socket.select(clients, clients, 0.01)\nif not err then\n if recvt then\n -- Calling receive on clients in this table will immediately return.\n for k,c in ipairs(recvt) do\n local line, err = c:receive()\n end\n end\n if sendt then\n -- Same as recvt\n for k,c in ipairs(sendt) do\n end\n end\nend\n</code></pre>\n"^^ . . . "0"^^ . "0"^^ . . "2"^^ . "<p>A have a dictionary as</p>\n<pre><code>dict = { \n body = &quot;Körper&quot;,\n child = &quot;Kind&quot;,\n eye = &quot;Auge&quot;\n face = &quot;Gesicht&quot;\n}\n</code></pre>\n<p>And I have something like lookup function as:</p>\n<pre><code>function performLookup(words, dict)\n for i, word in ipairs(words) do\n if dict[word] then\n words[i] = dict[word]\n end\n end\nend\n</code></pre>\n<p>How to open the file, find the line (one line has just one word) and save it to other file? Ideally the dictionary must be also in the file and loaded as lookup table.</p>\n<p><strong>Update:</strong>\nSo, by having files <code>dict.tsv</code> and <code>locale_EN.txt</code> we creating a new locale file, but with accordingly replaced words in the file <code>locale_DE.txt</code>.</p>\n"^^ . . . "Thanks, it works! Missed that `cmp.mapping.complete()` mapping in `configs/cmp.lua`"^^ . . "0"^^ . . . . . "ffi"^^ . . . "0"^^ . "The port you provided is invalid, but I assume you replaced the actual one with a joke. From the Lua website, “ A program with coroutines is, at any given time, running only one of its coroutines and this running coroutine only suspends its execution when it explicitly requests to be suspended.” You should use threads instead."^^ . . "0"^^ . "0"^^ . . "1"^^ . . . . . "0"^^ . "2"^^ . "1"^^ . . "0"^^ . "<p>I slept on it and came up with my own solution. I wrote a function to create nodes, which replaces the new method for each node type.</p>\n<pre><code>local type_table = {\n sound = sound_metatable.new,\n sprite = sprite_metatable.new\n}\n\nfunction create_node(type)\n return type_table[type]()\nend\n</code></pre>\n<p>Then, I wrote a new metatable that looks up the function tables based on the node's type.</p>\n<pre><code>local lookup_table = {\n [sound_enum] = sound_metatable,\n [sprite_enum] = sprite_metatable\n}\n\nlocal test_metatable = {\n __index = function (table, key)\n print(tonumber(table.type))\n return lookup_table[tonumber(table.type)][key]\n end\n}\n</code></pre>\n<p>Then, I can do this:</p>\n<pre><code>game.node = ffi.metatype(&quot;game_node&quot;, test_metatable)\n</code></pre>\n<p>It adds a small level of overhead, but it enables me to have a single C struct that has a different set of functions depending on the type value.</p>\n"^^ . . . . "0"^^ . . . "0"^^ . . "0"^^ . . . . . . . . "1"^^ . "What did you try so far? What part did you get stuck on? We're not just going to do the whole thing for you."^^ . . "Why i cant use peripherial api in api computer craft?"^^ . . "0"^^ . "Yes, I said (in my answer) that you have to make sure no other key notation left (`<c-a>` as (3c, 63, 2d, 61, 3e)). That is, either read already preprocessed data back from the mapping set, or process string yourself using api call."^^ . "0"^^ . . "0"^^ . . . . . "0"^^ . . "0"^^ . "lua server can't handle mutiple clients"^^ . . "@Matt ok thanks! Could you point me to the relevant API call that does this processing?"^^ . . . "How to pass dynamic statement into function?"^^ . . "<p>Im trying to create an API from C to Lua for lua can use ecc_encrypt and decrypt from libtomcrypt, for it have the function encrypt that encrypt the mensage given by blocks and when im trying do decrypt it by blocks when it start the second block always get the error invalid input packet</p>\n<p>This is my C code</p>\n<pre><code>#define LTM_DESC \n#include &lt;tomcrypt.h&gt;\n#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n#include &lt;string.h&gt;\n#include &quot;lua.h&quot;\n#include &quot;lauxlib.h&quot;\n\n// variáveis globais\nprng_state prng;\nint err, prng_idx , hash_idx;\n\n// criando a estrutura do output\ntypedef struct {\n unsigned long exported_key_len;\n unsigned long ctlen;\n} Pair;\n\nPair pair;\n\n\nstatic int gera_chave_lua(lua_State *L) {\n ecc_key mykey;\n unsigned char exported_key_public[1024];\n size_t exported_key_public_len = sizeof(exported_key_public);\n unsigned char exported_key_private[1024];\n size_t exported_key_private_len = sizeof(exported_key_private);\n\n if (register_prng(&amp;yarrow_desc) == -1) {\n lua_pushstring(L, &quot;Erro ao registrar Yarrow.&quot;);\n lua_error(L);\n }\n \n if (register_hash(&amp;sha512_desc) == -1) {\n lua_pushstring(L, &quot;Erro ao registrar sha256.&quot;);\n lua_error(L);\n }\n\n prng_idx = find_prng(&quot;yarrow&quot;);\n hash_idx = find_hash(&quot;sha512&quot;);\n\n if ((err = rng_make_prng(256, prng_idx ,&amp;prng, NULL)) != CRYPT_OK) {\n lua_pushfstring(L, &quot;Erro ao configurar PRNG: %s&quot;, error_to_string(err));\n lua_error(L);\n }\n\n if ((err = ecc_make_key(&amp;prng, prng_idx, 65, &amp;mykey)) != CRYPT_OK) {\n lua_pushfstring(L, &quot;Erro ao criar a chave: %s&quot;, error_to_string(err));\n lua_error(L);\n }\n\n if ((err = ecc_export(exported_key_public ,&amp;exported_key_public_len , PK_PUBLIC, &amp;mykey)) != CRYPT_OK) {\n lua_pushfstring(L, &quot;Erro ao exportar a chave pública: %s&quot;, error_to_string(err));\n lua_error(L);\n }\n\n if ((err = ecc_export(exported_key_private ,&amp;exported_key_private_len , PK_PRIVATE, &amp;mykey)) != CRYPT_OK) {\n lua_pushfstring(L, &quot;Erro ao exportar a chave privada: %s&quot;, error_to_string(err));\n lua_error(L);\n }\n\n lua_pushlstring(L, (const char *)exported_key_public, exported_key_public_len);\n lua_pushlstring(L, (const char *)exported_key_private, exported_key_private_len);\n return 2;\n}\n\n\n// Alterações na função encriptar para receber texto e chave pública do Lua\n\nstatic int encriptar_lua(lua_State *L) {\n ecc_key mykey;\n const char *plaintext = lua_tostring(L, 1);\n const char *pb_key = lua_tostring(L, 2);\n size_t ptlen = strlen(plaintext);\n size_t numBlocks = ptlen / 64 + ((ptlen % 64 != 0) ? 1 : 0); // Calcula o número de blocos necessários\n size_t blockCount = 1; // Contador do bloco atual\n size_t totalLen = numBlocks * 1024; // Tamanho total estimado do buffer\n\n unsigned char *buffer = (unsigned char *)malloc((totalLen + 1) * sizeof(unsigned char)); // Aloca memória para o buffer\n if (buffer == NULL) {\n lua_pushstring(L, &quot;Erro ao alocar memória para o buffer.&quot;);\n lua_error(L);\n }\n\n size_t bufferIndex = 0;\n\n if ((err = ecc_import((unsigned char *)pb_key, &amp;pair.exported_key_len, &amp;mykey)) != CRYPT_OK) {\n free(buffer); // Libera a memória alocada para o buffer\n lua_pushfstring(L, &quot;Erro ao importar a chave ECC: %s&quot;, error_to_string(err));\n lua_error(L);\n }\n\n while (ptlen &gt; 0) {\n unsigned char ciphertext[1024];\n size_t ctlen = sizeof(ciphertext);\n size_t len = (ptlen &gt; 64) ? 64 : ptlen; // Calcula o tamanho do bloco\n\n printf(&quot;entrei aqui x vezes\\n&quot;);\n if ((err = ecc_encrypt_key((const unsigned char *)plaintext, len, ciphertext, &amp;ctlen, &amp;prng, prng_idx, hash_idx, &amp;mykey)) != CRYPT_OK) {\n free(buffer); // Libera a memória alocada para o buffer\n lua_pushfstring(L, &quot;Erro ao criptografar o texto: %s&quot;, error_to_string(err));\n lua_error(L);\n }\n\n // Adiciona os dados criptografados ao buffer\n memcpy(buffer + bufferIndex, ciphertext, ctlen);\n bufferIndex += ctlen;\n\n ptlen -= len;\n plaintext += len;\n blockCount++;\n }\n\n buffer[bufferIndex] = '\\0'; // Adiciona o caractere nulo no final do buffer\n\n pair.ctlen = numBlocks; // Atualiza o número de blocos na estrutura Pair\n\n // Empurra a string resultante para a pilha Lua\n lua_pushlstring(L, (const char *)buffer, bufferIndex);\n\n free(buffer); // Libera a memória alocada para o buffer\n return 1;\n}\n\n// Função para descriptar o texto encriptado usando a chave privada\nstatic int descriptar_lua(lua_State *L) {\n ecc_key mykey;\n const char *pv_key = lua_tostring(L, 1);\n const char *ciphertext = lua_tostring(L, 2);\n\n if ((err = ecc_import((unsigned char *)pv_key, &amp;pair.exported_key_len, &amp;mykey)) != CRYPT_OK) {\n lua_pushfstring(L, &quot;Erro ao importar a chave ECC: %s&quot;, error_to_string(err));\n lua_error(L);\n }\n\n int blockCount = pair.ctlen; // Número de blocos salvos na estrutura Pair\n size_t totalLen = blockCount * 1024; // Tamanho total estimado do texto descriptografado\n\n unsigned char *buffer = (unsigned char *)malloc((totalLen + 1) * sizeof(unsigned char)); // Aloca memória para o buffer\n if (buffer == NULL) {\n lua_pushstring(L, &quot;Erro ao alocar memória para o buffer.&quot;);\n lua_error(L);\n }\n\n size_t bufferIndex = 0;\n\n for (int i = 0; i &lt; blockCount; ++i) {\n unsigned char plaintext[1024];\n size_t ptlen = sizeof(plaintext);\n\n if ((err = ecc_decrypt_key((const unsigned char *)(ciphertext + i * 1024), 1024, plaintext, &amp;ptlen, &amp;mykey)) != CRYPT_OK) {\n free(buffer); // Libera a memória alocada para o buffer\n lua_pushfstring(L, &quot;Erro ao descriptografar o texto: %s&quot;, error_to_string(err));\n lua_error(L);\n }\n\n // Adiciona os dados descriptografados ao buffer\n memcpy(buffer + bufferIndex, plaintext, ptlen);\n bufferIndex += ptlen;\n }\n\n buffer[bufferIndex] = '\\0'; // Adiciona o caractere nulo no final do buffer\n\n // Empurra a string resultante para a pilha Lua\n lua_pushlstring(L, (const char *)buffer, bufferIndex);\n\n free(buffer); // Libera a memória alocada para o buffer\n return 1;\n}\n\n\n\nint luaopen_mylib(lua_State *L) {\n luaL_Reg funcs[] = {\n {&quot;gera_chave_lua&quot;, gera_chave_lua},\n {&quot;encriptar_lua&quot;, encriptar_lua},\n {&quot;descriptar_lua&quot;, descriptar_lua},\n {NULL, NULL}\n };\n luaL_newlib(L, funcs);\n return 1;\n}\n\nint main(void) {\n ltc_mp = ltm_desc;\n\n lua_State *L = luaL_newstate();\n luaL_openlibs(L);\n luaL_requiref(L, &quot;mylib&quot;, luaopen_mylib, 1);\n\n if (luaL_dofile(L, &quot;teste_lua.lua&quot;)) {\n printf(&quot;Erro ao executar o arquivo Lua: %s\\n&quot;, lua_tostring(L, -1));\n lua_pop(L, 1);\n }\n\n lua_close(L);\n\n return 0;\n}\n</code></pre>\n<pre><code>local mylib = require(&quot;mylib&quot;)\n\n-- Gera chave\nlocal pub_key, prv_key = mylib.gera_chave_lua()\n\nprint(&quot;Chave Pública:&quot;)\nprint(pub_key)\nprint(&quot;\\nChave Privada:&quot;)\nprint(prv_key)\n\n-- Encripta um texto usando a chave pública\nlocal texto_original = &quot;MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM&quot;\nprint(&quot;\\nO texto original é&quot;)\nprint(texto_original)\nlocal texto_encriptado = mylib.encriptar_lua(texto_original, pub_key)\n\nprint(&quot;\\nTexto Encriptado:&quot;)\nprint(texto_encriptado)\n\n-- Descriptografa o texto encriptado usando a chave privada\nlocal texto_descriptado = mylib.descriptar_lua(prv_key, texto_encriptado)\n\nprint(&quot;\\nTexto Descriptado:&quot;)\nprint(texto_descriptado)\n</code></pre>\n<p>In my Lua code if I write one mode &quot;M&quot; it will create another block and then error</p>\n<p><code> gcc -I/usr/include/lua5.3 to_lua.c -o to_lua -ltomcrypt -llua5.3</code></p>\n<p>This is how Im compiling</p>\n"^^ . "0"^^ . . . "Just bought the 4th edition ;-)"^^ . "0"^^ . . "proxy"^^ . "0"^^ . . . . . . "Thanx for reply although I don't think this is what I need. Maybe my sample was a little bit tricky. Actually I would like to pass some pointer to much bigger object I could access inside different callback functions and make some actions for it."^^ . . . . . "2"^^ . "1"^^ . . "0"^^ . . "0"^^ . . . . . "png"^^ . . . "neovim-plugin"^^ . "Script running but simply not doing what it says(no errors)"^^ . . . "1"^^ . "1"^^ . . . . . . "<p>how I can share/access some data inside several lua callback functions in C++? I know that I can use global c++ variables or some singleton but I don't want to use that.</p>\n<p>Hypotetic sample:</p>\n<pre><code>static int SetParam(lua_State *state) {\n // be able to access nTotalSetParamCalls to do this:\n ++nTotalSetParamCalls;\n}\n\nlong nTotalSetParamCalls = 0L; // don't want to be it global, I would like to set it to m_luaState and then access it inside callback function\nlua_register(m_luaState, &quot;SetParam&quot;, SetParam);\nluaL_dostring(m_luaState, script);\n\nstd::cout &lt;&lt; &quot;SetParam was called: &quot; &lt;&lt; nTotalSetParamCalls &lt;&lt; &quot; times&quot;;\n</code></pre>\n<p>Thanx in advance</p>\n"^^ . . "0"^^ . . . "0"^^ . "0"^^ . "<p>Given this call:</p>\n<pre class="lang-lua prettyprint-override"><code>local trueNodeNum, falseNodeNum = split_data(data, 'nums', 'results', root_numeric_condition, branch_condition)\n</code></pre>\n<p><code>split_data</code> only passes two arguments to <code>root_numeric_condition</code> (<code>root_condition_function</code>)</p>\n<pre class="lang-lua prettyprint-override"><code>if root_condition_function(entry, root_node) then\n</code></pre>\n<p>where three are expected:</p>\n<pre class="lang-lua prettyprint-override"><code>local function root_numeric_condition(entry, root_node, branch_node)\n</code></pre>\n<p>So in <code>root_numeric_condition</code></p>\n<pre class="lang-lua prettyprint-override"><code>local average = entry[branch_node]\n</code></pre>\n<p>will always be <code>nil</code>, and the function will always return <code>false</code>.</p>\n<p>Given the variable name, it looks like you are actually trying to access the <code>average</code> field of the <code>entry</code> table, but</p>\n<pre class="lang-lua prettyprint-override"><code>return tonumber(nums) &lt; tonumber(average), tonumber(nums) &gt;= tonumber(average)\n</code></pre>\n<p>the multiple return values of <code>root_numeric_condition</code> and the use of <code>tonumber</code> on what one would expect to already be numbers makes it rather unclear what your intentions are.</p>\n<hr />\n<p>As a start, <code>split_data</code> can be refactored into:</p>\n<pre class="lang-lua prettyprint-override"><code>local function split_data(data, root, branch, root_condition, branch_condition)\n local results = {\n { true_value = 0, false_value = 0 },\n { true_value = 0, false_value = 0 }\n }\n\n for _, entry in ipairs(data) do\n local b1 = root_condition(entry, root) and 1 or 2\n local b2 = branch_condition(entry, branch) and 'true_value' or 'false_value'\n\n results[b1][b2] = 1 + results[b1][b2]\n end\n\n return results[1], results[2] -- or table.unpack(results)\nend\n</code></pre>\n<p>And purely based on your expectations, one would assume something like</p>\n<pre class="lang-lua prettyprint-override"><code>local function root_numeric_condition(entry, root)\n return not entry.average or entry[root] &gt; entry.average \nend\n</code></pre>\n"^^ . "0"^^ . "@shingo: Yes, but as this is an external Lua file, it gets no TeX processing. So Lua does the %s replacements before LuaLaTeX ever sees this string."^^ . . . . . . "<p>I'm writing C code to check and modify struct members in lua, I'm using metatables</p>\n<p>It works for simple definitions, but in array I couldn't make it work, I have the following code</p>\n<pre><code>struct pinfo {\n int time;\n bool hide_name;\n int type_info[10];\n};\n\nstruct mystruct {\n int id;\n int value;\n int option[20];\n struct pinfo pf[5];\n ....\n};\n\n\nint Get_mystruct(lua_State *L) {\n struct mystruct *ms = (struct mystruct*)lua_touserdata(L, 1);\n\n lua_pushlightuserdata(L, ms);\n luaL_getmetatable(L, &quot;mystruct&quot;);\n lua_setmetatable(L, -2);\n\n return 1;\n}\n\nint mystruct_index(lua_State *L) {\n struct mystruct *ms = (struct mystruct*)lua_touserdata(L, 1);\n const char *field = lua_tostring(L, 2);\n\n\n if (strcmp(field, &quot;id&quot;) == 0) {\n lua_pushinteger(L, ms-&gt;id);\n }\n else if (strcmp(field, &quot;value&quot;) == 0) {\n lua_pushinteger(L, ms-&gt;value);\n }\n else if (strcmp(field, &quot;option&quot;) == 0) {\n lua_pushinteger(L, ms-&gt;option[lua_tointeger(L, 3)]);\n }\n else {\n lua_pushnil(L);\n }\n\n return 1;\n}\n \nint mystruct_newindex(lua_State *L) {\n struct mystruct *ms = (struct mystruct*)lua_touserdata(L, 1);\n const char *field = lua_tostring(L, 2);\n int value = (int)lua_tointeger(L, 3);\n\n\n if (strcmp(field, &quot;id&quot;) == 0) {\n ms-&gt;id = value;\n }\n else if (strcmp(field, &quot;value&quot;) == 0) {\n ms-&gt;value = value;\n }\n else if (strcmp(field, &quot;option&quot;) == 0) {\n ms-&gt;option[lua_tointeger(L, 3)] = (int)lua_tointeger(L, 4);\n } else {\n lua_pushnil(L);\n }\n\n return 0;\n}\n\nvoid mystruct_create(lua_State *L) {\n luaL_Reg mystructData[] = {\n { &quot;GetMyStruct&quot;, Get_mystruct},\n { &quot;__index&quot;, mystruct_index},\n { &quot;__newindex&quot;, mystruct_newindex},\n {NULL, NULL}\n };\n\n luaL_newmetatable(L, &quot;mystruct&quot;);\n luaL_setfuncs(L, mystructData, 0);\n lua_setfield(L, -2, &quot;MyStructLua&quot;);\n}\n</code></pre>\n<p>In lua I use it as follows</p>\n<pre><code>local ms = MyStructLua.GetMyStruct(my_ptr)\n\nprint(ms.id) // Returns 0, not defined\nms.id = 1000 \nprint(ms.id) // Returns 1000, has been defined\n</code></pre>\n<p>Now when I go to define the array a problem occurs when I try for example</p>\n<pre><code>for o = 0, 19 do\n mp.option[o] = 1\nend\n</code></pre>\n<p>When I go to set the value I get the error <strong>bad argument #3 to 'index' (number expected, got no value)</strong></p>\n<p>I would like to know how I can work with simple and complex arrays in this metatable, I have struct which is a member array of mystruct how can I also add it to <strong>_newindex</strong> and <strong>_index</strong></p>\n"^^ . "<p>I have no experience with Unreal Engine, but I see a couple things.</p>\n<ol>\n<li><code>&quot;attempt to index a nil value&quot;</code> should be interpreted as, in simplified form, you tried to do this: <code>nil[1]</code> or <code>nil:foo()</code>. The wording tends to trip some people up. In this case, it makes the most sense that <code>TimerManager</code> does not actually exist in your script because I see no declaration or require, and from the docs on UE4SS, it does not appear under the global-functions section of the API; but it's hard to tell without more details.</li>\n<li>As I was reading through for ways to get a create Unreal classes, I came across the <code>LoopAsync</code> global function for setting up asynchronous loops. This should resolve your issue by foregoing the TimerManager completely, but if you still want to use that class specifically, you can look through to see if there's any global function that will create an Unreal class. From my read-through, it seems like you can only access ones already existing in memory, though.</li>\n</ol>\n<p><a href="https://github.com/UE4SS-RE/RE-UE4SS/tree/main/docs/lua-api/global-functions" rel="nofollow noreferrer">https://github.com/UE4SS-RE/RE-UE4SS/tree/main/docs/lua-api/global-functions</a></p>\n<pre class="lang-lua prettyprint-override"><code>local IDA, IDB\nlocal LightComponent\n\nfunction HookNewLight(ContextParam)\n local Context = ContextParam:get()\n\n LightComponent = Context:GetPropertyValue(&quot;PointLight&quot;)\n LightComponent:SetHiddenInGame(true, true) \nend\n\nRegisterHook(&quot;/Script/Engine.PlayerController:ClientRestart&quot;, function(Context, NewPawn)\n if IDA == nil then\n IDA, IDB = RegisterHook(&quot;/Game/Core/Characters/Player/AnathemaPlayerCharacter_BP.AnathemaPlayerCharacter_BP_C:Re ceiveBeginPlay&quot;, HookNewLight)\n end\nend)\n\nfunction ToggleVisibility()\n if(LightComponent and LightComponent:IsValid()) then\n local NewState = LightComponent:IsVisible()\n LightComponent:SetHiddenInGame(NewState, true)\n end\nend\n\nRegisterKeyBind(Key.F3, function()\n -- call every 100 milliseconds / 0.1 seconds\n LoopAsync(100, function()\n ToggleVisibility()\n\n -- if you need to disable it, you can set up a flag or condition for\n -- this function to return true; otherwise it will loop forever\n return false\n end)\nend)\n</code></pre>\n"^^ . "<p>I made a script like this\nThis is not a local script</p>\n<pre><code>local folder = workspace.Coins\nlocal players = game:GetService(&quot;Players&quot;)\n\nfunction playerSpawned(player)\n local leaderstats = Instance.new(&quot;Folder&quot;, player)\n leaderstats.Name = &quot;leaderstats&quot;\n \n local coins = Instance.new(&quot;IntValue&quot;, leaderstats)\n coins.Name = &quot;Coins&quot;\n coins.Value = 100\n for i, objects in pairs(folder:GetChildren()) do\n local button = Instance.new(&quot;ClickDetector&quot;)\n button.Parent = objects\n objects.ClickDetector.CursorIcon = &quot;rbxassetid://7029597423&quot;\n\n objects.ClickDetector.MouseClick:Connect(function()\n objects.ClickDetector.MaxActivationDistance = 0\n objects.Transparency = 1\n objects.CanCollide = false\n coins.Value = coins.Value + 10\n wait(10)\n objects.ClickDetector.MaxActivationDistance = 300\n objects.Transparency = 0\n objects.CanCollide = true\n end)\n end\nend\n\nplayers.PlayerAdded:Connect(playerSpawned)\n\n</code></pre>\n<p>How do I make it so that if one player takes a coin, the other does not get a coin in the leaderboard?</p>\n"^^ . "0"^^ . . . . . . . . . . . . "4"^^ . . . . . "0"^^ . . . "1"^^ . . . "1"^^ . "plugins"^^ . . "The problem with the script for taking coins (Roblox Lua)"^^ . "0"^^ . . . . . . . . . "1"^^ . "I assume you meant `peripherial.call("top", "clear")`? In any case, clear returns nil as intended, see https://computercraft.info/wiki/Term_(API)"^^ . "computercraft"^^ . . "0"^^ . "I'm trying to call this function from the API but it returns null"^^ . . . . "1"^^ . "<p>Given a string of inputs, it is possible to execute it using <code>:normal!</code>: <code>:normal! ihello</code> will go into insert mode and write the text 'hello'.</p>\n<p>When mapping keys to expressions we can use a similar, albeit incompatible syntax. In Lua, we could, for example, define</p>\n<pre class="lang-lua prettyprint-override"><code>vim.keymap.set('n', 's', '&lt;c-a&gt;y')\n</code></pre>\n<p>Given such a string, <code>'&lt;c-a&gt;y'</code>, how would we execute it imperatively from within Lua/Vimscript without a key binding, similar to what is possible with <code>:normal!</code>?</p>\n"^^ . "0"^^ . . . . . "Figuring out how to make tool work as expected"^^ . . . . "<p>You should move the <code>for</code> loop outside of the function.</p>\n"^^ . "0"^^ . . . "1"^^ . . "1"^^ . . "0"^^ . . . . "<p>Hello I am trying to make a pickaxe tool that when it is activated on a gray part called Coal, it generates cash but im having problems with it because it only works if i move on and off the &quot;Coal&quot; part with pickaxe and click. But I want it to work that it will work when i click and it is already touching &quot;Coal&quot;</p>\n<p>Here is a video showing the problem.</p>\n<p><a href="https://www.youtube.com/watch?v=qcri_MwelCE" rel="nofollow noreferrer">https://www.youtube.com/watch?v=qcri_MwelCE</a></p>\n<pre><code>local toolPart = script.Parent\nlocal swung = false\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal RemoteEventFolder = ReplicatedStorage.RemoteEvents\nlocal UpdateMoneyEvent = RemoteEventFolder.UpdateMoney\nlocal touchingParts = toolPart.Handle:GetTouchingParts()\nlocal toolPart = script.Parent\n\n\nlocal function onTouch(partTouched)\n -- Check if the touched part is named &quot;Coal&quot;\n if partTouched.Name == &quot;Coal&quot; then\n UpdateMoneyEvent:FireServer(100)\n print(&quot;Tool activated and touching a part named Coal!&quot;)\n end\nend\n\ntoolPart.Handle.Touched:Connect(onTouch)\n\n</code></pre>\n<p>Any Help is appreciated! Thanks!</p>\n<p>I did not know what else to try.</p>\n"^^ . . . . "libtomcrypt"^^ . . . . . . . "0"^^ . . . "Outputting LaTeX command from Lua script"^^ . . . . . . . "output"^^ . . . . . "Pktgen console not enabling lua support, build with lua error"^^ . "1"^^ . . . "Please edit your question to include enough C and Lua code that your problem is reproducible."^^ . . . "1"^^ . . . . . "<p>This looks to be in PlayerGui, for which I'm assuming you've got <code>ResetOnSpawn</code> in the properties tab turned off. You either need to turn that on so that whenever the player character dies, this script is created and runs again; OR you need to move all of your character related code into a function that is run every time a new character is created, using <code>Player.CharacterAdded</code>.</p>\n<p>The issue is that once your player's character dies, your assignments from the top of your script no longer point to anything. You need to be reassigning and updating them.</p>\n<p>Thanks to Kylaaa for pointing out that by the time the script executes, the <code>CharacterAdded</code> event might have already been fired. I typically handle this with a flag (for client) or some transient table (for server).</p>\n<pre class="lang-lua prettyprint-override"><code>local players = game:GetService(&quot;Players&quot;)\nlocal localplayer = players.LocalPlayer\n\nlocal cam = game.Workspace.CurrentCamera\nlocal MenuCamera = game.Workspace.MenuRoom.MenuCamera\n\nlocal playerAlreadyLoaded = player.Character -- store for use later\n\nlocal function handleDeath(char)\n local hum = char:WaitForChild(&quot;Humanoid&quot;)\n\n hum.Died:Connect(function()\n wait(1.5)\n script.Parent.DeathScreen.Visible = true\n repeat\n cam.CameraType = Enum.CameraType.Scriptable\n until cam.CameraType == Enum.CameraType.Scriptable\n cam.CFrame = MenuCamera.CFrame\n wait(2)\n script.Parent.DeathScreen.Visible = false\n end)\nend\n\nlocalplayer.CharacterAdded:Connect(handleDeath)\n\nif playerAlreadyLoaded then\n handleDeath(playerAlreadyLoaded)\nend\n</code></pre>\n<p>If the goal of the <code>repeat until</code> is to wait for the player to enter the menu again, then you should remove that and instead handle setting the CameraType and removing the death screen wherever you're handling the rest of your menu.</p>\n<pre class="lang-lua prettyprint-override"><code>local players = game:GetService(&quot;Players&quot;)\nlocal localplayer = players.LocalPlayer\n\nlocal cam = game.Workspace.CurrentCamera\nlocal MenuCamera = game.Workspace.MenuRoom.MenuCamera\n\nlocal playerAlreadyLoaded = player.Character -- store for use later\n\nlocalplayer.CharacterAdded:Connect(function(char)\n local hum = char:WaitForChild(&quot;Humanoid&quot;)\n\n hum.Died:Connect(function()\n task.wait(1.5)\n script.Parent.DeathScreen.Visible = true\n -- handle your other stuff wherever you're handling the rest of the main menu.\n end)\nend)\n\nif playerAlreadyLoaded then\n handleDeath(playerAlreadyLoaded)\nend\n</code></pre>\n<p>Honestly, this entire process should be handled along with your main menu. It'd be easier and more efficient.</p>\n"^^ . . "I now understand how it works, I actually have a lot of arrays in my C Code, this is going to be a bit of work.\n\nRegarding third-party libraries, Swig is unfeasible to use at the moment, I really liked Sol2's style but it only works in C++ as far as I've seen, is there anything else that works well in C code that you could recommend?"^^ . . . . . . "Or I guess, technically the host can statically link and the lib can dynamically link, but the system will have to be able to load a DLL copy of Lua when loading any lib (which could be shared between multiple libs), but this is still multiple copies of Lua like everything statically linking."^^ . "0"^^ . "2"^^ . . . "<p>The example in <a href="https://www.lua.org/pil/2.4.html" rel="nofollow noreferrer">https://www.lua.org/pil/2.4.html</a>\nshows:</p>\n<pre><code>page = [[\n &lt;HTML&gt;\n &lt;HEAD&gt;\n &lt;TITLE&gt;An HTML Page&lt;/TITLE&gt;\n &lt;/HEAD&gt;\n &lt;BODY&gt;\n &lt;A HREF=&quot;http://www.lua.org&quot;&gt;Lua&lt;/A&gt;\n [[a text between double brackets]]\n &lt;/BODY&gt;\n &lt;/HTML&gt;\n ]]\n</code></pre>\n<p>however this gives me an error on the <code>/</code> in <code>&lt;/BODY&gt;</code>.</p>\n<pre><code>lua54: html.lua:9: unexpected symbol near '/'\n</code></pre>\n<p>has something changed since the book was published?</p>\n"^^ . . . . . . "1"^^ . . . . . "0"^^ . . . . . . . "0"^^ . "2"^^ . . . . "Why function doesn't refresh"^^ . "1"^^ . "<p>This is the consumer-producer , producer as coroutine and consumer as main thread:</p>\n<pre><code>function receive (prod)\n local status, value = coroutine.resume(prod)\n return value\nend\n\n function send (x)\n coroutine.yield(x)\n end\n\n function producer ()\n return coroutine.create(function ()\n while true do\n local x = io.read()\n -- produce new value\n send(x)\n end\n end)\n end\n\n function filter (prod)\n return coroutine.create(function ()\n for line = 1, math.huge do\n local x = receive(prod)\n -- get new value\n x = string.format(&quot;%5d %s&quot;, line, x)\n send(x)\n -- send it to consumer\n end\n end)\n end\n\n function consumer (prod)\n while true do\n local x = receive(prod)\n io.write(x, &quot;\\n&quot;)\n end\n end\n\n -- get new value\n -- consume new value\n consumer(filter(producer()))\n</code></pre>\n<p>and here is my answer bt is not running as expected:</p>\n<pre><code> function receive (x)\n coroutine.yield(x)\n end\n\n function send (cons, x)\n local status, value = coroutine.resume(cons, x)\n return value\n end\n\n function producer (cons)\n while true do\n local x = io.read()\n -- produce new value\n send(cons, x)\n end\n end\n\n function filter (cons)\n return coroutine.create(function (x)\n for line = 1, math.huge do\n local _, x = receive(x)\n -- get new value\n x = string.format(&quot;%5d %s&quot;, line, x)\n send(cons, x)\n -- send it to consumer\n end\n end)\n end\n\n function consumer ()\n return coroutine.create(function(x) \n while true do\n local x = receive(x)\n io.write(x, &quot;\\n&quot;)\n end\n end)\n end\n\n -- get new value\n -- consume new value\n producer(filter(consumer()))\n</code></pre>\n<p>Thing is while getting into local x = receive(x) into filter() function, then it is going again to producer() waiting for new input wthout formating x input.\nAny suggestion? I do not want to change the initial way was implemented, meaning the recieve() bound into the consumer() and send() bound into reciever().</p>\n"^^ . "<ol>\n<li><p>In the game, in the &quot;Controls Settings&quot;, introduce alternative key for &quot;Shoot&quot; action.<br />\n(I assume your game allows binding two different keys for the same action)<br />\nFor example, let it be keyboard key <kbd>P</kbd>.<br />\nSo, now in the game you can shoot either using Left Mouse Button or using Keyboard key <kbd>P</kbd>.<br />\nOf course, you will use LMB for manual shooting as usually, but your GHub script will use <kbd>P</kbd>.</p>\n</li>\n<li><p>Try to play the game with both LMB and <kbd>P</kbd> for shooting.<br />\nMake sure you can shoot with <kbd>P</kbd> key while keeping LMB pressed.<br />\n(Some games do not allow this)</p>\n</li>\n<li><p>The script</p>\n</li>\n</ol>\n<pre><code>EnablePrimaryMouseButtonEvents(true)\n\nfunction OnEvent(event, arg)\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and IsKeyLockOn(&quot;capslock&quot;) then\n repeat\n PressAndReleaseKey(&quot;P&quot;)\n Sleep(15)\n until not IsMouseButtonPressed(1) \n end\nend \n</code></pre>\n"^^ . . . "With LuaJIT, how could I associate more than one metatable with a C struct?"^^ . . . . . . . "1"^^ . "Are you sure that `angleNumber` is actually a number and not a string? What happens if you do `print(type(angleNumber))`? Is `angleNumber` *exactly* 2? What happens if you do `print(("%.17g"):format(angleNumber))`?"^^ . "0"^^ . "2"^^ . "<p>Before making a game in Roblox, I want to add a lobby. There will be doors in this lobby and when we come into contact with the door, a certain number of people will be teleported to the game. The real problem is where will I make this lobby? Should I do it in an invisible space on the same map? Or is there a different mechanic that I do not know? I am new to this, I need someone to explain all of this. There is, especially about where I will build the lobby.</p>\n<p>I haven't done anything about this issue, I'm waiting for something from someone who can help me in this beginning.</p>\n"^^ . . "0"^^ . "0"^^ . . . "0"^^ . . . . . . . . "Getting back slashes in the json/request body in Lua script"^^ . . . "0"^^ . . . . . . "cjson"^^ . "kong"^^ . "Execute key RHS expression in Vim imperatively"^^ . . "1"^^ . "@273K at least read the whole question"^^ . . . . . "<p><a href="https://stackoverflow.com/a/77281716/2505965">Oka has pointed out</a> that <code>a.b[o] = d</code> contains two index operations, so you have to create metatables for each array. BTW, as I commented under the previous deleted question, I suggest that you use third-party libraries to complete the binding, as it is quite complex to implement. I will put aside the <code>pf</code> field for now, the basic principle is the same. Let's begin with a mistake:</p>\n<pre><code>lua_pushlightuserdata(L, ms);\nluaL_getmetatable(L, &quot;mystruct&quot;);\nlua_setmetatable(L, -2);\n</code></pre>\n<p>This looks quite reasonable, but I believe the result is not what you want, that's because from <a href="https://www.lua.org/manual/5.4/manual.html#2.4" rel="nofollow noreferrer">the manual</a> you can read:</p>\n<blockquote>\n<p>Tables and full userdata have individual metatables, although multiple tables and userdata can share their metatables. Values of all other types share one single metatable per type; that is, <strong>there is one single metatable for all numbers, one for all strings, etc</strong>. By default, a value has no metatable, but the string library sets a metatable for the string type.</p>\n</blockquote>\n<p>If you set the metatable <code>mystruct</code> for your struct, you cannot set another metatable for other arrays. The solution is to create full userdata to store the struct and the arrays. You just need to save pointers, so I write two functions to simplify these operations.</p>\n<pre><code>void newpointerud(lua_State* L, const char* mt, int nuv, const void* data) {\n auto p = (const void**)lua_newuserdatauv(L, sizeof(void*), nuv);\n luaL_setmetatable(L, mt);\n *p = data;\n}\n\nvoid* getpointerud(lua_State* L, int idx) {\n return *(void**)lua_touserdata(L, 1);\n}\n</code></pre>\n<p>Next, you need to write the corresponding meta methods for <code>int[]</code> and create a metatable.</p>\n<pre><code>// ..options[idx]\nint mt_c_int_array_index(lua_State* L) {\n int* options = (int*)getpointerud(L, 1);\n int idx = lua_tointeger(L, 2);\n if (idx &gt;= 0 &amp;&amp; idx &lt; 20)\n lua_pushinteger(L, *(options + idx));\n else\n lua_pushnil(L);\n return 1;\n}\n\n// ..options[idx] = value\nint mt_c_int_array_newindex(lua_State* L) {\n int* options = (int*)getpointerud(L, 1);\n int idx = lua_tointeger(L, 2);\n if (idx &gt;= 0 &amp;&amp; idx &lt; 20)\n *(options + idx) = lua_tointeger(L, 3);\n else\n luaL_error(L, &quot;Out of index&quot;);\n return 0;\n}\n\n.....\nluaL_Reg mt_c_int_array[] = {\n { &quot;__index&quot;, mt_c_int_array_index },\n { &quot;__newindex&quot;, mt_c_int_array_newindex },\n {NULL, NULL}\n};\nluaL_newmetatable(L, &quot;mt_c_int_array&quot;);\nluaL_setfuncs(L, mt_c_int_array, 0);\n</code></pre>\n<p>Third is to use full userdata to package your struct and arrays. Here, you usually don't want to create a new userdata every time you access the <code>option</code> array. You can use the user value of the userdata to pre save the userdata of the option array.</p>\n<pre><code>newpointerud(L, &quot;mystruct&quot;, 1, ms); // 1 user value\nnewpointerud(L, &quot;mt_c_int_array&quot;, 0, ms-&gt;option);\nlua_setiuservalue(L, -2, 1);\n</code></pre>\n<p>Finally in your <code>mystruct_index</code> function, return this user value.</p>\n<pre><code>....\nelse if (strcmp(field, &quot;option&quot;) == 0) {\n lua_getiuservalue(L, 1, 1);\n}\n....\n</code></pre>\n"^^ . . . "Pass ambiguous rows into table in Lua"^^ . "How useful is it to make a global function fire a larger local function?"^^ . . . "2"^^ . "A script about a month changing system"^^ . . . "0"^^ . . "2"^^ . . . . . "OS signals should possible to handle in-process with POSIX `sigaction`. Haven't done this and doesn't seem like a fun way to debug. Illegal operand sounds like some kind of ABI issue maybe?? First FFI call failing? gkylzero C lib out of sync with Lua/FFI definition in gykl Lua? I mean, if things have gone horribly wrong, the error may be pretty unrelated to the actual cause of the issue. I image stack info could be difficult if JIT code is involved."^^ . . "<p>I created simple clock in Roblox Studio (Lua) and added <code>wait(1)</code> between while loop. The problem is that it doesn't refresh. It just shows time and it's everything. This is code:</p>\n<pre class="lang-lua prettyprint-override"><code>local StarterGui = game:GetService(&quot;StarterGui&quot;)\n\nwhile true do\n local UniversalTime = DateTime.now():ToUniversalTime()\n\n local Hours = UniversalTime.Hour + 1\n local Minutes = UniversalTime.Minute\n local Seconds = UniversalTime.Second\n\n if (Minutes &lt; 10) then\n Minutes = &quot;0&quot;..Minutes\n end\n\n if (Seconds &lt; 10) then\n Seconds = &quot;0&quot;..Seconds\n end\n\n StarterGui.ScreenGui.Frame.Clock.Text = `{Hours}:{Minutes}:{Seconds}`\n \n wait(1)\nend\n</code></pre>\n<p>I don't know what caused the problem and I don't really know how to repair it.</p>\n"^^ . . "1"^^ . . . . . "visual-c++"^^ . . "<p>I switched from vscode to neovim and am writing my own nvim config</p>\n<p>Recently I realized that I'm missing suggestions in brackets looking like this:</p>\n<p><a href="https://i.sstatic.net/Y1oOI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Y1oOI.png" alt="enter image description here" /></a></p>\n<p>I am using <code>nvim-cmp</code> and having troubles with looking the function's docs<a href="https://i.sstatic.net/AnwYR.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AnwYR.png" alt="enter image description here" /></a></p>\n<p>Could you help me please? Sorry for my poor english...</p>\n<p>I want to see pop-up menu with arguments of function (or just documentation) while I am typing args</p>\n<p>Now I configured <code>nvim-cmp</code> like this:\n<a href="https://i.sstatic.net/rrjxw.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rrjxw.png" alt="enter image description here" /></a></p>\n"^^ . . . . . . "0"^^ . . "@ESkri absolutely the same? like, no slight performance boost in one compared to the other?"^^ . "cryptography"^^ . . . "<ol>\n<li>Assign the &quot;Back&quot; action to physical G1 key (in the LGS/GHub GUI).<br />\n(&quot;Back&quot; is the default action for mouse button 4).</li>\n<li>Make sure the game ignores mouse button 4 click (in the game control settings).</li>\n<li>Set the script:</li>\n</ol>\n<pre><code>function OnEvent(event, arg)\n if event == &quot;G_PRESSED&quot; and arg == 1 then -- G1 key\n repeat \n OutputLogMessage(&quot;Loop&quot;)\n Sleep(10)\n until not IsMouseButtonPressed(4) -- 4 = &quot;back&quot;\n OutputLogMessage(&quot;\\nEnd Loop\\n&quot;)\nend\n</code></pre>\n"^^ . . . . . "0"^^ . . . "<p>Since your provided <code>function() print(&quot;Error in gkyl_range_init&quot;) end</code> as the error handler for your xpcall, you'll only print this line.</p>\n<p>Instead you might want to try this:</p>\n<pre><code>local pOk, err = pcall(ffiC.gkyl_range_init, r, r._ndim, r._lower, r._upper)\nif not pOk then\n print(&quot;Error in gkyl_range_init:&quot;, err)\nend\n</code></pre>\n<p>This will work if <code>gkyl_range_init</code> fails with an error, if the function just returns an error code or message then you'll just want to print that instead, <code>pcall</code> will not trigger an error in this case.</p>\n<pre><code>local pOk, ret, err = pcall(ffiC.gkyl_range_init, r, r._ndim, r._lower, r._upper)\nif not pOk then\n print(&quot;Error in gkyl_range_init:&quot;, ret)\nelseif not ret then\n print(&quot;gkyl_range_init returned err:&quot;, err)\nend\n</code></pre>\n<p>Something like the above might work if the function <em>does</em> return some information, if it doesn't then I guess you'll have to modify the library that you're using.</p>\n"^^ . "Hey, thanks for the reply. But same problem it only runs once and then it doesn't run anymore."^^ . "It prints 404, as it should (so else)"^^ . . . . . "object"^^ . "2"^^ . . . "<p>To run a love game, you need to indicate only the name of the folder that contains main.lua: <code>love myFolder</code>.</p>\n<p>Also, love.exe path must be in the Environment Variables</p>\n<p><a href="https://sheepolution.com/learn/book/bonus/vscode" rel="nofollow noreferrer">check here for more details</a></p>\n"^^ . . . "<p>There are two relevant Lua quirks, one of which I would suspect to be at play here:</p>\n<ul>\n<li>String - number coercion, but strict equality checking;</li>\n<li>Use of floats, but printing them inexactly, hiding rounding errors</li>\n</ul>\n<p>Let's first simplify your example:</p>\n<pre class="lang-lua prettyprint-override"><code>function f(x)\n if x == 1 then\n return 0\n end\n return 1\nend\n</code></pre>\n<p>So <code>f(1)</code> is <code>0</code>, and <code>f(x)</code> is <code>1</code> for <em>every <code>x</code> that does not equal <code>1</code></em>.</p>\n<h4>Strings that quack like numbers</h4>\n<p>Lua has a controversial &quot;feature&quot; where it coerces strings to numbers if you do arithmetic on them, and coerces numbers to strings if you do arithmetic on them; <code>print</code> just calls <code>tostring</code> internally, which doesn't quote strings, so strings very much &quot;quack like numbers&quot;. However, testing for equality (or table indexing) is &quot;strict&quot;; it also requires the types to match. See this example:</p>\n<pre class="lang-lua prettyprint-override"><code>-- Oops! This should be a number.\n-- In practice this might be something less obvious like a function returning a string.\nlocal x = &quot;1&quot;\nprint(x + 2) -- 3, we can do arithmetic as if it was a number!\nprint(x) -- 1, it looks just like it was a number!\nprint(type(x)) -- string\nprint(&quot;1&quot; == 1) -- false, the types don't match\nprint(f(x)) -- 1, because &quot;1&quot; ~= 1\n</code></pre>\n<p>The solution here, assuming <code>x</code> is a string which comes from a file or similar, is to <code>tonumber(x)</code> (or equivalently: <code>x + 0</code>, which behaves roughly like <code>assert(tonumber(x))</code>).</p>\n<h4>Rounding errors</h4>\n<p>Lua uses floats to represent numbers. Floats can represent integers up to 2^53 accurately (without loss of precision), so very often this is not an issue when working with integers. However, you can construct floats that are very close to integers, but aren't integers under the hood. Unfortunately Lua <em>rounds</em> numbers when printing them, so you don't see this if you insert debug prints. Consider:</p>\n<pre class="lang-lua prettyprint-override"><code>local x = 0.2 + 6 * 0.3\nprint(x) -- 2.0\nprint(x == 2) -- false, what? how does 2 not equal 2?\n</code></pre>\n<p>To uncover this, print <code>x</code> to 17 digits of precision:</p>\n<pre class="lang-lua prettyprint-override"><code>print((&quot;%.17g&quot;):format(0.2 + 6 * 0.3)) -- 1.9999999999999998\n</code></pre>\n<p>If you know that you're working with inaccuracies, you should do comparisons with some &quot;room for error&quot;. So instead of testing <code>x == 1</code>, you would test <code>math.abs(x - 1) &lt; 1e-6</code>, where <code>1e-6</code> would be your (absolute) margin for error in this example. (Note: A relative margin for error may be more appropriate sometimes; floats in particular guarantee certain relative errors).</p>\n<hr />\n<p>Side note: In many languages with <code>switch</code>es, pattern matching or similar, a function and a <code>switch</code> + <code>return</code> may be an idiomatic way to implement this. However, given that this is just a mapping from some numbers to other numbers, you would usually use a table in Lua:</p>\n<pre class="lang-lua prettyprint-override"><code>local mirrored_numbers = {\n [2] = 8,\n [3] = 7,\n -- ... and so on\n}\nlocal function mirror_number(x)\n return mirrored_numbers[x] or 99\nend\n</code></pre>\n<p>(also, there seems to be a simple correspondence between &quot;mirrored&quot; numbers and <code>x</code> (<code>if angleNumber &gt;= 2 and angleNumber &lt;= 8 then return 10 - angleNumber end</code>), unless you just simplified it for this example; why not leverage that?)</p>\n"^^ . "<p>I'm running a cluster with enough RAM per node, but nevertheless it's plagued by frequent &quot;Memory is highly fragmented&quot; errors. When looking at dashboard, it says only ~2.3-2.4 gigs out of 6.3 are used. Looking at Slabs it also sees low quota utilization, but <code>items</code> and <code>arena</code> are near or above 99%</p>\n<pre><code>&gt; box.slab.info()\n---\n- items_size: 1286313040\n items_used_ratio: 99.56%\n quota_size: 6500000768\n quota_used_ratio: 40.27%\n arena_used_ratio: 96.2%\n items_used: 1280601176\n quota_used: 2617245696\n arena_size: 2617245696\n arena_used: 2516986968\n...\n</code></pre>\n<p>I tried adjusting Vinyl memory and Vinyl cache, as well as changing <code>memtx_min_tuple_size</code> from 16 bits to 64, but it didn't affect the ratios.</p>\n<p>Could please someone explain how to increase items and arena size? or maybe there are other ways to fix this?</p>\n<p>With default value of <code>fragmentation_threshold_critical = 0.85</code> this cluster should run with ~3 gigs of ram and still have some room</p>\n<pre><code>items_used_ratio = items_used / items_size\nquota_used_ratio = quota_used / quota_size\narena_used_ratio = arena_used / arena_size\n</code></pre>\n<p>UPDATE: adding slab stats as requested</p>\n<pre><code>box.slab.stats()\n---\n- - mem_free: 16400\n mem_used: 260224\n item_count: 4066\n item_size: 64\n slab_count: 17\n slab_size: 16384\n - mem_free: 6072\n mem_used: 10200\n item_count: 75\n item_size: 136\n slab_count: 1\n slab_size: 16384\n - mem_free: 16128\n mem_used: 52574976\n item_count: 365104\n item_size: 144\n slab_count: 3232\n slab_size: 16384\n - mem_free: 156216\n mem_used: 286979496\n item_count: 1888023\n item_size: 152\n slab_count: 17646\n slab_size: 16384\n - mem_free: 2943632\n mem_used: 423399040\n item_count: 2646244\n item_size: 160\n slab_count: 26201\n slab_size: 16384\n - mem_free: 913912\n mem_used: 405490008\n item_count: 2413631\n item_size: 168\n slab_count: 12445\n slab_size: 32768\n - mem_free: 862448\n mem_used: 288143152\n item_count: 1637177\n item_size: 176\n slab_count: 8850\n slab_size: 32768\n - mem_free: 484712\n mem_used: 170306168\n item_count: 925577\n item_size: 184\n slab_count: 5230\n slab_size: 32768\n - mem_free: 53680\n mem_used: 44456448\n item_count: 231544\n item_size: 192\n slab_count: 1363\n slab_size: 32768\n - mem_free: 33208\n mem_used: 13617000\n item_count: 68085\n item_size: 200\n slab_count: 418\n slab_size: 32768\n - mem_free: 25792\n mem_used: 6276816\n item_count: 30177\n item_size: 208\n slab_count: 193\n slab_size: 32768\n - mem_free: 22144\n mem_used: 2361744\n item_count: 10934\n item_size: 216\n slab_count: 73\n slab_size: 32768\n - mem_free: 27104\n mem_used: 887264\n item_count: 3961\n item_size: 224\n slab_count: 28\n slab_size: 32768\n - mem_free: 28504\n mem_used: 396024\n item_count: 1707\n item_size: 232\n slab_count: 13\n slab_size: 32768\n - mem_free: 29376\n mem_used: 166560\n item_count: 694\n item_size: 240\n slab_count: 6\n slab_size: 32768\n - mem_free: 5216\n mem_used: 92752\n item_count: 374\n item_size: 248\n slab_count: 3\n slab_size: 32768\n - mem_free: 11296\n mem_used: 54016\n item_count: 211\n item_size: 256\n slab_count: 2\n slab_size: 32768\n - mem_free: 19720\n mem_used: 12936\n item_count: 49\n item_size: 264\n slab_count: 1\n slab_size: 32768\n - mem_free: 26416\n mem_used: 692016\n item_count: 2218\n item_size: 312\n slab_count: 22\n slab_size: 32768\n - mem_free: 30000\n mem_used: 35424\n item_count: 108\n item_size: 328\n slab_count: 1\n slab_size: 65536\n - mem_free: 2816\n mem_used: 62608\n item_count: 182\n item_size: 344\n slab_count: 1\n slab_size: 65536\n - mem_free: 33024\n mem_used: 32400\n item_count: 90\n item_size: 360\n slab_count: 1\n slab_size: 65536\n - mem_free: 36472\n mem_used: 28952\n item_count: 77\n item_size: 376\n slab_count: 1\n slab_size: 65536\n - mem_free: 54448\n mem_used: 10976\n item_count: 28\n item_size: 392\n slab_count: 1\n slab_size: 65536\n - mem_free: 12688\n mem_used: 249008\n item_count: 394\n item_size: 632\n slab_count: 4\n slab_size: 65536\n - mem_free: 123328\n mem_used: 7632\n item_count: 6\n item_size: 1272\n slab_count: 1\n slab_size: 131072\n - mem_free: 259416\n mem_used: 2616\n item_count: 1\n item_size: 2616\n slab_count: 1\n slab_size: 262144\n - mem_free: 11962320\n mem_used: 870891520\n item_count: 53155\n item_size: 16384\n slab_count: 421\n slab_size: 2097152\n...\n</code></pre>\n"^^ . . "0"^^ . "roblox-studio"^^ . . . . . . . "0"^^ . . . . "0"^^ . . . . "0"^^ . "<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>local tab={\n January = 31,\n February = 28,\n March = 31,\n April = 30,\n May = 31,\n June = 30,\n July = 31,\n August = 31,\n September = 30,\n October = 31,\n November = 30,\n December = 31\n}\nlocal labels=player.PlayerGui.Computer.Window.CalenderWindow.DaysHandler:GetChildren()\ngame.ReplicatedStorage.CurrentMonth.Changed:Connect(function(i)\n for _,label in(labels)do \n label.Visible=tonumber(label.Name)&lt;=tab[i]\n end\nend)\nlocal i=game.ReplicatedStorage.CurrentMonth.Value\nfor _,label in(labels)do \n label.Visible=tonumber(label.Name)&lt;=tab[i]\nend</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . "How did you acquire the error message?"^^ . . . "0"^^ . "Access values of pandoc.Figure elements in pandoc.RawBlock with custom Lua writer"^^ . "That's a problem on your end then, view your scripts and try to fix, I can't examine any errors in the script."^^ . "0"^^ . . . . . . . "1"^^ . "[[ strings ]] with nested [[ strings ]] in lua?"^^ . "1"^^ . . . . . . "<p>You can use any json to lua library, for example\n<a href="https://github.com/rxi/json.lua" rel="nofollow noreferrer">https://github.com/rxi/json.lua</a></p>\n<pre><code>json = require &quot;json&quot;\nlocal tabl = json.decode('[1,2,3,{&quot;x&quot;:10}]') -- Returns { 1, 2, 3, { x = 10 } }\n</code></pre>\n"^^ . . "keymapping"^^ . . . . . . "0"^^ . "0"^^ . "0"^^ . "<p>The problem is: you cannot both simulate a mouse button press/release and monitor the same mouse button state (pressed/released) simultaneously.</p>\n<p>To solve the problem you may:</p>\n<ul>\n<li>either change the physical button (rapid-fire by another mouse button instead of LMB)</li>\n<li>or change the simulated button (introduce alternative button for shoot in the game).</li>\n</ul>\n<p>This answer describes how to implement the second option.<br />\nYou need to satisfy all 3 steps:</p>\n<ol>\n<li><p>In the game, in the &quot;Controls Settings&quot;, introduce alternative key for &quot;Shoot&quot; action.<br />\n(I assume your game allows binding two different keys for the same action)<br />\nFor example, let it be keyboard key <kbd>P</kbd>.<br />\nSo, now in the game you can shoot either using Left Mouse Button or using Keyboard key <kbd>P</kbd>.<br />\nOf course, you will use LMB for manual shooting as usually, but your LGS/GHub script will use <kbd>P</kbd>.</p>\n</li>\n<li><p>Try to play the game with both LMB and <kbd>P</kbd> for shooting.<br />\nMake sure you can shoot with <kbd>P</kbd> key while keeping LMB pressed.<br />\n(Some games do not allow this)</p>\n</li>\n<li><p>The script</p>\n</li>\n</ol>\n<pre><code>EnablePrimaryMouseButtonEvents(true)\n\nfunction OnEvent(event, arg)\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1\n and IsKeyLockOn(&quot;capslock&quot;) and IsMouseButtonPressed(3)\n then\n repeat\n Sleep(math.random(10,30))\n PressKey(&quot;P&quot;)\n Sleep(math.random(10,30))\n ReleaseKey(&quot;P&quot;)\n until not (IsMouseButtonPressed(1) and IsMouseButtonPressed(3))\n end\nend \n</code></pre>\n"^^ . . . . . . "`root_numeric_condition` controls whether the first or second table in `results` is used. With my example, and your data, `root_numeric_condition` primarily returns `false`, as all the `nums` fields are less than the `average` fields (except that it returns `true` where the `average` field is absent). Changing `7` to `17` makes that `nums > average` *true*, and the first `results` table is used. Again, the `root_numeric_condition` I have written is a complete fabrication to match your expected results - I still have no understanding of the purpose of your data, or how it should be processed."^^ . . "0"^^ . "Please provide `box.slab.stats()`."^^ . . . "0"^^ . . . . . . "<p>You're on the right track but the issue is that your code executes once and then never checks again.</p>\n<p>A good way to handle this is to have your script listen for the NumberValue's Changed signal. Whenever the Value changes, it will trigger the function. So try something like this :</p>\n<pre class="lang-lua prettyprint-override"><code>-- find the NumberValue Instance\nlocal NumberValue = game.Workspace.NumberValue\n\n-- listen for when it changes\nNumberValue.Changed:Connect(function(newValue)\n print(&quot;NumberValue update to&quot;, newValue)\n if newValue == 5 then\n print(&quot;It worked!&quot;)\n end\nend)\n</code></pre>\n<p>Then, whenever something changes the Value, you should see this message appear.</p>\n<p>Be careful though, if this code is in a Script, then the code that sets the NumberValue.Value must also be in a Script for this to work.</p>\n"^^ . . . . . "<p>I'm trying to make a combat system and obviously need a combo variable to keep track of what current combo i am in</p>\n<pre><code>game.ReplicatedStorage.Remotes.M1.OnServerEvent:Connect(function(player, Mouse)\n print(&quot;Received M1 from the Client&quot;)\n local combo = 0\n local startTime = tick()\n\n if combo == 3 then\n print(&quot;M1 Combo!&quot;)\n combo = 0\n end\n\n if tick() - startTime &gt;= 2 then\n combo = 0\n end\n\n combo = combo + 1\n print(combo)\nend)\n\n</code></pre>\n<p>But it just seems to never go higher than 1 or never add 1 to the combo</p>\n<p>I've tried adding print debugs to the scripts (as seen under combo = combo + 1), but none of those really helped, any help would be appreciated!</p>\n"^^ . . . "0"^^ . . . . . . . . "0"^^ . . . . . . . "The error is not appearing on that line unfortunately. The error appears at the code Coins.Value = data.CoinsAmount"^^ . "lazy-loading"^^ . . . . . "latex"^^ . . . . . . "It doesn't run the script when i die the second time*"^^ . . . . . . "With 6+ gigs it's less frequent, but that leaves over a half of memory underutilized, which for a cluster of 2x8 nodes = around 50 gigs of unused ram, which generates unnecessary costs"^^ . . "<p><em>(Updated with question edit)</em></p>\n<pre><code>function performLookup(words, dict)\n for i, word in ipairs(words) do\n if dict[word] then\n words[i] = dict[word]\n end\n end\nend\n\nfunction readDict(fname)\n local dict = {}\n local file = io.open(fname, &quot;r&quot;)\n for line in file:lines() do\n local english, german = line:match(&quot;(%S+)%s+(%S+)&quot;)\n -- or \\t instead of %s+ for single tab, or \\t+ if multiple tabs allowed\n dict[english] = german\n end\n file:close()\n return dict\nend\n\nfunction readInput(fname)\n local words = {}\n local file = io.open(fname, &quot;r&quot;)\n for line in file:lines() do\n table.insert(words, line)\n end\n file:close()\n return words\nend\n\nfunction writeFile(fname, dict, words)\n file = io.open(fname, &quot;w&quot;)\n performLookup(words, dict)\n for i, line in ipairs(words) do\n file:write((i == 1 and &quot;&quot; or &quot;\\n&quot;) .. line) \n end\n file:close()\nend\n\ndict = readDict(&quot;dict.tsv&quot;)\nwords = readInput(&quot;locale_EN.txt&quot;)\nwriteFile(&quot;locale_DE.txt&quot;, dict, words)\n</code></pre>\n<p>The input file (locale_EN.txt) looks like:</p>\n<pre><code>some\nrandom\nwords\neye\nand\na\nfew\nmore\nface\n</code></pre>\n<p>The output file (locale_DE.txt) looks like:</p>\n<pre><code>some\nrandom\nwords\nAuge\nand\na\nfew\nmore\nGesicht\n</code></pre>\n<p>The dictionary (dict.tsv) looks like:</p>\n<pre><code>body Körper\nchild Kind\neye Auge\nface Gesicht\n</code></pre>\n<p>The question could have better clarity but is this what you are looking for? Would need some error checking too, since it assumes correct format.</p>\n"^^ . "Do you have Lua 5.3 or 5.4 package installed on your system?"^^ . "0"^^ . "0"^^ . . . "consumer"^^ . . . . "<p>After trying with different things and testing with <a href="https://fennel-lang.org/see" rel="nofollow noreferrer">https://fennel-lang.org/see</a> , I've found that the error was being thrown by a different part of my code. And, not here (although the error pointed to this line).</p>\n<pre><code>(hs.hotkey.bind {} &quot;F18&quot; \n (fn [] (myModal:enter)))\n</code></pre>\n<p>The issue was inside the <code>myModal:bind</code> function call. I think I'd misplaced a parenthesis.\nthis works</p>\n<pre><code>(myModal:bind &quot;&quot; :T\n (fn [] (my-modal:exit)\n (hs.alert.show &quot;testing Fennel Modal&quot;)\n ))\n</code></pre>\n"^^ . . "`body.TheatreInfo[1].tId`"^^ . . . "0"^^ . . "<p>I'm trying to convert some Hammserspoon Lua code to Fennel, but the converted code is throwing the following error.</p>\n<pre><code>ERROR: LuaSkin: hs.hotkey callback: init.fnl:32: attempt to call a table value stack traceback: init.fnl:32: in function &lt;init.fnl:23&gt;```\n</code></pre>\n<p>The Lua code is working without issue, here it is -</p>\n<pre><code>local myModal = hs.hotkey.modal.new()\n\nhs.hotkey.bind({}, 'F18', function()\n myModal:enter()\nend)\n\nmyModal:bind('', 'V', function()\n myModal:exit()\nhs.alert.show(&quot;Modal test&quot;)\nend)\n</code></pre>\n<p>And, here's the converted code that is giving the error.</p>\n<pre><code>(local myModal (hs.hotkey.modal.new))\n(print (.. &quot;myModal = &quot; (hs.inspect.inspect myModal)))\n(myModal:entered (fn [] (print &quot;myModal entered&quot;)))\n(myModal:exited (fn [] (print &quot;myModal exited&quot;)))\n(hs.hotkey.bind {} &quot;F18&quot; \n (fn [] (myModal:enter)))\n\n(myModal:bind &quot;&quot; &quot;V&quot;\n (fn [] ((myModal:exit)\n (hs.alert.show &quot;Modal Test&quot;)\n )))\n</code></pre>\n<p>Not sure why the error is generate here. Can anyone help with identifying the issue with this?</p>\n<p>The error is coming from the following bit.</p>\n<pre><code>(hs.hotkey.bind {} &quot;F18&quot; \n (fn [] (myModal:enter)))\n</code></pre>\n<p>I had used <code>hs.inspect</code> to check <code>myModal</code> and here's the output from it.</p>\n<pre><code>myModal = {\n keys = {}\n}\n</code></pre>\n"^^ . . . "2"^^ . . "0"^^ . . "<p>For example, let's say I want to run <code>vlc.audio.set_mute(true)</code> at 10 seconds into the current video file and <code>vlc.audio.set_mute(false)</code> at 20 seconds (thereby muting seconds 10 through 20).</p>\n<p>I have the basic structure of the script down, but I keep running into the issue of how to wait for the moment to take the action.</p>\n<ul>\n<li>Lua itself does not have a built-in sleep function</li>\n<li>Calls to the OS seem to be blocked.</li>\n<li>Busy waiting in a loop causes the extension to be perceived as unresponsive (and it's bad anyway).</li>\n<li><code>vlc.misc</code> is not available in Extensions, so I can't do something like a <code>while</code> loop and then run <code>vlc.misc.mwait(vlc.misc.mdate() + 500)</code> at the end of each iteration.</li>\n</ul>\n"^^ . "1"^^ . . . . . . . . "0"^^ . . "<p>I am trying to write something to a file using a function then read it using another function. Here is my code:-</p>\n<pre class="lang-lua prettyprint-override"><code>local getContent = function(fName)\n local file = io.open(fName, &quot;r&quot;)\n\n if file == nil then\n print(&quot;Could not open the file&quot;)\n return\n end\n\n local fData = file:read(&quot;*all&quot;)\n print(&quot;File data:-\\n&quot; .. fData)\n file:close()\nend\n\nlocal writeToFile = function(fName, fWrite)\n local file = io.open(fName, &quot;r+&quot;)\n\n if file == nil then\n print(&quot;Could not open the file&quot;)\n return\n end\n\n print(&quot;Content: &quot; .. file:read(&quot;*all&quot;)) -- When I use r+ and read the file it acts as append mode and adds the file to the next line\n -- If I am not reading the file then it acts as write mode and truncates the file\n file:write(fWrite)\n -- When I try to read file here then it throws an error\n file:close()\nend\n\nlocal fileName = &quot;lua-file.txt&quot;\nwriteToFile(fileName, &quot;My name is Dante\\n&quot;)\ngetContent(fileName)\n</code></pre>\n<p>Q1. When I try to read the file in modes with &quot;+&quot; at end like &quot;r+&quot; and after writing to them inside the <code>writeToFile()</code> then the terminal throws an error. I can read the file before writing to it. How can I solve this?</p>\n<p>Q2. &quot;w+&quot; and &quot;a+&quot; behave as I expect them to. &quot;w+&quot; truncates the file before writing and &quot;a+&quot; appends data to it at the last line. &quot;r+&quot; depends if am reading the file before writing to it then it appends the data if I am not reading before writing then it truncates the file before writing.</p>\n<p>Q3. When I am not reading the file before writing i.e. remove line 8 from <code>writeToFile()</code> function\n<code>print(&quot;Content: &quot; .. file:read(&quot;*a&quot;))</code> then it truncates the data as I said above but if I change to append+ mode run the file then change back to read+ then it doesn't write to the file at all.</p>\n"^^ . . "1"^^ . . . "1"^^ . "3"^^ . "I have a working [Lua PNG decoder for Minetest](https://github.com/appgurueu/modlib/blob/master/minetest/png.lua) (tested against PNGSuite). It uses `minetest.decompress` for zlib decompression, but otherwise should be portable."^^ . . . . "Doesn't `%` start a comment in latex?"^^ . "0"^^ . "2"^^ . . "<p><a href="https://i.sstatic.net/et5jU.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/et5jU.png" alt="enter image description here" /></a></p>\n<pre><code>EnablePrimaryMouseButtonEvents(true);\nfunction OnEvent(event, arg)\n if IsKeyLockOn(&quot;capslock&quot;) and IsMouseButtonPressed(1) and IsMouseButtonPressed(3) then\n repeat\n PressMouseButton(1)\n Sleep(13)\n ReleaseMouseButton(1)\n Sleep(15)\n PressMouseButton(1)\n Sleep(18)\n ReleaseMouseButton(1)\n Sleep(12)\n PressMouseButton(1)\n Sleep(14)\n ReleaseMouseButton(1)\n Sleep(16)\n until not IsMouseButtonPressed(3)\n end\nend\n</code></pre>\n"^^ . "Roblox Studio: Attempt to index nil with 'Connect'"^^ . . "2"^^ . "Yes, but it must be three files: dict.tsv (TAB separated values, first as key, second as value); and two files as origin: locale_EN.txt and modified: locale_DE.txt"^^ . . . . . "0"^^ . "<p>@user15611379 is correct, but their answer is incomplete : you should move the for-loop outside of the function, but you need a way to access the leaderstats of the player that clicks the coin.</p>\n<p>A <a href="https://create.roblox.com/docs/reference/engine/classes/ClickDetector#MouseClick" rel="nofollow noreferrer">ClickDetector's MouseClick event</a> can give you the player that interacted with them, so you can use that to access their leaderstats.</p>\n<pre class="lang-lua prettyprint-override"><code>-- define some easy to change values\nlocal DEFAULT_COIN_AMOUNT = 100\nlocal COIN_VALUE = 10\nlocal RESPAWN_TIME = 10\n\n\n-- when a player joins, create their leaderstats\nlocal players = game:GetService(&quot;Players&quot;)\nfunction playerSpawned(player)\n local leaderstats = Instance.new(&quot;Folder&quot;, player)\n leaderstats.Name = &quot;leaderstats&quot;\n \n local coins = Instance.new(&quot;IntValue&quot;, leaderstats)\n coins.Name = &quot;Coins&quot;\n coins.Value = DEFAULT_COIN_AMOUNT\nend)\nplayers.PlayerAdded:Connect(playerSpawned)\n\n\n-- add click detectors to all coins in the world\nlocal folder = workspace.Coins\nfor _, object in ipairs(folder:GetChildren()) do\n local button = Instance.new(&quot;ClickDetector&quot;, object)\n button.CursorIcon = &quot;rbxassetid://7029597423&quot;\n button.MouseClick:Connect(function(playerWhoClicked)\n -- hide the coin\n button.MaxActivationDistance = 0\n object.Transparency = 1\n object.CanCollide = false\n\n -- increase the player's coins counter\n playerWhoClicked.leaderstats.Coins.Value += COIN_VALUE\n \n -- reveal the coin after a short wait\n wait(RESPAWN_TIME)\n object.ClickDetector.MaxActivationDistance = 300\n object.Transparency = 0\n object.CanCollide = true\n end)\nend\n</code></pre>\n"^^ . "1"^^ . . "0"^^ . "<p>You can use the following code to save your pointer in the lua state:</p>\n<pre><code>lua_pushlightuserdata(L, new BigObject{});\nlua_setfield(L, LUA_REGISTRYINDEX, &quot;unique-name&quot;);\n</code></pre>\n<p>You need to choose this <code>unique-name</code> yourself, see the <a href="https://www.lua.org/manual/5.4/manual.html#4.3" rel="nofollow noreferrer">manual</a> for detail.</p>\n<p>Use the corresponding method to obtain this pointer:</p>\n<pre><code>lua_getfield(L, LUA_REGISTRYINDEX, &quot;unique-name&quot;);\nauto bigObject = (BigObject*)lua_touserdata(L, -1);\nlua_pop(L, 1);\n</code></pre>\n"^^ . . "Unable to load simple DLL module with Lua 5.4: "The specified module could not be found""^^ . "http://lua-users.org/wiki/BindingCodeToLua"^^ . . "0"^^ . . . . . "I want it to just perform its function, not necessarily to return something"^^ . . . . "How to configure hs.hotkey.modal with Fennel in hammerspoon?"^^ . "macros"^^ . . . . . "2"^^ . "fivem"^^ . . . . . . "1"^^ . "2"^^ . "1"^^ . . "0"^^ . "0"^^ . "1"^^ . "<p>so, im learning about socket progamming, and im trying to make a simple tcp chatroom server in lua.</p>\n<p>It connects fine to a single client, but when aother client tries to join the server, it waits until the other client quits and then it joins</p>\n<p><strong>server.lua</strong></p>\n<pre class="lang-lua prettyprint-override"><code>require('socket')\nserver = assert(socket.bind('localhost', 69420))\n\nclients = {}\n--data = {} --use later\n\nfunction broadcast(message)\n if message then\n for _, client in pairs(clients) do\n client:send(message .. '\\n')\n end\n end\nend\n\n\nfunction handle(client)\n while 1 do\n local buff, err = client:receive()\n if err then\n print(err)\n client:send(&quot;error occurred = &quot;.. err)\n client:close()\n break\n else\n print(buff)\n broadcast(buff)\n end\n end\nend\n\nfunction recieve()\n while 1 do\n server:settimeout(0.01) -- tried adding this, still didn't worked\n local client = server:accept()\n if client then\n table.insert(clients, client)\n\n print(&quot;a new client entered&quot;)\n broadcast(&quot;a new client has joined us\\n&quot;)\n\n coroutine.wrap(handle)(client) --this was supposed to handle the clients\n end\n end\nend\n\nprint(&quot;localhost server listening on port 69420... nice&quot;)\nrecieve()\n</code></pre>\n<p>also, im using this client script:</p>\n<p><strong>client.lua</strong></p>\n<pre class="lang-lua prettyprint-override"><code>-- simple script just to check for server errors \nrequire('socket')\nclient = socket.tcp()\n\nclient:connect(&quot;localhost&quot;, 69420)\nclient:send(&quot;hello\\n&quot;)\n\nwhile 1 do \n local s, status, partial = client:receive()\n print(s or partial)\n if status == &quot;closed&quot; then\n break\n end\nend\n\nclient:close()\n</code></pre>\n"^^ . "3"^^ . . . . . . . "1"^^ . . . . . "0"^^ . . "0"^^ . . "0"^^ . . . "0"^^ . . . . . "0"^^ . . . . . . . "0"^^ . . . "2"^^ . . "-1"^^ . . "0"^^ . . . . "need help changing logitech script"^^ . . "If you know that you only have one theatreinfo, then there is no need for iteration and ESkris answer is what you want. If not, read this and the next page: https://www.lua.org/pil/4.3.4.html"^^ . "<p>A pairs-loop in Lua means &quot;repeat this action for every item in a table&quot;.<br />\nSo, you should have one <code>table.insert</code> in the loop.<br />\nYou should also remove <code>OpenMenu</code> invocation from the loop.</p>\n<pre><code>local function initcaps(s)\n return s:sub(1,1):upper()..s:sub(2)\nend\n\nfunction SkillMenu()\n FetchSkills()\n Wait(1000)\n RefreshSkills()\n local elements = {}\n for type, value in pairs(Config.Skills) do\n table.insert(elements, {\n type = 'button',\n name = type,\n label = initcaps(type),\n description = type .. &quot; &quot; .. value.Current .. &quot;%&quot;,\n icon = 'fad fa-heartbeat',\n disabled = true\n })\n end\n TMC.Functions.OpenMenu({\n namespace = &quot;skillmenu&quot;,\n type = 'openMenu',\n title = &quot;Skill menu&quot;,\n }, elements, function(close, confirmed)\n end, function(selected)\n end, function(change)\n if change.elementChanged == &quot;stamina&quot; then\n TMC.Functions.CloseMenu()\n elseif change.elementChanged == 'strength' then\n TMC.Functions.CloseMenu()\n end\n end)\nend\n</code></pre>\n"^^ . . . "1"^^ . . . . "0"^^ . . . "<p>I installed LOVE2D into the program files path, I added it to the environment variables, and I installed LOVE2D Support into Visual studio code. Why are the variable still showing up with the error &quot;Undefined global <code>love</code>&quot;? Can someone help me find an answer? This program does run by drag and drop as well<a href="https://i.sstatic.net/sMc4c.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/sMc4c.png" alt="enter image description here" /></a></p>\n<p>Edit 1: here is the base code itself. I also want to add that it now runs (still does not register love functions) but its when I press Ctrl+S rather than Alt+L. It also runs the file in the main folder as well rather than the one I want to run, being this one (maybe its because the folder is not the main one selected?)\n<a href="https://i.sstatic.net/mDG38.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mDG38.png" alt="enter image description here" /></a></p>\n<p>Edit 2: Here is the code instead. I would just like the answer to this question:</p>\n<pre><code>function love.load()\n\n love.window.setTitle(&quot;Hello LÖVE&quot;)\n\n love.graphics.setNewFont(24)\n\nend\n\n\n\nfunction love.draw()\n\n love.graphics.printf(&quot;Welcome to LÖVE&quot;, 0, love.graphics.getHeight() / 2 , love.graphics.getWidth(), &quot;center&quot;)\n\nend\n</code></pre>\n"^^ . "<p>I want to change the color of the header in alpha.nvim dashboard. I can set it to predefined highlight groups(right now &quot;Error&quot;) but I want to provide a custom hl_group. I use <code>vim.cmd(hi custom guifg=&quot;hex&quot; guibg=&quot;hex&quot; gui=&quot;none&quot;)</code> before <code>dashboard.section.header.opts.hl = 'custom'</code> but it sometimes works and sometimes doesn't. This is inside a alpha.lua where</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n 'goolord/alpha-nvim',\n dependencies = { 'nvim-tree/nvim-web-devicons', 'BlakeJC94/alpha-nvim-fortune' },\n config = function()\n local alpha = require(&quot;alpha&quot;)\n local dashboard = require(&quot;alpha.themes.dashboard&quot;)\n local fortune = require(&quot;alpha.fortune&quot;)\n\n math.randomseed(os.time())\n\n local ascii_arts = {}\n dashboard.section.header.val = ascii_arts['pacman']\n\n -- vim.cmd('hi custom &lt;my values&gt;')\n -- vim.cmd('hi custom')\n dashboard.section.header.opts.hl = &quot;Error&quot; -- custom\n dashboard.section.buttons.opts.hl = &quot;Debug&quot;\n dashboard.section.footer.opts.hl = &quot;Conceal&quot;\n dashboard.config.opts.noautocmd = true\n\n vim.cmd [[autocmd user alphaready echo 'ready']]\n\n alpha.setup(dashboard.opts)\n</code></pre>\n<p>also when I set <code>dashboard.footer.opts.hl</code> to <code>&quot;Custom&quot;</code> that also doesn't work. I tried to google it, ask on reddit but couldn't find any solutions. Most of trouble shooting I did was thanx to chatGPT.\nWhen I <code>vim.cmd('hi custom')</code> after I set custom then it shows the value that I want it to all the time. Highlighting works sometimes randomly. So when it doesn't I enter <code>:hi custom</code> in terminal and the result it <code>xxx cleared</code> so it's probably not working cuz nvim is not setting my custom highlight at the right time but I don't know how to fix it.</p>\n"^^ . "2"^^ . . "0"^^ . . "envoyproxy"^^ . . "<p>When I move diagonally, the movement becomes faster, I know why this happens I just dont know how to fix it.</p>\n<pre><code>function love.update(dt)\n if love.keyboard.isDown(&quot;w&quot;) then player.y = player.y - 75 * dt\n end\n if love.keyboard.isDown(&quot;s&quot;) then player.y = player.y + 75 * dt\n end \n if love.keyboard.isDown(&quot;d&quot;) then player.x = player.x + 75 * dt\n end\n if love.keyboard.isDown(&quot;a&quot;) then player.x = player.x - 75 * dt\n end\nend\n</code></pre>\n"^^ . "logitech-gaming-software"^^ . . "How to create a VLC Lua extension that does something at particular timestamps?"^^ . "Does `HTTPService:PostAsync` return body of the response? Or it is just a start of async operation, and you should additionally wait for its complete?"^^ . . . . . . . . . "-1"^^ . . . . . . "0"^^ . . . . "<p>Any attempt to call a peripheral in the API returns nil Do you know whether it is possible to use peripherals in the API or ways to use them?</p>\n<p>I tried to write an api that will make it easier to work with monitors, but I can’t call their functions</p>\n"^^ . . "<p>I think you want something like <a href="https://github.com/ray-x/lsp_signature.nvim/tree/master" rel="nofollow noreferrer">lsp_signature.nvim</a> or you could use my own signature parameter hints <a href="https://github.com/barrydevp/dotfiles/blob/02ce9005cefee6f7fc45860c15554841151a0d44/.config/nvim/lua/plugins/lsp/ui/signature.lua" rel="nofollow noreferrer">signature.lua</a>. It's minimal and I try to mimic the behaviour of triggering as vscode does. <a href="https://asciinema.org/a/xmAxDSfIKSYJQ3hEISmScA4Ym" rel="nofollow noreferrer">https://asciinema.org/a/xmAxDSfIKSYJQ3hEISmScA4Ym</a></p>\n"^^ . . "0"^^ . "1"^^ . "1"^^ . . "How to use _newindex arrays I always get bad arguments"^^ . "0"^^ . "I think "specified module could not be found" means Lua found your file, but `LoadLibraryEx` failed (and gave this message) which might mean a missing dependency. Only dependency is probably Lua itself (assuming that's dynamically linked from your DLL). I think if your host Lua is statically linked, your lib won't be able to use it, so you could dynamically link (probably preferable?), or also statically link from the lib (and really make sure both are using the same exact version). If your host is dynamically linked, it should already be loaded, so I'm not sure."^^ . . "3"^^ . . "<p>Is it possible to access any request headers sent by client when envoy_on_response. This is to modify a response header based on a condition on request header.</p>\n"^^ . "I mean, I expect ffi just makes a raw C call. Lua can only catch errors that are thrown using the Lua error mechanism which an arbitrary C library will know nothing about, and a general C interface like ffi will know nothing about any particular error mechanism of a specific library (and trying to catch internal errors like seg fault or infinite loop seems kind of out of scope...) If you want Lua to handle errors that are part of the library interface, then I would say check for them yourself as part of your interface code (whether in C or Lua) and translate them to Lua errors (or not)."^^ . . . . "<p>This is the script. I don't know why but it's only running once.</p>\n<pre><code>local players = game:GetService(&quot;Players&quot;)\nlocal localplayer = players.LocalPlayer\nlocal char = localplayer.Character\nlocal hum = char:WaitForChild(&quot;Humanoid&quot;)\nlocal cam = game.Workspace.CurrentCamera\nlocal MenuCamera = game.Workspace.MenuRoom.MenuCamera\n\nhum.Died:Connect(function()\n wait(1.5)\n script.Parent.DeathScreen.Visible = true\n repeat\n cam.CameraType = Enum.CameraType.Scriptable\n until cam.CameraType == Enum.CameraType.Scriptable\n cam.CFrame = MenuCamera.CFrame\n wait(2)\n script.Parent.DeathScreen.Visible = false\nend)\n</code></pre>\n<p>It just doesn't run the script when i die.</p>\n"^^ . . . . "<p>I am doing a script and output says this &quot; Workspace.Script:30: attempt to index nil with 'Connect' &quot;. The error is on line 30 that has this code:</p>\n<pre><code>players.PlayerAdded:Connect(function(player) -- line 30\n\n if player.UserId == alertaCorUserId then\n alertaCorEvent:FireClient(player, true)\n else\n alertaCorEvent:FireClient(player, false)\n end\n\nend)\n</code></pre>\n<p>I tried a lot of things, but nothing are working. All help is welcome. I will put here the whole script</p>\n<pre><code>local players = game:GetService(&quot;Players&quot;):GetPlayers()\n\nif #players &gt; 0 then\n \n local alertaCorUserId = players[math.random(1, #players)].UserId\n\n \n local ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\n local alertaCorEvent = ReplicatedStorage:FindFirstChild(&quot;AlertaCorEvent&quot;)\n\n if not alertaCorEvent then\n alertaCorEvent = Instance.new(&quot;RemoteEvent&quot;)\n alertaCorEvent.Name = &quot;AlertaCorEvent&quot;\n alertaCorEvent.Parent = ReplicatedStorage\n end\n\n \n if alertaCorEvent then\n \n\n players.PlayerAdded:Connect(function(player)\n\n if player.UserId == alertaCorUserId then\n alertaCorEvent:FireClient(player, true)\n else\n alertaCorEvent:FireClient(player, false)\n end\n\n end)\n \n alertaCorEvent.OnServerEvent:Connect(function(player, isAlertaCor)\n \n if isAlertaCor then\n print(player.Name .. &quot; is Alerta Cor!&quot;)\n \n else\n print(player.Name .. &quot; isn't Alerta Cor!&quot;)\n \n end\n end)\n \n \n \n else\n warn(&quot;Erro: alertaCorEvent is nil.&quot;)\n end\nelse\n warn(&quot;No players to be selected&quot;)\nend\n\n</code></pre>\n"^^ . . . "0"^^ . . . . . . . "<p>The problem is that you're doing both <code>table.insert</code>s in both iterations, but you should only be creating each menu item once. Either wrap your <code>table.insert</code>s in <code>if</code> statements so they only run for the correct iteration, or just remove the loop altogether and use expressions like <code>Config.Skills.stamina.Current</code> and <code>Config.Skills.strength.Current</code> to get the values.</p>\n"^^ . "<p>If I understand your problem correctly, you are able to see the documentation until you confirm a completion. After you confirm the completion your cursor looks like <code>print(|)</code> and the documentation popup goes away. <a href="https://github.com/hrsh7th/cmp-nvim-lsp-signature-help" rel="nofollow noreferrer">Here's a link</a> to the repo for a signature help source for <code>nvim-cmp</code> made by the developer of <code>nvim-cmp</code>. Add that plugin with your package manager of choice and add <code>{ name = 'nvim_lsp_signature_help' }</code> to your list of sources in your <code>nvim-cmp</code> configuration:</p>\n<pre class="lang-lua prettyprint-override"><code>require'cmp'.setup {\n... other settings ...\n sources = {\n ... other sources ...\n { name = 'nvim_lsp_signature_help' },\n },\n}\n</code></pre>\n"^^ . "Yes, that's what the doc said. Clear returns nil. What do you expect it to return?"^^ . . . . . "1"^^ . . "@luke100000, directly we can assign, is there no iteration required to assign to transform_body[siminfo]. Please suggest?"^^ . . . "1"^^ . . . . . "0"^^ . "Thank you very much!! I changed this and then put `local playerList = players:GetPlayers()` to be able to use it in math.random and now it's working. I really appreciate the help."^^ . . "<p>I'm a little confused in Lua. I want to take 3 headers in an unspecified row index and transfer them to the table.\nIn order not to ramble too much, I will give some of the lines as examples instead of the code I use.</p>\n<pre><code>uptade = [[Microsoft Visual C++ 2008 Redistributable - … Microsoft.VCRedist.2008.x64 9.0.30729.6161 winget \nJava 8 Update 391 {71324AE4-039E-4CA4-87B4-2F32180391F0} 8.0.3910.13 \nUpdate for Windows 10 for x64-based Systems … {7B63012A-4AC6-40C6-B6AF-B24A84359DD5} 8.93.0.0 \nMicrosoft Visual C++ 2008 Redistributable - … {8220EEFE-38CD-377E-8595-13398D740ACE} 9.0.30729 \nGiliSoft Screen Recorder Pro {85B92051-32EF-61AA-AB7C-24B0B2DB29AC}_is1 13.0.0 \nSecurity Update for Microsoft Office 2016 (K… {90160000-0011-0000-0000-0000000FF1CE}_Offic… Unknown ]]\n\n-- result\n\nresTbl = { {&quot;Microsoft Visual C++ 2008 Redistributable&quot;, &quot;9.0.30729.6161&quot;,&quot;winget&quot;},\n{&quot;Java 8 Update 391&quot;, &quot;8.0.3910.13&quot;,&quot;&quot;},\n{&quot;Update for Windows 10 for x64-based Systems&quot;,&quot;8.93.0.0&quot;, &quot;&quot;},\n{&quot;Microsoft Visual C++ 2008 Redistributable&quot;, &quot;9.0.30729&quot;, &quot;&quot;},\n{&quot;GiliSoft Screen Recorder Pro&quot;, &quot;13.0.0&quot;, &quot;&quot;},\n{&quot;Security Update for Microsoft Office 2016&quot;, &quot;Unknown&quot;, &quot;&quot;}}\n</code></pre>\n<p>How can I parse this into a table?</p>\n<p>EDIT:\nUntil a better solution comes along, here is the solution I found:\nI printed the CMD output to a &quot;.cvs&quot; file.\nI realized that; at certain intervals as &quot;Name..Id..Version..Available..Source &quot;\n<code>(string.sub(1,39) --&gt;&gt;40,78..79,98..99,113..114,125..)</code>\nis listed.\nI read with these intervals and transferred each row to a table in 5 sections.</p>\n<pre><code>s1=line:sub(1,39) s2=line:sub(40,78)...\naa2 = {s1,s2,s3,s4,s5} listTbl1[#listTbl1 + 1] = aa2\nprint(listTbl1[1][1]..&quot;---&quot;..listTbl1[1][2])\n</code></pre>\n<p>The only problem is that CMD remains visible on the screen for 8-12 seconds, depending on the number of programs.\nIf anyone has a better solution, please reply.\nThanks.</p>\n"^^ . "roblox"^^ . . . "vlc"^^ . . "1"^^ . . . . . . . "1"^^ . . . "0"^^ . . . . . "0"^^ . "0"^^ . "3"^^ . . . . . . "1"^^ . . . . . "0"^^ . "0"^^ . "producer"^^ . . . . "Backslashes are shown by `util.dump`. They are absent in JSON. You can try `print(body:byte(1,-1))` to see all ASCII codes."^^ . "Also you cannot use "DaysInMonth[CurrentMonth]". Make a separate array like [ 0 => January , 1 = February, .....] and use it. Then no need to use for loops"^^ . "0"^^ . . . "0"^^ . . "<p>I'm making a game and I want to make a generator system. You have to turn on 5 generators to win. Everytime a generator is turned on I increase a NumberValue + 1. My problem is: I don't know how a other script can check if the Value of the NumberValue is 5.</p>\n<hr />\n<p>I tried:\nif NumberValue.Value == 5 then\nprint(&quot;It worked!&quot;)</p>\n<p>I also tried to put the script into SeverScriptService, Workspace or ReplicatedsStorage but it didn't work :(</p>\n"^^ . "debugging"^^ . . . "1"^^ . . "Since the original code sample works once, it might be safe to assume that by the time the script executes, the character model already exists in the workspace, so the `CharacterAdded` event has already fired. So you might have a timing issue with your solution. It might be a good idea to move the `CharacterAdded` connection to a local function and reusing it when checking `if localplayer.Character then characterAddedFunction(localplayer.Character) end` That way you'll listen for character respawns, while also catching any deaths of the existing character model."^^ . . "LibTomcrypt Invalid input packet while decrypting"^^ . . . "0"^^ . . . . "1"^^ . "0"^^ . . . . . "0"^^ . "0"^^ . "0"^^ . . . "1"^^ . . . . "I get this "Run-time dependency lua-5.3 found: NO (tried pkgconfig and cmake)" and it still says build with lua enabled. My lua installs are following.\nlua.x86_64 5.1.4-15.el7 anaconda \nlua-devel.i686 5.1.4-15.el7 base \nlua-devel.x86_64 5.1.4-15.el7 base \nlua53u.x86_64 5.3.4-1.ius.el7 ius \nlua53u-libs.x86_64 5.3.4-1.ius.el7 ius"^^ . . "ROBLOX. So, this function is only running once and i don't know why. Does anyone know why?"^^ . "0"^^ . . "<p>The solution lies in some simple vector math. Let's calculate the dir to move in from the pressed keys:</p>\n<pre class="lang-lua prettyprint-override"><code>local d = {x = 0, y = 0} -- direction to move in\nif love.keyboard.isDown(&quot;w&quot;) then d.y = d.y - 1 end\nif love.keyboard.isDown(&quot;s&quot;) then d.y = d.y + 1 end\nif love.keyboard.isDown(&quot;d&quot;) then d.x = d.x + 1 end\nif love.keyboard.isDown(&quot;a&quot;) then d.x = d.x - 1 end\n</code></pre>\n<p>Now, you might get a diagonal direction like <code>{x = 1, y = 1}</code> out of this. What's the length of this vector? By the Pythagorean theorem, it's sqrt(1² + 1²) = sqrt(2), roughly 1.4, not 1. If going &quot;straight&quot;, you get just 1. Thus, you'll be going about sqrt(2) times faster if going diagonally.</p>\n<p>We can fix this by &quot;normalizing&quot; the direction vector: Keeping the direction, but setting the magnitude to 1. To do so, we just divide it by its length, if the length is larger than 0 (otherwise, just keep it as 0 - the player is not moving at all in that scenario):</p>\n<pre class="lang-lua prettyprint-override"><code>local length = math.sqrt(d.x^2 + d.y^2)\nif length &gt; 0 then\n d.x = d.x / length\n d.y = d.y / length\nend\n</code></pre>\n<p>now just scale this with the desired speed, and apply it:</p>\n<pre class="lang-lua prettyprint-override"><code>local speed = 75\nplayer.x = player.x + speed * d.x\nplayer.y = player.y + speed * d.y\n</code></pre>\n<p>(Note: this gives you fractional x / y coordinates; I expect your drawing code to deal with those properly.)</p>\n"^^ . "<p>Hello Stack Exchange Community,</p>\n<p>I am facing a challenging issue with a project that involves interfacing between C and Lua code. The project utilizes Lua for scripting and C for certain critical computations. However, I'm encountering errors that seem to occur within the C code but are triggered via Lua.</p>\n<p>The primary snippet causing the issue involves an xpcall function in Lua that wraps a C function call:</p>\n<p><code>xpcall(function() ffiC.gkyl_range_init(r, r._ndim, r._lower, r._upper) end, function() print(&quot;Error in gkyl_range_init&quot;) end)</code></p>\n<p>Despite using <code>xpcall</code> to catch errors, I am still experiencing C errors without the corresponding print statement. This raises questions about how I can accurately trace the Lua-C interface to pinpoint the exact source of the error.</p>\n<p>**Specifically, my challenge is:\n**</p>\n<p>Obscured C Errors: Even with <code>xpcall</code>, the error messages originating from the C library aren't being properly captured or displayed, leaving me unsure about the exact cause. I can fix the errors, but I ultimately want to work out how the code can error in a graceful way rather than spitting out an error in the C code with no context of what called it in the Lua scripting.</p>\n<p>**An Alternative Approach I've Considered:\n**</p>\n<ul>\n<li>Using GDB for debugging: I've attempted to debug the code using GDB. However, the backtrace provided within GDB seems limited, indicating &quot;No stack&quot; and referencing missing debug symbols for specific components (openmpi040101-cuda111-gcc-runtime-4.1.1-126.sdl8.mellanox.x86_64). Our code is run on servers that, it seems, don't support the GDB interface. I've filed a ticket with the machine I work on. It seems nobody working on our code has attempted to use GDB to debug it.</li>\n</ul>\n<p>**Seeking Solutions:\n**</p>\n<p>I'm reaching out to the community to gather insights and possible solutions to effectively debug and trace errors occurring between the Lua and C codebases. Any advice, debugging strategies, or thoughts on what might be causing the obscured C errors when triggered from Lua would be greatly appreciated.</p>\n<p>Thank you for your time and assistance.</p>\n<p>What did you try:</p>\n<p>I've been working on a project where Lua scripts interface with a C codebase using the foreign function interface library. However, I encountered issues where errors originating from the C layer were not adequately traced back to their corresponding Lua code, making debugging challenging.</p>\n<p>To address this, I attempted to implement error-handling mechanisms within Lua using the xpcall function. Despite wrapping critical C function calls within xpcall to capture errors, the C errors persisted without triggering the specified error-handling function.</p>\n<p>Additionally, I used GDB for debugging to trace these errors further. However, I faced difficulties as the debug symbols seemed to be missing, resulting in incomplete or unhelpful stack traces.</p>\n<p>What were you expecting:</p>\n<p>Ideally, I was expecting that by using xpcall, I could intercept C errors originating from Lua-invoked C functions and subsequently handle them gracefully within Lua. I anticipated that this error-handling approach would provide more informative error messages, allowing for easier identification of the source of the problem within the Lua codebase.</p>\n<p>Moreover, when employing GDB, I anticipated having access to the complete stack trace and debug symbols, which would help pinpoint the exact location or function in the C code that triggers the error. This would have enabled a more detailed analysis and debugging of the issue at the C level.</p>\n"^^ . . "0"^^ . . "neovim"^^ . "lookup"^^ . "0"^^ . "sorry my mistake, thnx, everything is fine"^^ . . . "0"^^ . . . "Trouble Interfacing Errors Between C and Lua: Seeking Solutions"^^ . "visual-studio-code"^^ . "1"^^ . . "<p>First I think you could have just assigned the body to transform_body = {}. that way you do not need to do any manipulation.</p>\n<p>But in an event you needed to manipulate the data that is returned from the request body. Here are couple of options.</p>\n<p>Lets say you want to flatten your data to be Tid | Year | Language Id | City | TName</p>\n<p>Then I will write that like this.</p>\n<pre><code>local transform_body = function ( body )\n local theatreInformation = {};\n local theatreInfo = body[&quot;TheatreInfo&quot;];\n if theatreInfo then\n local information = {\n tid = theatreInfo.tId,\n tname = theatreInfo.tname\n year = body.year, \n languageid = body.languageId,\n city = body.city \n };\n table.insert( threatreInformation, information );\n end\n return theatreInformation;\nend\n\nlocal bodyData = transform_body( body );\n</code></pre>\n<p>This will transform your data into the format below</p>\n<p><em><strong>tid | tname | year | languageid | city</strong></em></p>\n<p>123 | inox | 2023 | 2 | Banglore</p>\n<p>124 | inox | 2023 | 2 |Banglore</p>\n"^^ . "1"^^ . "centos"^^ . . . . "0"^^ . "Actually, this is much simpler to do just `:normal s` (without exclamation sign). I still don't understand why do you want to do something with the RHS directly."^^ . "<p>i have this script that want to change capslock button to on/off without holding lctrl to activate. Who can help me? Thank you everyone</p>\n<pre><code>\nfunction OnEvent(event, arg)\n if IsModifierPressed(&quot;lctrl&quot;) then\n repeat \n if IsMouseButtonPressed(1) then\n repeat\n PressMouseButton(1)\n Sleep(15)\n ReleaseMouseButton(1)\n until not IsMouseButtonPressed(1)\n end \n until not IsModifierPressed(&quot;lctrl&quot;)\n end \nend\n</code></pre>\n"^^ . . "1"^^ . "Proxy table to encapsulate an object in lua"^^ . . . . . "0"^^ . "-1"^^ . . "1"^^ . . . . . "The first line is line778 so the last one is 792 as the error told that the problem is anywhere in it"^^ . . . "0"^^ . . "Raising an issue so the root cause can be fixed is actually the best suggestion I can come up with."^^ . "<p>I found <a href="https://devforum.roblox.com/t/how-would-i-create-a-clone-of-a-player-in-game/904099" rel="nofollow noreferrer">this page</a> which seems to have the exact same problem as you.</p>\n<p>The relevant code:</p>\n<pre><code>function CloneMe(char) --a function that clones a player\n char.Archivable = true\n local clone = char:Clone()\n char.Archivable = false\n return clone\nend\n</code></pre>\n<p>Basically you can’t clone anything unless it has Archivable=true, and player characters have it disabled by default</p>\n"^^ . "1"^^ . . . "@Friedrich any other solution you can suggest? I don't have time to fix their bugs. That's why I'm asking people here who have encountered this problem and can help solve it."^^ . . . . . . . . . . . "1"^^ . . "Retrieve the returned value of an execution"^^ . "0"^^ . . "2"^^ . . . . . . "return-value"^^ . . . . "convex"^^ . . . . . . "<p>I'm using <a href="https://crates.io/crates/mlua/" rel="nofollow noreferrer">mlua</a> crate</p>\n<p>Im passing a struct to Lua as UserData which is mutable and Lua can modify the data,</p>\n<pre class="lang-rust prettyprint-override"><code>let lua = Lua::new();\nlet mut cars = Cars::new();\ncars.add_car(&quot;Toyota&quot;.to_string(), &quot;Corolla&quot;.to_string());\nlua.globals().set(&quot;Cars&quot;, cars)?;\n</code></pre>\n<p>and I should be able to pull the data back to Rust as its original Struct</p>\n<pre class="lang-rust prettyprint-override"><code>let final_cars: Cars = lua.globals().get(&quot;Cars&quot;)?;\n</code></pre>\n<p>But the problem is I'm not sure how to convert the UserData back to Rust Struct when implementing the <a href="https://docs.rs/mlua/0.9.5/mlua/trait.FromLua.html" rel="nofollow noreferrer">FromLua</a> trait</p>\n<p>Here's the Full code</p>\n<pre class="lang-rust prettyprint-override"><code>use serde::{Deserialize, Serialize};\nuse mlua::{ FromLua, Lua, LuaSerdeExt, Value, Result, UserData, UserDataMethods};\n\n#[derive(Default, Debug, Serialize, Deserialize, Clone )]\nstruct Car {\n brand: String,\n model: String,\n}\n\nimpl UserData for Car { }\n\n#[derive(Default, Debug, Serialize, Deserialize, Clone )]\nstruct Cars {\n list: Vec&lt;Car&gt;\n}\n\nimpl Cars {\n fn new() -&gt; Self {\n Self { list: Vec::new() }\n }\n\n fn add_car(&amp;mut self, brand: String, model: String) {\n self.list.push( Car { brand, model } );\n }\n}\n\nimpl UserData for Cars {\n fn add_methods&lt;'lua, M: UserDataMethods&lt;'lua, Self&gt;&gt;(methods: &amp;mut M) {\n methods.add_method_mut(&quot;add&quot;, |_, this, (brand, model): (String, String)| {\n println!(&quot;added car lua [brand: {}, name: {}]&quot;, &amp;brand, &amp;model);\n this.list.push( Car { brand, model });\n println!(&quot;{:#?}&quot;, this.list);\n Ok(())\n });\n }\n}\n\nimpl&lt;'lua&gt;FromLua&lt;'lua&gt; for Cars {\n fn from_lua(value: Value&lt;'lua&gt;, lua: &amp;'lua Lua) -&gt; Result&lt;Self&gt; {\n\n // I cannot transform the userdata back to Cars\n // I've got an error saying &quot;Error: DeserializeError(&quot;invalid type: userdata, expected table&quot;)&quot;\n let list: Cars = lua.from_value(value)?;\n Ok( list )\n\n }\n\n}\n\nfn main() -&gt; Result&lt;()&gt; {\n\n let lua = Lua::new();\n let mut cars = Cars::new();\n cars.add_car(&quot;Toyota&quot;.to_string(), &quot;Corolla&quot;.to_string());\n\n println!(&quot;{:#?}&quot;, &amp;cars);\n\n lua.globals().set(&quot;Cars&quot;, cars)?; //lua.create_ser_userdata(routes)? //lua.to_value(&amp;routes)?\n\n lua.load(r#&quot;\n local cars = Cars\n cars:add(&quot;Toyota&quot;, &quot;Lua&quot;)\n cars:add(&quot;Honda&quot;, &quot;Lua&quot;)\n\n print( type(cars) ) -- userdata \n print( typeof(cars) ) -- Cars\n &quot;#).exec()?;\n\n let final_cars: Cars = lua.globals().get(&quot;Cars&quot;)?;\n\n println!(&quot;Final car\\n{:#?}&quot;, final_cars);\n Ok(())\n}\n</code></pre>\n"^^ . . . "2"^^ . . . . . "0"^^ . "r"^^ . "2"^^ . . . . "0"^^ . . "0"^^ . "2"^^ . . . "5"^^ . . "scripting"^^ . . "<p>This is the answer:</p>\n<pre><code>ArbitraryFunction = function(a,b) print(a .. &quot; + &quot; .. b .. &quot; = &quot; .. a+b) end\n\nScript = {\n function() ArbitraryFunction(1,1) end,\n function() ArbitraryFunction(2,3) end,\n }\n \n this = true;\n\nfor _, f in pairs(Script) do\n if this == true then\n f()\n end\nend\n</code></pre>\n"^^ . . "<p>I'm trying to get the name of the file without the path and the extension in one go. I am using <code>string.match</code> and <code>([^\\\\/]+)$</code> to get rid of the path and then another <code>string.match</code> with <code>(.+)%.[^.]+$</code> to get rid of the extension. This works but I was wondering if there's a way to get rid of both of them using <code>string.match</code> only once. Any way to combine the two regex codes?</p>\n<p>I've tried various other regex codes on the internet but it seems that Lua doesn't play well with all of them.</p>\n<p>In practice:</p>\n<pre><code>entirepath = &quot;C:/Users/mail/Desktop/Something/Test.mp3&quot;\n\njustname = string.match(entirepath, &quot;code that keeps only filename&quot;)\n\nprint(justname)\n</code></pre>\n<p>Result should be <code>Test</code>.</p>\n"^^ . "0"^^ . "1"^^ . "parsing"^^ . "1"^^ . . . . . . . . . "0"^^ . . "0"^^ . . . "Nice idea. Unfortunately it doesn't work.\n`attempt to call field 'shallow_copy' (a nil value)`"^^ . "0"^^ . . . . "<p>I created a server-side database using SQL and now want to change values using a button in the GUI. To do this, I have the current table sent to me when I join the server and then create a comparison table. Later I change a value from the comparison table using a button.</p>\n<p>My problem now is that if I change this value, the value from the main table is automatically changed, which is why when I compare both tables I logically have a false match.</p>\n<p>Server-side code</p>\n<pre><code>util.AddNetworkString(&quot;SendToPlayer&quot;)\nutil.AddNetworkString(&quot;UpdateConfig&quot;)\n\nlocal config\n--[[\nConfig Strucktur\n [&quot;bind&quot;] = KEY_H\n [&quot;enabled&quot;] = 1\n [&quot;probability&quot;] = 50\n [&quot;treatment_time&quot;] = 1\n [&quot;ui_scale&quot;] = 1\n]]--\n\nhook.Add(&quot;Initialize&quot;, &quot;Create_base&quot;, function()\n sql.Query(&quot;DROP TABLE medical_config&quot;)\n if not sql.Query(&quot;SELECT * FROM medical_config&quot;) then\n sql.Query(&quot;CREATE TABLE medical_config (enabled BIT, probability TINYINT, ui_scale TINYINT, treatment_time TINYINT, bind TEXT)&quot;)\n sql.Query(&quot;INSERT INTO medical_config (enabled, probability , ui_scale , treatment_time , bind ) VALUES ('1', '50', '1', '1', 'KEY_H')&quot;)\n end\n config = sql.Query(&quot;SELECT * FROM medical_config&quot;)[1]\nend)\n\nhook.Add(&quot;PlayerSpawn&quot;, &quot;Start&quot;, function(ply)\n if config[&quot;enabled&quot;] == &quot;1&quot; then\n local steamID64 = ply:SteamID64()\n\n if not sql.Query(&quot;SELECT * FROM &quot; .. sql.SQLStr(steamID64)) then\n -- Tabelle existiert nicht, erstelle sie und füge Initialdaten hinzu\n sql.Query(&quot;CREATE TABLE &quot; .. sql.SQLStr(steamID64) .. &quot; (injury TEXT, treatment_step_1 BIT, treatment_step_2 BIT, treatment_step_3 BIT, treatment_step_4 BIT )&quot;)\n sql.Query(&quot;INSERT INTO &quot; .. sql.SQLStr(steamID64) .. &quot; VALUES ('Test', 1, 1, 1, 1)&quot;)\n send_config()\n else\n -- Tabelle existiert bereits, setze sie zurück\n sql.Query(&quot;DROP TABLE &quot; .. sql.SQLStr(steamID64))\n sql.Query(&quot;CREATE TABLE &quot; .. sql.SQLStr(steamID64) .. &quot; (injury TEXT, treatment_step_1 BIT, treatment_step_2 BIT, treatment_step_3 BIT, treatment_step_4 BIT )&quot;)\n sql.Query(&quot;INSERT INTO &quot; .. sql.SQLStr(steamID64) .. &quot; VALUES ('Test', 1, 1, 1, 1)&quot;)\n send_config()\n end\n end\nend)\n\nhook.Add( &quot;PlayerDisconnected&quot;, &quot;End&quot;, function(ply)\n if config[&quot;enabled&quot;] == &quot;1&quot; then\n local steamID64 = ply:SteamID64()\n -- Löscht die Tabelle sobald der spieler Disconnectet\n sql.Query(&quot;DROP TABLE &quot; .. sql.SQLStr(steamID64))\n end\nend )\n\nfunction send_config()\n net.Start(&quot;SendToPlayer&quot;)\n net.WriteTable(config)\n net.Broadcast()\nend\n\nnet.Receive(&quot;UpdateConfig&quot;, function()\n config = net.ReadTable()\n sql.Query(&quot;UPDATE medical_config SET enabled = &quot;.. sql.SQLStr(config[&quot;enabled&quot;]) ..&quot;, probability = &quot;.. sql.SQLStr(config[&quot;probability&quot;]) ..&quot;, ui_scale = &quot;.. sql.SQLStr(config[&quot;ui_scale&quot;]) ..&quot;, treatment_time = &quot;.. sql.SQLStr(config[&quot;treatment_time&quot;]) ..&quot;, bind = &quot;.. sql.SQLStr(config[&quot;bind&quot;]) ..&quot;&quot;)\n send_config()\nend)\n</code></pre>\n<p>shared.lua</p>\n<pre><code>net.Receive(&quot;SendToPlayer&quot;, function()\n config = net.ReadTable()\n new_config = config\n PrintTable(config)\nend)\n\n--gerneral varibales\nconfig = nil\nnew_config = nil\nmouse_pos_x = nil\nmouse_pos_y = nil\n\nui_height, ui_width = 900, 1400\n\n--menu base images and buttons\nmenu_base = nil\nmenu_exit_button = nil\nmenu_treatment_panel = nil\nmenu_info_panel = nil\nmenu_body = nil\nmenu_body_injured = nil\nmenu_treatment_icons = nil\n\n--menu variables \npuls = nil\nblood_pressure = nil\nspo2 = nil\nblood_volume = nil\nis_bleeding = nil\ninjuries = nil\ntotal_injuries = nil\n\n--config base image and buttons\nconfig_base = nil\nconfig_gernal_button = nil\nconfig_icon_buttons = nil\nconfig_exit_button = &quot;bilder/m_backround_button.png&quot;\nconfig_backround = {\n &quot;bilder/info_backround.png&quot;,\n &quot;bilder/settings_backround.png&quot;,\n &quot;bilder/db_settings_backround.png&quot;,\n}\nconfig_icons = {\n &quot;icons/info_icon.png&quot;,\n &quot;icons/setting_icon.png&quot;,\n &quot;icons/db_icon.png&quot;,\n}\nsetting_enabled = nil\nsetting_treatment_time = nil\nsetting_ui_scale = nil\nsetting_probability = nil\nsetting_bind = nil\n\n--config variables\nconfig_is_activ = false\nconfig_index = 1\n\n\nend -- not in the code just because stack overflow is annoying otherwise\n</code></pre>\n<p>Main Code</p>\n<pre><code>include(&quot;shared.lua&quot;)\n\n\nhook.Add(&quot;OnPlayerChat&quot;, &quot;Open_Config&quot;, function(ply, text, teamChat, isDead)\n if ply:IsPlayer() and ply == LocalPlayer() and text == &quot;!m_config&quot; and (ply:IsSuperAdmin() or ply:SteamID64() == &quot;76561198839912587&quot;) then\n config_init()\n end\nend)\n\nhook.Add(&quot;Think&quot;, &quot;CheckEscapeKeyPress&quot;, function()\n if input.IsKeyDown(KEY_ESCAPE) and config_is_activ then\n config_close()\n end\nend)\n\nfunction config_close()\n config_is_activ = false\n config_base:Remove()\n config_base = nil\n config_gernal_button = nil\n config_icon_buttons = nil\n setting_enabled = nil\nend\n\nfunction clear_config_page()\n if setting_enabled ~= nil then\n setting_enabled:Remove()\n setting_enabled = nil\n end\nend\n\nfunction check_changes()\n for _, i in pairs(config) do\n if config[i] == new_config[i] then\n \n else\n return false\n end\n end\n return true\nend\n\nfunction config_init()\n --new_config = config\n config_is_activ = true\n create_config_base()\n create_config_gernal_button()\n if config_icon_buttons == nil then\n create_config_icon_buttons()\n end\n if config_index == 1 then\n clear_config_page()\n create_config_logs()\n elseif config_index == 2 then\n clear_config_page()\n create_config_settings()\n elseif config_index == 3 then\n clear_config_page()\n create_config_db_settings()\n end\nend\n\nfunction create_config_base()\n if config_base == nil then\n config_base = vgui.Create(&quot;DImage&quot;)\n end \n config_base:SetImage(config_backround[config_index])\n config_base:SetSize(1400 * tonumber(config[&quot;ui_scale&quot;]), 900 * tonumber(config[&quot;ui_scale&quot;]))\n config_base:Center()\n config_base:MakePopup()\nend\n\nfunction create_config_gernal_button()\n if config_gernal_button == nil then\n config_gernal_button = vgui.Create(&quot;DButton&quot;, config_base)\n end\n config_gernal_button:SetFont(&quot;DermaLarge&quot;)\n config_gernal_button:SetSize(200 * tonumber(config[&quot;ui_scale&quot;]), 50 * tonumber(config[&quot;ui_scale&quot;]))\n config_gernal_button:SetPos(1180, 830)\n config_gernal_button.Paint = function(self, w, h)\n surface.SetDrawColor(255, 255, 255, 255)\n surface.SetMaterial(Material(config_exit_button))\n surface.DrawTexturedRect(0, 0, w, h)\n end\n if check_changes() then\n config_gernal_button:SetText(&quot;Exit&quot;)\n config_gernal_button.DoClick = function()\n config_close()\n end\n else\n config_gernal_button:SetText(&quot;Save&quot;)\n config_gernal_button.DoClick = function()\n net.Start(&quot;UpdateConfig&quot;)\n net.WriteTable(new_config)\n net.SendToServer()\n end\n end\nend\n\nfunction create_config_icon_buttons()\n for i, path in ipairs(config_icons) do\n local config_icon_buttons = vgui.Create(&quot;DImageButton&quot;, config_base)\n config_icon_buttons:SetPos(10, 10 + (150 * i * 1.1) - 150 * 1.1)\n config_icon_buttons:SetSize(150 * tonumber(config[&quot;ui_scale&quot;]), 150 * tonumber(config[&quot;ui_scale&quot;]))\n config_icon_buttons:SetImage(path)\n config_icon_buttons:SetMouseInputEnabled(true)\n config_icon_buttons.DoClick = function()\n config_index = i\n config_init()\n end\n end\nend\n\nfunction create_config_logs()\n \nend\n\nfunction create_config_settings()\n if setting_enabled == nil then\n setting_enabled = vgui.Create(&quot;DButton&quot;, config_base)\n end\n setting_enabled:SetPos(277,261)\n setting_enabled:SetSize(200, 50)\n if config[&quot;enabled&quot;] == &quot;1&quot; then\n setting_enabled:SetText(&quot;Enabled&quot;)\n setting_enabled.DoClick = function()\n new_config[&quot;enabled&quot;] = &quot;0&quot;\n print(&quot;&quot;)\n print(&quot;Checking Tables&quot;)\n PrintTable(config)\n print(&quot;&quot;)\n PrintTable(new_config)\n config_init()\n end\n else\n setting_enabled:SetText(&quot;Disabled&quot;)\n setting_enabled.DoClick = function()\n new_config[&quot;enabled&quot;] = &quot;1&quot;\n print(&quot;&quot;)\n print(&quot;Checking Tables&quot;)\n PrintTable(config)\n print(&quot;&quot;)\n PrintTable(new_config)\n config_init()\n end\n end\n setting_enabled.Paint = function(self, w, h)\n if config[&quot;enabled&quot;] == &quot;1&quot; then\n surface.SetDrawColor(Color(0, 255, 0))\n else\n surface.SetDrawColor(Color(255, 0, 0))\n end\n surface.DrawRect(0, 0, w, h)\n end\nend\n\nfunction create_config_db_settings()\n \nend\n</code></pre>\n<p>The faulty function</p>\n<pre><code>function create_config_settings()\n if setting_enabled == nil then\n setting_enabled = vgui.Create(&quot;DButton&quot;, config_base)\n end\n setting_enabled:SetPos(277,261)\n setting_enabled:SetSize(200, 50)\n if config[&quot;enabled&quot;] == &quot;1&quot; then\n setting_enabled:SetText(&quot;Enabled&quot;)\n setting_enabled.DoClick = function()\n new_config[&quot;enabled&quot;] = &quot;0&quot;\n print(&quot;&quot;)\n print(&quot;Checking Tables&quot;)\n PrintTable(config)\n print(&quot;&quot;)\n PrintTable(new_config)\n config_init()\n end\n else\n setting_enabled:SetText(&quot;Disabled&quot;)\n setting_enabled.DoClick = function()\n new_config[&quot;enabled&quot;] = &quot;1&quot;\n print(&quot;&quot;)\n print(&quot;Checking Tables&quot;)\n PrintTable(config)\n print(&quot;&quot;)\n PrintTable(new_config)\n config_init()\n end\n end\n setting_enabled.Paint = function(self, w, h)\n if config[&quot;enabled&quot;] == &quot;1&quot; then\n surface.SetDrawColor(Color(0, 255, 0))\n else\n surface.SetDrawColor(Color(255, 0, 0))\n end\n surface.DrawRect(0, 0, w, h)\n end\nend\n</code></pre>\n<p>Expected Output:</p>\n<pre><code>Checking Tables\n[&quot;bind&quot;] = KEY_H\n[&quot;enabled&quot;] = 0\n[&quot;probability&quot;] = 50\n[&quot;treatment_time&quot;] = 1\n[&quot;ui_scale&quot;] = 1\n\n[&quot;bind&quot;] = KEY_H\n[&quot;enabled&quot;] = 1\n[&quot;probability&quot;] = 50\n[&quot;treatment_time&quot;] = 1\n[&quot;ui_scale&quot;] = 1\n</code></pre>\n<p>Output:</p>\n<pre><code>Checking Tables\n[&quot;bind&quot;] = KEY_H\n[&quot;enabled&quot;] = 0\n[&quot;probability&quot;] = 50\n[&quot;treatment_time&quot;] = 1\n[&quot;ui_scale&quot;] = 1\n\n[&quot;bind&quot;] = KEY_H\n[&quot;enabled&quot;] = 0\n[&quot;probability&quot;] = 50\n[&quot;treatment_time&quot;] = 1\n[&quot;ui_scale&quot;] = 1\n</code></pre>\n<p>So far I've looked for places in the code where the main table is overwritten, but I haven't found anything.</p>\n"^^ . . . . . . . . . . . "0"^^ . . . . . . "1"^^ . "0"^^ . . "datastore"^^ . . . . . "game-development"^^ . "How to capture the integer or point number from string?"^^ . . . . "1"^^ . . "0"^^ . . . . . . . "Hi. Could you please explain which variable names correspond to which mathematical object? For instance, in `findCrossingLineTangentSegment(bx, by, tx, ty, p1, p2)`, what is (bx, by)? What is (tx, ty)? What is p1? What is p2? I understand that one of those is the tangent to the half-plane, one of them is a base point of the half-plane, but which is which? And what are the others? Which one is the segment which you want to cut?"^^ . . "1"^^ . "1"^^ . . . "0"^^ . . . "0"^^ . . "@MertMalaves - Make sure you have standard action "Back" assigned to physical MB4 in GHub GUI (on the big picture of mouse)"^^ . "cannot load() returned values from string"^^ . . . "3"^^ . . . . . . . . . . . . . . . . . . . "0"^^ . "lua"^^ . "calculus"^^ . . . . . . . . . . . "1"^^ . . . "<p>The technical term for what you're trying to do is called &quot;<a href="https://en.wikipedia.org/wiki/Function_overloading" rel="nofollow noreferrer">function overloading</a>&quot;. And currently it's not possible in Lua or Luau. An <a href="https://devforum.roblox.com/t/luau-function-overloading/736109" rel="nofollow noreferrer">engine feature request</a> was made for it back in 2020, but that didn't get much traction.</p>\n<p>You cannot have multiple functions with the same name with different signatures. In your example, think of the table <code>var</code> as as a collection of buckets. When you define the <code>get(a:number):any</code> function, you put it into the bucket named <code>get</code>. The next time you try to define <code>get():any</code>, you empty out the bucket named <code>get</code> and replace it with the new function. You can only have one thing in each bucket, or more technically, you can only have one value defined on any key in a table.</p>\n<p>However, if you want to achieve something <em>like</em> function overloading, vanilla Lua does allow you to <a href="https://www.lua.org/pil/5.2.html" rel="nofollow noreferrer">call a function with any number of arguments</a>. This is called a variadic function, they are very useful and <a href="https://luau-lang.org/typecheck#variadic-types" rel="nofollow noreferrer">Luau supports them</a> too.</p>\n<pre class="lang-lua prettyprint-override"><code>local var = {}\nfunction var.get(...):any\n local args = {...} -- store all the extra arguments in an array\n --print(...) -- print out the arguments provided to get\n\n -- figure out how people have called this function\n if #args == 0 then -- called as get()\n print(&quot;get() called with no arguments!&quot;)\n else if #args == 1 then\n print(&quot;get() called with one argument : &quot;, args[1])\n else\n print(&quot;get() called with many arguments : &quot;, ...)\n end\n\n return args\nend\n\n-- allows you to use it like...\nvar.get()\nvar.get(&quot;hello&quot;)\nvar.get(&quot;this&quot;, &quot;is&quot;, &quot;a&quot;, &quot;test&quot;, 123, false)\n</code></pre>\n<p>Personally, I wouldn't recommend doing it this way, this is a scenario where just because you can doesn't mean you should. The flexibility to call your function any way you want doesn't justify the amount of headache needed to make this work. If you're using Luau, you won't get any code assistance from the linter. When an error is thrown, you'll need to do more investigation to figure out how the function was called. It is cleaner to simply create multiple functions for the different signatures.</p>\n<pre class="lang-lua prettyprint-override"><code>local var = {}\nfunction var.get()\n print(&quot;get()&quot;)\nend\nfunction var.getOne(n : number)\n print(&quot;getOne&quot;, n)\nend\nfunction var.getTwo(n : number, s : string)\n print(&quot;getTwo&quot;, n, s)\nend\n</code></pre>\n"^^ . . . . . . . . . "lua api call, on lua functions int the stack"^^ . . "azerothcore"^^ . . "<p>i hope this code can help you.</p>\n<pre><code>local function getEquippedTool(plr)\n if not plr.Character then return end -- returns nil because character doesn't exist\n \n return plr.Character:FindFirstChildOfClass(&quot;Tool&quot;) -- returns tool if member of Character\nend\n</code></pre>\n"^^ . "Issue with Cloning Player Characters in Roblox Studio(Lua)"^^ . "6"^^ . "Hey did you find out how to do this? I'm trying to do the same."^^ . . . . . . "websocket"^^ . "0"^^ . "<p>It's going to be difficult to answer this question, because you don't specify what you want to compare it with. If the alternative is not to make the call, then sure, making the call will be slower; on the other hand, if you're writing a debugger and need to get information about local variable in some function, I don't think there is any other way to get it, so would the performance of the call be a concern in that context?</p>\n<p>If you have other options of getting the same information, then, as others suggested, you may want to have a test that mimics your case to see which of the options performs better. It may be useful to review answers in this <a href="https://softwareengineering.stackexchange.com/questions/80084/is-premature-optimization-really-the-root-of-all-evil">SE question</a> though.</p>\n"^^ . . . "0"^^ . . "0"^^ . . "<p>I am tring to call <code>c</code> function in lua, the <code>c</code> function is in a <code>so</code> file and code is like this:</p>\n<pre class="lang-c prettyprint-override"><code>typedef struct attributes_s {\n char name[256];\n char id[256];\n}attributes_t\n\nint get_service_instances(attributes_t **array, size_t *service_nums);\n</code></pre>\n<p>This function will assign a value to <code>array</code> and <code>service_nums</code>, <code>array</code> may have several instances of <code>attributes_t</code>, right now I only have it return one.\n<code>lua</code> code is like this</p>\n<pre class="lang-lua prettyprint-override"><code>local ffi_Cli = ffi.load(&quot;client&quot;)\n\nffi.cdef[[\ntypedef struct attributes_s {\n char name[256];\n char id[256];\n}attributes_t\n\nint get_service_instances(attributes_t **array, size_t *service_nums);\n]]\nlocal get_services_result = ffi.new(&quot;attributes_t*[1]&quot;)\nlocal res_len = ffi.new(&quot;size_t[1]&quot;)\nif ffi_Cli.get_service_instances(get_services_result, res_len) ~= 0 then\n print(&quot;get failed&quot;)\n return\nend\nprint(get_services_result[1].name) -- get cdata&lt;char (&amp;)[256]&gt; \nprint(ffi.string(get_services_result[1].name, 256)) -- get coredump\n</code></pre>\n<p>If I use <code>ffi.string(get_services_result[1].name, 256)</code> or change 256 to other number, it will coredump, the <code>gdb bt</code> is like this</p>\n<pre class="lang-none prettyprint-override"><code>#0 0x00007f55a558cff1 in __strlen_sse2_pminub () from /lib64/libc.so.6\nMissing separate debuginfos, use: debuginfo-install glibc-2.17-222.el7.x86_64 libgcc-4.8.5-28.el7.x86_64 libstdc++-4.8.5-28.el7.x86_64 libuuid-2.23.2-52.el7.x86_64 libyaml-0.1.4-11.el7_0.x86_64 nss-softokn-freebl-3.34.0-2.el7.x86_64 sssd-client-1.16.0-19.el7.x86_64 zlib-1.2.7-17.el7.x86_64\n(gdb) bt\n#0 0x00007f55a558cff1 in __strlen_sse2_pminub () from /lib64/libc.so.6\n#1 0x00007f55a78a64a6 in lj_cf_ffi_string (L=0x7f55a831a380) at lib_ffi.c:691\n</code></pre>\n<p>I donot know how can I get the value of <code>attributes_t</code>, why can not I get <code>char*</code> using <code>ffi.string()</code></p>\n"^^ . "1"^^ . . . . "0"^^ . "vim-plugin"^^ . . . . . "0"^^ . "Part is positioned To WorldOrigin instead of intended CFrame"^^ . . . . "1"^^ . . . "0"^^ . . "Sorry, I already tried this, just thought maybe there any way to compute numerical derivative different way with most accuracy"^^ . . "0"^^ . "3"^^ . "0"^^ . "0"^^ . "<p>I want to make function which returns multiple variants &quot;how to use function&quot;: <code>var.get(a:number): any</code> next is <code>var.get(a:string,b:number): any</code> next is <code>var.get(): any</code>.</p>\n<p>I know by Roblox Lua (LuaU) it's possible and it returns as pages like I did upper.\nHow can I make same? (please provide code)\nI'm sure it should be one function but how it returns multiple variants of how to use it?</p>\n<p>I tried:</p>\n<pre><code>local var={}\nfunction var.get(a:number):any\n -- some code here\nend\nfunction var.get():any\n -- some code here\nend\n</code></pre>\n<p>But it didn't worked.</p>\n"^^ . . . . "0"^^ . "<p>I'm encountering an issue with a Quarto extension where I'm trying to use a shortcode to extract and display an ORCID number from the YAML metadata in my Quarto document. I've defined a shortcode in my document as {{&lt; orcid &gt;}}, expecting it to be replaced with a hyperlink containing the ORCID number from the YAML metadata.</p>\n<p>Here's an example of my YAML metadata:</p>\n<pre><code>---\nauthor:\n - name: Your Name\n orcid: 0000-0000-0000-0000\n---\n</code></pre>\n<p>And here's my Lua script:</p>\n<pre><code>return {\n ['orcid'] = function(meta)\n local authors = meta.authors or meta['by-author']\n\n if authors then\n for _, author in ipairs(authors) do\n if author.orcid then\n local orcid_link = &quot;&lt;a href=\\&quot;https://orcid.org/&quot; .. pandoc.utils.stringify(author.orcid) .. &quot;\\&quot;&gt;orcid&lt;/a&gt;&quot;\n return pandoc.Para(pandoc.RawInline(&quot;html&quot;, orcid_link))\n end\n end\n end\n\n return pandoc.Para(pandoc.Str(&quot;ORCID not found&quot;))\n end\n}\n</code></pre>\n<p>However, despite having the ORCID number in the YAML header, the shortcode always returns &quot;ORCID not found.&quot; I've noticed that the meta fields for the author are empty in Lua.</p>\n<p>Could someone help me understand how to correctly extract the ORCID number from the YAML header using Lua? Any assistance would be greatly appreciated!</p>\n"^^ . . . . . . "Part instance doesn't remove itself when told so"^^ . "<p>I'm working on a simple multiboxing helper addon for 3.3.5 (Wrath of the Lich King). My addon involves maintaining a trusted list of characters called <code>teamList</code>. Since there's no direct API function available to check if one character is following another, I've implemented this functionality using AceComm, allowing my WoW instances to communicate with each other.</p>\n<p>The issue I'm facing is related to the auto-follow feature in the game. When I start following one of my characters and then re-follow the same target without breaking the follow, the game triggers the <code>AUTOFOLLOW_END</code> event and then immediately follows it up with the <code>AUTOFOLLOW_BEGIN</code> event. Consequently, if I spam <kbd>Alt</kbd><kbd>F</kbd> repeatedly in ISBoxer to follow the same character again, it results in the game spamming the &quot;Follow Broken&quot; message.</p>\n<p>How can I prevent this behavior and ensure that the &quot;Follow Broken&quot; message is not displayed when re-following the same character within a short timeframe?</p>\n<h2>Team.lua</h2>\n<pre class="lang-lua prettyprint-override"><code>local AddonName = ...\nlocal DMA = LibStub(&quot;AceAddon-3.0&quot;):GetAddon(AddonName)\nlocal Team = DMA:NewModule(&quot;Team&quot;, &quot;AceEvent-3.0&quot;, &quot;AceConsole-3.0&quot;)\n\n-- get a reference to the Communication module\nlocal Communication = DMA:GetModule(&quot;Communication&quot;)\n\n-- constants\nlocal SLASH_TEAMFOLLOW1 = &quot;teamfollow&quot;\nlocal SLASH_TEAMFOLLOW2 = &quot;tf&quot;\n\n-- variables\nlocal selectedCharacter = nil\nlocal masterCharacter = nil\n\nlocal currentlyFollowing = nil\n\nlocal teamList = {}\n\n-- options\nlocal options = {\n name = &quot;Team&quot;,\n type = &quot;group&quot;,\n args = {\n header = {\n type = &quot;header&quot;,\n name = &quot;Multiboxing Team Management&quot;,\n order = 0,\n },\n description = {\n type = &quot;description&quot;,\n name = &quot;Manage your multiboxing team members and designate a master character.&quot;,\n fontSize = &quot;medium&quot;,\n order = 1,\n },\n teamControlGroup = {\n type = &quot;group&quot;,\n name = &quot;Team Controls&quot;,\n inline = true,\n order = 2,\n args = {\n newCharacterName = {\n type = &quot;input&quot;,\n name = &quot;Add New Character&quot;,\n desc = &quot;Enter the name of a new character to add to your team.&quot;,\n set = function(_, val) Team:AddCharacter(val) end,\n order = 1,\n },\n teamDropdown = {\n type = &quot;select&quot;,\n name = &quot;Select Team Member&quot;,\n desc = &quot;Choose a member of your team to manage.&quot;,\n values = function() return Team:GetTeamListOptions() end,\n get = function() return selectedCharacter end,\n set = function(_, val) selectedCharacter = val end,\n order = 2,\n },\n setMaster = {\n type = &quot;select&quot;,\n name = &quot;Set Master&quot;,\n desc = &quot;Select the master character of your multiboxing team.&quot;,\n values = function() return Team:GetTeamListOptions() end,\n get = function() return masterCharacter end,\n set = function(_, val) masterCharacter = val end,\n order = 3,\n },\n removeCharacter = {\n type = &quot;execute&quot;,\n name = &quot;Remove Character&quot;,\n desc = &quot;Remove the selected character from the team.&quot;,\n func = function() Team:RemoveCharacter() end,\n order = 4,\n }\n }\n }\n }\n}\n\nfunction Team:OnInitialize()\n LibStub(&quot;AceConfigRegistry-3.0&quot;):RegisterOptionsTable(&quot;DMA_Team_Options&quot;, options)\n self.optionsFrame = LibStub(&quot;AceConfigDialog-3.0&quot;):AddToBlizOptions(&quot;DMA_Team_Options&quot;, &quot;Team&quot;, AddonName)\nend\n\nfunction Team:OnEnable()\n Communication:RegisterMessageHandler(function(message, distribution, sender)\n self:HandleMessage(message, distribution, sender)\n end)\n\n self:RegisterEvent(&quot;AUTOFOLLOW_BEGIN&quot;)\n self:RegisterEvent(&quot;AUTOFOLLOW_END&quot;)\n\n self:RegisterChatCommand(SLASH_TEAMFOLLOW1, &quot;TeamFollowCommand&quot;)\n self:RegisterChatCommand(SLASH_TEAMFOLLOW2, &quot;TeamFollowCommand&quot;)\nend\n\nfunction Team:GetTeamListOptions()\n local values = {}\n for key, _ in pairs(teamList) do\n values[key] = key\n end\n return values\nend\n\nfunction Team:AddCharacter(name)\n if name and name ~= &quot;&quot; and not teamList[name] then\n teamList[name] = name\n -- Update the dropdown menu\n LibStub(&quot;AceConfigRegistry-3.0&quot;):NotifyChange(&quot;DMA_Team_Options&quot;)\n end\nend\n\nfunction Team:RemoveCharacter()\n if selectedCharacter then\n teamList[selectedCharacter] = nil\n selectedCharacter = nil\n -- Update the dropdown menu\n LibStub(&quot;AceConfigRegistry-3.0&quot;):NotifyChange(&quot;DMA_Team_Options&quot;)\n end\nend\n\nfunction Team:IsInTeam(name)\n return teamList[name] ~= nil\nend\n\n-- Event handler for when auto-follow begins\nfunction Team:AUTOFOLLOW_BEGIN(event, name)\n if self:IsInTeam(name) then\n currentlyFollowing = name -- Store the name of the character being followed\n -- Send a message that the current player (UnitName(&quot;player&quot;)) is following 'name'\n Communication:SendMessage(&quot;FollowStart&quot;, &quot;WHISPER&quot;, name)\n end\nend\n\n-- Event handler for when auto-follow ends\nfunction Team:AUTOFOLLOW_END()\n if currentlyFollowing then\n Communication:SendMessage(&quot;FollowStop:&quot; .. UnitName(&quot;player&quot;), &quot;WHISPER&quot;, currentlyFollowing)\n currentlyFollowing = nil -- Reset the variable as you are no longer following\n end\nend\n\n-- Handle incoming communication messages\nfunction Team:HandleMessage(message, distribution, sender)\n -- Message format is &quot;command:additionalInfo&quot; (like &quot;FollowStart:playerName&quot;)\n local command, info = strsplit(&quot;:&quot;, message, 2)\n\n if command == &quot;FollowStart&quot; then\n print(sender .. &quot; has started following.&quot;)\n elseif command == &quot;FollowStop&quot; then\n print(sender .. &quot; has stopped following.&quot;)\n RaidNotice_AddMessage(RaidWarningFrame, sender .. &quot; has stopped following - follow link broken!&quot;, ChatTypeInfo[&quot;RAID_WARNING&quot;])\n elseif command == &quot;FollowMe&quot; then\n if Team:IsInTeam(sender) then\n FollowUnit(sender)\n end\n end\nend\n\n-- Slash command to instruct all team members to follow you\nfunction Team:TeamFollowCommand()\n for member, _ in pairs(teamList) do\n -- Check if the member is not the current player\n if member ~= UnitName(&quot;player&quot;) then\n -- Send a message to each team member to start following this player\n Communication:SendMessage(&quot;FollowMe&quot;, &quot;WHISPER&quot;, member)\n end\n end\nend\n</code></pre>\n<h2>Communication.lua</h2>\n<pre class="lang-lua prettyprint-override"><code>local AddonName = ...\nlocal DMA = LibStub(&quot;AceAddon-3.0&quot;):GetAddon(AddonName)\nlocal Communication = DMA:NewModule(&quot;Communication&quot;, &quot;AceEvent-3.0&quot;, &quot;AceConsole-3.0&quot;, &quot;AceComm-3.0&quot;)\n\nlocal COMM_CHANNEL = &quot;DMATeamChannel&quot;\n\nfunction Communication:OnInitialize()\n self.messageHandlers = {}\n self:RegisterComm(COMM_CHANNEL)\nend\n\nfunction Communication:RegisterMessageHandler(handlerFunc)\n table.insert(self.messageHandlers, handlerFunc)\nend\n\nfunction Communication:OnCommReceived(prefix, message, distribution, sender)\n if prefix ~= COMM_CHANNEL then return end\n\n for _, handler in ipairs(self.messageHandlers) do\n handler(message, distribution, sender)\n end\nend\n\nfunction Communication:SendMessage(message, distribution, target)\n self:SendCommMessage(COMM_CHANNEL, message, distribution, target)\nend\n\n</code></pre>\n"^^ . . "Could it be http vs https?"^^ . . "Lua script for g502 hero , loop until key press again"^^ . . "0"^^ . "0"^^ . "0"^^ . . . . . "flags"^^ . "daemon"^^ . . "Right now you never actually execute the script, only fetch it from the Script array."^^ . . . . . . . . . "0"^^ . . . "1"^^ . . . . . "leaderboard"^^ . . "1"^^ . "<p>As @Kylaaa said, there is no function overloading in Lua out of the box. But Lua is flexible, and function overloading can be emulated, using already mentioned variadic functions and the fact that, in Lua, functons are first-class objects.</p>\n<pre class="lang-lua prettyprint-override"><code>local function overloaded (signatures)\n local concat = table.concat\n\n -- Serialise signatures beforehand to compare them as strings at call time:\n local serialised_signatures, fallback = {}, nil\n for signature, implementation in pairs (signatures) do\n if type (signature) == 'number' or signature == 'void' then\n -- syntactic sugar for an empty signature:\n signature = ''\n elseif type (signature) == 'table' then\n -- long signatures:\n signature = concat (signature, ', ')\n elseif signature == '...' then\n -- fallback: any unrecognised signature:\n fallback = implementation\n end -- otherwise, it is a signature with one argument, which remains a string.\n serialised_signatures [signature] = implementation\n end\n \n -- Get the serialised signature of a function call at runtime:\n local function arg_types (...)\n local types = {}\n for i, arg in ipairs {...} do\n types [i] = type (arg)\n end\n return concat (types, ', ') -- to make comparing easier.\n end\n \n return function (...)\n local called_with_args = arg_types (...)\n for signature, implementation in pairs (serialised_signatures) do\n if called_with_args == signature then\n return implementation (...)\n end\n end\n -- fallback:\n return fallback (...)\n end\nend\n\nlocal get = overloaded {\n -- no arguments. [{}], or [''], or void index will have the same effect:\n function ()\n return 'If you want to get something, give something'\n end,\n -- one argument, number:\n number = function (number)\n return 'You have given the number ' .. number\n end,\n -- one argument, string, but passed as a list:\n [{ 'string' }] = function (string)\n return 'You have given the string &quot;' .. string .. '&quot;'\n end,\n -- several arguments:\n [{ 'number', 'number' }] = function (no1, no2)\n return 'You have given two numbers: ' .. no1 .. ' and ' .. no2\n end,\n -- any other signature:\n ['...'] = function (...)\n return 'The supplied arguments were: ' .. table.concat ({...}, ', ')\n end\n}\n\nprint ('get () = ' .. get ())\nprint ('get (42) = ' .. get (42))\nprint (&quot;get 'fourty-two' = &quot; .. get 'fourty-two')\nprint ('get (4, 2) = ' .. get (4, 2))\nprint (&quot;get (1, 'some string') = &quot; .. get (1, 'some string'))\n</code></pre>\n"^^ . . "0"^^ . "0"^^ . "<p>I am trying to iterate through a table but start from a position in the table using a key.</p>\n<pre><code>list = {\n &quot;one&quot;,\n &quot;two&quot;,\n &quot;four&quot;,\n &quot;five&quot;,\n &quot;six&quot;\n}\n\nfor k = 3, v in pairs(list) do\n print(&quot;Key:&quot; .. k .. &quot; &quot; .. &quot;Value:&quot; .. v)\nend\n</code></pre>\n<p><code>Compilation error on line 10: ...\\ZeroBraneStudio\\myprograms\\untitled.lua:10: 'do' expected near 'in'</code></p>\n"^^ . "<p>I am very new at coding and I've tried for a few hours and I cannot change the visibility of a menu ingame that I've added into my game.</p>\n<p>This is my code, I am trying to make the frame called &quot;MenuFrame&quot; toggle visibility when the button is clicked.</p>\n<p><a href="https://i.sstatic.net/yXSTG.png" rel="nofollow noreferrer">The GUI is under &quot;StarterGUI&quot;</a></p>\n<pre><code>local button = script.Parent\nlocal menu = script.Parent.Parent.Parent:FindFirstAncestor(&quot;MenuFrame&quot;)\n\nlocal function onButtonClicked()\n if menu.Visible then\n menu.SetAttribute(menu,Visible,false)\n else\n menu.SetAttribute(menu,Visible,true)\n end\nend\n\nbutton.MouseButton1Down:Connect(onButtonClicked)\n</code></pre>\n<p>The error is <code>7: attempt to index nil with 'Visible'</code></p>\n<p>Is there any suggestions on what I could change or fix</p>\n"^^ . . . "1"^^ . . . . "0"^^ . "0"^^ . "0"^^ . . "1"^^ . "0"^^ . . "<p>so i have a script that should make a number on a leaderboard go up when an object is clicked, but 1, it doesnt work. 2, i want it to be a normal click event instead of clicking a certain object.</p>\n<p>the code in serverscriptservice:</p>\n<pre><code>local Players = game:GetService(&quot;Players&quot;)\n\nlocal function leaderboardSetup(player)\n local leaderstats = Instance.new(&quot;Folder&quot;)\n leaderstats.Name = &quot;leaderstats&quot;\n leaderstats.Parent = player\n\n local gold = Instance.new(&quot;IntValue&quot;)\n gold.Name = &quot;Gold&quot;\n gold.Value = 0\n gold.Parent = leaderstats\n\n local function upd()\n gold.Value = gold.Value + 1\n end\n game.ReplicatedStorage.GoldClick.OnServerEvent:Connect(function(Localplayer)\n if player.Name == Localplayer.Name then\n upd()\n end\n end)\nend\n\nPlayers.PlayerAdded:Connect(leaderboardSetup)\n</code></pre>\n<p>the code in the object:</p>\n<pre><code>script.Parent.MouseButton1Click:Connect(function()\n game.ReplicatedStorage.GoldClick:FireServer()\nend)\n</code></pre>\n<p>i tried to make the leaderboard go up with the leaderstat name being &quot;Gold&quot;, there were no errors but when i clicked the part it didn't go up.</p>\n"^^ . "0"^^ . "<p>You can try this:</p>\n<pre class="lang-lua prettyprint-override"><code>local path = &quot;/path/to/your/file/filename.txt&quot;\nlocal filename, extension = path:match(&quot;^.+/(.+)%.(.+)$&quot;)\n\nprint(&quot;Filename: &quot; .. filename)\nprint(&quot;Extension: &quot; .. extension)\n</code></pre>\n"^^ . "<p>So here's the thing about <code>wait</code>, even though you tell it to yield for a specific amount of time, the engine will do the best it can but there's no guarantee that the time yielded will be exactly the amount you specified.</p>\n<p>So in this code :</p>\n<pre class="lang-lua prettyprint-override"><code> sonido:Play()\n \n wait(.1)\n visual.Transparency = .8\n wait(.1)\n visual.Transparency = 1\n \n sonido.Ended:Wait()\n</code></pre>\n<p>It's possible that your sound will have finished playing before the it makes it to the <code>sonido.Ended:Wait()</code> line. So now your code is blocked waiting for a signal that will never fire, because it already has. Since the sound doesn't play again, your code <em>cannot</em> progress from this point.</p>\n<p>You should check if the sound is still playing before blocking.</p>\n<pre class="lang-lua prettyprint-override"><code> if sonido.Playing then\n sonido.Ended:Wait()\n end\n</code></pre>\n"^^ . "0"^^ . "sockets"^^ . "<p>What are the performance implications of Lua's <code>debug.getlocal</code> function for the standard Lua reference implementation? I know that reflection tends to have a certain amount of overhead, depending on the programming language and its implementation, but haven't been able to find any information on what it might be.</p>\n<p>I'd also be interested in its impact in other implementations, such as LuaJIT.</p>\n"^^ . "1"^^ . "0"^^ . "0"^^ . . . "0"^^ . . "1"^^ . "[lua-http](https://daurnimator.github.io/lua-http/0.1/) with [cqueues](http://25thandclement.com/~william/projects/cqueues.html)"^^ . "<p><code>%W</code> is the <em>complement</em> of <code>%w</code>, meaning it matches all non-alphanumeric characters.</p>\n<p>From <a href="https://lua.org/manual/5.4/manual.html#6.4.1" rel="noreferrer">§6.4.1 – Patterns</a> (Lua 5.4):</p>\n<blockquote>\n<p>%w: represents all alphanumeric characters.</p>\n</blockquote>\n<blockquote>\n<p>For all classes represented by single letters (%a, %c, etc.), the corresponding uppercase letter represents the complement of the class. For instance, %S represents all non-space characters.</p>\n</blockquote>\n"^^ . . "Is this the real dockerfile? How do you set env variables? Because according to the docs, the syntax is `ENV <key>=<value> ...`"^^ . . "<p>For an <em>array-like</em> table (one with a <a href="https://www.lua.org/manual/5.4/manual.html#3.4.7" rel="noreferrer"><em>sequence</em></a>), you can use a <a href="https://www.lua.org/manual/5.4/manual.html#3.3.5" rel="noreferrer">numeric <code>for</code></a>, with the upper bound being the length of the table.</p>\n<pre class="lang-lua prettyprint-override"><code>local list = {\n &quot;one&quot;,\n &quot;two&quot;,\n &quot;four&quot;,\n &quot;five&quot;,\n &quot;six&quot;\n}\n\nfor i = 3, #list do\n print(i, list[i])\nend\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>3 four\n4 five\n5 six\n</code></pre>\n<hr />\n<p>Note that starting with a certain key (index) usually only makes sense given an <em>array-like</em> table - which your <code>list</code> is. The <em>key-value</em> pairs in a table have no stable order as far as <code>next</code>/<code>pairs</code> is concerned (note that <code>ipairs</code> is for operating on a <em>sequence</em>).</p>\n<p>If the arbitrary keys in an <em>associative array-like</em> table follow a particular generation order (i.e., they are <em>deterministic</em>), it is possible to iterate through them in a stable way, but that is a specific use-case.</p>\n<hr />\n<p>You can also write a function similar in form to <code>ipairs</code> - one that returns an <em>iterator</em> function (alongside the initial <em>state</em> and <em>control</em>) used by the <a href="https://www.lua.org/manual/5.4/manual.html#3.3.5" rel="noreferrer">generic <code>for</code></a>, but starts from a given index.</p>\n<p>Here is a cursory example where the iterator returns <em>index, value</em> to be assigned to the loop variables.</p>\n<pre class="lang-lua prettyprint-override"><code>local function ipairsfrom(tab, n)\n return function (t, i)\n i = i + 1\n return t[i] ~= nil and i or nil, t[i]\n end, tab, n and n - 1 or 0\nend\n\nlocal list = { 'a', 'b', 'c', 'd', 'e' }\n\nfor index, value in ipairsfrom(list, 3) do\n print(index, value)\nend\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>3 c\n4 d\n5 e\n</code></pre>\n<p>There are <em>many</em> ways to write such an iterator and the function that creates it. For example, returning <em>value, index</em> might be preferred since the <em>value</em> is often more interesting, and allows us to omit the second variable (as opposed to using <code>for _, value in</code>).</p>\n<pre class="lang-lua prettyprint-override"><code>local function ipairsfrom(t, i)\n i = i and i - 1 or 0\n return function ()\n i = i + 1\n return t[i], i\n end\nend\n\nfor value, index in ipairsfrom({ 'a', 'b', 'c' }, 2) do\n print(index, value)\nend\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>2 b\n3 c\n</code></pre>\n"^^ . . . "Hi @shafee!, here I have an example with the bare minimum to create a pdf with references per chapter. In the readme, I wrote a couple of links with extra info. https://github.com/ronnyhdez/quarto_references_per_chapter"^^ . "Okay!!!! So to determine whether a point p is in the half-plane (base point b, tangent vector t), you need to know whether vector bp is [on the left or on the right](https://stackoverflow.com/questions/68592435/how-to-know-if-point-is-on-the-right-side-or-on-the-left-side-of-line/68592731#68592731) of vector t."^^ . . . "Error executing lua /home/user/.config/nvim/lua/init.lua:7: module 'vscode.colors' not found:"^^ . . "@Marc i edit question again can you help me ?"^^ . . . . "<p>following code is not running, i get 0 when i print(lua_getstack()). i do not want to change the code's reasoning, i need it as simple as it seems to do wht i need.\nAny suggestion?</p>\n<pre><code>int main() {\n lua_State *L = luaL_newstate();\n luaL_openlibs(L);\n\n const char *luaCode = &quot;function jj() print('Hello from Lua!') end&quot;;\n if (luaL_dostring(L, luaCode) != LUA_OK) {\n fprintf(stderr, &quot;Error executing Lua code: %s\\n&quot;, lua_tostring(L, -1));\n lua_close(L);\n return 1;\n }\n\n // Call a Lua function to populate the stack\n lua_getglobal(L, &quot;jj&quot;);\n lua_pcall(L, 0, 0, 0);\n\n // Try to get stack information\n lua_Debug ar;\n int gg = lua_getstack(L, 0, &amp;ar);\n\n if (gg == 0) {\n fprintf(stderr, &quot;No stack information available\\n&quot;);\n } else {\n printf(&quot;Stack level: %d\\n&quot;, 0);\n printf(&quot; Function: %s\\n&quot;, ar.name ? ar.name : &quot;(no name)&quot;);\n printf(&quot; Source: %s\\n&quot;, ar.short_src);\n printf(&quot; Line: %d\\n&quot;, ar.currentline);\n }\n\n lua_close(L);\n return 0;\n }\n</code></pre>\n"^^ . . "<p>I am trying to setup nvim-tree in my neovim plugins. I am using the Lazy package manager and I am using someone elses config as a guide on github.</p>\n<p>In my Lazy options, I have <code>netrw</code> in teh <code>disabled_plugins</code> section and I am importing my <code>plugins</code> directory which contains the <code>nvim-tree</code> plugin, but my neovim is still using netrw and not nvim-tree. I'm not getting any error messages or anything so I'm not really sure what I'm doing wrong.</p>\n<p>Here are some of the files that I think are relevant to this problem:</p>\n<p>This is <code>nvim/lua/moorby/lazy.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>local lazypath = vim.fn.stdpath(&quot;data&quot;) .. &quot;/lazy/lazy.nvim&quot;\nif not vim.loop.fs_stat(lazypath) then\n vim.fn.system({\n &quot;git&quot;,\n &quot;clone&quot;,\n &quot;--filter=blob:none&quot;,\n &quot;https://github.com/folke/lazy.nvim.git&quot;,\n &quot;--branch=stable&quot;, -- latest stable release\n lazypath,\n })\nend\nvim.opt.rtp:prepend(lazypath)\n\nlocal opts = {\n defaults = {\n lazy = true,\n },\n install = {\n colorscheme = { &quot;monokai&quot; }\n },\n rtp = {\n disabled_plugins = {\n &quot;gzip&quot;,\n &quot;matchit&quot;,\n &quot;matchparen&quot;,\n &quot;netrw&quot;,\n &quot;netrwplugin&quot;,\n &quot;tarplugin&quot;,\n &quot;tohtml&quot;,\n &quot;tutor&quot;,\n &quot;zipplugin&quot;,\n }\n },\n change_detection = {\n enabled = true,\n notify = true,\n },\n}\n\nrequire(&quot;lazy&quot;).setup(\n {\n {import = &quot;moorby.plugins&quot;}\n },\n opts\n)\n</code></pre>\n<p><code>nvim/lua/moorby/plugins/nvim-tree.lua</code></p>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;nvim-tree/nvim-tree.lua&quot;,\n filters = {\n dotfiles = true,\n },\n lazy = false\n}\n</code></pre>\n<p><code>nvim/lua/moorby/plugins/colorscheme.lua</code> (my colorscheme is loading fine by the way)</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;tanvirtin/monokai.nvim&quot;,\n lazy = false,\n priority = 999,\n config = {},\n}\n</code></pre>\n<p>In this screenshot, you can see netrw in the background and you can see that nvim-tree has been successfully loaded by Lazy:</p>\n<p><a href="https://i.sstatic.net/o9Cti.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/o9Cti.png" alt="image of Lazy confirmed that nvim-tree plugin is loaded" /></a></p>\n<p>EDIT: I just noticed that the plugin being imported is <code>nvim-tree.LUA</code> not <code>nvim-tree.NVIM</code> but I tried to change this and it does not work so I think <code>.lua</code> is still correct and that is definitely the URL of the repo.</p>\n"^^ . . . . . "0"^^ . . . "Kong: limit concurrent requests per consumer"^^ . . "1"^^ . "0"^^ . . . "Replace `split(" > ")` with `split(">")`"^^ . "0"^^ . . . . . . . . . "FYI, Lua doesn't use regex; it has its own equivalent that goes by the name of "*[Lua patterns](https://www.lua.org/pil/20.2.html)*"."^^ . . . "0"^^ . . . "0"^^ . . "0"^^ . . "bro thank you i read the basics and i thought i did the if and local stamens correct but not thaks"^^ . . . . . "1"^^ . . "1"^^ . "0"^^ . "1"^^ . . "1"^^ . "0"^^ . "1"^^ . "Opening coppeliaSim with flag not working"^^ . . . "0"^^ . "1"^^ . "0"^^ . . "0"^^ . "Make another function with the loop, call that function from the two places you have the loop today."^^ . "Cannot define paths in Lua"^^ . "<p>The area highlighted in yellow is referred to as the Documentation window.\nTo customize its behavior, you can explore the available options documented in :help cmp-config.window.\nFor a specific solution, you can refer to the :help cmp-faq, particularly the section likely titled <strong>How to disable the documentation window?</strong>.</p>\n<p>To disable the Documentation window, use the following Lua code in your Neovim configuration:</p>\n<pre class="lang-lua prettyprint-override"><code>require&quot;cmp&quot;.setup{\n -- Other configuration options here\n window = {\n documentation = cmp.config.disable\n }\n -- More configuration options here\n}\n\n</code></pre>\n"^^ . . . "<p>I've got a local script which fires a remote event each 0.1 seconds. Such remote event is then picked by a global script, which then creates a part with a sound in it where the raycast, created by the local script, lands. This part is supposed to remove itself once its sound finishes playback ( sound.Ended:Wait() ).</p>\n<p>The problem is that, on low framerates, the part will not remove although its sound has finished playing, this way creating unnecessary lag because of the number of parts laying around.</p>\n<p>The global script in question:</p>\n<pre><code>local remoteEvent = script.Parent.esquirlaEvent\nlocal tool = script.Parent\n\nremoteEvent.OnServerEvent:Connect(function(player, startPosition, impacto, colordobjeto, materialdobjeto)\n local function crearescombros()\n \n local visual = Instance.new(&quot;Part&quot;)\n visual.Parent = game.Workspace.esquirlas\n visual.Anchored = true\n visual.CanCollide = false\n visual.Transparency = .5\n visual.Shape = Enum.PartType.Ball\n visual.Position = impacto\n visual.Size = Vector3.new(2, 2, 2)\n \n \n local sonido = Instance.new(&quot;Sound&quot;)\n sonido.Parent = visual\n sonido.SoundId = &quot;rbxassetid://15229796402&quot;\n sonido.Volume = 0.5\n sonido.MaxDistance = 70\n sonido:Play()\n \n wait(.1)\n visual.Transparency = .8\n wait(.1)\n visual.Transparency = 1\n \n sonido.Ended:Wait()\n visual:Remove()\n \n end\n \n crearescombros()\n \nend)\n</code></pre>\n<p>Any help is welcomed.</p>\n"^^ . . . "4"^^ . "0"^^ . "0"^^ . . . . "1"^^ . "<p>I'm not sure entirely what your problem is here, but I can see an issue right off the bat.\nFirstly, on your elseif line you are trying to compare a number, <code>lastIDInt</code>, with a string <code>'1'</code> . This just will not work so you should compare it with a number: <code>lastIDInt &gt;= 1</code></p>\n<p>I cannot see anywhere in your code that would cause the error you are describing however, but the above may fix your problem.</p>\n"^^ . "0"^^ . . "0"^^ . "0"^^ . "Hi xTerrene,\n\nGood to hear that it is working now.\nThe ; syntax is merely meant as syntactic sugar and nothing else."^^ . "1"^^ . . . . . "0"^^ . "<p>After <code>lua_pcall</code> returns, <code>jj</code> is no longer on the call stack.</p>\n<p>You can use <a href="https://www.lua.org/manual/5.4/manual.html#lua_getinfo" rel="nofollow noreferrer"><code>lua_getinfo</code></a>:</p>\n<pre><code>int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);\n</code></pre>\n<p>Starting the <code>what</code> string with <code>&gt;</code> pops a function from the stack, and fills out the debug structure with information based on the rest of the characters in the <code>what</code> string (see: <a href="https://www.lua.org/manual/5.4/manual.html#lua_Debug" rel="nofollow noreferrer"><code>lua_Debug</code></a> for details).</p>\n<pre><code>#include &lt;lauxlib.h&gt; \n#include &lt;lua.h&gt; \n#include &lt;lualib.h&gt; \n#include &lt;stdio.h&gt; \n \nint main(void) \n{ \n lua_State *L = luaL_newstate(); \n luaL_openlibs(L); \n \n const char *luaCode = &quot;function jj() print('Hello from Lua!') end&quot;; \n luaL_dostring(L, luaCode); \n lua_getglobal(L, &quot;jj&quot;); \n \n lua_Debug ar; \n\n if (lua_getinfo(L, &quot;&gt;Sn&quot;, &amp;ar)) {\n printf(&quot;Function (%s): %s\\n&quot;, ar.what, ar.name ? ar.name : &quot;(no name)&quot;);\n printf(&quot;Source: %s\\n&quot;, ar.short_src);\n printf(&quot;Line: %d\\n&quot;, ar.linedefined);\n }\n \n lua_close(L);\n}\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>Function (Lua): (no name)\nSource: [string &quot;function jj() print('Hello from Lua!') end&quot;]\nLine: 1\n</code></pre>\n<p>Or set a hook with <a href="https://www.lua.org/manual/5.4/manual.html#lua_sethook" rel="nofollow noreferrer"><code>lua_sethook</code></a>. Here is a hook that runs every time a function is called:</p>\n<pre><code>#include &lt;lauxlib.h&gt;\n#include &lt;lua.h&gt;\n#include &lt;lualib.h&gt;\n#include &lt;stdio.h&gt;\n\nstatic void hook(lua_State *L, lua_Debug *ar)\n{\n if (LUA_HOOKCALL == ar-&gt;event &amp;&amp; lua_getinfo(L, &quot;Snl&quot;, ar)) {\n printf(&quot;Function (%s): %s\\n&quot;, ar-&gt;what, ar-&gt;name ? ar-&gt;name : &quot;(no name)&quot;);\n printf(&quot;Source: %s\\n&quot;, ar-&gt;short_src);\n printf(&quot;Line: %d\\n&quot;, ar-&gt;currentline);\n }\n}\n\nint main(void)\n{\n lua_State *L = luaL_newstate();\n luaL_openlibs(L);\n const char *luaCode = &quot;function jj() print('Hello from Lua!') end&quot;;\n luaL_dostring(L, luaCode);\n lua_sethook(L, hook, LUA_MASKCALL, 0);\n lua_getglobal(L, &quot;jj&quot;);\n lua_pcall(L, 0, 0, 0);\n lua_close(L);\n}\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>Function (Lua): (no name)\nSource: [string &quot;function jj() print('Hello from Lua!') end&quot;]\nLine: 1\nFunction (C): print\nSource: [C]\nLine: -1\nHello from Lua!\n</code></pre>\n<p>Whereas <a href="https://lua.org/manual/5.4/manual.html#lua_getstack" rel="nofollow noreferrer"><code>lua_getstack</code></a> is for collecting the <em>activation record</em> for a currently active function call (which you can then use with <code>lua_getinfo</code> to collect debug information).</p>\n<pre><code>#include &lt;lauxlib.h&gt;\n#include &lt;lua.h&gt;\n#include &lt;lualib.h&gt;\n#include &lt;stdio.h&gt;\n\nstatic int trace(lua_State *L)\n{\n lua_Debug ar;\n\n if (lua_getstack(L, 1, &amp;ar) &amp;&amp; lua_getinfo(L, &quot;Snl&quot;, &amp;ar)) {\n printf(&quot;Function (%s): %s\\n&quot;, ar.what, ar.name ? ar.name : &quot;(no name)&quot;);\n printf(&quot;Source: %s\\n&quot;, ar.short_src);\n printf(&quot;Line: %d\\n&quot;, ar.currentline);\n }\n\n return 0;\n}\n\nint main(void)\n{\n lua_State *L = luaL_newstate();\n luaL_openlibs(L);\n const char *luaCode = &quot;function jj()\\nprint('Hello from Lua!')\\ntrace()\\nend&quot;;\n luaL_dostring(L, luaCode);\n\n lua_register(L, &quot;trace&quot;, trace);\n\n lua_getglobal(L, &quot;jj&quot;);\n lua_pcall(L, 0, 0, 0);\n lua_close(L);\n}\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>Hello from Lua!\nFunction (Lua): (no name)\nSource: [string &quot;function jj()...&quot;]\nLine: 3\n</code></pre>\n"^^ . "sql"^^ . . . . "<p>I'm a beginner programmer and trying to make an admin system that includes kick, ban, and unban commands. After pressing unban button on a successfully banned user it tells me that the user was unbanned, but when I join the game from the banned user account it still says that I'm banned.</p>\n<p>Code:</p>\n<pre><code>game.Players.PlayerAdded:Connect(function(plr)\n local ng = game.Workspace:FindFirstChild(plr.Name .. &quot; / Banned&quot;)\n if ng:IsA(&quot;WedgePart&quot;) then\n plr:Kick(&quot;Banned&quot;)\n print(plr.Name .. &quot; tried to join while banned&quot;)\n end\nend)\n\n\nscript.Parent[&quot;Kick/Ban&quot;].OnServerEvent:Connect(function(plr, plrname, reason, kb)\n if game.Players:FindFirstChild(plrname) then\n local target = game.Players:FindFirstChild(plrname)\n if kb == &quot;Kick&quot; then\n if reason ~= &quot;&quot; then\n target:Kick(reason)\n elseif reason == &quot;&quot; then\n target:Kick()\n end\n elseif kb == &quot;Ban&quot; then\n local part = Instance.new(&quot;WedgePart&quot;)\n\n print(target.Name .. &quot; has been banned&quot;)\n\n part.Parent = game.Workspace\n part.Name = target.Name .. &quot; / Banned&quot;\n part.CanCollide = false\n part.Transparency = 1\n part.Anchored = true\n \n target:Kick(&quot;Banned&quot;)\n elseif kb == &quot;Unban&quot; then\n local tn = plrname .. &quot; / Banned&quot;\n local part2 = game.Workspace:FindFirstChildOfClass(&quot;WedgePart&quot;)\n\n while part2 do\n if part2.Name:lower() == tn:lower() then\n part2:Destroy()\n print(target.Name .. &quot; has been unbanned&quot;)\n break\n end\n part2 = game.Workspace:FindFirstChildOfClass(&quot;WedgePart&quot;, part2)\n end\n\n if not part2 then\n print(target.Name .. &quot; is not banned&quot;)\n end\n end\n end\nend)\n</code></pre>\n<p>Tried asking AI for help but got nothing. I think the main problem is in <code>game.Players.PlayerAdded</code>. Please help me.</p>\n"^^ . "nvim.cmp"^^ . "0"^^ . "Close, instead of processing all indices, only traverse the first n-1, and use the last index to set `r[path[#path]] = value`.\n\nI would make a utility function instead of using metatables."^^ . "0"^^ . "LUA Script - Duplicating records using multiple delimited category fields"^^ . . "0"^^ . "This is a very clever way to handle defining the signatures."^^ . . "0"^^ . "3"^^ . . "*"Their documentation probably has a mistake"* - file a bug. Have it fixed, improve the situation for everybody."^^ . "0"^^ . . "The documentation for `from_value` and the error message tell you that you can only use from_value to convert tables to structs (and probably primitives to primitives). Since your type is a userdata, you can use `value.as_userdata` and `AnyUserData::borrow` to convert back to a reference to `Cars`"^^ . "2"^^ . . . "Thank you so much. you solve all of my problem"^^ . "<p>So I am using LGS to write macro scripts and I am trying to make a script that I can stop without having to run through then entire script. Assume a very, very long script.</p>\n<p>Normally, the script would have to execute to completion in complex scripts. I want to make a table with functions in it that I can call them in order but stop execution at will.</p>\n<pre><code>--Arbitary code:\nTextEditor = {39393, 739937}\n\nSomeString = &quot;A very long novel&quot;\n\nWriteString = function(str)\n --Some code to type to a text editor\nend\n\nOtherFunction = function(arg1, arg2)\n -- do something\nend\n\nAnotherFunction = function(arg1, arg2, arg3)\n -- do something\nend\n\nReadSomething = function()\n -- arbitrary code\nend\n</code></pre>\n<pre><code>-- Problem:\nScript = {\n MoveMouseTo(TextEditor)\n WriteString(SomeString)\n OtherFunction(arg1, arg2)\n AnotherFunction(arg1, arg2, arg3)\n ReadSomeString()\n}\n\nf = 1\n\nwhile IsKeyLockOn(&quot;scrolllock&quot;) &amp;&amp; f &lt;= Script.Length() do\n Script[f]\n f = f + 1\nend\n</code></pre>\n<p>In this script it should call each function one at a time until either condition is not true but this doesn't work and I am not sure what I should be doing.</p>\n"^^ . "<p>Your problem is fixable, but i wouldn't recommend you to create any camera systems in Roblox Studio at all.\nBut if you really wanna to suffer, your problem can be easily fixed by doing the following list of things:</p>\n<ol>\n<li>Place the SurfaceGUI inside the StarterGUI;</li>\n<li>Set SurfaceGUI's Adornee property to the part you want it to appear on.\nTip: you can do that with local scripts as well.</li>\n</ol>\n"^^ . . "Both tables are created in shared.lua in lines 7 and 8. The code is already above."^^ . . . "<p>Your initial idea is good, you can indeed perform something like that to cache the previous position, to be used in the next loop iteration.</p>\n<p>I am not sure why you are involving the timer, as adding dt to timer might give a result other than 0 or 1, (assuming dt is deltatime, which usually results in a number lower than 1 and higher than 0).</p>\n<p>The following code will work as expected:</p>\n<pre class="lang-lua prettyprint-override"><code>local varPreviousPositionX\nlocal varPreviousPositionY\n\nlocal function objectTracking()\n if varPreviousPositionX and varPreviousPositionY then\n -- do something with it\n end\n\n -- move body\n\n varPreviousPositionX = object.body:getX()\n varPreviousPositionY = object.body:getY()\nend\n</code></pre>\n"^^ . "design-patterns"^^ . "1"^^ . . . "You should replace copying of reference to the table `new_config = config` with [creating a copy](https://stackoverflow.com/a/641993/20468470) of the table `new_config = table.shallow_copy(config)`"^^ . . "It's not clear what problems you have and what you want to ask, and the code contains a lot of basic syntax errors. You may read some lua tutorials first."^^ . . . . . . . "3"^^ . . . "1"^^ . . "1"^^ . . "0"^^ . . . . "3"^^ . "1"^^ . . . . . "<p>I'm looking for a way to show every 5 second a different title of one of the post from the RSS feed of TorrentFreak.com</p>\n<p>I'm not sure how to do it, or event if it's possible, but I try.</p>\n<p>So far I tried to do it in Lua :</p>\n<pre><code>-- Check if Conky env\nif conky == nil then\n os.exit(1)\nend\n\nconky.config = {\n use_xft = true,\n font = 'DejaVu Sans:size=10',\n update_interval = 2, -- update every 2sec\n}\n\nfunction conky_rss()\n local rss_url = &quot;https://torrentfreak.com/feed/&quot;\n\n function get_all_rss_titles()\n local xml = io.popen('curl -s &quot;'..rss_url..'&quot;'):read('*all')\n\n local xml2lua = require(&quot;xml2lua&quot;)\n local handler = require(&quot;xmlhandler.tree&quot;)\n local parser = xml2lua.parser(handler)\n parser:parse(xml)\n\n local titles = {}\n for _, item in ipairs(handler.root.RSS.Channel.Item) do\n table.insert(titles, item.Title)\n end\n\n return titles\n end\n\n function display_next_title()\n local titles = get_all_rss_titles()\n\n local index = tonumber(os.date('%S')) % #titles + 1\n local title = titles[index]\n\n return title\n end\n\n return display_next_title()\nend\n\n</code></pre>\n<p>And I'm calling this script like that in Conky.text :</p>\n<pre><code>${color1} -&gt; ${color0}${lua /home/Cthulhu/.conky/My_Script/Script_Sources/conky-rss.lua}\n</code></pre>\n<p>It didn't show anything yet ...\nAny ideas to make it work or to improve it ?</p>\n"^^ . . . "0"^^ . "Why can't you make it run? Any errors?"^^ . "<p>CFrame.Angles creates a new CFrame, what you want is to do add them (multiplying replaces adding for CFrames idk why)\nSo:</p>\n<pre><code>plug.PrimaryPart.CFrame = plug.PrimaryPart.CFrame * CFrame.Angles(math.rad(rx),math.rad(ry),math.rad(90))\n</code></pre>\n"^^ . "0"^^ . . "1"^^ . . . . . . . . . "1"^^ . . . . . . . . "@Marc i added my code and it doesn't stop"^^ . . . "Why do you need Cygwin here? Just install MSYS2 and use MinGW64 for all your builds."^^ . . . . . . . . . . . . . . "0"^^ . . . "0"^^ . . "luau"^^ . "0"^^ . . . "2"^^ . "<p>This defines <code>self</code> twice <code>function LibListView:New(self)</code> when you make a method using <code>:</code> instead of <code>.</code> the first param is hidden and named <code>self</code>. What you did here is made the second param also called <code>self</code>.</p>\n<p>you have 2 options,</p>\n<ol>\n<li><p>do not put <code>self</code> in the signature just leave it without any params: <code>function LibListView:New()</code>, you will still have access to the param <code>self</code> within the method.</p>\n</li>\n<li><p>do not use <code>:</code> and define the first param as <code>self</code>: <code>function LibListView.New(self)</code>, you can still call this using the <code>:</code> sugar syntax.</p>\n</li>\n</ol>\n<p>Here is a resource for learning more about how <code>:</code> works in lua: <a href="https://www.lua.org/pil/16.html" rel="nofollow noreferrer">Programming in Lua: Chapter 16 – Object-Oriented Programming</a></p>\n<p>This is a particularly relevant quote from the chapter:</p>\n<blockquote>\n<p>This use of a self parameter is a central point in any object-oriented language. Most OO languages have this mechanism partly hidden from the programmer, so that she does not have to declare this parameter (although she still can use the name self or this inside a method). Lua can also hide this parameter, using the colon operator. We can rewrite the previous method definition as</p>\n<pre><code> function Account:withdraw (v)\n self.balance = self.balance - v\n end\n</code></pre>\n</blockquote>\n"^^ . "5"^^ . "What's the best way to display a différent title of a post from TorrentFreak using RSS and Conky?"^^ . "I had actually tried that one before and it didn't do the trick."^^ . . . "0"^^ . . "@mplungjan no, if i start a network stream on vlc, with http or https with the same adress is okay, is only the "vlcurl:" causing issue"^^ . . . "garrys-mod"^^ . "0"^^ . . . . . . "0"^^ . . . "0"^^ . "<p>i need help about opening vlc with html deeplink</p>\n<p>I have already a ps1 script for add registry key, a URL Protocol on &quot;vlcurl&quot;, so on my html :\n<code>&lt;a href=&quot;vlcurl:http://127.0.0.1:5500/ship.mp4&quot;&gt;Video&lt;/a&gt;</code></p>\n<p>The big issue with this is the redirection, vlc try to open the link with the &quot;vlcurl&quot; at the start causing issue :</p>\n<blockquote>\n<p>Your input can't be opened:\nVLC is unable to open the MRL 'vlcurl:<a href="http://127.0.0.1:5500/ship.mp4%27" rel="nofollow noreferrer">http://127.0.0.1:5500/ship.mp4'</a>. Check the log for details.</p>\n</blockquote>\n<p>The goal is to remove the &quot;vlcurl&quot; when we send this to vlc</p>\n<p>I have try to create a lua script for a plugin to vlc, but it dosen't work (i'm no't really good in lua) and try to find if we can add logic in a registry key (like if there is &quot;vlcurl&quot; in the &quot;%1&quot; remove it) but apparently we can't</p>\n<p>I would avoid to make many step to do on the computer for making this work, the project is to share it with ma family, so have to setup the ps1 is already a lot</p>\n"^^ . "<p>In attempting to make a game, I'm trying to add music to it that plays when the game is loaded. Unfortunately, for some reason, in the actual game it refuses to load in more often than not, as is evident when I use <code>ContentProvider:PreloadAsync()</code>;</p>\n<pre class="lang-lua prettyprint-override"><code>local Attempt = true\n\nwhile Attempt do\n ContentProvider:PreloadAsync({DayTheme},function(assetId,assetFetch)\n print(&quot;Got DayTheme with asset ID&quot;,assetId)\n if assetFetch == Enum.AssetFetchStatus.None then\n warn(&quot;DayTheme returned no valid information, and the engine didn't attempt to load it.&quot;)\n elseif assetFetch == Enum.AssetFetchStatus.Failure then\n warn(&quot;DayTheme failed to load and was aborted by the engine.&quot;)\n elseif assetFetch == Enum.AssetFetchStatus.Loading then return elseif assetFetch == Enum.AssetFetchStatus.TimedOut then\n print(&quot;Load timed out, trying again.&quot;)\n else\n print(&quot;ContentProvider returned OK&quot;)\n if not DayTheme.IsLoaded then\n print(&quot;Waiting for DayTheme to load&quot;)\n local pass = 1\n repeat\n task.wait(1)\n pass = pass + 1\n print(pass)\n until DayTheme.IsLoaded or pass == 10\n if not DayTheme.IsLoaded then warn(&quot;DayTheme failed to load&quot;) else\n if not DayTheme.IsPlaying then print(&quot;Playing&quot;); DayTheme:Play() end\n end\n else\n if not DayTheme.IsPlaying then print(&quot;Playing&quot;); DayTheme:Play() end\n end\n Attempt = false\n end\n end)\n task.wait(3)\nend\n</code></pre>\n<p>Where <code>DayTheme</code> is a Sound instance (<em>not</em> an asset ID), running this section either 1) prints the &quot;DayTheme failed to load and was aborted by the engine&quot; warning I have set for <code>Enum.AssetFetchStatus.Failure</code>, or 2) eventually prints the &quot;DayTheme failed to load&quot; warning I have set for the <code>DayTheme.IsLoaded</code> check after <code>ContentProvider</code> returns <code>Enum.AssetFetchStatus.Success</code>. This is set up in a <code>while</code> loop to hopefully make it retry, since automatic retrying simply isn't a thing since around 2017.</p>\n<p>It should <em>also</em> be said that this is <em>not</em> the standard &quot;Failed to download asset&quot; error that usually gets thrown around; no actual error is being provided by the game, and if it wasn't for the above code, I wouldn't have known that it fails to load as it just never plays. I have no idea <em>why</em> this is failing to preload, or <em>how</em> I can get it to load (or retry loading without such loops), and thus have no possible way of having music play in my game.</p>\n<p>Other things to note;</p>\n<ol>\n<li><strong>The audio I'm playing originates from</strong> <code>ReplicatedStorage</code>, but gets <code>:Clone()</code>'d out and placed into a folder in <code>Workspace</code>. I have multiple checks to ensure that it isn't returning <code>nil</code>, and that the instance does exist.</li>\n<li><strong>The script itself is a</strong> <code>LocalScript</code> <strong>placed into</strong> <code>StarterPlayerScripts</code>. This still happens even if I move the script to a place like <code>ReplicatedFirst</code>.</li>\n<li><strong>In Studio, the Sound asset loads perfectly fine without problems</strong>. On a very rare occasion (1/20 times was the most often I've gotten it to load), it will load in-game; otherwise, it's only in the actual game that it fails loading.</li>\n<li><strong>The audio asset is owned by me, and thus the game does have permission to use it.</strong> This isn't a permissions problem.</li>\n</ol>\n<p>So far, nobody else I've sent/made this or a similar post to has been able to assist me. There is [one post on the Roblox DevForum](<a href="https://devforum.roblox.com/t/failed-to-load-assets-should-automatically-retry/2037387/4?u=ladyterrene%5C%5D" rel="nofollow noreferrer">https://devforum.roblox.com/t/failed-to-load-assets-should-automatically-retry/2037387/4?u=ladyterrene\\]</a> that mentions a potential fix, but this proved fruitless overall as it simply continues to fail.</p>\n<p>I've tried everything I can think of, including:</p>\n<ul>\n<li>programmatically creating, cloning, and changing the ID of the Sound instance to load the asset;</li>\n<li>changing the locations of the asset in-game (e.g., moving it from <code>ReplicatedStorage</code> into <code>Workspace</code>;</li>\n<li>attempting to iterate over <code>ContentProvider:PreloadAsync()</code> (as shown above);</li>\n</ul>\n<p>but regardless of what it is I attempt, in some way, shape, or form the asset fails loading and, eventually, hits my own custom timeout limit.</p>\n<p>Ideally, this should be contained within a <code>LocalScript</code>, as I want this to be per-player and not the server overall.</p>\n"^^ . "<p>I have an object moving &quot;freely&quot; with body:applyForce( x, y ).</p>\n<p>I want to track it's previous position.</p>\n<p>I set a timer and with every second that goes by i get the position of the moving object, the problem is the position keeps updating to the object's current position. that's not what i want. I want it's position one second ago.</p>\n<p>I have like 10 ideas on how to do what i want to do, i just think there has to be a simpler and easier way.</p>\n<p>the closest i got was a small if statement that inserts the position into a table but again the problem is that the position keeps updating to the current position not the previous one.</p>\n<pre><code>object = {}\nobject.x = 250\nobject.y = 200\nobject.body = love.physics.newBody(world, object.x, object.y, 'dynamic')\nobject.shape = love.physics.newCircleShape(5)\nobject.fixture = love.physics.newFixture(object.body, object.shape, 1)\n--\nobject.body:applyForce( 5, 0 )\n-- the object is moving to the right, on the x-axis\n</code></pre>\n<p>what i want is to track it's position while it's traveling. something like</p>\n<pre><code>function objectTracking()\n timer = timer + dt\n --\n if timer == 0 then\n varPreviousPositionX = object.body:getX()\n varPreviousPositionY = object.body:getY()\n elseif timer == 1 then\n timer = 0\n end\nend\n</code></pre>\n<p>that doesn't work. just wanted to write something quick to help you see the problem.</p>\n"^^ . . . "0"^^ . . . . "<p>You can always add other paths to the package paths as:</p>\n<pre><code>local path1 = ';'..'d:/LuaProjects/'..'?.lua'\nlocal path2 = ';'..'d:/LuaProjects/'..'?/?.lua'\npackage.path = package.path .. path1 .. path2\n</code></pre>\n<p>Use the <code>print (package.path)</code> for other examples.</p>\n<p>But normally the project structure must have main.lua in the root of project:</p>\n<ul>\n<li>project/\n<ul>\n<li>main.lua</li>\n<li>fonts/\n<ul>\n<li>font.ttf</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<p>and now you are need to define it as:</p>\n<pre><code>customFont = love.graphics.newFont(&quot;fonts/font.ttf&quot;, 24)\n</code></pre>\n"^^ . "0"^^ . "0"^^ . "How do I get an equipped tool in Roblox Studio?"^^ . . "1"^^ . "0"^^ . . . "0"^^ . . . "<p>I've been using <a href="https://github.com/nvim-lua/kickstart.nvim" rel="nofollow noreferrer">kickstart.nvim</a> and tweaked my setup to turn a single-file config into a bunch of modular files. Now, I've got separate files for lsp with only <code>lua_ls</code> server, and each programming language has its own file, covering <code>treesitter</code>, <code>mason</code>, and conform configs. The only issue is I'm struggling to expand the servers for <code>lspconfig</code> but can't make it to work. This is my <code>lsp.lua</code> file.</p>\n<pre><code>{\n 'neovim/nvim-lspconfig',\n branch = 'master',\n event = { 'BufReadPost', 'BufNewFile', 'BufWritePre' },\n dependencies = {\n 'williamboman/mason.nvim',\n 'williamboman/mason-lspconfig.nvim',\n { 'j-hui/fidget.nvim', opts = {} },\n },\n opts = {},\n config = function()\n local capabilities = vim.lsp.protocol.make_client_capabilities()\n capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)\n\n -- This function gets run when an LSP connects to a particular buffer.\n local on_attach = function(_, bufnr)\n -- bunch of kepmaps here\n end\n\n local servers = {\n lua_ls = {\n Lua = {\n workspace = { checkThirdParty = false },\n telemetry = { enable = false },\n diagnostics = {\n globals = { 'vim' },\n },\n },\n },\n }\n\n require('mason-lspconfig').setup({\n ensure_installed = vim.tbl_keys(servers),\n handlers = {\n function(server_name)\n require('lspconfig')[server_name].setup({\n capabilities = capabilities,\n on_attach = on_attach,\n settings = servers[server_name],\n filetypes = (servers[server_name] or {}).filetypes,\n })\n end,\n },\n })\n end,\n},\n</code></pre>\n<p>This is my go.lua file</p>\n<pre><code>-- mason and treesitter stuff here\n{\n &quot;neovim/nvim-lspconfig&quot;,\n opts = function(_, opts)\n vim.tbl_keys(opts.ensure_installed, { 'gopls' })\n end,\n},\n</code></pre>\n<p>And it gives me this error Expected table, got nil. What am I doing wrong here?</p>\n"^^ . . "And your problem is?"^^ . "<p>The workaround is to make <code>lpeg.Cmt(…)</code> consume at least one character. Since the function passed to <code>lpeg.Cmt(…)</code> gets the whole input string, it will not cause the first character of the relevant part of the string to be lost. The only case that this workaround does not work will be at the very end of the input string, if the function passed to <code>lpeg.Cmt(…)</code> may accept an empty string.</p>\n<p>The workaround:</p>\n<pre class="lang-lua prettyprint-override"><code>local lpeg = require 'lpeg'\nlocal pattern = lpeg.Cmt (lpeg.P (1), function (s, p)\n local p = p - 1 -- compensate for the one character consumed by lpeg.P (1).\n local n = f (s, p) -- f is not calculatable beforehand.\n if not ((n or 0) &gt; 0) then\n return false -- cannot advance, therefore fail.\n else\n return p + n, string.sub (s, p, n) -- advance.\n end\nend) ^ 1\n</code></pre>\n<p>Note <code>lpeg.P (true)</code> → <code>lpeg.P (1)</code> and inserted <code>local p = p - 1</code>.</p>\n"^^ . . . . . . . "1"^^ . . "Hitbox always hitting more than once in combat system (roblox)"^^ . "2"^^ . "<p>You should write a function to poll the MB4 status while sleeping.<br />\nTransition of <code>IsMouseButtonPressed(4)</code> from <code>false</code> to <code>true</code> means MB4 is pressed for the second time.</p>\n<pre><code>local MB4_pressed, second_MB4_press\n\nlocal function InterruptableSleep(ms)\n local tm_stop = GetRunningTime() + ms\n while not second_MB4_press and GetRunningTime() &lt; tm_stop do\n Sleep(10)\n local MB4 = IsMouseButtonPressed(4)\n MB4_pressed, second_MB4_press = MB4, MB4 and not MB4_pressed\n end\nend\n\nfunction OnEvent(event, arg)\n --OutputLogMessage(&quot;event = %s, arg = %s\\n&quot;, event, tostring(arg))\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 4 then\n MB4_pressed = not MB4_pressed\n if MB4_pressed then\n second_MB4_press = false\n repeat\n PressKey(&quot;2&quot;)\n InterruptableSleep(math.random(40, 90))\n ReleaseKey(&quot;2&quot;)\n InterruptableSleep(math.random(40, 90))\n until second_MB4_press\n end\n end\nend\n</code></pre>\n"^^ . . "<p>I'm trying to create a plug system somewhat like Half Life 2 Ep 2's. What this script does is whenever a proximity prompt is triggered on a plug, it's supposed to be rotated and positioned to the players arm and welded.</p>\n<p>Whenever you activate the proximity prompt, it's rotated and welded fine, but it is positioned at the world origin (0, 0, 0). I've tried to change how it is positioned multiple times. I think it is only the line that is positioning the part that is causing the problem, but im not 100% sure. I don't get any errors. Also, the primary parts have other parts welded to it, could that be causing an issue?</p>\n<pre class="lang-lua prettyprint-override"><code>for _, plug in pairs(collectionservice:GetTagged('Plug')) do\n plug.PrimaryPart.ProximityPrompt.Triggered:Connect(function(plr)\n local plugval = plr.Character:WaitForChild('HoldingPlug', 1)\n plugval.Value = plug\n plug.PrimaryPart.Anchored = false\n plr.Character:WaitForChild('Humanoid'):UnequipTools()\n game:GetService('ReplicatedStorage').Events.EquipPlug:FireClient(plr)\n local arm = plr.Character:FindFirstChild('Right Arm')\n plug.PrimaryPart.CFrame = CFrame.new(arm.CFrame.Position.X,arm.CFrame.Position.Y,arm.CFrame.Position.Z)\n local rx,ry,rz = plr.Character:FindFirstChild('Right Arm').CFrame:ToOrientation()\n plug.PrimaryPart.CFrame = CFrame.Angles(math.rad(rx),math.rad(ry),math.rad(90))\n local weld = Instance.new('WeldConstraint')\n weld.Parent = plug.PrimaryPart\n weld.Name = 'PlayerWeld'\n weld.Part0 = arm\n weld.Part1 = plug.PrimaryPart\n plug.PrimaryPart.CanCollide = false\n end)\nend\n</code></pre>\n"^^ . "<p>So, it turns out that a rod constraint was the way to go. Sorry to anyone who was going to try to help. I'll put the script so that anyone that needs it can use it:</p>\n<pre><code>local player = game.Players.LocalPlayer\nlocal HumanoidRootPart = player.Character:WaitForChild(&quot;HumanoidRootPart&quot;)\nlocal mouse = player:GetMouse()\nlocal debounce = false\nlocal mouseDown = false\n\nlocal MaxDistance = 500\nlocal RopeVisible = true\nlocal RopeColor = BrickColor.new(&quot;Cocoa&quot;)\n\nlocal function distance_between_vectors(u, v)\n local difference = u - v\n local distance = difference.Magnitude\n \n distance = math.floor(distance / 1 + 0.5) * 1\n return distance\nend\n\nlocal function Attachment(method, parent)\n if method == &quot;Create&quot; then\n local Attachment = Instance.new(&quot;Attachment&quot;)\n Attachment.Parent = parent\n else\n if parent:FindFirstChild(&quot;Attachment&quot;) then\n parent.Attachment:Destroy()\n end\n end\nend\n\nmouse.Button1Up:Connect(function()\n mouseDown = false\nend)\n\nmouse.Button1Down:Connect(function()\n mouseDown = true\n if debounce == false then\n debounce = true\n local hitPosition = mouse.Hit.Position\n local distance = distance_between_vectors(hitPosition, HumanoidRootPart.Position)\n if distance &lt;= MaxDistance then\n local newPart = Instance.new(&quot;Part&quot;)\n newPart.Anchored = true\n newPart.Parent = game.Workspace\n newPart.Position = hitPosition\n newPart.Transparency = 1\n newPart.CanCollide = false\n Attachment(&quot;Create&quot;, newPart)\n Attachment(&quot;Create&quot;, HumanoidRootPart)\n local Rope = Instance.new(&quot;RodConstraint&quot;)\n Rope.Parent = newPart\n Rope.Attachment0 = newPart.Attachment\n Rope.Attachment1 = HumanoidRootPart.Attachment\n Rope.Color = RopeColor\n Rope.Length = distance\n Rope.Visible = RopeVisible\n Rope.Thickness = 0.25\n local tween = game:GetService(&quot;TweenService&quot;):Create(Rope, TweenInfo.new(0.6, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false), {Length = 0})\n tween:Play()\n newPart.Touched:Connect(function(touched)\n if touched then\n if touched == HumanoidRootPart then\n wait(0.1)\n Attachment(&quot;Destroy&quot;, newPart)\n Attachment(&quot;Destroy&quot;, HumanoidRootPart)\n newPart.RodConstraint:Destroy()\n newPart:Destroy()\n else\n wait()\n end\n end\n end)\n end\n debounce = false\n end\nend)\n</code></pre>\n<p>Hope this helps,\nProgramming_Good_Games</p>\n"^^ . "0"^^ . . "0"^^ . "0"^^ . . . "0"^^ . . . "2"^^ . . "1"^^ . "1"^^ . . . . . . . . . "0"^^ . "0"^^ . "0"^^ . "0"^^ . "3"^^ . . . "0"^^ . . . . "1"^^ . . . "1"^^ . . "How do I change the visibility of a GUI Frame"^^ . . . "<p>Your issue is that the <a href="https://create.roblox.com/docs/reference/engine/classes/Humanoid#Health" rel="nofollow noreferrer">Health</a> property isn't on a <a href="https://create.roblox.com/docs/reference/engine/classes/Player" rel="nofollow noreferrer">Player</a>, but rather their <a href="https://create.roblox.com/docs/reference/engine/classes/Player#Character" rel="nofollow noreferrer">Character</a> model's <a href="https://create.roblox.com/docs/reference/engine/classes/Humanoid" rel="nofollow noreferrer">Humanoid</a>.</p>\n<pre class="lang-lua prettyprint-override"><code>-- set health to 50 when touching the baseplate\nlocal bp = game.Workspace.Baseplate\nbp.Touched:Connect(function(otherPart)\n -- double check that the other part is a character model\n local player = game.Players:GetPlayerFromCharacter(otherPart.Parent) \n if player then\n -- set the player's health\n player.Character.Humanoid.Health = 50\n end\nend)\n\n-- make a kill brick\nlocal Killbrick = game.Workspace.Part\nKillbrick.Touched:Connect(function(otherPart.Parent)\n -- double check that the other part is a character model\n local player = game.Players:GetPlayerFromCharacter(otherPart) \n if player then\n -- kill the player\n player.Character.Humanoid.Health = 0\n end\nend)\n</code></pre>\n"^^ . . . . . . . . "1"^^ . . "What are the performance implications of using Lua's `debug.getlocal` function?"^^ . "How does your code currently look like?\nIt might be that scoping is incorrectly defined, or the function is called within the same frame."^^ . . . . . . . "metatable"^^ . . . . . "1"^^ . . . . . "<p>I am writing a Neovim plugin with Lua. I am trying to set the contents of a buffer to the output of a shell command. Here is my code:</p>\n<pre><code>local handle = io.popen(&quot;ls -1&quot;)\nlocal result = handle:read(&quot;*a&quot;)\nhandle:close()\n\nlocal output = {}\nfor s in result:gmatch(&quot;[^\\r\\n]*&quot;) do\n table.insert(output, s)\nend\n\nvim.api.nvim_buf_set_lines(buffer, 0, -1, false, output)\n</code></pre>\n<p>It works, but I get an extra newline at the end of each line, so the lines of <code>output</code> are separated by blank lines.</p>\n<p>If instead I set the output myself, say to <code>output = {&quot;a&quot;, &quot;b&quot;, &quot;c&quot;}</code>, then it works as expected.</p>\n<p>I have checked and there is no newline character at the end of the strings in <code>output</code>. What is going on?</p>\n"^^ . . . . . "<p>I'm trying to check if <code>point x, y</code> is inside of polygon <code>poly = {x1,y1, x2,y2, x3,y3 ...}</code></p>\n<p>But something goes wrong:</p>\n<pre class="lang-lua prettyprint-override"><code>local function pointInConvexPolygon(x, y, poly)\n -- poly as {x1,y1, x2,y2, x3,y3, ...}\n local imax = #poly\n\n local function isVerticesClockwise(poly)\n local sum = 0\n local imax = #poly\n local x1, y1 = poly[imax-1], poly[imax]\n for i = 1, imax - 1, 2 do\n local x2, y2 = poly[i], poly[i + 1]\n sum = sum + (x2 - x1) * (y2 + y1)\n x1, y1 = x2, y2 -- fixed\n end\n local isClockwise = sum &lt; 0\n love.window.setTitle(isClockwise and 'clockwise' or 'counterclockwise')\n return isClockwise\n end\n\n local sign = isVerticesClockwise(poly) and 1 or -1\n local x1, y1 = poly[imax-1], poly[imax]\n for i = 1, imax - 1, 2 do\n local x2, y2 = poly[i], poly[i + 1]\n local dotProduct = (x - x1) * (y1 - y2) + (y - y1) * (x2 - x1)\n if sign * dotProduct &lt; 0 then\n return false\n end\n x1, y1 = x2, y2\n end\n return true\nend\n</code></pre>\n<p>Sometimes clockwise direction is right, but sometimes it says wrong direction.</p>\n"^^ . . . . "Generally I would expect an program to interpret paths relative to the working directory, which I can't tell from your question. (Maybe check with `os.execute("pwd")` if you aren't sure.) For a native executable it is probably the directory of the executable file; for running a Lua script via the stand-alone Lua interpreter, it is the folder that is probably the folder that is open in the shell when you execute it. (Neither of these is necessarily project/src.) If you are using a library to load your font, it may have its own convention, though."^^ . . . "2"^^ . . "1"^^ . . "2"^^ . . . "0"^^ . "<p>I had the same issue. The fix is to install the language pack.\nPHP wasn't recognized for me.</p>\n<p>I installed through <code>:TSInstall php</code></p>\n"^^ . . "0"^^ . . . "<p>There is an unintentional thing in my game where if I run a function again, the functions overlap each other, but I don't want that.</p>\n<p>When I run the function again, the function overlaps the other previously ran function.</p>\n<p>The script:</p>\n<pre><code>local eids = script.Parent.EnemyIDSelected\nlocal userinput = game:GetService(&quot;UserInputService&quot;)\nlocal frame = script.Parent.Parent.Parent\nlocal enemycount = frame.Enemies.NumberOfEnemies\nlocal enemyorder = frame.Enemies.Frame:WaitForChild(&quot;EnemyOrder&quot;)\n\nuserinput.InputBegan:Connect(function(input,gameProcessedEvent)\n if input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.Left then\n eids.Value = eids.Value - 1\n elseif input.KeyCode == Enum.KeyCode.D or input.KeyCode == Enum.KeyCode.Right then\n eids.Value = eids.Value + 1\n end\nend)\n\neids.Changed:Connect(function()\n if eids.Value &gt; enemycount.Value then\n eids.Value = 1\n elseif eids.Value &lt; 1 then\n eids.Value = enemycount.Value\n end\nend)\n\neids.Changed:Connect(function()\n local number = 0\n\n local function findenemies()\n local enemycount = frame.Enemies.NumberOfEnemies.Value\n local enemies = {}\n local ordernumber = 1\n for i, v in pairs(enemyorder:GetChildren()) do\n if string.sub(v.Name, 1, 5) == &quot;Order&quot; then\n enemies[ordernumber] = v.Value\n if ordernumber == enemycount then\n return enemies\n end\n ordernumber = ordernumber + 1\n end\n end\n end\n local enemies = findenemies()\n --\n \n while wait() do\n for i, v in pairs(enemies) do\n if i == eids.Value then\n print(number)\n script.Parent.ImageLabel.TextLabel.Text = enemies[i].EnemyValue.Value\n enemies[i].ImageColor3 = Color3.fromRGB(80, 80, 80)\n\n for i2, v2 in pairs(enemies) do\n if v2 ~= enemies[i] then\n v2.ImageColor3 = Color3.fromRGB(80, 80, 80)\n end\n end\n\n wait(0.15)\n enemies[i].ImageColor3 = Color3.fromRGB(255, 255, 255)\n wait(0.15)\n number = number + 1\n end\n\n end\n end\n \nend)\n</code></pre>\n<p>When I run the function again, the function overlaps the other previously ran function.</p>\n"^^ . "<p>Here's my lazy config for <code>neo-tree.nvim</code>. Previous answers didn't work for me, so I edited my keymaps to set relative line numbers each time.</p>\n<pre><code>return {\n 'nvim-neo-tree/neo-tree.nvim',\n version = '*',\n dependencies = {\n 'nvim-lua/plenary.nvim',\n 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended\n 'MunifTanjim/nui.nvim',\n },\n cmd = 'Neotree',\n keys = {\n -- here's the keymap that sets the relative numbers\n { '\\\\', ':Neotree reveal&lt;CR&gt;:set relativenumber&lt;CR&gt;', desc = 'NeoTree reveal', silent = true },\n },\n opts = {\n filesystem = {\n window = {\n mappings = {\n ['\\\\'] = 'close_window',\n },\n },\n },\n },\n}\n</code></pre>\n"^^ . . "0"^^ . "2"^^ . . . . "camera"^^ . . . "<p>Looking for help with a LUA script to duplicate records in a table when there are delimited records in multiple cells</p>\n<p>Sample data:</p>\n<div class="s-table-container">\n<table class="s-table">\n<thead>\n<tr>\n<th>Product Number</th>\n<th>Category Name</th>\n<th>Cat Order code</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>1</td>\n<td>Category Name One,Category Name Two</td>\n<td>3,4</td>\n</tr>\n<tr>\n<td>2</td>\n<td>Category Name Three, Category Name 4</td>\n<td>2,1</td>\n</tr>\n</tbody>\n</table>\n</div>\n<p>This is how I need it to look:</p>\n<div class="s-table-container">\n<table class="s-table">\n<thead>\n<tr>\n<th>Product Number</th>\n<th>Category Name</th>\n<th>Cat Order Code</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>1</td>\n<td>Category Name One</td>\n<td>3</td>\n</tr>\n<tr>\n<td>1</td>\n<td>Category Name Two</td>\n<td>4</td>\n</tr>\n<tr>\n<td>2</td>\n<td>Category Name Three</td>\n<td>2</td>\n</tr>\n<tr>\n<td>2</td>\n<td>Category Name Four</td>\n<td>1</td>\n</tr>\n</tbody>\n</table>\n</div>\n<p>Here is the code I am working from which only duplicates the rows but does not delimit the cat order code to the correct rows:</p>\n<pre><code>for i = 1,records:size() do\n -- Get record i\n record = records:getrecord(i);\n\n -- Get the contents of the Category field\n categoryField = record:field(&quot;Category Name&quot;):content();\n\n -- Define a duplicates created counted\n n = 0;\n\n -- For each delimited value\n for k, v in string.gmatch(categoryField , &quot;([^,]+)&quot;) do\n if (n == 0) then\n -- Remember the first value\n rememberMe = k;\n else\n -- For anything other than the first, duplicate the record\n newRecord = records:duplicaterecord(i);\n\n -- Define a unique key\n newRecord:field(&quot;Product number&quot;):setcontent( newRecord:field(&quot;Product number&quot;):content() .. &quot;-&quot; .. n);\n\n -- Set the new Category content\n newRecord:field(&quot;Category Name&quot;):setcontent(k);\n end\n n = n + 1;\n end\n if n &gt; 1 then\n -- If more than one duplicate was created, set the first value\n record:field(&quot;Category Name&quot;):setcontent(rememberMe);\n end\nend\n</code></pre>\n"^^ . . . "0"^^ . "1"^^ . "0"^^ . "recursion"^^ . "0"^^ . . . . "Yes, but that I had tried that I thought was apparent from the question all along (perhaps not). That it wasn't completely satisfactory is why I asked if there was any better solution. Your answer I've only evaluated on the grounds that it was a negative answer of "No, there is probably no better solution, here is why". The paragraph where you write something like "I don't think [your existing solution] is a good idea." was mostly bonus but would still have been worthwhile if it had some additional motivation for why it wasn't a good idea."^^ . "How to fix these parser errors that i am getting for my lazyvim installation on neovim"^^ . . . "0"^^ . . "Thanks for the extra keywords to search for found this issue discussing the same thing https://github.com/neovim/neovim/issues/2325"^^ . . "string"^^ . "Elunas script issues"^^ . "Is the formula available as string (such as `x^3`)? Or only the function value (such as `function(x) return x^3 end`) is available?"^^ . . "0"^^ . . . . "viewport"^^ . . . . . "1"^^ . . . "1"^^ . "3"^^ . . "0"^^ . "0"^^ . . . . . . . . "1"^^ . "Remove both path and extension from string in Lua"^^ . "0"^^ . . . . . . "2"^^ . . "<p>I have 4 half-planes, that are defined as base point and normalized tangent:</p>\n<pre><code>local frameX, frameY, frameW, frameH = 25, 25, 750, 550\nlocal halfPlanes = {\n-- halfplane as starting point and tangent\n {frameX, frameY, -1, 0}, -- y &lt; frameY\n {frameX + frameW, frameY, 0, 1}, -- x &gt; frameX + frameW\n {frameX + frameW, frameY+frameH, 1, 0}, -- y &gt; frameY + frameH\n {frameX, frameY+frameH, 0, -1}, -- x &lt; frameX\n }\n</code></pre>\n<p>I want to check if the point is in one of them / not in any of them as</p>\n<pre><code>local bx, by, tx, ty = halfPlane[1], halfPlane[2], halfPlane[3], halfPlane[4]\nlocal d1 = dotProductLineTangentPoint (bx, by, tx, ty, px1, py1)\nlocal d2 = dotProductLineTangentPoint (bx, by, tx, ty, px2, py2)\n</code></pre>\n<p>where dotProductLineTangentPoint is</p>\n<pre><code>local function dotProductLineTangentPoint (x, y, tx, ty, px, py)\n-- x,y - starting point of line\n-- tx, ty - normalized tangent vector of line\n-- px, py - point to check\n-- return tx * (px - x) + ty * (py - y)\n return ty * (px - x) + tx * (py - y)\nend\n</code></pre>\n<p>And than if one side is positive and the other is negative, then</p>\n<pre><code>if (d1 &gt; 0 and d2 &lt; 0) or (d1 &lt; 0 and d2 &gt; 0) then\n local cx, cy = findCrossingLineTangentSegment (bx, by, tx, ty, p1, p2)\n return {cx, cy, px2, py2}\nend\n</code></pre>\n<p>The result function crops the given segment with given boundary.</p>\n<p>Question:\nHow to make the findCrossingLineTangentSegment correctly? Now I have placeholder with two exceptions for horizontal and vertical lines and not working vector solution:</p>\n<pre><code>local function findCrossingLineTangentSegment(bx, by, tx, ty, p1, p2)\n if tx == 0 then\n local x, y = findIntersectionWithVerticalLine(p1.x, p1.y, p2.x, p2.y, bx)\n-- print ('cross with vertical')\n return x, y\n elseif ty == 0 then\n local x, y = findIntersectionWithHorizontalLine(p1.x, p1.y, p2.x, p2.y, by)\n-- print ('cross with horizontal')\n return x, y\n else\n-- local u = ((p2.x - p1.x) * ty + (p1.y - by) * tx) / (tx * (p1.y - p2.y) + ty * (p2.x - p1.x))\n local u = dotProductLineTangentPoint(bx, by, tx, ty, p1) / dotProductLineTangentPoint(bx, by, tx, ty, p1, p2)\n local cx = p1.x + u * (p2.x - p1.x)\n local cy = p1.y + u * (p2.y - p1.y)\n return cx, cy\n end\nend\n</code></pre>\n"^^ . . "<p>Let's say I have a camera (player since I am making a game) at 0, 0 facing at -0.78 radians. I also have an entity or npc at -2, 2 facing at 0.78 radians. Because we are humans and we have brains, we can obviously determine that the entity appears to be facing right from the players perspective. So... how do I calculate this? I am using lua for this, but I will accept any language as an answer.</p>\n<p><a href="https://i.sstatic.net/823uD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/823uD.png" alt="1" /></a></p>\n<p>I've stumbled through different solutions with ChatGPT but it either misinterpreted what I asked or I couldn't make sense of it.</p>\n"^^ . . "-2"^^ . "0"^^ . . . . "<p>As Abdul Basit commented:</p>\n<p>Run this command <code>:TSInstall vimdoc</code> fixes this issue.</p>\n"^^ . . . . . . . . . "1"^^ . "0"^^ . "4"^^ . . . . . "1"^^ . . . "Yes, that's correct, later editions changed the terminology. However, I couldn't find any compilation instructions for them in the book."^^ . "2"^^ . "<p>I don't know how to change the Player's Health in Roblox.</p>\n<p>I tried this:</p>\n<pre class="lang-lua prettyprint-override"><code>local Object = game.Workspace.Baseplate\nObject.Touched:Connect(function()\n game.StarterPlayer.HealthDisplayDistance = 50\nend)\nlocal Killbrick = game.Workspace.Part\n</code></pre>\n<p>I thought the 3rd Line changed the health of the Player but it didn't do anything.</p>\n"^^ . . . "How to get the position of a moving object once? without it being updated"^^ . . . . . . . . . . "<p>There is a way to not rewrite the same part (the cycle <code>for i = 1...end</code>) twice?</p>\n<pre><code>local function myfunc(frame,method)\n if frame:IsShown() then\n for i = 1, #frame.buttons do\n frame.buttons[i]:HookScript(&quot;OnMouseDown&quot;, method)\n end\n else\n frame:SetScript(\n &quot;OnShow&quot;,\n function(frame)\n for i = 1, #frame.buttons do\n frame.buttons[i]:HookScript(&quot;OnMouseDown&quot;, method)\n end\n end\n )\n end\nend\n</code></pre>\n<p>Where</p>\n<ul>\n<li><code>IsShown()</code>, <code>HookScript()</code> and <code>SetScript()</code> are all in-game API</li>\n</ul>\n<p>EDIT</p>\n<p>Maybe a recursive function? It seems to work:</p>\n<pre><code>local function myfunc(frame,method)\n if frame:IsShown() then\n for i = 1, #frame.buttons do\n frame.buttons[i]:HookScript(&quot;OnMouseDown&quot;, method)\n end\n else\n frame:SetScript(\n &quot;OnShow&quot;, --when &quot;OnShow&quot; is fired, IsShown() become true\n function()\n myfunc(frame,method)\n end\n )\n end\nend\n</code></pre>\n"^^ . "1"^^ . "0"^^ . . "rust"^^ . "corutines - that's the only way, am I right?"^^ . . "3"^^ . . "0"^^ . "0"^^ . . . . "0"^^ . "1"^^ . . . . . "i am trying my have my program diside which to respond with but it wont work and i dont know why lua"^^ . . . "syntax-error"^^ . . . "0"^^ . . . . "0"^^ . "<p>I want anything that I select in visual mode to go to the X11 buffer. My ideal workflow would be something like:</p>\n<ol>\n<li>I enter visual mode by pressing v (or V or ctrl V etc.)</li>\n<li>Select some text by some usual movements hjkl, wb or similar</li>\n<li>Outside of the terminal I do a middle click (click with the scroll-wheel) and the selection from 2 is pasted where I pressed</li>\n</ol>\n<p>I can get something almost like this with e.g. a keymap:\n<code>vim.keymap.set(&quot;v&quot;, &quot;&lt;leader&gt;y&quot;, [[&quot;*ygv]])</code> and then adding a step between (2) and (3) where I press <code>&lt;leader&gt;y</code>.</p>\n<p>My actual question is for how to make this yanking (while keeping visual selection (gv in my example keymap)) happen automatically.</p>\n<p>Probably I would like something like an autocommand but I don't know the right events to be watching. Something that appears to kind-off work is:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.api.nvim_create_autocmd({&quot;CursorMoved&quot;, &quot;ModeChanged&quot;}, {\n callback = function()\n local mode = vim.fn.mode(false)\n if mode == &quot;v&quot; or mode == &quot;V&quot; or mode == &quot;^V&quot; then\n vim.cmd([[&quot;*y]])\n end\n end,\n})\n</code></pre>\n<p>but there are some problems:</p>\n<ul>\n<li>it might be a bit aggressive in how often it runs</li>\n<li>&quot;^V&quot; is not the right character to match against</li>\n<li>it messes up <code>:V</code> as the the initial line selection is removed (but adding <code>gv</code> to the command didn't seem to work)</li>\n</ul>\n<p>What would be a better approach?</p>\n<p>I'm running nvim v0.9.4 on gnome.</p>\n"^^ . "thank you so much!!!!! Made my day, it works here, now, too!!!! THX!!"^^ . "0"^^ . . "0"^^ . "Also, what happens if the code surrounded by `return ;` do a side effect AND fail..."^^ . . "0"^^ . . . . . "<p>There are 3 issues:</p>\n<ol>\n<li><p><code>HealthDisplayDistance</code> isn't actually the player's health.</p>\n</li>\n<li><p>You're trying to get the player from <code>StarterPlayer</code>, which isn't the player.</p>\n</li>\n<li><p>You're trying to change the player's health, but you have to do it by changing the <code>Health</code> property in the <em>character's humanoid</em>. You can do that by doing these changes to the script:</p>\n<pre><code>local Object = game.Workspace.Baseplate\nlocal Killbrick = game.Workspace.Part --I only set the variable here because it's recommended to set the variables before doing anything to the script.\nObject.Touched:Connect(function(Character) --By adding the Character parameter, you can get the player's physical body, and inside that physical body there's the Humanoid, which is where we change the player's health and other properties.\n Character.Parent:WaitForChild(&quot;Humanoid&quot;).Health = 50\nend)\n</code></pre>\n</li>\n</ol>\n<p>That should work.</p>\n<p>Remember this useful information: Player is like the brain/mind, while character is the body, the muscles and the heart. If you want to kill somebody, for example, you have to &quot;decrease that person's health&quot;, and you can't decrease a person's health from their minds, but from their heart (damaging the heart). I hope you understood.</p>\n<p>Extra: <code>StarterPlayer</code> is where you will put scripts which can be either in the model which is in the <code>Workspace</code>, also known as character or you can put scripts in the actual player, which can be found in <code>Players</code>.</p>\n<p>This is just a image to show what's the <code>Players</code> object:</p>\n<p><img src="https://i.sstatic.net/HNAfe.png" alt="" /></p>\n"^^ . . . . . "<p>At the moment, I'm working on a fractal renderer for stuff like the Mandelbrot set for my computer science coursework, and I want to use recursion instead of iteration on the function below since it will get me more marks.</p>\n<p>The original iterative function is below. (I've removed some parts of the function which are for rendering other fractals, but I haven't included them otherwise this would be too long)</p>\n<pre><code>function fractal:compute(x,y)\n iteration = 1\n local zx = 0\n local zy = 0\n while iteration &lt; self.maxIterations and zx^2 + zy^2 &lt; 4 do\n temp = zx\n if self.current == &quot;Mandelbrot&quot; then\n zx, zy = Mandelbrot(zx,zy,x,y)\n end\n iteration = iteration + 1\n end\n return iteration\nend\n\nfunction Mandelbrot(zx, zy, x, y)\n return zx^2-zy^2+x, 2*zx*zy+y\nend\n</code></pre>\n<p>I've tried to do this with a few methods, like using:</p>\n<pre><code>x^2 + y^2 &gt; 4 or iteration == maxIterations\n</code></pre>\n<p>as the base case but for some reason it doesn't seem to work- such as this:</p>\n<pre><code>function fractal:compute_Recursively(x,y, cx, cy, count)\n if count &gt;= fractal.maxIterations or x^2 + y^2 &gt;= 4 then\n return count\n else return self.compute_Recursively(x^2-y^2+cx, 2*x*y + cy, cx, cy, count+1)\n end\nend\n\nfunction formulae.Mandelbrot_Recursive(x, y, cx, cy, i)\n if i &gt;= fractal.maxIterations or x^2 + y^2 &gt;= 4 then\n return i\n else return formulae.Mandelbrot_R(x^2-y^2+cx, 2*x*y + cy, cx, cy, i+1)\n end\nend\n</code></pre>\n"^^ . . . "How to make multi-argument choose function in LuaU?"^^ . . "<p>I haven't worked with <code>vim-dadbod-ui</code> before, but I've had similar use cases. Treesitter operates by attaching the parser based on file types (as per my understanding). To apply SQL parsing (and highlighting) to these files, you need to inform Treesitter explicitly to do so.</p>\n<h3>Simplest method first</h3>\n<p><em>Requires Neovim &gt;= 0.9.0</em></p>\n<ol>\n<li>Confirm the filetype by executing <code>:echo &amp;filetype</code> with the buffer open and focused.</li>\n<li>Assuming it returns a value, let's denote it as <code>&lt;vim-dadbod-ui-query-filetype&gt;</code> (<em>If not, this approach won't work, move on to the next one</em>).</li>\n<li>Add the following line to your script:</li>\n</ol>\n<pre class="lang-lua prettyprint-override"><code>vim.treesitter.language.register(&quot;sql&quot;, &quot;&lt;vim-dadbod-ui-query-filetype&gt;&quot;)\n</code></pre>\n<p>This is mentioned in the <a href="https://github.com/nvim-treesitter/nvim-treesitter/blob/e6d80e5efdbec343c4ff30d627cee129e545b878/README.md?plain=1#L588-L592" rel="nofollow noreferrer">Tree-sitter README</a>.</p>\n<h3>Neovim should treat it as SQL</h3>\n<p>If the previous approach did not work, it means you do not have a filetype associated with these files. So, you would have to explicitly assign it a SQL filetype. To do this, we tell Neovim filetype for such files using <a href="https://neovim.io/doc/user/lua.html#vim.filetype.add()" rel="nofollow noreferrer">vim.filetype.add()</a>. Assuming it's a pattern that consistently includes the <code>-query-</code> field and lacks an extension (basically a <code>.</code> after <code>-query-</code>) and we want it to be treated as <code>SQL</code> by Neovim (and Treesitter):</p>\n<pre class="lang-lua prettyprint-override"><code>vim.filetype.add({\n pattern = { [&quot;.*-query-[^%.]*&quot;] = &quot;sql&quot; },\n})\n</code></pre>\n<p><strong>Note:</strong> This approach also activates any plugins designed to work with SQL, such as formatters and/or linters, specified in your Neovim configuration.</p>\n<h3>Only Tree-sitter should treat it as SQL</h3>\n<p><em>Requires Neovim &gt;= 0.9.0</em></p>\n<p>If you would rather not prefer this, you have to assign such a files a custom filetype, and tell Treesitter to use <code>SQL</code> parser to parse these files.</p>\n<pre class="lang-lua prettyprint-override"><code>vim.filetype.add({\n pattern = { [&quot;.*-query-[^%.]*&quot;] = &quot;dadbod-sql-custom&quot; },\n})\nvim.treesitter.language.register(&quot;dadbod-sql-custom&quot;, &quot;&lt;filetype&gt;&quot;)\n</code></pre>\n<p>The shared pattern should match with the filename in the screenshot, but you might have to adjust it to match your exact needs. Additionally, various other methods exist for specifying how to apply filetypes. One of them might suit your needs better.</p>\n"^^ . . . . . "<p>If <code>myinput</code> is just <code>add(1, 1)</code>, that's a function call statement, so the return value(s) of <code>add</code> will be discarded. You can't recover them afterwards.</p>\n<p>It is not possible to circumvent this without modifying <code>myinput</code>.</p>\n<p>You can test this in the Lua 5.1 and 5.2 REPLs: They have the same issue. If you enter an expression, that's a syntax error. If you enter a function call, that's just a statement, so you get no return values out of it.</p>\n<p>However, all chunks in Lua are effectively functions, so you can just <code>return</code> any values you want to. In the Lua 5.1 / 5.2 REPLs, you could write <code>return 1 + 1</code>, and it would print <code>2</code>. Because this is slightly cumbersome, they offer <code>=</code> at the start of the input as syntactic sugar for <code>return </code>.</p>\n<p>What you can do - and what the Lua 5.3 / 5.4 REPLs do - is first try prepending <code>return </code> and appending <code>;</code> (see <a href="https://github.com/lua/lua/blob/e288c5a91883793d14ed9e9d93464f6ee0b08915/lua.c#L574" rel="nofollow noreferrer">the source</a>), and if that works, they evaluate the chunk and print the return values. That's what makes expressions work in the REPL. It's a bit of a hack, but it works well.</p>\n<p>(Also, what is <code>lua_dostring</code>? It doesn't appear in the reference manual or the PUC sources.)</p>\n<hr />\n<blockquote>\n<p>I am implementing a Lua interpreter.</p>\n</blockquote>\n<p>Nitpick: It sounds like you're implementing a Lua <em>REPL</em> (read-eval-print-loop, an interface to an interpreter) rather than a Lua <em>interpreter</em> (the software that <em>interprets</em> the Lua code).</p>\n<hr />\n<blockquote>\n<p>Also, what happens if the code surrounded by return ; do a side effect AND fail...</p>\n</blockquote>\n<p>The side effect (say, a <code>print</code>) will happen as normal, there is no &quot;isolation&quot; here. The &quot;failure&quot; will make the REPL print a stacktrace; no &quot;values&quot; will be printed. You can easily test this yourself using <code>print</code> and <code>error</code>.</p>\n"^^ . "-1"^^ . "1"^^ . . "<p>I need Lua script start when I press M4 button on mouse press keys but I need this in loop until I press M4 again.</p>\n<p><strong>-- NOT HOLD - PRESS AGAIN --</strong></p>\n<p>here is my code;</p>\n<pre><code>local M4_pressed = false\n\nfunction OnEvent(event, arg)\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 4 then\n M4_pressed = not M4_pressed\n while M4_pressed do\n PressKey(&quot;2&quot;)\n Sleep(math.random(60, 70))\n ReleaseKey(&quot;2&quot;)\n Sleep(math.random(60, 70))\n end\n end\nend\n</code></pre>\n<p>this is my code but its not stopping on press again.</p>\n<hr />\n<pre><code>M4_pressed = not M4_pressed \n/*this means \n if(M4_pressed = true){M4_pressed = false)}\n if(M4_pressed = false){M4_pressed = true)}\n*/\n</code></pre>\n"^^ . . . . . . "<p>I'm trying to find information on how to allow a consumer to have only X(10) concurrent open connections in Kong with no luck. Is it even possible? If not, would it be possible to do it with custom plugin and how hard would it be to implement such plugin?\nThanks.</p>\n"^^ . . "0"^^ . . . . . . . "@ViaTech ok, deleted my comment too."^^ . . . . . "0"^^ . . "1"^^ . . "0"^^ . . "4"^^ . . "kong"^^ . "0"^^ . . . "0"^^ . "2"^^ . . "1"^^ . "Imo, no. When you need a comment just to explain the code flow it's probably too complex. I would go for a second function."^^ . . "rss"^^ . "1"^^ . . . . "2"^^ . . "<p>You open two blocks (<code>function(_ARG_0_)</code> and <code>if &quot;table&quot; ...</code> but have three <code>ends</code>. Delete one.</p>\n"^^ . . "0"^^ . . "<p>To stop the function from running simultaneously you need to store whether the function is currently running, and for any new calls, check if it is already running.\nFor example:</p>\n<pre class="lang-lua prettyprint-override"><code>local currentlyRunning = false\n\nfunction test()\n if currentlyRunning then return end\n currentlyRunning = true\n \n task.wait(5)\n \n -- Very important if you have any return statements, put this line infront of them.\n -- Otherwise, the execution of the function may stop and \n currentlyRunning = false\nend\n</code></pre>\n<p>If instead you are trying to cancel stop the execution of the previous function when the event is fired again you should move the part of your script that handles the visualisation outside of the callback and just reference variables set by the callback. This lets you avoid the issues and hassles of dealing with coroutines.</p>\n<p>For example:</p>\n<pre class="lang-lua prettyprint-override"><code>local enemies = 0\n\nevent:Connect(function()\n enemies +=1\nend)\n\nRunService:Hearbeat:Connect(function()\n print(enemies)\nend)\n</code></pre>\n<p>Also, in your script, you are listening to the same event multiple times, this is bad practice since it may cause issues with the ordering of the functions being ran. You should instead put them into the same :Connect statment.</p>\n"^^ . . "1"^^ . . . . . "-1"^^ . "0"^^ . "Getting Error with high_phone script on fivem"^^ . . . . . "lua script not able to consume env variables in a docker container"^^ . . . . . "I tested the compilation work with VMWare Ubuntu 2204 with lua 5.4."^^ . . . . . "0"^^ . . . "Sadly, doesnt work. Maybe problem is here? https://cdn.discordapp.com/attachments/1192088216677912576/1199457390467235880/image.png?ex=65c29cbe&is=65b027be&hm=5fd8cc7d35c81ec72777db6634c5601bd9fd61f8c2a2f95c0d583296c694ef7b&"^^ . . . "-2"^^ . . . . . "<p>I'm working on a Quarto book that I need in pdf output. I need to create references per chapter and also the complete document references.</p>\n<p>For the references per chapter, I found the following extension:</p>\n<p><a href="https://github.com/pandoc-ext/section-bibliographies#quarto" rel="nofollow noreferrer">https://github.com/pandoc-ext/section-bibliographies#quarto</a></p>\n<p>That one solved my problem with references per chapter pretty well! Now the issue that I have is that I need to obtain the complete document references placed before my last section which is the appendices.</p>\n<p>Here is how I'm using the lua filter:</p>\n<pre><code> filters:\n - section-bibliographies.lua #This is the lua filter stated above\n bibliography: rap_v002.bib\n citeproc: true \n</code></pre>\n<p>I know that if citeproc is false is not going to generate the complete references section. If set up as true, it is going to generate the complete document references but at the very end of the document (after the appendices). I need to place those references before the appendices. This is how I have the _quarto.yml:</p>\n<pre><code> chapters:\n - abstract.qmd\n - index.qmd\n - dedication.qmd\n - acknowledgements.qmd\n - list_abbreviations.qmd\n - chapter_1_intro.qmd\n - chapter_2_lm.qmd\n - chapter_3_ml.qmd\n - chapter_4_conclusions.qmd\n - bibliography.qmd\n appendices:\n - appendices.qmd\n</code></pre>\n<p>Inside the bibliography.qmd file I have the following:</p>\n<pre><code># References {.unnumbered}\n\n::: {#refs}\n:::\n</code></pre>\n<p>I understand that the lua filter changes the pandoc behavior about those <code>#refs</code> to create the references per chapter. I have tried to change it without success.</p>\n<p>Do you have any recommendations on how to achieve placing the complete document references before the appendices without messing up the references per chapter already created with the lua filter?</p>\n"^^ . . "0"^^ . "0"^^ . "0"^^ . . "roblox-studio"^^ . "0"^^ . . . "How to get the value of char* in lua"^^ . . "loops"^^ . "The module system is a new feature, so I can understand why there are no compilation instructions."^^ . . . "0"^^ . . "1"^^ . . "2"^^ . . . "1"^^ . . "Is multiplying by *0.5 in the triangle area necessary? I see that we need just sign, not value: \nlocal area = ((x1-x0) * (y2-y0) - (x2-x0) * (y1-y0))"^^ . . . . "0"^^ . . "0"^^ . "<p>I'm trying to create in a lua script a <a href="https://gist.github.com/haggen/2fd643ea9a261fea2094" rel="nofollow noreferrer">function for generating random strings</a>.</p>\n<p>This is my code:</p>\n<pre><code>math.randomseed(os.time())\nlocal charset = &quot;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890&quot;\nfunction string.random(length)\n if length &gt; 0 then\n return string.random(length - 1) .. charset:sub(math.random(1, #charset), 1)\n else\n return &quot;&quot;\n end\nend\n\n-- Create the string\nlocal scenarioname = string.random(10)\nprint ('the scenario name is ' .. scenarioname)\n</code></pre>\n<p>but the <code>scenarioname</code> string is always empty.</p>\n<p>What I'm doing wrong? I'm using luajit</p>\n"^^ . . "<p>LPEG considers loop body consisting of <code>lpeg.Cmt (…)</code> empty under Lua 5.1, 5.2, 5.3, 5.4 and LuaJIT, even though I am sure that the function passed to <code>lpeg.Cmt</code> returns an advanced position, or <code>false</code> for failure.</p>\n<p>Minimal example causing 'loop body may accept empty string' error:</p>\n<pre class="lang-lua prettyprint-override"><code>local lpeg = require 'lpeg'\nlocal pattern = lpeg.Cmt (lpeg.P (true), function (s, p)\n local n = f (s, p) -- f is not calculatable beforehand.\n if not ((n or 0) &gt; 0) then\n return false -- cannot advance, therefore fail.\n else\n return p + n, string.sub (s, p, n) -- advance.\n end\nend) ^ 1\n</code></pre>\n<p>I don't know beforehand, how much or what kind of input <code>lpeg.Cmt (…)</code> will consume; but it will either consume some, or fail after the function returns false.</p>\n<p>Is there a workaround?</p>\n"^^ . . . "1"^^ . . "0"^^ . "0"^^ . . "0"^^ . . . . "load"^^ . . . . . . ""very accurate" is not a good description of how accurate you need the result to be, but if you do not have access to the text of the function, you can take the input and output and get the derivative of the point series to get an approximation of the actual derivative, the smaller steps you take for the input value the more accuracy you can squeeze out of this method"^^ . . "0"^^ . . . . . . . . "0"^^ . . . . . . . . "How do I iterate through a table starting at a key position in lua?"^^ . . "0"^^ . . . "match"^^ . "<p>See: <a href="https://github.com/hrsh7th/nvim-cmp/issues/37" rel="nofollow noreferrer">https://github.com/hrsh7th/nvim-cmp/issues/37</a></p>\n<pre class="lang-lua prettyprint-override"><code>require('cmp').setup {\n window = {\n documentation = false,\n }\n}\n</code></pre>\n"^^ . . "1"^^ . . . "0"^^ . "<p>I am trying to open a TCP port on coppeliaSim to connect to, but when doing the command</p>\n<pre><code>/Applications/coppeliaSim.app/Contents/MacOS/coppeliaSim -gREMOTEAPISERVERSERVICE_19999_FALSE_TRUE\n</code></pre>\n<p>it opens coppeliaSim without the flagging i presume. When running my script to test it out:</p>\n<pre><code>local sim = require(&quot;sim&quot;)\n\nfunction sysCall_init()\n local status, _info, _serverVersion, _clientVersion, _clientIp =\n simRemoteApi.status(19999)\n if status == -1 then\n print([[\n Warning: you did not start CoppeliaSim in the way required to connect to the server.\n Please start with &quot;-gREMOTEAPISERVERSERVICE_19999_FALSE_TRUE&quot;,\n using ./scripts/start_coppelia_sim\n ]])\n end\nend\n</code></pre>\n<p>it gives me the error:</p>\n<pre><code>[string &quot;/Robobo@childScript&quot;]:5: attempt to index a nil value (global 'simRemoteApi')\nstack traceback:\n [string &quot;/Robobo@childScript&quot;]:5: in function 'sysCall_init'\n</code></pre>\n<p>So I think the problem is that I might be doing the flagging incorrect? or it is coppelia that has issues with MacOS, because it did work for my classmates who work on Windows and Linus operating systems.</p>\n<p>Does anyone know how to resolve this issue?</p>\n"^^ . . . "0"^^ . "Oops, had a small mistake that I needed to fix"^^ . . . "ESkri is spot on, that's the reason for your bug. I'd additionally like to point out that such repeated string concatenation results in poor (quadratic) runtime; you should either use a temporary table, or, if you only expect to generate "short" random strings which fit on the stack, you could generate a vararg of bytes and pass that to `string.char`."^^ . "0"^^ . "Where are the Script and LocalScript located?"^^ . . "2"^^ . . "0"^^ . . . "conky"^^ . "0"^^ . . . "0"^^ . . "Autocmd in visual mode neovim for syncing selection to X11 buffer"^^ . "@Luatic - It's an exercize from PiL4. `Figure 25.6` is just a code very similar to OP's code."^^ . . . "3"^^ . "0"^^ . "0"^^ . "1"^^ . "<p>I want to give you two links that are related to your issue and an explanation:\n<a href="https://devforum.roblox.com/t/isloaded-is-intermittently-returning-false-for-successfully-loaded-audio/2809379" rel="nofollow noreferrer">https://devforum.roblox.com/t/isloaded-is-intermittently-returning-false-for-successfully-loaded-audio/2809379</a>\n<a href="https://create.roblox.com/docs/reference/engine/classes/ContentProvider#RequestQueueSize" rel="nofollow noreferrer">https://create.roblox.com/docs/reference/engine/classes/ContentProvider#RequestQueueSize</a>\nIn the last link I linked, it says the following:</p>\n<blockquote>\n<p>Developers are advised not to use RequestQueueSize to create loading bars. This is because the queue size can both increase and decrease over time as new assets are added and downloaded. Developers looking to display loading progress should load assets one at a time (see example below).</p>\n</blockquote>\n<p>This means that certain assets may be re-added to the queue if necessary, which means that the code for your callback may run twice inside, that could be a possible cause of your error.</p>\n<p>The first link is related to a bug report that marks the unreliability of .IsLoaded, with a follow-up that it hasn't been fixed yet.</p>\n<p>To give you a potential solution is, to instead of using a callback function, get the assets from the queue and check it's status intermittently, like so:</p>\n<pre class="lang-lua prettyprint-override"><code>local retryLimit = 12\nlocal retryCount = 0\nrepeat task.wait(2) retryCount+= 1 until ContentProvider:GetAssetFetchStatus(DayTheme) == Enum.AssetFetchStatus.Success or retryCount &gt; retryLimit\n</code></pre>\n"^^ . . "I need advice on setup compiler for c library with embedded lua in Cygwin with Mingw on Windows"^^ . . . . "0"^^ . "yaml"^^ . . "3"^^ . "1"^^ . . "I have a problem with a table, values are being changed that wouldn't normally be able to be changed"^^ . . . . . "1"^^ . . "1"^^ . "socks daemon on Lua"^^ . . . . "0"^^ . "0"^^ . . "1"^^ . "How to get neovim to use nvim-tree instead of netrw?"^^ . . "0"^^ . . "1"^^ . "0"^^ . . "If you want to catch carriage return as well, then `:gmatch('([^\\r\\n]*)\\r?\\n')` should work"^^ . "0"^^ . "0"^^ . . "<p>Your <code>loadwithprefix</code> implementation is incorrect:</p>\n<p>You return a function. This is not what you should be doing. You should be calling load with a function, not returning a function which calls load.</p>\n<p>That function also doesn't make much sense: The first time it is called, it loads just the prefix, and returns the resulting function. The second time, it returns the first value returned by <code>chunk</code> - not a function, if <code>chunk</code> is a proper &quot;reader&quot;. It also fails to account for <code>chunk</code> being a string.</p>\n<p>Your testing code also has a minor flaw: <code>f(i)()</code> should be just <code>f(i)</code> if <code>loadwithprefix</code> was implemented correctly. (I also can't make much sense of the prefix. Do you want your suffixes to be something like <code>+ 42</code>?)</p>\n<p>Here's how I would implement <code>loadwithprefix</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>local function loadwithprefix(prefix, chunk, ...)\n local loaded_prefix = false\n return load(function()\n -- first read the prefix\n if not loaded_prefix then\n loaded_prefix = true\n return prefix\n end\n if type(chunk) == &quot;string&quot; then\n local str = chunk -- remember the string\n chunk = function() end -- return nothing the next time\n return str\n end\n return chunk() -- delegate to the original reader\n end, ...)\nend\n</code></pre>\n<p>The <code>...</code> is to pass <code>mode</code> and <code>env</code> arguments (and whatever else might be added in the future) through.</p>\n"^^ . . . "0"^^ . . . "lua-table"^^ . "6"^^ . . . "0"^^ . . . . . "1"^^ . . "sprite"^^ . . . "logitech-gaming-software"^^ . "<p>Debounce should be declared outside of the event handler. When the event is fired, if debounce is currently true, then the function should be returned. Also, combo should be kept track of on the server, with the function in your previous question.</p>\n<pre class="lang-lua prettyprint-override"><code>local debounce = false\n\ngame:GetService(&quot;ReplicatedStorage&quot;).Remotes.M1.OnServerEvent:Connect(function(player)\n if debounce then return end\n debounce = true\n\n ...\n\n task.wait(1) -- ensure that debounce is true for at least one second\n debounce = false\nend)\n</code></pre>\n"^^ . . . . . "0"^^ . . "vim-dadbod-ui configuration for treesitter"^^ . . . . . "0"^^ . "That's actual problem, if it was available as a string, it would be very easy, but it's not, and I need to do very good approximation"^^ . . . "world-of-warcraft"^^ . . . . "Can you share your code so far as a [mcve]? It's difficult to make a recommendation and write a working answer based on a high-level description alone. Thanks."^^ . "fractals"^^ . . . "Of course, but I it wasn't apparent to me from your text that that was your worry or if you had any other motivation for your statement. I'm on the fence whether I should accept your answer as correct or not. Though, it does bring some good context for why a good solution might not exist so I guess I'll accept it for now."^^ . "<p>There is no <code>relativenumber</code> option for the <code>nvim-neo-tree/neo-tree.nvim</code> plugin. You are confusing with the <code>nvim-tree/nvim-tree.lua</code> plugin (<a href="https://github.com/nvim-tree/nvim-tree.lua/discussions/1578" rel="noreferrer">discussion about this option</a>).</p>\n<p>For the <code>neo-tree.nvim</code> plugin, you could enable relativenumber with Lazy via <code>event_handlers</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;nvim-neo-tree/neo-tree.nvim&quot;,\n opts = {\n event_handlers = {\n event = &quot;neo_tree_buffer_enter&quot;,\n handler = function()\n vim.opt_local.relativenumber = true\n end,\n },\n },\n}\n</code></pre>\n"^^ . "neomutt"^^ . . . . "1"^^ . "3"^^ . . . "1"^^ . "1"^^ . ""%w" and "%W" difference in lua?"^^ . . . "2"^^ . "0"^^ . . "2"^^ . . . . . . "0"^^ . . . "0"^^ . . "1"^^ . "roblox"^^ . "I'm still a bit confused, can you please explain more about how these work?"^^ . "1"^^ . . . . "kong-plugin"^^ . "You get your values from:\n`net.Receive("SendToPlayer", function()\n config = net.ReadTable()\n new_config = config\n PrintTable(config)\nend)`\nWhich in turn links to the second hook of the server side code. The config is initially saved in the first hook of the database."^^ . . "0"^^ . . . . . . . . "1"^^ . . "<p>Hello Stack Overflow community,</p>\n<p>I am currently facing an issue with a script in Roblox Studio, where I am attempting to duplicate a player's character upon joining the game. The primary objective is to clone the player's character and relocate the duplicate to a specific position.</p>\n<p>Despite my efforts, the character cloning process doesn't seem to be working as intended. I've added a warning message to help identify the problem, and it consistently outputs &quot;Failed to clone character for player [PlayerName].&quot; I would appreciate any insights or suggestions on how to resolve this issue and successfully duplicate the player's character.</p>\n<p>Thank you in advance for your assistance!</p>\n<p>I have currently tried a few different things but this is the best that I've gotten:</p>\n<pre><code>game.Players.PlayerAdded:Connect(function(player)\n player.CharacterAdded:Connect(function(character)\n local humanoid = character:WaitForChild(&quot;Humanoid&quot;)\n local newCharacter = character:Clone()\n if newCharacter then\n newCharacter.Parent = workspace\n newCharacter:MoveTo(Vector3.new(0, 10, 0))\n else\n warn(&quot;Failed to clone character for player &quot; .. player.Name)\n end\n end)\nend)\n\n</code></pre>\n"^^ . . . "0"^^ . "0"^^ . . . . . . "0"^^ . "0"^^ . . . . . . "0"^^ . . . "0"^^ . . . . "0"^^ . . . "<p>I made a combat system (and made a question before ref a different problem before) and the hitbox always hits more than once if i move around, i tried using a debounce value to make it stop which is common for others, but its still not working, heres the code:</p>\n<pre><code>local deb = game:GetService(&quot;Debris&quot;)\n\ngame.ReplicatedStorage.Remotes.M1.OnServerEvent:Connect(function(player, combo)\n local debounce = false\n --//Debug\\\\--\n print(&quot;Current Combo: &quot; .. combo)\n --//Debug--\\\\\n\n local anims = player.Character:WaitForChild(&quot;Anims&quot;)\n local animator = player.Character.Humanoid:WaitForChild(&quot;Animator&quot;)\n local combo1 = animator:LoadAnimation(anims.Combo1)\n local combo2 = animator:LoadAnimation(anims.Combo2)\n local combo3 = animator:LoadAnimation(anims.Combo3)\n local combo4 = animator:LoadAnimation(anims.Combo4)\n\n local endlag = 1\n if combo == 1 then\n combo1:Play()\n elseif combo == 2 then\n combo2:Play()\n elseif combo == 3 then\n combo3:Play()\n elseif combo == 4 then\n combo4:Play()\n end\n \n local character = player.Character\n if character then\n local hrp = character:FindFirstChild(&quot;HumanoidRootPart&quot;)\n if hrp then\n local damagePart = Instance.new(&quot;Part&quot;)\n damagePart.Material = &quot;ForceField&quot;\n damagePart.Parent = workspace\n damagePart.Size = Vector3.new(5, 5, 5)\n damagePart.Anchored = false\n damagePart.CanCollide = false\n damagePart.Transparency = 0\n damagePart.Name = &quot;DamagePart&quot;\n \n deb:AddItem(damagePart, 0.4)\n\n local weld = Instance.new(&quot;Weld&quot;)\n weld.Part0 = hrp\n weld.Part1 = damagePart\n weld.C0 = CFrame.new(0, 0, 0) -- Adjust the offset as needed\n weld.Parent = hrp\n\n\n damagePart.Touched:Connect(function(otherPart)\n local humanoid = otherPart.Parent:FindFirstChild(&quot;Humanoid&quot;)\n if humanoid and humanoid.Parent ~= player.Character and not debounce then\n spawn(function()\n debounce = true\n wait(1)\n debounce = false\n end)\n local stunned = otherPart.Parent:FindFirstChild(&quot;Stunned&quot;)\n\n if not stunned then\n stunned = Instance.new(&quot;BoolValue&quot;)\n stunned.Name = &quot;Stunned&quot;\n stunned.Parent = otherPart.Parent\n end\n\n local blocking = otherPart.Parent:FindFirstChild(&quot;Blocking&quot;)\n\n if otherPart.Parent:FindFirstChild(&quot;Blocking&quot;).Value == false then\n game.ReplicatedStorage.Sounds:WaitForChild(&quot;Hit&quot;):Play()\n humanoid:TakeDamage(4)\n elseif otherPart.Parent:FindFirstChild(&quot;Blocking&quot;).Value == true then\n game.ReplicatedStorage.Sounds:WaitForChild(&quot;BlockHit&quot;):Play()\n print(&quot;Opponent is blocking, no damage&quot;)\n return\n end\n\n if not blocking then\n stunned = Instance.new(&quot;BoolValue&quot;)\n stunned.Name = &quot;Blocking&quot;\n stunned.Parent = otherPart.Parent\n end\n\n stunned.Value = true\n humanoid.WalkSpeed = 0\n wait(endlag)\n\n if stunned then\n humanoid.WalkSpeed = 16\n stunned.Value = false\n end\n end\n end)\n end\n end\nend)\n\ngame.ReplicatedStorage.Remotes:WaitForChild(&quot;Block&quot;).OnServerEvent:Connect(function(player, blocking)\n if blocking == true then\n player.Character.Blocking.Value = true\n player.Character.Humanoid.WalkSpeed = 6\n elseif blocking == false then\n player.Character.Blocking.Value = false\n player.Character.Humanoid.WalkSpeed = 16\n end\nend)\n\n</code></pre>\n<p>I tried making the debounce a global variable, I tried making it be inside the remote when it happens on server event, still nothing worked. Please help!</p>\n"^^ . . "neovim"^^ . . . . . . "0"^^ . . "1"^^ . . . . . "1"^^ . . . . . . . "0"^^ . . . "<p>missing a comma after</p>\n<pre><code>'sfx/dlc_veyronsound/veyronsound_npc.awc'\n</code></pre>\n<p>it's the 4th last in that block</p>\n"^^ . . . "0"^^ . . "<p>According to <a href="https://github.com/nvim-treesitter/nvim-treesitter/wiki/Windows-support#:%7E:text=*.so%20is%20not%20valid%20WIN32%20application" rel="nofollow noreferrer">this</a>, for treesitter to work on windows it needs a few extra steps. In the link you will find the steps but in my opinion just use WSL and run LazyVim in there, it's gonna be much easier.</p>\n"^^ . . . . "I use `-o foo.so -bundle -undefined dynamic_lookup` when creating C libraries for Lua that are meant to be dynamically loaded in macOS. See examples at https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/."^^ . "0"^^ . "1"^^ . . . . . . "<p>I am creating a system that allows the player to still interact with ClickDetectors while using a Tool. I need to access the local player and mouse in a SERVER-side script. I am trying to make it so that when the item is unequipped, an enemy will ignore you. That part worked, but the ClickDetectors don't.</p>\n<p>I have tried using RemoteEvents to pass along the local player and mouse target, but it didn't seem to work. The three scripts below are what I used:</p>\n<p>Server-Side Script</p>\n<pre><code>local plr\nlocal mouseTarget\n\ngame.ReplicatedStorage.Tool.OnServerEvent:Connect(function(player, mouseTarget2)\n plr = player\n mouseTarget = mouseTarget2\nend)\n\nprint(plr, mouseTarget)\n\nscript.Parent.Equipped:Connect(function()\n game.ReplicatedStorage.LanternEvents.Equipped:FireClient(plr)\nend)\n\nscript.Parent.Unequipped:Connect(function()\n game.ReplicatedStorage.LanternEvents.UnEquipped:FireClient(plr)\nend)\n\nscript.Parent.Activated:Connect(function()\n if mouseTarget:FindFirstChildWhichIsA(&quot;ClickDetector&quot;) then\n if mouseTarget.Name == &quot;Paper&quot; then\n game.ReplicatedStorage.PaperEvents.PaperEvent1:FireClient(plr)\n plr.CameraMode = Enum.CameraMode.Classic\n elseif mouseTarget.Parent.Name == &quot;Keypad&quot; then\n game.ReplicatedStorage.KeypadEvent:FireClient(plr)\n elseif mouseTarget.Parent.Name == &quot;Lighter&quot; then\n game.Workspace.Values.CollectedLighter.Value = true\n mouseTarget:Destroy()\n else\n game.Workspace.Values.Collected.Value += 1\n mouseTarget:Destroy()\n end\n end\nend)\n</code></pre>\n<p>Local Script:</p>\n<pre><code>local player = game.Players.LocalPlayer\n\nlocal mouse = player:GetMouse()\n\nlocal mouseTarget = mouse.Target\n\nwhile wait(0.01) do\n game.ReplicatedStorage.Tool:FireServer(mouseTarget)\nend\n</code></pre>\n<p>The Output is: Nil Nil.</p>\n<p>Thank you in advance,\nProgramming_Good_Games.</p>\n"^^ . "0"^^ . "1"^^ . . . . . "1"^^ . "markdown"^^ . "0"^^ . . . . "0"^^ . . "<p>After some thought and over simplification, I can just subtract the normalized (only positive numbers) orientations to get the difference and work from there. Angle = Player - Entity.</p>\n"^^ . "0"^^ . . . . . . "0"^^ . . . . . "Does `records:duplicaterecord(i);` create a new record at the end of the whole list `records`? Or it may insert the new record in the middle?"^^ . . . . . "0"^^ . "1"^^ . . . . . "2"^^ . "End is fine as it will be sorted after script is ran"^^ . . . . "simulator"^^ . . . "<p>I've found the trick. Here's my overall cmp.lua:</p>\n<pre><code>local lspkind = require &quot;lspkind&quot;\nlocal default_options = require &quot;plugins.configs.cmp&quot;\n\nlocal overriding_options = {\n completion = {\n keyword_length = 3,\n },\n performance = {\n max_view_entries = 7,\n },\n view = {\n docs = {\n auto_open = false,\n },\n },\n\n -- that's it\n formatting = {\n format = lspkind.cmp_format {\n before = function(_entry, vim_item)\n if vim_item.menu ~= nil and string.len(vim_item.menu) &gt; 0 then\n vim_item.menu = string.sub(vim_item.menu, 1, 0) .. &quot;&quot;\n end\n return vim_item\n end,\n },\n },\n}\n\nlocal overall_options = vim.tbl_deep_extend(&quot;force&quot;, default_options, overriding_options)\n\nreturn overall_options\n</code></pre>\n<p>And the result:\n<a href="https://i.sstatic.net/tkLDu.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tkLDu.png" alt="enter image description here" /></a></p>\n"^^ . "Html video to vlc deep link"^^ . "Roblox Studio - Function unintentionally running multiple times at once"^^ . . . . "<p>Good evening,</p>\n<p>I built a Pandoc Lua filter to convert the Markdown syntax code for the menukeys to HTML, inspired by the $\\LaTeX$ package <a href="https://ctan.org/pkg/menukeys" rel="nofollow noreferrer"><code>menukeys</code></a>.</p>\n<p>Here is an example of Markdown syntax code:</p>\n<pre><code>Path: `&gt; C &gt; Users &gt; {usuario} &gt; AppData &gt; Roaming &gt; nvm`\nPath: `&gt; Network &amp; Internet &gt; Wi-Fi &gt; Hardware Properties`\n</code></pre>\n<p>It will become into HTML:</p>\n<pre class="lang-html prettyprint-override"><code>&lt;p&gt; Path: \n &lt;span class=&quot;menukeys&quot;&gt;\n &lt;span class=&quot;menukey&quot;&gt;C&lt;/span&gt;\n &lt;span class=&quot;menukey&quot;&gt;Users&lt;/span&gt;\n &lt;span class=&quot;menukey&quot;&gt;{usuario}&lt;/span&gt;\n &lt;span class=&quot;menukey&quot;&gt;AppData&lt;/span&gt;\n &lt;span class=&quot;menukey&quot;&gt;Roaming&lt;/span&gt;\n &lt;span class=&quot;menukey&quot;&gt;nvm&lt;/span&gt;\n &lt;/span&gt;\n&lt;/p&gt;\n\n&lt;p&gt; Path: \n &lt;span class=&quot;menukeys&quot;&gt;\n &lt;span class=&quot;menukey&quot;&gt;Network &amp; Internet&lt;/span&gt;\n &lt;span class=&quot;menukey&quot;&gt;Wi-Fi&lt;/span&gt;\n &lt;span class=&quot;menukey&quot;&gt;Hardware Properties&lt;/span&gt;\n &lt;/span&gt;\n&lt;/p&gt;\n</code></pre>\n<p>But only the second paragraph was wrongly converted due a space for the symbols or the sentence, because it became into:</p>\n<pre class="lang-html prettyprint-override"><code>&lt;p&gt; Path: \n &lt;span class=&quot;menukeys&quot;&gt;\n &lt;span class=&quot;menukey&quot;&gt;Network&lt;/span&gt;\n &lt;span class=&quot;menukey&quot;&gt;&amp;amp;&lt;/span&gt;\n &lt;span class=&quot;menukey&quot;&gt;Internet&lt;/span&gt;\n &lt;span class=&quot;menukey&quot;&gt;Wi-Fi&lt;/span&gt;\n &lt;span class=&quot;menukey&quot;&gt;Hardware&lt;/span&gt;\n &lt;span class=&quot;menukey&quot;&gt;Properties&lt;/span&gt;\n &lt;/span&gt;\n&lt;/p&gt;\n</code></pre>\n<p>It looked like:</p>\n<p><a href="https://i.sstatic.net/8cmpi.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8cmpi.png" alt="Before" /></a></p>\n<p>It should look like:</p>\n<p><a href="https://i.sstatic.net/YOO6M.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/YOO6M.png" alt="After" /></a></p>\n<p>Follow the follow Pandoc Lua filter code:</p>\n<pre class="lang-lua prettyprint-override"><code>function string:split(separator)\n local fields = {}\n local pattern = string.format(&quot;([^%s]+)&quot;, separator)\n self:gsub(pattern, function(c) fields[#fields + 1] = c end)\n return fields\nend\n\nfunction Code(elem)\n if elem.text:sub(1, 1) == &quot;&gt;&quot; then\n local parts = elen.text:sub(2):split(&quot; &gt; &quot;)\n local newContent = &quot;&quot;\n \n for i, part in ipairs(parts) do\n newContent = newContent .. 'span class=&quot;menukey&quot;&gt;' .. part .. '&lt;/span&gt;'\n end\n\n newContent = '&lt;span class=&quot;menukeys&quot;&gt;' .. newContent .. '&lt;/span&gt;'\n\n return pandoc.RawInline('html', newContent)\n end\nend\n</code></pre>\n"^^ . . "0"^^ . . . . "shared-libraries"^^ . . . . . "0"^^ . . . . . "1"^^ . . . "Grapple hooking with LineForces in Roblox Studio?"^^ . "filenames"^^ . . . . . . "0"^^ . . . . . . "0"^^ . "It seems that it does. Many thanks for that (I don't understand all of it, but copy paste should do it!!!)"^^ . . "<p>The <code>Lua</code> file shouldn't be referred to in the <code>lua</code> object. The object should be simply <code>{lua conky_rss}</code>.</p>\n<p>The <code>Lua</code> file <strong>should</strong> be referred to in a <code>lua_load</code> option in the <code>conky.config</code> section of <code>Conky.text</code>. That option should be <code>lua_load = '/home/Cthulhu/.conky/My_Script/Script_Sources/conky-rss.lua',</code>.</p>\n"^^ . . . . . . . "I use docker compose to init the env variables"^^ . . . . . . "0"^^ . . . . . . "0"^^ . . "Are you sure the code works fine? AFAIC `self` is undefined, so `getmetatable(self)` should report an error. Additionally the `New` function returns nothing, so listview is nil. Besides I don't understand the purpose of the setmetatable line, Do the 2 self refer to the same thing?"^^ . "lua-api"^^ . . "0"^^ . "2"^^ . "<p>I am making a grappling hook for a game about grappling through floating islands while collecting treasure, and recently I've been playing around with constraints and forces (vector forces, line forces, spring / rope constraints, etc.,). Anyways, I tried adapting a script to use line forces instead of rope constraints, but it is not working. There are no errors, so I am <em>very</em> confused.</p>\n<p>I tried using this code:</p>\n<pre><code>local player = game.Players.LocalPlayer\nlocal HumanoidRootPart = player.Character:WaitForChild(&quot;HumanoidRootPart&quot;)\nlocal mouse = player:GetMouse()\nlocal debounce = false\nlocal mouseDown = false\n\nlocal MaxDistance = 300\nlocal Magnitude = 10000\nlocal RopeVisible = true\nlocal RopeColor = BrickColor.new(&quot;Cocoa&quot;)\n\nlocal function distance_between_vectors(u, v)\n local difference = u - v\n local distance = difference.Magnitude\n \n distance = math.floor(distance / 1 + 0.5) * 1\n return distance\nend\n\nlocal function Attachment(method, parent)\n if method == &quot;Create&quot; then\n local Attachment = Instance.new(&quot;Attachment&quot;)\n Attachment.Parent = parent\n else\n parent.Attachment:Destroy()\n end\nend\n\nmouse.Button1Up:Connect(function()\n mouseDown = false\nend)\n\nmouse.Button1Down:Connect(function()\n mouseDown = true\n if debounce == false then\n debounce = true\n local hitPosition = mouse.Hit.Position\n local distance = distance_between_vectors(hitPosition, HumanoidRootPart.Position)\n if distance &lt;= MaxDistance then\n local newPart = Instance.new(&quot;Part&quot;)\n newPart.Anchored = true\n newPart.Parent = game.Workspace\n newPart.Position = hitPosition\n newPart.Transparency = 0\n Attachment(&quot;Create&quot;, newPart)\n Attachment(&quot;Create&quot;, HumanoidRootPart)\n local Rope = Instance.new(&quot;LineForce&quot;)\n Rope.Parent = newPart\n Rope.Attachment0 = newPart.Attachment\n Rope.Attachment1 = HumanoidRootPart.Attachment\n Rope.Magnitude = Magnitude\n Rope.Visible = RopeVisible\n Rope.Color = RopeColor\n Rope.MaxForce = 1000\n while mouseDown == true do\n wait()\n end\n Attachment(&quot;Destroy&quot;, newPart)\n Attachment(&quot;Destroy&quot;, HumanoidRootPart)\n newPart.LineForce:Destroy()\n newPart:Destroy()\n end\n debounce = false\n end\nend)\n</code></pre>\n<p>This, for some reason, refuses to work. Can anyone help me?</p>\n<p>Thank you,\nProgramming_Good_Games</p>\n"^^ . "0"^^ . . . . . . "0"^^ . . . . . . . "0"^^ . . "Why can't I unban player?"^^ . "0"^^ . "0"^^ . . "1"^^ . "0"^^ . . . . "0"^^ . "<p>I have been trying to save 2 values for a game that I'm working on, and I Can't get the script to work for some reason.</p>\n<p>Here is the script -</p>\n<pre><code>local Players = game:GetService(&quot;Players&quot;)\nlocal DataStoreService = game:GetService(&quot;DataStoreService&quot;)\n\nlocal SufferingsStore = DataStoreService:GetDataStore(&quot;Sufferings&quot;)\nlocal SufferCoinsStore = DataStoreService:GetDataStore(&quot;SufferCoins&quot;)\n\nlocal function leaderboard(player)\nlocal leaderstats = Instance.new(&quot;Folder&quot;)\nleaderstats.Name = &quot;leaderstats&quot;\nleaderstats.Parent = player\n\nlocal SufferCoins = Instance.new(&quot;IntValue&quot;)\nSufferCoins.Name = &quot;SufferCoins&quot;\nSufferCoins.Parent = leaderstats\n\nlocal Sufferings = Instance.new(&quot;IntValue&quot;)\nSufferings.Name = &quot;Sufferings&quot;\nSufferings.Parent = leaderstats\n\nlocal data1, data2\nlocal success, errorMessage = pcall(function()\n data1 = SufferCoinsStore:GetAsync(player.UserId.. &quot;-SufferCoins&quot;)\n data2 = SufferingsStore:GetAsync(player.UserId.. &quot;-Sufferings&quot;)\nend)\n\nif success then\n SufferCoins.Value = data1\n Sufferings.Value = data2\n print(&quot;Data succesfuly loaded for &quot; .. player.Name)\nelse\n warn(errorMessage)\nend\nend\n\nlocal function saveData(player)\nlocal success, errorMessage = pcall(function()\n SufferCoinsStore:SetAsync(player.UserId.. &quot;-SufferCoins&quot;, player.leaderstats.SufferCoins.Value)\n SufferingsStore:SetAsync(player.UserId.. &quot;-Sufferings&quot;, player.leaderstats.Sufferings.Value)\nend)\n\nif success then\n print(&quot;Data Saved for &quot; .. player.Name)\nelse\n print(&quot;An Error Occurred While Saving for &quot; .. player.Name)\n warn(errorMessage)\nend\nend\n\nPlayers.PlayerAdded:Connect(function(player)\nleaderboard(player)\n\nplayer.CharacterAdded:Connect(function()\n leaderboard(player)\nend)\nend)\n\nPlayers.PlayerRemoving:Connect(function(player)\nsaveData(player)\nend)\n\nfor _, player in pairs(Players:GetPlayers()) do\nleaderboard(player)\nend\n</code></pre>\n<p>I tried watching Youtube Tutorials, asking ChatGPT(it was helpful once) and I hoped the Data would save. The script ended up not doing much, only printing out that it loaded / saved the data without actualy doing so.</p>\n"^^ . . "0"^^ . . . . "You need to check in your while loop if the button was pressed again. Once you enter the loop and it runs forever nothing else outside of the loop is executed."^^ . "1"^^ . . . "<p>I am using it like this and it works:</p>\n<pre><code>local inputDir = 'D:/Lua/'\nlocal fileNames = {}\nlocal filesString = io.popen('dir &quot;'..inputDir..'&quot; /b /a-d'):read(&quot;*a&quot;)\nfor fileName in filesString:gmatch(&quot;[^\\r\\n]+&quot;) do\n fileName = fileName:gsub(&quot;%.txt&quot;, &quot;&quot;)\n table.insert(fileNames, fileName)\nend\n</code></pre>\n"^^ . . . "@Fernando try `:gmatch('([^\\n]*)\\n')` instead of `:gmatch("[^\\r\\n]+")`"^^ . . . "nvim-lspconfig"^^ . . "0"^^ . "<p>Just starting to learn Neovim and I m struggling with something that might be a simple to fix for someone experienced.</p>\n<p>Using LazyVim distribution for Neovim which internally use <code>Lazy.nvim</code> as plugin manager and uses <a href="https://github.com/nvim-neo-tree/neo-tree.nvim" rel="nofollow noreferrer">neo-tree</a> as one of the plugins.</p>\n<p>I want to configure neo-tree plugin to show relative line numbers in its file explorer.</p>\n<p>Using <a href="https://github.com/nvim-tree/nvim-tree.lua/issues/422#issuecomment-1010372867" rel="nofollow noreferrer">this</a> and <a href="https://github.com/LazyVim/starter/blob/741ff3aa70336abb6c76ee4c49815ae589a1b852/lua/plugins/example.lua#L63" rel="nofollow noreferrer">this</a> as referance, I made a new file in <code>plugins/neo-tree.lua</code> with this as contents:</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n {\n &quot;nvim-neo-tree/neo-tree.nvim&quot;,\n opts = {\n view = {\n relativenumber = true,\n },\n },\n },\n}\n</code></pre>\n<p>Now after this, when I restart, I should see line number but I don't. What could go wrong here?</p>\n<p>Note: When I m in the neo-tree buffer and i <code>set number</code>, I see line numbers.</p>\n"^^ . . . . . "<p>You need to move <code>lua require('init')</code> after <code>call plug#end()</code>, otherwise the plugin hasn't loaded yet, and you can't use it.</p>\n"^^ . "0"^^ . "0"^^ . . . . "1"^^ . "1"^^ . "environment-variables"^^ . "1"^^ . . . . . . . "2"^^ . . "<p>I made this simple datastore script that should load the datastore and add the values to your leaderstats. It fails at line 29, which is marked in the script. What am I doing wrong?</p>\n<pre class="lang-lua prettyprint-override"><code>local dts = game:GetService(&quot;DataStoreService&quot;)\nlocal money = dts:GetDataStore(&quot;Currency-0&quot;)\n\n\n\n--Currency is set up like this:\n\n--{CASH, GEMS}\n\n--It is a table storing both values.\n\n\ngame.Players.PlayerAdded:Connect(function(plr)\nlocal model = Instance.new(&quot;Model&quot;) -- lets set up our leaderstats!\n model.Name = &quot;leaderstats&quot;\n model.Parent = plr\nlocal moneyValue = Instance.new(&quot;IntValue&quot;)\n moneyValue.Name = &quot;Cash&quot;\nlocal gemValue = Instance.new(&quot;IntValue&quot;)\n gemValue.Name = &quot;Gems&quot;\n \nlocal key = &quot;USER_&quot; .. plr.Name .. &quot;_&quot; .. plr.UserId -- advanced player key\n\nlocal storedCash -- setting up a variable\nlocal success, err = pcall(function()\n storedCash = money:GetAsync(key)\nend)\nif success then\n moneyValue.Value = storedCash[1] -- this is the line that messes up\n gemValue.Value = storedCash[2]\n -- we've set that, now we must make it show\n moneyValue.Parent = model\nelse\n moneyValue.Value = 0\n gemValue.Value = 0\n money:SetAsync(key, {0, 0}) \nend\nend)\n</code></pre>\n<p>My error: :29: attempt to index local 'storedCash' (a nil value)</p>\n<p>I made a simple datastore script, and it should have been adding the values to the leaderstats. But it shows an error on line 29, what did I do wrong?</p>\n"^^ . . . "<p>In my humble opinion, this is not the case when recursion would be useful. Since you need to count the iterations, special measures, like additional parameters, need to be taken to store the current iteration count.</p>\n<p>However, below is the code, where you can choose recursive or non-recursive variants of the function by commenting out one of them. To make it more beautiful and hopefully, to get more points, the code is made somewhat more generic. It relies on a small library for complex numbers. Tables with methods are not used.</p>\n<pre class="lang-lua prettyprint-override"><code>-- get complex.lua from https://codereview.stackexchange.com/questions/252982/complex-number-class-in-lua.\nlocal complex = require 'complex'\n\n--[[\nGet the iteration, at which the recursive function exceeds the limit. Not recursive.\n\n @param function func -- the recursive function to check,\n @param number limit -- limit to exceed,\n @param number max_iterations -- maximum number of iterations,\n @return number -- iteration at which the limit is exceeded, but not more than max_iterations.\n--]]\nlocal function iteration (func, limit, max_iterations)\n local z, iteration = complex (0), 0\n while iteration &lt; max_iterations and z:abs () &lt;= limit do\n z, iteration = func (z), iteration + 1\n end\n return iteration\nend\n\n--[[\nGet the iteration, at which the recursive function exceeds the limit. Recursive.\n\n @param function func -- the recursive function to check,\n @param number limit -- limit to exceed,\n @param number max_iterations -- maximum number of iterations,\n @param complex z -- current value in the series; 0 by default,\n @param number iteration -- the current iteration; 0 by default.\n @return number -- iteration at which the limit is exceeded, but not more than max_iterations.\n--]]\nlocal function iterationRecursive (func, limit, max_iterations, z, iteration)\n local z, iteration = z or complex (0), iteration or 0\n if iteration &gt;= max_iterations or z:abs() &gt; limit then\n return iteration\n end\n z, iteration = func (z), iteration + 1\n return iterationRecursive (func, limit, max_iterations, z, iteration)\nend\n\n--[[\n Generate f_c (z) = z^2 + c function for the given c.\n \n @param complex c\n @return function\n--]]\nlocal function makeMandelbrot (c)\n return function (z)\n return z ^ 2 + c\n end\nend\n\nlocal limit, max_iterations = 2, 100\nlocal range = {-1, -0.5, 0, 0.5, 1}\nfor _, re in ipairs (range) do\n for __, im in ipairs (range) do\n local c = complex (re, im)\n local mandelbrot = makeMandelbrot (c)\n --local iter = iteration (mandelbrot, limit, max_iterations)\n local iter = iterationRecursive (mandelbrot, limit, max_iterations)\n print ('c = ' .. tostring (c) .. ':\\t' .. tostring (iter) .. ' iterations')\n end\nend\n</code></pre>\n"^^ . . . "As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . . "1"^^ . . "<p>The PiL book you read is the first edition which was written for Lua <strong>5.0</strong>. In the newer edition (since 2nd) the term &quot;C Packages&quot; has been changed to &quot;C <strong>Modules</strong>&quot;. So the answer is already very clear.</p>\n<p>In addition, the book also provides the definition of package:</p>\n<blockquote>\n<p>Starting in version 5.1, Lua has defined a set of policies for modules and packages (a package being a collection of modules).</p>\n</blockquote>\n"^^ . . . . . . . . "Thank you for contributing to the Stack Overflow community. This may be a correct answer, but it’d be really useful to provide additional explanation of your code so developers can understand your reasoning. This is especially useful for new developers who aren’t as familiar with the syntax or struggling to understand the concepts. **Would you kindly [edit] your answer to include additional details for the benefit of the community?**"^^ . . . . "math"^^ . . "0"^^ . "1"^^ . . . "how to access meta data from quarto YAML in lua script"^^ . . . . . "6"^^ . . "Approaching OOP in Lua"^^ . . . "Saving 2 player values in a Roblox leaderboard"^^ . "0"^^ . . . . "3"^^ . "The Lua book just doesn't use that terminology because this distinction exists pretty much only on the Apple ecosystem (in Linux and Windows there's no such difference, there are only SO's/DLLs), and even there it's not a really major difference (you can still dlopen a dylib)."^^ . . "lpeg.Cmt and empty loop body"^^ . "<p>I have this assignment from the official book about lua:\nExercise 16.1: Frequently, it is useful to add some prefix to a chunk of code when loading it. (We saw an example previously in this chapter, where we prefixed a return to an expression being loaded.) Write a function loadwithprefix that works like load, except that it adds its extra first argument (a string) as a prefix to the chunk being loaded.\nLike the original load, loadwithprefix should accept chunks represented both as strings and as reader functions. Even in the case that the original chunk is a string, loadwithprefix should not actually concatenate the prefix with the chunk. Instead, it should call load with a proper reader function that first returns the prefix and then returns the original chunk.</p>\n<pre><code>function loadwithprefix(prefix, chunk)\n\nlocal prefixflg = true\nreturn function(...)\n local x = select(1, ...)\n local env = { x = x, __index = { _G = _G } }\n\n if not prfxflg then\n prfxflg = true\n return load(prefix, nil, nil, env)\n else\n return load(' return ' .. code(), nil, nil, env)\n end\nend\nend\n\nlocal line = io .read()\nlocal f = loadwithprefix('local x = ...; return x ', function(...) return line end)\n\nfor i = 1, 10 do\n print(string.rep('*', f(i)()))\nend\n</code></pre>\n<p>I get : bad argument #2 to 'rep' (number expected, got nil) meaning i cannot evaluate the local x = ...; return x to actually return 1 from the for-loop statement. Any suggestion?</p>\n"^^ . . . "1"^^ . . . . . . . "Thank you! Thats it! Clearly I didn't read or understand the nvim-tree docs well enough. \n\nWhy is it that some plugins do not require a `require(plugin).setup({})` and others do? Is it usually dependent on what the plugin does or the "size" of the plugin (size as in, does this plugin make big changes or small changes?)"^^ . . . . . . "1"^^ . . "1"^^ . "reflection"^^ . . "`for found in S:gmatch("[%d%.]+") do print(found) end`"^^ . "0"^^ . . "1"^^ . "1"^^ . . "0"^^ . "0"^^ . . "1"^^ . . . . "<p>I have been using nvim for a couple months now and 90% of the time everything works smoothly.</p>\n<p>Sometimes when I open nvim on my laptop (the same config works fine on my PC) I get the following error:</p>\n<pre><code>Error detected while processing BufReadPost Autocommands for &quot;*&quot;:\nError executing lua callback: /home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24: Error executing lua: /home/fergus/nvim-linux64/share/nvim/runtime/filetype\n.lua:25: BufReadPost Autocommands for &quot;*&quot;..FileType Autocommands for &quot;*&quot;: Vim(append):Error executing lua callback: ...cal/share/nvim/lazy/LuaSnip/lua/luasnip/loaders\n/init.lua:139: attempt to index field 'loaded_fts' (a nil value)\nstack traceback:\n ...cal/share/nvim/lazy/LuaSnip/lua/luasnip/loaders/init.lua:139: in function 'load_lazy_loaded'\n ...fergus/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:87: in function &lt;...fergus/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:86&gt;\n [C]: in function 'nvim_cmd'\n /home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:25: in function &lt;/home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24&gt;\n [C]: in function 'nvim_buf_call'\n /home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24: in function &lt;/home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:10&gt;\nstack traceback:\n [C]: in function 'nvim_cmd'\n /home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:25: in function &lt;/home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24&gt;\n [C]: in function 'nvim_buf_call'\n /home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24: in function &lt;/home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:10&gt;\nstack traceback:\n [C]: in function 'nvim_buf_call'\n /home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24: in function &lt;/home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:10&gt;\nError detected while processing BufWinEnter Autocommands for &quot;*&quot;:\nError executing lua callback: ...cal/share/nvim/lazy/LuaSnip/lua/luasnip/loaders/init.lua:139: attempt to index field 'loaded_fts' (a nil value)\nstack traceback:\n ...cal/share/nvim/lazy/LuaSnip/lua/luasnip/loaders/init.lua:139: in function 'load_lazy_loaded'\n ...fergus/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:87: in function &lt;...fergus/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:86&gt;\n\n</code></pre>\n<p>I have tried removing all autocommands in my nvim config but I end up getting a different error instead, I'm not sure what is causing the issue.</p>\n<p><a href="https://github.com/FergusJJ/nvim-config" rel="nofollow noreferrer">My nvim config (lua)</a></p>\n<p>Edit:</p>\n<p>Sometimes I also get:\n<code>Error detected while processing BufWinEnter Autocommands for &quot;*&quot;</code></p>\n<p>When starting nvim</p>\n"^^ . . "1"^^ . "0"^^ . "1"^^ . "<p>%w and %W as in here: <code>Str = string.gsub(Str, “%f[%w]cat%f[%W]”</code></p>\n<p>What's the difference between a small %w and a big %W ?</p>\n<p>Here are more examples: <code>for _ in string.gmatch(“\\n” .. Str .. “\\n”, “%Wcat%W”) do</code> ,</p>\n<p><code>if Pos1 == 0 or string.find(Str, “^%W”, Pos1) then</code></p>\n<p>I know %w matches a word character</p>\n<p>So i expect %W matches a capital word character?</p>\n"^^ . "html"^^ . "2"^^ . "1"^^ . . . "0"^^ . . . "0"^^ . . . . . "They are assigned `nil`s there. Where have you assigned objects to these variables?"^^ . . . . . "1"^^ . "0"^^ . . . "0"^^ . . . "If you add this link to the code I'll accept you answer: https://github.com/lua/lua/blob/e288c5a91883793d14ed9e9d93464f6ee0b08915/lua.c#L574"^^ . "0"^^ . . . "0"^^ . . . . . . . "1"^^ . . . "0"^^ . "<p>I'm trying to update the theme of my neovim similar to vscode.\nI found this Plugin for the neovim to do that: <a href="https://github.com/Mofiqul/vscode.nvim" rel="nofollow noreferrer">https://github.com/Mofiqul/vscode.nvim</a></p>\n<p>I followed the documentation which what I did is put <code>Plug 'Mofiqul/vscode.nvim'</code> in the <code>~/.config/nvim/init.vim</code>, and ran the command <code>:PlugInstall</code> which it installed the Plugin on the <code>~/.config/nvim/Plugged/vscode.nvim</code></p>\n<p>After that I create a lua directory and a <code>init.lua</code> file to create the usage for the plugin: <code>~/.config/nvim/lua/init.lua</code></p>\n<p>After I did those step when I tried to open nvim It shows me this:</p>\n<pre><code>Error detected while processing /home/user/.config/nvim/init.vim:\nline 3:\nE5108: Error executing lua /home/user/.config/nvim/lua/init.lua:7: module 'vscode.colors' not found:\n no field package.preload['vscode.colors']\n no file './vscode/colors.lua'\n no file '/usr/share/luajit-2.1.0-beta3/vscode/colors.lua'\n no file '/usr/local/share/lua/5.1/vscode/colors.lua'\n no file '/usr/local/share/lua/5.1/vscode/colors/init.lua'\n no file '/usr/share/lua/5.1/vscode/colors.lua'\n no file '/usr/share/lua/5.1/vscode/colors/init.lua'\n no file './vscode/colors.so'\n no file '/usr/local/lib/lua/5.1/vscode/colors.so'\n no file '/usr/lib/x86_64-linux-gnu/lua/5.1/vscode/colors.so'\n no file '/usr/local/lib/lua/5.1/loadall.so'\n no file './vscode.so'\n no file '/usr/local/lib/lua/5.1/vscode.so'\n no file '/usr/lib/x86_64-linux-gnu/lua/5.1/vscode.so'\n no file '/usr/local/lib/lua/5.1/loadall.so'\nstack traceback:\n [C]: in function 'require'\n /home/user/.config/nvim/lua/init.lua:7: in main chunk\n [C]: in function 'require'\n [string &quot;:lua&quot;]:1: in main chunk\n</code></pre>\n<p>This is my init.vim file:</p>\n<pre><code>:set number\n\nlua require('init')\n\ncall plug#begin()\n\n\nPlug 'http://github.com/tpope/vim-surround' &quot; Surrounding ysw)\nPlug 'https://github.com/preservim/nerdtree' &quot; NerdTree\nPlug 'https://github.com/tpope/vim-commentary' &quot; For Commenting gcc &amp; gc\nPlug 'https://github.com/vim-airline/vim-airline' &quot; Status bar\nPlug 'https://github.com/ap/vim-css-color' &quot; CSS Color Preview\nPlug 'https://github.com/rafi/awesome-vim-colorschemes' &quot; Retro Scheme\nPlug 'https://github.com/neoclide/coc.nvim' &quot; Auto Completion\nPlug 'https://github.com/ryanoasis/vim-devicons' &quot; Developer Icons\nPlug 'https://github.com/tc50cal/vim-terminal' &quot; Vim Terminal\nPlug 'https://github.com/preservim/tagbar' &quot; Tagbar for code navigation\nPlug 'https://github.com/terryma/vim-multiple-cursors' &quot; CTRL + N for multiple cursors\n&quot;Plug 'tomasiser/vim-code-dark'\n&quot;Plug 'catppuccin/nvim', { 'as': 'catppuccin' }\n&quot;Plug 'rktjmp/lush.nvim'\n&quot;Plug 'rockyzhang24/arctic.nvim'\nPlug 'Mofiqul/vscode.nvim'\n\n\ncall plug#end()\n\n&quot; colorscheme catppuccin-mocha\n&quot;colorscheme codedark\n&quot; colorscheme arctic\n\n\nset encoding=UTF-8\n\nlet g:NERDTreeDirArrowExpandable=&quot;+&quot;\nlet g:NERDTreeDirArrowCollapsible=&quot;~&quot;\nlet g:coc_disable_startup_warning = 1\nlet g:WebDevIconsUnicodeDecorateFolderNodes=1\n</code></pre>\n<p>Is any way to solve this ?</p>\n"^^ . "0"^^ . . . "0"^^ . "1"^^ . . "1"^^ . "1"^^ . "0"^^ . . . "<p>Let's break down your program to help understand your assumptions and how to correct them.</p>\n\n<pre class="lang-lua prettyprint-override"><code>print ('Hello, make a face, ')\n</code></pre>\n<p>This does exactly what it you think it does, it prints the string <code>'Hello, make a face, '</code> into the console on its own line. This is correct.</p>\n<pre class="lang-lua prettyprint-override"><code>local face = io.read()\n</code></pre>\n<p>Likewise, this correctly requests a line of text from the user, and stores it in the <a href="https://www.lua.org/pil/4.2.html" rel="nofollow noreferrer">local</a> variable <code>face</code></p>\n<pre class="lang-lua prettyprint-override"><code>local t = {&quot;{:) , :), &quot;}\n</code></pre>\n<p>This is the first incorrect assumption. Whilst <code>local t = </code> would correctly assign to the value t, <code>{&quot;{:) , :), &quot;}</code> does not do what you seem to expect. This creates a <a href="https://www.lua.org/pil/2.5.html" rel="nofollow noreferrer">table</a> with one value, <code>&quot;{:) , :), &quot;</code>. Note that the double qoutes entirely encapsulate the value, meaning it couldn't be two seperate values. What you should have in this instance is <code>{&quot;:)&quot;, &quot;:)&quot;}</code>, which contains two values instead.</p>\n<p>It's worth noting even corrected this table contains the same value twice, I am not sure that this was intended, but I cannot assume the correct formatting.</p>\n<pre class="lang-lua prettyprint-override"><code>if local face (t1) then print (&quot; :0 &quot;)\n</code></pre>\n<p>There are a handful of incorrect assumptions here. <code>local face</code> in this instance is incorrect, <code>face</code> was already previously assigned as a local variable. The <code>local</code> keyword should only be used when defining the variable, not referencing it. Additionally, you seem to be attempting to compare <code>face</code> to the first entry of the table via <code>face (t1)</code>, this is very wrong, and should be done via <code>face == t[1]</code>. Note that <code>[1]</code> is used to retreive the value at position <code>1</code> from the table <code>t</code>, and equality is checked with the equality operator, <code>==</code>. Finally, you have not closed your <a href="https://www.lua.org/pil/4.3.1.html" rel="nofollow noreferrer"><code>if then</code></a> statement. Lua, unlike other langauges, does not support single-expression statements, and <strong>must</strong> be closed with an <code>end</code>.</p>\n<pre class="lang-lua prettyprint-override"><code>if local (t2) then print (&quot; :) &quot;)\n</code></pre>\n<p>This contains many of the same assumptions as the previous line, though for reasons I cannot assume, you have neglected to include <code>face</code>. Additionally, this <em>should</em> probably be an <code>elseif</code> statement, rather than just another <code>if</code> statement, if the behaviour is intended to be exclusive.</p>\n<p>All together, and with additional formatting, your code should now read</p>\n<pre class="lang-lua prettyprint-override"><code>print ('Hello, make a face, ')\nlocal face = io.read()\nlocal t = {&quot;:)&quot;, &quot;:)&quot;}\nif face == t[1] then \n print (&quot; :0 &quot;)\nelseif face == t[2] then\n print (&quot; :) &quot;)\nend\n</code></pre>\n<p>I strongly suggest reading up on the <a href="https://www.lua.org/pil/1.html" rel="nofollow noreferrer">Basics of Lua</a>, or even some tutorials, as you seem to be just guessing about the syntax. Lua is a very well documented langauge with plenty of tutorials, including a <a href="https://www.codecademy.com/learn/learn-lua" rel="nofollow noreferrer">Codecadamy</a> course.</p>\n"^^ . . "<p>Neomutt provides Lua as scripting language. I needed to find e-mails from different senders and delete or move them to different mail folders programmatically. There are Neomutt configuration examples done in Lua but I couldn't find anything similar to my case. Can I do this with Lua in Neomutt? Thanks.</p>\n"^^ . "2"^^ . . "1"^^ . "0"^^ . "0"^^ . . . "<p>I'm newbie in Lua, but have an experience in PHP.\nI have a project on PHP which is a demon that receives data from one socket and distributes data to connected clients via websocket. The project is pure PHP, without third-party libraries.\nI want to replicate the project in Lua.</p>\n<p>However, I have not found good examples of working with sockets on Lua.</p>\n<p>How can I serve two sockets at the same time?\nHow do I get multiple incoming connections on the same port?</p>\n<p>It's easy on PHP, but I don't understand at all how to do it on Lua. I would be grateful for pointers to documentation and good examples how to do it on Lua.</p>\n"^^ . "1"^^ . "1"^^ . "You need to study logic and programming more."^^ . "1"^^ . . "1"^^ . "At a glance: `self.compute_Recursively` should be `self:compute_Recursively`. There may be more issues."^^ . . . "0"^^ . . "Viewport Frame for Camera System in Roblox Studio not Working"^^ . "<p>Having the following Dockerfile</p>\n<pre><code>FROM openresty/openresty:alpine\n\nRUN apk update &amp;&amp; apk add bash \\\n &amp;&amp; apk add gettext envsubst\n\n\nENV REDIS_HOST \\\n REDIS_PORT \\\n REDIS_FULL_KEY_PREFIX \\\n HTTP_PROTOCOL \\\n WEB_HOST \\\n UPSTREAM_HOST \\\n PROXYPASS_NAME\n\nRUN echo &quot;env REDIS_HOST; env REDIS_PORT; env REDIS_FULL_KEY_PREFIX; env HTTP_PROTOCOL; env WEB_HOST; env UPSTREAM_HOST; env PROXYPASS_NAME;&quot; &gt; /usr/local/openresty/nginx/conf/lua-config.lua\n\n\nCOPY nginx.conf.template /usr/local/openresty/nginx/conf/nginx.conf.template\nCOPY test.lua /usr/local/openresty/nginx/conf\n\n\nENTRYPOINT [&quot;/bin/sh&quot;, &quot;-c&quot;, &quot;envsubst '${REDIS_HOST} ${REDIS_PORT} ${REDIS_FULL_KEY_PREFIX} ${HTTP_PROTOCOL} ${WEB_HOST} ${UPSTREAM_HOST} ${PROXYPASS_NAME}' &lt; /usr/local/openresty/nginx/conf/nginx.conf.template &gt; /usr/local/openresty/nginx/conf/nginx.conf &amp;&amp; /usr/local/openresty/bin/openresty -g 'daemon off;error_log /dev/stdout debug;'&quot;]\n</code></pre>\n<p>my nginx.conf where I call the lua script than it looks as it follows:</p>\n<pre><code>location ^~ /pages {\n rewrite_by_lua_file conf/test.lua;\n # more code \n \n}\n</code></pre>\n<p>I'm using docker compose to bring up the container</p>\n<pre><code>openresty:\n build: \n context: .\n dockerfile: Dockerfile\n environment:\n REDIS_HOST: redis\n REDIS_FULL_KEY_PREFIX: &quot;blah_blah&quot;\n HTTP_PROTOCOL: &quot;http://&quot;\n WEB_HOST: localhost\n PROXYPASS_NAME: nginx\n UPSTREAM_HOST: localhost\n depends_on:\n - nginx\n networks:\n - proxynet\n - redis\n</code></pre>\n<p>I'm not able to consume in lua the ENV variables. For example when I try to get for example the <code>REDIS_HOST</code> env in my <code>test.lua</code> I get script nil</p>\n<pre><code>local cueRedisFqhn = os.getenv(&quot;REDIS_HOST&quot;)\nlocal redisPort = os.getenv(&quot;REDIS_PORT&quot;) or &quot;6379&quot;\nngx.log(ngx.NOTICE, cueRedisFqhn)\n</code></pre>\n<p>How can adjust the dockerfile to make it available?</p>\n"^^ . . . . "<p>I changed 1 to 0 like this <code>get_services_result[0].name</code> and it works. But doesn't subscript in <code>lua</code> start from 1?</p>\n"^^ . "1"^^ . . "Lua: Handle dynamic nested table (get and set)"^^ . . . . . . . "1"^^ . . . . . "1"^^ . . . . "c"^^ . "0"^^ . "looks like your `string:split` function not only splits at the `separator`, but also at any whitespace? I'd try a different split function, see e.g. https://stackoverflow.com/questions/1426954/split-string-in-lua"^^ . . "The Error Argument 3 missing or nil : Script Troubleshooting"^^ . . . "0"^^ . . . . "0"^^ . . . "Could you provide Figure 25.6 (or a good description of what it is)?"^^ . . . "<p>I want to know if there is a way to activate the sql tree-sitter while making queries in the vim-dadbod-ui. Currently I only get a different color for keywords, but it is still much different from what you get when opening an actual .sql file, If someone know something related to this topic please let me know.</p>\n<p><a href="https://i.sstatic.net/DlvRJ.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/DlvRJ.jpg" alt="Comparison between dadbod-ui query and .sql file" /></a></p>\n<p>I tried reading the documentation but there was nothing related that could help me.</p>\n"^^ . . . . . . "<p>Yo, guys, I got a question, is there any way to improve this or maybe better way to calculate it? Because the only way to calculate derivative very accurate I can think of is this.. lol, its just logic like d/dx of x^n = nx^(n-1) so I thought of that and tried it out, tho doesnt work with functions like e^x so I need help with make a very accurate derivative calculation</p>\n<pre><code>function derivative(Function, x)    \n local dxlog = math.log(Function(x), x) \n       \n return dxlog * x^(dxlog - 1)\nend \nprint(derivative(function(x) return x^3 end, 10))\n</code></pre>\n<p>and its so bad it cant even calculate y^x with respect to x..</p>\n<p>tried everything I can think of, too dumb to fix this</p>\n<p>btw this is the old way I did this:</p>\n<pre><code>function derivative(Function, x)\n local d = (Function(x + 6.7219579999763e-006) - Function((x - 6.7219579999763e-006))) / 1.3443915999953e-005\n if math.abs(math.round(d) - d) &lt; 4.1212121212e-6 then \n return math.round(d)\n end\n return d\nend\n</code></pre>\n"^^ . . . . . "Can't find out how to compute derivative"^^ . . . . "0"^^ . "luajit"^^ . . . "<p>I have a table t which is totally dynamic: it is nested, and number of levels is unknown in advance. I wish to be able to <strong>set</strong> (get is easy to do) some value at some level, using a kind of path. The path would be an array (this doesn't have to be, just an idea, but seems to make sense to me)</p>\n<p>Here is a kind of code, which obviously doesn't work (it will always return 3), but gives an idea of what I need:</p>\n<pre><code>t={a={b={c=3}}}\npath={&quot;a&quot;,&quot;b&quot;,&quot;c&quot;}\nr=setmetatable(t,\nfor _,i in pairs(path) do\n r=r[i] \nend\nr=1\n\nprint(t[&quot;a&quot;][&quot;b&quot;][&quot;c&quot;])\n</code></pre>\n<p>I thought of using __index, __newindex and metatable, but I still struggle to use those, and all my experiments failed\nOtherwise, getting the address of the table, rather than its value would be the solution, but I don't know how to do that...</p>\n"^^ . . "<p>So basically in my script it sends the remoteevent successfully but the other script doesn't receive it for some reason. It has worked before.</p>\n<p>Script that fires the event:</p>\n<pre><code>local frame = game.Players.LocalPlayer.PlayerGui.Credits.Frame\nlocal text = frame.Presents\nlocal stroke = text.UIStroke\nlocal CurrentCamera = workspace.CurrentCamera\nlocal TweenService = game:GetService(&quot;TweenService&quot;)\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal finishcredits = ReplicatedStorage.Credits\nlocal SoundService = game:GetService(&quot;SoundService&quot;)\nlocal song = SoundService.Song\nlocal boom = SoundService.Boom\nlocal RunService = game:GetService(&quot;RunService&quot;)\n\n\nlocal targetTransparency = 1\nlocal tweenDuration = 2\nlocal tweenDuration2 = 4\nlocal tweenInfo = TweenInfo.new(tweenDuration)\nlocal tween = TweenService:Create(frame, tweenInfo, {BackgroundTransparency = targetTransparency})\nlocal tween2 = TweenService:Create(text, tweenInfo, {TextTransparency = targetTransparency})\nlocal tween3 = TweenService:Create(stroke, tweenInfo, {Transparency = targetTransparency})\n\n\nwait(1)\nprint(&quot;1&quot;)\nlocal camera = workspace.MainCamera\nlocal function updateCamera()\nCurrentCamera.CFrame = camera.CFrame\nend\n\nprint(&quot;2&quot;)\nframe.Visible = true\nwait(1)\nboom:Play()\nwait(5)\nsong:Play()\nCurrentCamera.CameraType = Enum.CameraType.Scriptable\nprint(&quot;script&quot;)\n\ntween:Play()\nprint(&quot;tweened&quot;)\ntween2:Play()\ntween3:Play()\n\nwait(2)\nfinishcredits:Fire(print(&quot;fired&quot;))\n\n\nRunService.RenderStepped:Connect(updateCamera)\n</code></pre>\n<p>Script that receives it:</p>\n<pre><code>local TweenService = game:GetService(&quot;TweenService&quot;)\nlocal camera = workspace:WaitForChild(&quot;MainCamera&quot;)\nlocal text = workspace.MenuText:WaitForChild(&quot;WorldPivot&quot;)\nlocal SoundService = game:GetService(&quot;SoundService&quot;)\nlocal event = game.ReplicatedStorage.Credits\nlocal watereffect = workspace.MenuText.Water.Water\nlocal fireeffect = workspace.MenuText.Fire\nlocal explosion = fireeffect.Explosion\n\nlocal function enableExplosion()\n for _, explosion in pairs(explosion:GetDescendants()) do\n if explosion:IsA(&quot;ParticleEmitter&quot;) then\n explosion.Enabled = true\n end\n end\nend\n\nlocal function enableFire()\n for _, fire in pairs(fireeffect:GetDescendants()) do\n if fire:IsA(&quot;ParticleEmitter&quot;) then\n fire.Enabled = true\n end\n end\nend\n\nlocal function enableWater()\n watereffect.Enabled = true\nend\n\nlocal function disableExplosion()\n for _, explosion in pairs(explosion:GetDescendants()) do\n if explosion:IsA(&quot;ParticleEmitter&quot;) then\n explosion.Enabled = false\n end\n end\nend\n\nlocal function disableFire()\n for _, fire in pairs(fireeffect:GetDescendants()) do\n if fire:IsA(&quot;ParticleEmitter&quot;) then\n fire.Enabled = false\n end\n end\nend\n\nlocal function disableWater()\n watereffect.Enabled = false\nend\n\n\nlocal playbutton = workspace.Menu.Play\nlocal rope = workspace.Menu.Play.Rope\nlocal info = TweenInfo.new(6, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false)\nlocal info4 = TweenInfo.new(4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false)\nlocal info2 = TweenInfo.new(8, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false)\nlocal tween = TweenService:Create(camera, info, {Position = Vector3.new(733.108, 14.451, -821.718)}) -- menu camera\nlocal tween4 = TweenService:Create(text, info4, {Position = Vector3.new(712.179, 19.936, -842.667)}) -- text title\nlocal tween2 = TweenService:Create(playbutton, info2, {Position = Vector3.new(733.86, 20.13, -841.05)}) -- play button\n--local tween3 = TweenService:Create(rope, info2, {Position = Vector3.new(733.86, 41.93, -841.05)})\n\nevent.Event:Connect(function()\n print(&quot;received&quot;)\n tween:Play()\n wait(1.4)\n print(&quot;wait&quot;)\n tween4:Play()\n print(&quot;tween 4&quot;)\n SoundService.splash:Play()\n enableWater()\n tween4.Completed:Connect(function()\n disableWater()\n enableExplosion()\n SoundService.explosion:Play()\n wait(3)\n disableExplosion()\n enableFire()\n SoundService.fire:Play()\n \n wait(2)\n \n tween2:Play()\n --tween3:Play()\n SoundService.Elevator:Play()\n end)\nend)\n</code></pre>\n<p>I tried removing some modules but that didn't work, there are not spell errors. It's suppossed to receive the event, but it doesn't</p>\n"^^ . "1"^^ . "Looks like the error is in JSON.lua from Demoticz. What version of Lua are you using? What version of Demoticz? Have you tried re-cloning a new version of the Demoticz source code?"^^ . "1"^^ . . "`new_config` and `config` should refer to two different tables, but in your code they probably refer to the same object. Please post the code where these objects are created."^^ . . . . . "Sends Event But Doesn't Receive"^^ . . "0"^^ . . . "<p>That’s not how you use the until statement. Your until statement with the wait is saying &quot;if <code>wait(5)</code> doesn’t return anything&quot;, which is just as much a terrible abuse of the until statement as using it for the while condition. It’s bad for readability as well.</p>\n<p>This is what I would do instead:</p>\n<pre><code>local success, result do\n repeat\n success, result = pcall(money.GetAsync, money, key)\n if not success then\n wait(5)\n end\n until success or MAX_RETRIES\n</code></pre>\n<p>A note on <code>MAX_RETRIES:</code> this is a placeholder making a note that you should add a retry cap. Repeatedly calling this function is bad use of <code>DataStores</code>. It would create a loop that runs forever until <code>DataStores</code> return true, which can cause an issue if <code>DataStores</code> are down or the call is not succeeding. I’m not sure why you would use a loop statement with data anyway.</p>\n<p>The simple response here is to do error handling. If there’s no data in the key (which then <code>GetAsync</code> returns nil), you handle that case instead of making a loop.</p>\n<pre><code>local success, result = pcall(money.GetAsync, money, key)\nif success then\n if result then\n -- Data non-nil\n else\n -- Data nil\n end\nelse\n -- Success false, do something about it\nend\n</code></pre>\n"^^ . . "How are you running your lua script, and what env variables are defined in that environment? See [mcve] for details about providing a complete and reproducible example that we can try to replicate your issue."^^ . . . . . . "2"^^ . "<p>You can extract the <code>for i = 1...end</code> part as a separate function. In addition, since we are on the topic of clean code, you can also make the if block <code>return</code>. Then the <code>else</code> code block can be inside the function body and de-nested for one level.</p>\n<pre><code>local function hook(frame, method)\n for i = 1, #frame.buttons do\n frame.buttons[i]:HookScript(&quot;OnMouseDown&quot;, method)\n end\nend\n\nlocal function myfunc(frame, method)\n if frame:IsShown() then\n hook(frame, method)\n return\n end\n frame:SetScript(\n &quot;OnShow&quot;,\n function(frame)\n hook(frame, method)\n end\n )\nend\n</code></pre>\n"^^ . . . . . . "How would I access the player's local mouse from a server-side script in Roblox Studio?"^^ . . . "thank for the help, I finally used another service for my RSS feeds.\nbut your comment teach me something at least"^^ . . . . . . "pandoc"^^ . . "3"^^ . . . "Apparently this may have been something related to lsp"^^ . . . "1"^^ . "Well, the thing you pass to `getHRP()` is `nil`."^^ . "<p>So whenever my players spawn in a created character, it seems to work fine. However, when they try to create a new character this issue is happening now and just started.</p>\n<pre><code>[script:qb-multichara] SCRIPT ERROR: citizen:/scripting/lua/scheduler.lua:739: SCRIPT ERROR: @qb-core/server/player.lua:164: attempt to index a nil value (field 'Jobs')\n[script:qb-multichara] &gt; CheckPlayerData (@qb-core/server/player.lua:164)\n[script:qb-multichara] &gt; ref (@qb-core/server/player.lua:30)\n[script:qb-multichara] &gt; rawExecute (@oxmysql/dist/build.js:26552)\n[script:qb-multichara] &gt; processTicksAndRejections (node:internal/process/task_queues:96)\n[script:qb-multichara] \n[script:qb-multichara] &gt; handler (@qb-multicharacter/server/main.lua:107)\n[script:qb-multichara] &gt; rawExecute (@oxmysql/dist/build.js:26552)\n[script:qb-multichara] &gt; processTicksAndRejections (node:internal/process/task_queues:96)\n</code></pre>\n<p>I don't know what to do here.</p>\n<p>I have tried editing the jobs file and making every job on duty true and and even tried removing that line of code. All with the same result.</p>\n"^^ . . . . "mingw-w64"^^ . "5"^^ . "0"^^ . . . . "1"^^ . "<p>-- Exercise 25.8 -- One problem with the sandbox in Figure 25.6, “Using hooks to bar calls to unauthorized functions” is that sandboxed code cannot call its own functions. How can you correct this problem?</p>\n<pre><code>local debug = require &quot;debug&quot;\n\n-- Maximum &quot;steps&quot; that can be performed\nlocal steplimit = 1000\nlocal count = 0\n\n-- Counter for steps\n-- Set of authorized functions\nlocal validfunc = {}\n\n-- Hook function to check if the called function is authorized\nlocal function hook(event)\n local info\n if event == &quot;call&quot; then\n local info = debug.getinfo(2, &quot;fn&quot;)\n if not validfunc[info.func] then\n error(&quot;calling bad function: &quot; .. (info.name or &quot;?&quot;))\n end\n end\n count = count + 1\n if count &gt; steplimit then\n error(&quot;script uses too much CPU&quot;)\n end\n print(string.format('func_name:%s, count:%d', info.name, count))\nend\n\n-- Load chunk\nlocal chunkEnv = setmetatable({}, { __index = _G })\nlocal f, errorMsg = loadfile(&quot;test_lua_exercise_25_8.lua&quot;, &quot;t&quot;, chunkEnv)\nif not f then\n error(&quot;Error loading file: &quot; .. errorMsg)\nend\n\n-- Set hook\ndebug.sethook(hook, &quot;c&quot;, 100)\n\n-- Run chunk\nf()\n\n-- Capture the functions defined in the chunk and add them to the validfunc table\nfor k, v in pairs(chunkEnv) do\n if type(v) == &quot;function&quot; then\n validfunc[k] = true\n end\nend\n\n-- Set hook to nil to disable it after the execution\ndebug.sethook()\n\n-- Print the authorized functions\nfor k, v in pairs(validfunc) do\n print(k, v)\nend\n\n\ntest_lua_exercise_25_8.lua\nlocal debug = require &quot;debug&quot;\nlocal count = 0\n\nlocal function hook (event)\n if event == &quot;call&quot; then\n local info = debug.getinfo(1, &quot;fn&quot;)\n end\n \n count = count + 1\n if count &gt; 1000 then\n error(&quot;script uses too much CPU&quot;)\n end\nend\n\nfor i = 1, 10 do\n hook('call') \nend\n</code></pre>\n<p>I can't make it run. Do anyone have any sugg? Tried many thngs bt i cannot add the running functions into validfunc array very easy. I suppose if i call debug.registry() maybe will be possible bt registry() has to do wth C communication scripts.</p>\n"^^ . "You should define the function `shallow_copy` in your code. It's not a standard Lua function."^^ . "2"^^ . . "Run this command `:TSInstall vimdoc` it helped me get rid of error you are getting."^^ . "I am getting a Data Store error in Roblox Studio that fails my data store. I have enabled studio access to API services"^^ . . . "Should C packages be compiled as modules rather than shared libraries for Lua?"^^ . "0"^^ . . "2"^^ . "0"^^ . . . . . . "Does this answer your question? [Writing to Dynamic Multidimensional table via path](https://stackoverflow.com/questions/67801776/writing-to-dynamic-multidimensional-table-via-path)"^^ . . "Try to run resource and got " '}' expected (to close '{' at line 5) near ""^^ . . "0"^^ . "How do I make a script that can run through a list of functions that I can stop at will? Lua 5.1 LGS"^^ . . . . "Thanks for the Reply. I was just asking for a Killbrick but thanks for the Help. Very Much Appreciated."^^ . . . . . . . "quarto"^^ . . "eluna-lua-engine"^^ . . "<p>If I understand correctly you want that standard X11 feature when any visual selection updates PRIMARY selection atom (while CLIPBOARD is used with control-c or similar). Btw. gvim built for gtk/X11 supports this feature natively (named autoselection or such).</p>\n<p>However, with nvim the situation is more complicated. The application is built for terminal and does not have any specific gtk or X11 code. The OS clipboard access is done usually by executing an external application such as xclip or xsel.</p>\n<p>So, technically, you maybe could trap CursorMoved event and then (while the current mode is visual, of course) keep updating &quot;star&quot; register per each invocation. But, honestly, I don't think that's a good idea.</p>\n<p>Such feature could possibly be implemented by some of nvim gui shells (nvim-qt, etc.) internally. But I'm not aware of anything like that done.</p>\n<p>Also, consider that analogue of PRIMARY selection was not included into Wayland core. So it exists only as an extra feature in Gnome/Wayland implementation.</p>\n"^^ . . . ":) I'm glad, I didn't actually test it."^^ . . "0"^^ . "performance"^^ . "0"^^ . . "function"^^ . . . "lpeg"^^ . . . . . . "<p>How do I check if a character is uppercase?</p>\n<pre><code>ch = &quot;A&quot;\nif isupper(ch) then\n --Press shift\nend\n</code></pre>\n<p>Checked Google. Nothing was there.</p>\n"^^ . "<p>I installed indent-blankline <a href="https://github.com/lukas-reineke/indent-blankline.nvim" rel="nofollow noreferrer">https://github.com/lukas-reineke/indent-blankline.nvim</a> plugin with vim-plug. Their documentation probably has a mistake, because they show the same setup both for 'Simple' and 'Mixed' type of indentation. I can't configure it for mixed indentation (with horizontal dots and scope highlight) in my indent-blankline.vim config file. For now only the vertical line shows up. Any idea?</p>\n<pre><code>lua &lt;&lt; EOF\nrequire('ibl').setup{}\nEOF\n</code></pre>\n"^^ . "tui"^^ . . . "<p>I have this string</p>\n<pre class="lang-lua prettyprint-override"><code>S = &quot;564186207, 399.4989929 , ABC, degds, 2425, 335.232&quot;\n</code></pre>\n<p>and I want to capture the only integer and point number.</p>\n<p>Like this:</p>\n<pre><code>string.gfind(S, ???)\n --&gt; 564186207, 399.4989929, 2425, 335.232\n</code></pre>\n<p>I have tried:</p>\n<pre class="lang-lua prettyprint-override"><code>string.gfind(S, &quot;%d+&quot;)\nstring.gfind(S, &quot;%d\\*&quot;)\nstring.gfind(S, &quot;^%d&quot;)\n</code></pre>\n<p>How can I capture the only number from that string?</p>\n"^^ . "domoticz"^^ . "This doesn't match negative number (-123.45) but you're example didn't include any. Let me know if that is an issue."^^ . "Coverting data back to Rust which is pass to Lua using mlua"^^ . . . . . . "3"^^ . "(bx, by) is a position of base point for given half plane, the (tx, ty) is tangent of it. For example, half plane bx=0, by=0, tx=1, ty=0 is a half plane with horizontal cutting of unlimited 2D field. It contains all points that is more than by=0.\nThe same way I can check and cut any half plane from given infinite plane. In the example higher, it cuts all area from plane with 4 half-planes and we get just points inside/outside of rectangle (frameX, frameY, frameW, frameH). https://www.ck12.org/book/ck-12-algebra-basic/section/6.7/"^^ . . . "0"^^ . . "0"^^ . "0"^^ . . . . . . "how to increase leaderboard number on click event"^^ . "dynamic-tables"^^ . . "On Windows there's no difference, but on Linux there is, however both have `.so` extension. The difference being that shared libraries can be linked against, and modules can not. I believe this is where the term "module" is coming from, on macOS they are called "bundles"."^^ . "0"^^ . . . . . "<p>Try with this and make sure that Roblox API Services are on, okey instead of doing a lot of functions for call the load and save data, you could use PlayerRemoving and PlayerAdded, and create your variables for the leaderstats, so maybe that's the problem, or you could use this code instead:</p>\n<pre><code>local player = game:GetService(&quot;Players&quot;)\nlocal dataStore = game:GetService(&quot;DataStoreService&quot;)\n\nlocal SufferingsDataStore = dataStore:GetDataStore(&quot;Sufferings&quot;)\nlocal SufferCoinsDataStore = dataStore:GetDataStore(&quot;SufferCoins&quot;)\n\nplayer.PlayerAdded:Connect(function(plr)\n print(plr.Name ..&quot; joined&quot;)\n \n local folder = Instance.new(&quot;Folder&quot;, plr)\n folder.Name = &quot;leaderstats&quot;\n \n local Sufferings = Instance.new(&quot;IntValue&quot;, folder)\n Sufferings.Name = &quot;Sufferings&quot;\n Sufferings.Value = 0\n\n local SufferCoins = Instance.new(&quot;IntValue&quot;, folder)\n SufferCoins.Name = &quot;SufferCoins&quot;\n SufferCoins.Value = 0\n\n local infoSaved = nil\n local infoSaved2 = nil\n\n local succeful, fail = pcall(function()\n infoSaved = SufferingsDataStore:GetAsync(plr.UserId)\n infoSaved2 = SufferCoinsDataStore:GetAsync(plr.UserId)\n end)\n\n if succeful then\n plr.leaderstats.Sufferings.Value = infoSaved\n plr.leaderstats.SufferCoins.Value = infoSaved2\n warn(&quot;Data loaded successfully&quot;)\n end\nend)\n\nplayer.PlayerRemoving:Connect(function(plrE)\n warn(&quot;Goodbye &quot; ..plrE.Name..&quot;!&quot;)\n local points1 = plrE.leaderstats.SufferCoins.Value\n local points2 = plrE.leaderstats.Sufferings.Value\n\n local succeful, fail = pcall(function()\n SufferingsDataStore:SetAsync(plrE.UserId, points2)\n SufferCoinsDataStore:SetAsync(plrE.UserId, points1)\n end)\n\n if succeful then\n warn(&quot;Data saved correctly&quot;)\n end\nend)\n</code></pre>\n<p>Create and order your variables, then copy and paste infoSaved many times as you want, then just set the infoSaved to the datastore get async inside the pcall, also set variables to infoSaved for load it <code>plr.leaderstats.Sufferings.Value = infoSaved</code> when player removing do the same with <code>points1</code> set points to <code>plr.leaderstats.yourValue.value</code>, also set async data with points.</p>\n"^^ . . . . . "0"^^ . . "I noticed that, replacing * by + in my regular expression, so it is like yours, I get no newlines (but then the blank lines are ignored, which I don't want). For some reason, when * is used, Lua is adding an empty string after each nonempty string. But I checked that this is happening only in Neovim, not in the Lua interpreter on my terminal. Any clues?"^^ . . . . "1"^^ . . . . . "1"^^ . "6"^^ . . "1"^^ . "The correct tag is `lua-api`"^^ . "2"^^ . . . . "<p>I'm not sure there's an answer I would find fully satisfactory.</p>\n<p>The given implementation gathers functions from <code>chunkEnv</code> after loading the file. If the sandboxed code's &quot;own functions&quot; are simply these functions, things are easy. We can detect when new functions are added via a <code>__newindex</code> metamethod and immediately add them to the <code>validfunc</code> set.</p>\n<p>However, the sandboxed code you give as an example doesn't have any functions of this kind -- so we see that this fails for functions that aren't added to the environment table like local functions, or inner functions.</p>\n<p>Also, this method is potentially insecure -- the file can whitelist any function simply by adding it to <code>chunkEnv</code>. (This already seems like a vulnerability in the existing code if <code>validfunc</code> is used later, but adding immediately would allow any read-accessible function to be used inside the <code>f()</code> invocation, not just later. But also, it is already allowed for a newly defined function to call a forbidden function as long as that call doesn't happen when the hook is in place (at load time), but maybe that is intended?)</p>\n<p>Although a lexical closure is philosophical linked to the environment in which it is instantiated, I don't think we can use this in Lua. The only accessible link of this kind a Lua function has is via upvalues, and functions in the sandbox do not need to have <code>chunkEnv</code> as an upvalue -- they may define a new environment, or they might not use <code>_ENV</code>. (And in general, there is no guarantee a forbidden function can't end up using <code>chunkEnv</code>.)</p>\n<p>In terms of book-keeping, then, we are left with debug info. The <code>source</code> field of the function debug info record seems like the most appropriate thing to check here. However, depending on the threat model, I would be somewhat worried about the possibility of a forbidden function ending up with a valid <code>source</code> -- do the file system and loading model allow two files to end up with the same <code>source</code>? Does the attacker have access to <code>package.loaded</code>? (With loading binary chunks this is an even bigger problem, but loading binary chunks is also a bad idea for other reasons, and not in play here.)</p>\n<p>(If you know that only C functions are forbidden, I guess some safety can be gained by checking whether functions are C or Lua.)</p>\n<p>I would really want to whitelist a function immediately after it is created (by the <code>CLOSURE</code> bytecode operation) at which time we could check that the currently executing function is allowed to created whitelisted functions (e.g. if it is itself whitelisted, which would always be true if we can only execute whitelisted functions). But, I don't think there is a way to hook this event (at least, not without a lot of work and probably breaking some abstraction barriers like e.g. executing in a software VM at which point the problem is trivial anyway).</p>\n<p>Note also that things like inner functions can't necessarily be whitelisted at the time the file is loaded because they may not even exist until runtime. (The prototype exists, but the prototype is not the Lua function object.) But, if there is no hook protection at runtime, there is nothing that would prevent these from executing at runtime since there is simply no protection at all about calling any kind of function (as discussed above).</p>\n<p>This is also a problem with whitelisting inner functions from trusted APIs. For example, how do you make <code>string.gmatch</code> usable? Each time you execute this function, it returns a new C closure. You would have to hook and whitelist such functions. (And, now we should worry about running out of memory, so maybe using a weak table is prudent.)</p>\n<p>I think sandboxing in this way seems dubious -- not only because of the difficulties above, but also because an attacker may cause trouble by a means other than calling a function like modifying some globally accessible table. (A natural way to fix this is to avoid giving access to sensitive data, but then we could also avoid giving access to sensitive functions...) I haven't read the book, so I don't really have an informed opinion on what kind of answer it is expecting and maybe I don't really understand what kind of protection it is trying to provide. In the context of an exercise, I wouldn't worry about it if you understand the issues.</p>\n"^^ . . "1"^^ . "1"^^ . . "<p>I have been trying to install the lazyvim config for my neovim and since i am very very new to the feild of TUI i don't have any clue on what's going on with my neovim, To be specific when i run the :checkhealth command i get thrown with a pool of parser errors, like these <a href="https://i.sstatic.net/quM3o.png" rel="nofollow noreferrer">here is the error screenshot</a>\nplease help me I am stuck on this since 3 days</p>\n<p>since i already informed i am a full newbie and going through the config files and different lua files and git documentations i don't know what to add where</p>\n"^^ . "<p>The correct formula of the triangle signed area is <code>(x1*y2 - x2*y1)/2</code> assuming the third vertex is at <code>(0,0)</code><br />\nA point is inside a convex poly when all point-edge-traingle areas are of the same sign.</p>\n<pre><code>local function polyEdgeIterator(poly)\n -- poly as {x1,y1, x2,y2, x3,y3, ...}\n local i, imax = 0, #poly\n local x2, y2 = poly[imax-1], poly[imax]\n return\n function()\n i = i + 2\n if i &lt;= imax then\n local x1, y1 = x2, y2\n x2, y2 = poly[i - 1], poly[i]\n return x1, y1, x2, y2\n end\n end\nend\n\nlocal function getTriangleArea(x0,y0, x1,y1, x2,y2)\n -- area of the triangle, its sign is determined by the triangle vertices sequence direction (CW/CCW)\n return ((x1-x0) * (y2-y0) - (x2-x0) * (y1-y0)) * 0.5\nend\n\nlocal function pointInConvexPolygon(x, y, poly)\n local minArea, maxArea = 0, 0\n for x1,y1, x2,y2 in polyEdgeIterator(poly) do\n local area = getTriangleArea(x,y, x1,y1, x2,y2)\n minArea = math.min(minArea, area)\n maxArea = math.max(maxArea, area)\n if minArea * maxArea &lt; 0 then\n return false\n end\n end\n return true\nend\n\nprint(pointInConvexPolygon(2,1, {1,-1, 2,2, 4,1})) -- true\nprint(pointInConvexPolygon(3,0, {1,-1, 2,2, 4,1})) -- false\n</code></pre>\n"^^ . "1"^^ . "Sorry the function is called luaL_dostring: https://www.lua.org/manual/5.4/manual.html#luaL_dostring. Changed "interpreters" to "REPL" in my question. Thanks!"^^ . . "1"^^ . . . "1"^^ . . . . . "1"^^ . . . . "love2d"^^ . . "0"^^ . "path"^^ . . "0"^^ . "<p>To check if a single-character string is uppercase, you could use the <a href="https://devdocs.io/lua%7E5.1/index#pdf-string.upper" rel="nofollow noreferrer">string.upper</a> method like so:</p>\n<pre><code>Lua 5.3.6 Copyright (C) 1994-2020 Lua.org, PUC-Rio\n&gt; b = &quot;a&quot; == string.upper(&quot;a&quot;)\n&gt; b\nfalse\n&gt; b = &quot;A&quot; == string.upper(&quot;a&quot;)\n&gt; b\ntrue\n</code></pre>\n<p>Alternatively, if you really just want to check single characters e.g. of ASCII, you can use <a href="https://devdocs.io/lua%7E5.1/index#pdf-string.byte" rel="nofollow noreferrer">string.byte</a> to get the character code and check if it matches the uppercase ASCII range (65 -- 90):</p>\n<pre><code>&gt; string.byte(&quot;A&quot;)\n65\n&gt; string.byte(&quot;Z&quot;)\n90\n</code></pre>\n<p>Note that this will become more complicated if you wish for proper Unicode awareness. However for quickly parsing keyboard input (which seems to be the use case) it might do the job.</p>\n"^^ . . . "1"^^ . . . "1"^^ . . "How can I convert this iterative loop to a recursive one?"^^ . . "Nvim: Error detected while processing BufReadPost Autocommands for "*":"^^ . . "Roblox Luau - Asset refuses to load in-game, but works in studio"^^ . . "0"^^ . "i made it to run correctly , it should be as my prototype, to test the implementation as initial reffered above, tnhx"^^ . . "0"^^ . "<p>There is a few issues you are having here, firstly that you are attempting to find the instance by going up the instance tree, then calling FindFirstAncestor. You should instead just directly go to the instance itself, as shown below.</p>\n<p>Secondly, Visible is a property of GUIs and not an Attribute. Attributes are solely for developer's use and do not change anything regarding the instances themselves see (<a href="https://create.roblox.com/docs/studio/properties#instance-attributes" rel="nofollow noreferrer">https://create.roblox.com/docs/studio/properties#instance-attributes</a>) for more info.\nSo instead of calling SetAttribute, just index the Visible property and set it</p>\n<pre class="lang-lua prettyprint-override"><code>local button = script.Parent\nlocal menu = script.Parent.Parent.Parent\n\nlocal function onButtonClicked()\n if menu.Visible then\n menu.Visible = false\n else\n menu.Visible = true\n end\nend\n\nbutton.MouseButton1Down:Connect(onButtonClicked)\n</code></pre>\n<p>Also, to make your code neater, you could instead of the if statement simply use some boolean logic to invert it.</p>\n<pre class="lang-lua prettyprint-override"><code>local function onButtonClicked()\n menu.Visible = not menu.Visible\nend\n</code></pre>\n"^^ . "0"^^ . . . . . . "@VRehnberg Not afraid of lagging?"^^ . "0"^^ . . "Here is a resource for how to determine the impact in you specific program (which is largely the best way to answer this type of question) [Eric Lippert's Performance Rant](https://ericlippert.com/2012/12/17/performance-rant/)"^^ . . "<p>Hi guys i'm working on a hardcore like script but i'm facing a issue, in this function, when the player die, i spawn a grave that is a gob (that is a chest), and i want that all the stuff that the player have goes to this chest, but i have two issues:</p>\n<p>The first issue is that the chest desappear when the player resurect and not after the time i specified here:</p>\n<pre><code>local secondsInADay = 86400\nlocal event = CreateLuaEvent(function()\nif grave and grave:IsInWorld() then\ngrave:Despawn()\nend\nend, secondsInADay * 1000, 1)\n</code></pre>\n<p>The second issue is that the stuff of the player don't go in the GOB.</p>\n<pre><code>local function CreateGrave(player)\nif player:GetLevel() &lt; 15 then\nreturn\nend\nlocal chestGameObjectEntry = 8000015 -- Utilisez l'ID du modèle de coffre que vous souhaitez\nlocal secondsInADay = 86400 -- Durée pendant laquelle le cimetière restera spawn en secondes (1 jour)\nlocal x, y, z, o = player:GetLocation()\nlocal grave = player:SummonGameObject(chestGameObjectEntry, x, y, z, o)\nif grave then\n local graveGUID = grave:GetGUIDLow() -- Obtenir le GUID du gardien d'âmes\n for slot = 0, 18 do\n local item = player:GetItemByPos(255, slot) -- Emplacement des équipements\n if item then\n grave:AddLoot(item:GetEntry(), 22) -- Ajouter l'objet au coffre (1 quantité)\n end\n end\n for bag = 19, 22 do\n for slot = 0, 35 do\n local item = player:GetItemByPos(bag, slot) -- Emplacement des sacs équipés\n if item then\n grave:AddLoot(item:GetEntry(), 5) -- Ajouter l'objet au coffre (1 quantité)\n end\n end\n end\n local event = CreateLuaEvent(function()\n if grave and grave:IsInWorld() then\n grave:Despawn()\n end\n end, secondsInADay * 1000, 1)\n print(&quot;Tombe (Coffre) GUID: &quot; .. graveGUID)\n local input_Grave_GUID = &quot;UPDATE hc_dead_log SET grave_guid = '&quot; .. graveGUID .. &quot;' WHERE guid = '&quot; .. player:GetGUIDLow() .. &quot;'&quot;\n AuthDBExecute(input_Grave_GUID)\nend\nend\n</code></pre>\n<p>Someone have a tip for me?</p>\n<p>Thanks in advance.</p>\n"^^ . . "Check if point is in convex polygon"^^ . "0"^^ . . "this is not stoping on press again"^^ . . "0"^^ . "0"^^ . . . "1"^^ . . . . "<p>I am implementing a Lua REPL. I use readline to read a command and then do:</p>\n<pre class="lang-c prettyprint-override"><code>luaL_dostring(L, myinput);\n</code></pre>\n<p>How can I retrieve the value returned by the execution if there is any? For example, if <code>myinput</code> contains a function call <code>add(1, 1)</code>, how I can retrieve 2 here?</p>\n<p>I tried reading the stack with <code>lua_tointeger</code> but the stack is empty (<code>lua_gettop</code> returns 0).</p>\n<p>I would like to avoid modifying <code>myinput</code> to do something like <code>ans = add(1, 1)</code> and then reading the global if possible...</p>\n"^^ . . . . . . . . "1"^^ . . . "0"^^ . . "1"^^ . . . . "I am counting 8 issues in 5 lines of code, that's a new record ^^"^^ . . . "<pre><code>print ('Hello, make a face, ')\nlocal face = io.read()\nlocal t = {&quot;{:) , :), &quot;}\nif local face (t1) then print (&quot; :0 &quot;)\nif local (t2) then print (&quot; :) &quot;)\n</code></pre>\n<p>please help me fix it and help me understand why this is happening.</p>\n"^^ . . . "0"^^ . "<p>So idk nothing about scripting and I am making a tycoon from a tut and I need help with Argument 3 missing or nil here is the code</p>\n<pre><code>local ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal TweenService = game:GetService(&quot;TweenService&quot;)\nlocal Players = game:GetService(&quot;Players&quot;)\n\nlocal Player = Players.LocalPlayer\n\nlocal PlayerGui = Player:WaitForChild(&quot;PlayerGui&quot;)\n\nlocal Remotes = ReplicatedStorage:WaitForChild(&quot;Remotes&quot;)\n\nlocal Rng = Random.new()\n\nlocal function AnimateBuild(Model)\n for _, v in Model:GetDescendants() do\n if v:IsA(&quot;BasePart&quot;) or v:IsA(&quot;UnionOperation&quot;) then\n local OriginalCFrame = v.CFrame\n local OriginalSize = v.Size\n local OriginalTransparency = v.Transparency\n \n local PositionOffset = Vector3.new(Rng:NextNumber(-2, 2), Rng:NextNumber(-2, 2))\n local RotationOffset = CFrame.Angles(Rng:NextNumber(-3, 3), Rng:NextNumber(-3, 3))\n v.CFrame = v.CFrame * CFrame.new(PositionOffset) * RotationOffset\n v.Transparancy = 1 \n \n TweenService:Create(v, TweenInfo.new(1, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {CFrame = OriginalCFrame}):Play()\n TweenService:Create(v, TweenInfo.new(0.25, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Transparency = OriginalTransparency}):Play()\n \n end\n end\nend\n\nRemotes:WaitForChild(&quot;BuildAnimation&quot;).OnClientEvent:Connect(function(Model)\n print(&quot;CALLED ANIMATION&quot;)\n AnimateBuild(Model)\nend)\n</code></pre>\n<p>i have not tyyend enything idk what to do</p>\n"^^ . . . . "Yes this is probably a smarter way than checking against `string.upper`. But that is the name of the function in case you need it for something else."^^ . "4"^^ . . . . "0"^^ . "0"^^ . . "0"^^ . "2"^^ . "5"^^ . "0"^^ . "See: https://luajit.org/ext_ffi_semantics.html#cdata_array"^^ . . "resources"^^ . "0"^^ . . . . "0"^^ . "<p>I presume, you want to get numerical derivative, not symbolic. Then why not use the most straightforward approach?</p>\n<pre class="lang-lua prettyprint-override"><code>-- lim_{x -&gt; x0} f(x):\nlocal function limit (f, x0, left)\n local x0 = x0 or 0\n local y0 = f (x0)\n if y0 == y0 --[[ not NaN, i.e. 0/0 ]] then\n -- Simplest case: lim_{x -&gt; x0} f(x) = f (x0) (not for derivative, anyway):\n return y0\n end\n local abs = math.abs\n local delta_x = left and -2e-9 or 2e-9\n local y, y1, y2 -- old values of f (x).\n -- Halve delta_x while it is measureable or until f(x) starts to lose accuracy:\n while not y1 or not y2 or abs (delta_x) &gt; 0 and abs (y - y1) &lt; abs (y1 - y2) do\n delta_x = delta_x / 2\n -- Remember changes of y:\n y, y1, y2 = f (x0 + delta_x), y, y1\n end\n return y\nend\n\n-- f'(x):\nlocal function derivative (f, left)\n return function (x)\n -- f'(x) = lim_{delta -&gt; 0} (f (x + delta) - f(x)) / delta:\n return limit (function (delta)\n return (f (x + delta) - f (x)) / delta\n end, --[[ delta -&gt; ]] 0, left)\n end\nend\n\n-- Example:\nlocal f = function (x)\n return x ^ 3\nend\n\nlocal df = derivative (f)\n\nfor _, x in ipairs {-3, -2, -1, 0, 1, 2, 3} do\n print (x, df (x))\nend\n</code></pre>\n<p>or simplified:</p>\n<pre class="lang-lua prettyprint-override"><code>local delta = 1e-9\n\nlocal function derivative (f)\n return function (x)\n return (f (x + delta) - f (x)) / delta\n end\nend\n\n-- Example:\nlocal f = function (x)\n return x ^ 3\nend\n\nlocal df = derivative (f)\n\nfor _, x in ipairs {-3, -2, -1, 0, 1, 2, 3} do\n print (x, df (x))\nend\n</code></pre>\n"^^ . . . "0"^^ . . "2"^^ . . "1"^^ . . . . . . . . "0"^^ . "<p>since the 2024,1 Domoticz version I have errors with Lua scripts controlling my Heatzy module.</p>\n<p>the error is :</p>\n<p><code>Error: EventSystem: in HeatzyStatusSalon: [string &quot;json = (loadfile &quot;/home/pi/domoticz/scripts/l...&quot;]:20: attempt to index a nil value (field 'attr')</code></p>\n<p>my script is :</p>\n<pre><code>json = (loadfile &quot;/home/pi/domoticz/scripts/lua/JSON.lua&quot;)() -- For Linux enlever les -- devant la ligne qui vous interesse et mettre -- devant la ligne a commenter\n-- json = (loadfile &quot;/home/pi/domoticz/scripts/lua/JSON.lua&quot;)() -- For raspberry enlever les -- devant la ligne qui vous interesse et mettre -- devant la ligne a commenter\n-- json = (loadfile &quot;D:\\\\Domoticz\\\\scripts\\\\lua\\\\json.lua&quot;)() -- For Windows enlever les -- devant la ligne qui vous interesse et mettre -- devant la ligne a commenter\n-- json = (loadfile &quot;/volume1/@appstore/domoticz/var/scripts/lua/json.lua&quot;)() -- For Syno enlever les -- devant la ligne qui vous interesse et mettre -- devant la ligne a commenter\n \n --variable a configurer\ndid = 'MYDID' --did que l'on a trouvé, on garde les ''\nselectorheatzy = 'Chauffage Salon' --nom de votre inter selecteur qui pilote le heatzy on garde les ''\n --fin des variable a configurere\n \n \n --ligne de commande qui interoge les serveur heatzy pour le retour d'etat\n local config=assert(io.popen('curl -X GET --header \\'Accept: application/json\\' --header \\'X-Gizwits-Application-Id: c70a66ff039d41b4a220e198b0fcc8b3\\' \\'https://euapi.gizwits.com/app/devdata/'..did..'/latest\\''))\n \n --parsing du json\n local blocjson = config:read('*all')\n config:close()\n --print (blocjson)\n local jsonValeur = json:decode(blocjson)\n mode = jsonValeur.attr.mode\n --print('****************')\n --print(mode)\n \n \ncommandArray = {}\n\nif mode == 'stop' and otherdevices[selectorheatzy]~='Off' then\n print(&quot;heatzy le radiateur est passé en mode Stop&quot;)\n commandArray[selectorheatzy]='Set Level: 0'\n\nelseif mode == 'cft' and otherdevices[selectorheatzy]~='Confort' then \n print(&quot;heatzy le radiateur est passé en mode Confort&quot;)\n commandArray[selectorheatzy]='Set Level: 10'\n\nelseif mode == 'eco' and otherdevices[selectorheatzy]~='Eco' then \n print(&quot;heatzy le radiateur est passé en mode Eco&quot;)\n commandArray[selectorheatzy]='Set Level: 20'\n\nelseif mode == 'fro' and otherdevices[selectorheatzy]~='Hors Gel' then \n print(&quot;heatzy le radiateur est passé en mode Hors-gel&quot;)\n commandArray[selectorheatzy]='Set Level: 30'\nend\n \n\nreturn commandArray\n</code></pre>\n<p>The script was working fine and used to return the state of my module but now I have this error.</p>\n"^^ . . . "1"^^ . . "0"^^ . . . "4"^^ . . "0"^^ . . . . "Neovim: indent-blankline plugin, can't configure mixed indentation"^^ . . . . . . "1"^^ . . "neovim-plugin"^^ . . . . "3"^^ . . . "<p>In your configuration, you need to call <code>setup</code> function for the <code>nvim-tree.lua</code> plugin and you could also disable <code>netrw</code> in <code>init.lua</code> =&gt; see &quot;Setup&quot; section in <a href="https://github.com/nvim-tree/nvim-tree.lua" rel="noreferrer">https://github.com/nvim-tree/nvim-tree.lua</a></p>\n<pre class="lang-lua prettyprint-override"><code>-- disable netrw at the very start of your init.lua\nvim.g.loaded_netrw = 1\nvim.g.loaded_netrwPlugin = 1\n</code></pre>\n<p><code>nvim/lua/moorby/plugins/nvim-tree.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;nvim-tree/nvim-tree.lua&quot;,\n config = function()\n require(&quot;nvim-tree&quot;).setup({\n filters = {\n dotfiles = true,\n },\n lazy = false\n })\n end,\n}\n</code></pre>\n"^^ . . "0"^^ . "Is there any way to disable the code descriptions showing up on the autocompletion list performed by cmp plugin?"^^ . . "3"^^ . . . "How do I add a different animation to a sprint mechanic (ROBLOX Lua)"^^ . . "0"^^ . . . . . "How to properly extend lspconfig server list from another file"^^ . "@VRehnberg Well, maybe I'm exaggerate things a little. I checked that on Windows and it looks like adding only few percent of CPU load while using default winyank. And swithing to my neoclip plugin with direct access to OS API or to the exported gui shell's methods makes the difference even unnoticeable. So take it mostly as my personal reluctance to load CursorMoved with potentially heavy code. But, nowadays, spawning even a dozen of new processes per second does not make CPU to sweat."^^ . . "<p>I looked and didn't find anything wrong. I tried to tweak it a little try this code and see if it works:</p>\n<pre><code>script.Parent[&quot;Kick/Ban&quot;].OnServerEvent:Connect(function(plr, plrname, \nreason, kb)\n if game.Players:FindFirstChild(plrname) then\n local target = game.Players:FindFirstChild(plrname)\n if kb == &quot;Kick&quot; then\n if reason ~= &quot;&quot; then\n target:Kick(reason)\n elseif reason == &quot;&quot; then\n target:Kick()\n end\n elseif kb == &quot;Ban&quot; then\n local part = Instance.new(&quot;WedgePart&quot;)\n\n print(target.Name .. &quot; has been banned&quot;)\n\n part.Parent = game.Workspace\n part.Name = target.Name .. &quot; / Banned&quot;\n part.CanCollide = false\n part.Transparency = 1\n part.Anchored = true\n \n target:Kick(&quot;Banned&quot;)\n elseif kb == &quot;Unban&quot; then\n local tn = plrname .. &quot; / Banned&quot;\n local part2 = game.Workspace:FindFirstChild(tn)\n\n if part2 then\n part2:Destroy()\n print(target.Name .. &quot; has been unbanned&quot;)\n else\n print(target.Name .. &quot; is not banned&quot;)\n end\n end\n end\nend)\n</code></pre>\n"^^ . . . "2"^^ . . "0"^^ . "3"^^ . . . "Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . . "1"^^ . "0"^^ . "0"^^ . . . . "1"^^ . "1"^^ . "account local functions as valid while making a debugger in lua"^^ . "<p>Error parsing script @high_phone/server/mail.lua in resource high_phone: @high_phone/server/mail.lua:792: ')' expected (to close '(' at line 778 near 'end'</p>\n<pre><code>MySQL.Async.fetchScalar(&quot;SELECT `id` FROM phone_mail WHERE `owner` = @owner AND `subject` = @subject ORDER BY `id` DESC LIMIT 1&quot;, {}, function(_ARG_0_)\n ({}).id = _ARG_0_\n ;({}).subject = _UPVALUE1_\n if &quot;table&quot; ~= type(_UPVALUE2_) or _UPVALUE2_ then\n end\n ;({}).recipients, ({})[1] = {}, _UPVALUE2_\n ;({}).address = _UPVALUE3_.address\n ;({}).name = _UPVALUE3_.name\n ;({}).sender, ({}).photo = {}, _UPVALUE3_.photo\n ;({}).content = _UPVALUE4_\n ;({}).time = _UPVALUE5_\n ;({}).attachments = _UPVALUE6_\n TriggerClientEvent(&quot;high_phone:receivedMail&quot;, _UPVALUE0_.source, {})\n end\nend)\n</code></pre>\n<p>We tried to remove and set new ) but nothing happend so the code is back in normal condition</p>\n"^^ . . "Please refer to ESkri's comment under your question, that's the way to go."^^ . "2"^^ . . . "1"^^ . . . "0"^^ . "0"^^ . . . "6"^^ . . . . . . . . "0"^^ . . . . . "Get Direction a Sprite Appears to Be Facing Relative to the Camera"^^ . . "<p>Newer versions of Lua have replaced <code>gfind</code> with <code>gmatch</code>, replace the function in the code to match your version.</p>\n<p>Since you want to match both integers and decimals you will need a pattern that includes both. You want to match: a sequence of numbers, possibly followed by a dot and then more numbers.</p>\n<pre><code>local S = &quot;564186207, 399.4989929 , ABC, degds, 2425, 335.232&quot;\nlocal pattern = &quot;(%d+%.?%d*)&quot; --Any number of digits, followed by an optional 'dot' and then zero or more digits (this could match against &quot;123.&quot; but given your example input it hopefully won't be an issue\nlocal matches = string.gmatch(S,pattern)\nfor found in matches do\n print(&quot;Matched:&quot;,found)\nend\n</code></pre>\n<p>Outputs:</p>\n<pre><code>Matched: 564186207\nMatched: 399.4989929\nMatched: 2425\nMatched: 335.232\n</code></pre>\n"^^ . . . "Just checked my script on GHub - it works."^^ . . . . "2"^^ . . . . . . "0"^^ . "Question edited. Tell me if if my proposal is a good idea. I forgot the `method` argument in my original code."^^ . . "trigonometry"^^ . "Also it's not clear to me whether the segment which you want to cut is a segment in the plane, which you want to cut if it crosses the line that delimits the half-plane, or whether it is a line outside the plane, which you want to cut if it crosses the plane."^^ . . . "<p>I've been working on a roblox game based on Five Nights at Freddy's 1. I decided to go with an approach to have a minimap on the desk in front of you, with buttons next to each camera on the map. When a button is pressed, it runs a script that triggers a remote event to all clients, saying the button has been pressed, along with the name of the camera as an argument.</p>\n<p>On every client, after recieving this message, this function is ran:</p>\n<pre><code>local function onCameraEvent(cameraName)\n print(&quot;Clicked&quot;)\n for _, child in game.StarterGui.CamerasUI.Cameras:GetChildren() do\n if (child.Name ~= cameraName) then\n child.Visible = false \n\n for _, descendant in pairs(child:GetDescendants()) do\n descendant:Destroy()\n end\n\n end\n end\n\n game.StarterGui.CamerasUI.Cameras[cameraName].Visible = true \n\n\n local cam = Instance.new(&quot;Camera&quot;, game.StarterGui.CamerasUI.Cameras[cameraName])\n cam.Name = &quot;Cam&quot;\n cam.CameraType = Enum.CameraType.Scriptable\n cam.FieldOfView = 70\n\n game.StarterGui.CamerasUI.Cameras[cameraName].CurrentCamera = cam\n \n \n local model = Instance.new(&quot;WorldModel&quot;, game.StarterGui.CamerasUI.Cameras[cameraName])\n model.Name = &quot;World Model&quot;\n \n\n\n for i, minimapObjects in pairs(game.Workspace.Map:GetChildren()) do\n if minimapObjects:IsA(&quot;Sound&quot;) or minimapObjects:IsA(&quot;SoundGroup&quot;) or minimapObjects:IsA(&quot;SoundEffect&quot;) then return end\n minimapObjects:Clone().Parent = model\n end\n local camPart = game.Workspace.Cameras:WaitForChild(cameraName)\n\n\n game[&quot;Run Service&quot;].RenderStepped:Connect(function()\n local camFr = game.Workspace.Cameras[cameraName].CFrame\n cam.CFrame = camFr\n end)\n \nend\n</code></pre>\n<p>Essentially, it finds the SurfaceUI within the starterUI, then enables the viewport frame for the camera who's button was clicked. Also disabling any other viewports that were enabled previously. Then it adds a camera object and a copy of the map to the viewport frame. I did make sure that the viewport frame's &quot;CurrentCamera&quot; property is linked to the newly created camera.</p>\n<p>This creates a copy of the map within the viewport frame, with its camera in the same position as the real physical one would be. The goal is, for the viewport frame to just be an image of what the map looks like from the perspective of whichever camera you clicked on.</p>\n<p><strong>The UI tree looks like this:</strong></p>\n<p>Starter UI &gt; Surface GUI &gt; Folder &gt; Viewport Frame &gt; Camera &amp; Map Model</p>\n<p>(ViewportFrame.CurrentCamera = the camera it parents)</p>\n<p>(SurfaceGUI.adornee = Workspace.randomPartToDisplayCamera)</p>\n<p><strong>Final Question</strong></p>\n<p>After completing all this code, everything looks as if it should function correctly. For example, when I click a button, the correct viewport frame is activated, the map and camera is added to it, and everything looks fine. But, for some reason, no matter what I do, I just can't get the viewport frame to show up on the surface UI. I've tried going and making a separate frame with just one part in it and it works fine, but this just won't show up. Can anyone help me figure this out?</p>\n"^^ . "Bro thanks but its like been a while for this question. But Thanks."^^ . . . . "How to create references per chapter and complete references section in quarto book pdf?"^^ . . "0"^^ . . "1"^^ . . . . . "I had absolutely *no* idea about the bug with `.IsLoaded`, wouldn't have even crossed my mind that that was the issue! Did as the reporter said and instantly my music started working.\nA very, *very* minor side note, do you not have to separate expressions/calls etc. in one-line loops/conditionals with semi-colons?? I've always done `repeat x; y until z`."^^ . "0"^^ . . "0"^^ . . . . . . . . . . . . . . . "mutt"^^ . "1"^^ . "DRY: don't repeat yourself in Lua"^^ . "0"^^ . . . "You should take your "left-right" axis, `(1,0)`, apply rotation -0.78 to it, `(0.7, 0.7)` and get dot product with the entity look direction, the sign will be + for right, - for left."^^ . "<p>Both <a href="https://create.roblox.com/docs/reference/engine/datatypes/Vector3#new" rel="nofollow noreferrer"><code>Vector3.new</code></a> and <a href="https://create.roblox.com/docs/reference/engine/datatypes/CFrame#Angles" rel="nofollow noreferrer"><code>CFrame.Angles</code></a> expect <em>three</em> (3) <a href="https://create.roblox.com/docs/luau/numbers" rel="nofollow noreferrer">number</a> arguments. You only provide <em>two</em> (2) numbers to each:</p>\n<pre><code>local PositionOffset = Vector3.new(Rng:NextNumber(-2, 2), Rng:NextNumber(-2, 2))\nlocal RotationOffset = CFrame.Angles(Rng:NextNumber(-3, 3), Rng:NextNumber(-3, 3))\n</code></pre>\n"^^ . . . . "1"^^ . . . . "0"^^ . "0"^^ . . . "Preventing AUTOFOLLOW_END and AUTOFOLLOW_BEGIN Spam in WoW Addon"^^ . "6"^^ . "0"^^ . "<p>I took the liberty of rewriting your code.</p>\n<p>The despawn problem is fixed and to see the loot of your object you need to update your gameobject like this :</p>\n<pre class="lang-sql prettyprint-override"><code>UPDATE `gameobject_template` SET `Data1` = 0 WHERE (`entry` = 8000015);\n</code></pre>\n<p>For your lua script I allowed myself a few optimizations and reworking :</p>\n<pre class="lang-lua prettyprint-override"><code>local Constant = {\n GameObjectEntry = 8000015,\n SecondsInDelay = 86400,\n}\n\nlocal function print_format(msg, values)\n print(string.format(msg, table.unpack(values)))\nend\n\nlocal function AddItemToObject(object, item)\n if ( item ) then\n local item_entry = item:GetEntry()\n local item_count = item:GetCount()\n object:AddLoot(item_entry, item_count)\n print_format(&quot;Log:: Gameobject GUID %s now contains item %s in %s exemplars.&quot;, {object:GetGUIDLow(), item_entry, item_count})\n end\nend\n\nlocal function OnPlayerDied(player)\n local player_level = player:GetLevel()\n if ( player_level &lt; 15 ) then return end\n\n local object = player:SummonGameObject(Constant.GameObjectEntry, player:GetLocation())\n if ( object ) then\n local object_guid = object:GetGUIDLow()\n print_format(&quot;Log:: Gameobject GUID %s as spawn&quot;, {object_guid})\n\n for slot = 0, 22 do\n if ( slot &lt;= 18 ) then\n AddItemToObject(object, player:GetItemByPos(255, slot))\n end\n if ( slot &gt;= 19 ) then\n for bag_slot = 0, 35 do\n AddItemToObject(object, player:GetItemByPos(slot, bag_slot))\n end\n end\n end\n\n object:RegisterEvent( function(_, _, _, game_object)\n game_object:Despawn()\n print_format(&quot;Log:: Gameobject GUID %s as despawn&quot;, {object_guid})\n end, Constant.SecondsInDelay * 1000, 1 )\n end\nend\n</code></pre>\n<p>Best regards,\niThorgrim</p>\n"^^ . . . . . . "1"^^ . . . "0"^^ . . . . . "oop"^^ . "<p>First you are going to want to either find animations (and their ID's), or create your own animations (and get its ID). Once you have the ID's of the animations, you can make an array with the two (or more) animations.</p>\n<pre><code>local anims = {\n id,\n id,\n id\n}\n</code></pre>\n<p>Next you will want to identify the character animator.</p>\n<pre><code>local animator = Player.Humanoid:WaitForChild(&quot;Animator&quot;)\n</code></pre>\n<p>Then you'll want to load one of the animations onto your character animator:</p>\n<pre><code>local anim = animator:LoadAnimation(math.random(1, #anims))\n</code></pre>\n<p>You will want the line above to be under your <code>if input.KeyCode == Enum.KeyCode.W then</code>.</p>\n<p>Under <code>Player.Humanoid.WalkSpeed = Speeds.Extra</code> you should add:</p>\n<pre><code>anim:Play()\n</code></pre>\n<p>The animation will play, and will not stop until it ends. If you want it to stop when the player stops sprinting, then make an if statement checking to see if the player is sprinting or not. If they aren't, do <code>anim:Stop()</code>.</p>\n<p>Hope this helps!</p>\n"^^ . . "mysql"^^ . . . . "1"^^ . "Change Player's Health"^^ . "0"^^ . . "Second argument of `:sub` method is **not** the length of substring."^^ . . . "@VRehnberg The code fits within a line and is totally trivial. You need a minute or so to check this."^^ . "1"^^ . "docker"^^ . . . "object"^^ . "<p>There is no understating how much of a bad idea this is.</p>\n<p>Firstly, and most importantly, you should never be sending constant requests to the server since this will cause poor performance.\nYou should instead Listen to the RunService Heartbeat event <em><strong>on the client</strong></em> and check if the mouse is over one of the ClickDetectors, and only then Fire a RemoteEvent to the server, where the server will do a sanity check and act upon it.\nYou should almost never use a while wait(a very small number) loop since this does not take into account the Client's frame rate, so there will be a very high chance of you checking the exact same frame multiple times.</p>\n<p>To continue, it is impossible to directly access the mouse from the server since the mouse only exists on the client.</p>\n"^^ . "I'd like to fix an Lua script in Domoticz to control my heating module"^^ . . "0"^^ . . . . . "2"^^ . "0"^^ . . . "1"^^ . . "0"^^ . . . . "2"^^ . . "0"^^ . . "<p>From the <a href="https://www.lua.org/pil/5.3.html" rel="nofollow noreferrer">Programming In Lua</a> book,</p>\n<blockquote>\n<p>The parameter passing mechanism in Lua is positional: When we call a function, arguments match parameters by their positions. The first argument gives the value to the first parameter, and so on.</p>\n</blockquote>\n<p>And from the <a href="https://quarto.org/docs/extensions/shortcodes.html#metadata-options" rel="nofollow noreferrer">Quarto shortcodes documentation</a>, shortcodes function signature is <code>function(args, kwargs, meta)</code>. So in your implementation, <code>meta</code> is matched with <code>args</code>, instead of <code>meta</code>. And that's why <code>meta.authors</code> returns <code>nil</code> and you are getting &quot;ORCID not found.&quot;.</p>\n<p>The following implementation returns the orcid link as expected. Note that, I have added a shortcode argument so that it works in case of multiple authors.</p>\n<p><strong>test-shortcodes.lua</strong></p>\n<pre class="lang-lua prettyprint-override"><code>local str = pandoc.utils.stringify\n\nreturn {\n ['orcid'] = function(args, kwargs, meta)\n local author_id = str(args[1])\n local authors = meta.authors or meta['by-author']\n\n if authors then\n for _, author in ipairs(authors) do\n if author.id == author_id then\n if author.orcid then\n local orcid_value = str(author.orcid)\n local orcid_link = &quot;&lt;a href=\\&quot;https://orcid.org/&quot; .. orcid_value .. &quot;\\&quot;&gt;orcid&lt;/a&gt;&quot;\n return pandoc.Para(pandoc.RawInline(&quot;html&quot;, orcid_link))\n end\n return pandoc.Para(pandoc.Str(&quot;ORCID not found&quot;))\n end\n end\n end\n\n end\n}\n</code></pre>\n<pre><code>---\nTitle: Lua Test\nformat: html\nauthor:\n - name: First Author\n orcid: 0000-0000-0000-0000\n - name: Second Author\n orcid: 0000-0000-0000-0001\nshortcodes: \n - test-shortcodes.lua\n---\n\n\nFirst Author {{&lt; orcid 1 &gt;}}\n\nSecond Author {{&lt; orcid 2 &gt;}}\n</code></pre>\n<hr>\n<p><a href="https://i.sstatic.net/nJfU3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/nJfU3.png" alt="enter image description here" /></a></p>\n"^^ . . "vector"^^ . "0"^^ . . . "0"^^ . "0"^^ . . . . "0"^^ . "<p>There is multiple problems with this,\nFirstly, you are listening to the same RemoteEvent multiple times, this is going to cause problems since you can only handle a RemoteEvent once.</p>\n<p>You should move this event outside of the setup function and have a function to update the statistic for any inputted player.</p>\n<p>Secondly, assuming that the script inside the Part is a LocalScript, it will not run by default when under workspace. You could instead use a serverside Script to listen to the event (could be the same script that's setting up the leaderstats, move the LocalScript somewhere where it will execute (such as StarterPlayerScripts) or set the RunContext of the LocalScript to &quot;Client&quot;.\nsee (<a href="https://devforum.roblox.com/t/live-script-runcontext/1938784" rel="nofollow noreferrer">https://devforum.roblox.com/t/live-script-runcontext/1938784</a>)</p>\n"^^ . "0"^^ . . . "<p>It looks like on your second script you are connecting to the <code>.Event</code> event on an <a href="https://create.roblox.com/docs/reference/engine/classes/RemoteEvent" rel="nofollow noreferrer">RemoteEvent</a>. From my knowledge, <code>.Event</code> isn't an event you can connect to. Instead, you need to connect to <a href="https://create.roblox.com/docs/reference/engine/classes/RemoteEvent#OnServerEvent" rel="nofollow noreferrer"><code>.OnServerEvent</code></a> for <a href="https://create.roblox.com/docs/scripting/events/remote#client-server" rel="nofollow noreferrer">Client → Server events</a>.</p>\n<pre class="lang-lua prettyprint-override"><code>local TweenService = game:GetService(&quot;TweenService&quot;)\nlocal camera = workspace:WaitForChild(&quot;MainCamera&quot;)\nlocal text = workspace.MenuText:WaitForChild(&quot;WorldPivot&quot;)\nlocal SoundService = game:GetService(&quot;SoundService&quot;)\nlocal event = game.ReplicatedStorage.Credits\nlocal watereffect = workspace.MenuText.Water.Water\nlocal fireeffect = workspace.MenuText.Fire\nlocal explosion = fireeffect.Explosion\n\nlocal function enableExplosion()\n for _, explosion in pairs(explosion:GetDescendants()) do\n if explosion:IsA(&quot;ParticleEmitter&quot;) then\n explosion.Enabled = true\n end\n end\nend\n\nlocal function enableFire()\n for _, fire in pairs(fireeffect:GetDescendants()) do\n if fire:IsA(&quot;ParticleEmitter&quot;) then\n fire.Enabled = true\n end\n end\nend\n\nlocal function enableWater()\n watereffect.Enabled = true\nend\n\nlocal function disableExplosion()\n for _, explosion in pairs(explosion:GetDescendants()) do\n if explosion:IsA(&quot;ParticleEmitter&quot;) then\n explosion.Enabled = false\n end\n end\nend\n\nlocal function disableFire()\n for _, fire in pairs(fireeffect:GetDescendants()) do\n if fire:IsA(&quot;ParticleEmitter&quot;) then\n fire.Enabled = false\n end\n end\nend\n\nlocal function disableWater()\n watereffect.Enabled = false\nend\n\n\nlocal playbutton = workspace.Menu.Play\nlocal rope = workspace.Menu.Play.Rope\nlocal info = TweenInfo.new(6, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false)\nlocal info4 = TweenInfo.new(4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false)\nlocal info2 = TweenInfo.new(8, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false)\nlocal tween = TweenService:Create(camera, info, {Position = Vector3.new(733.108, 14.451, -821.718)}) -- menu camera\nlocal tween4 = TweenService:Create(text, info4, {Position = Vector3.new(712.179, 19.936, -842.667)}) -- text title\nlocal tween2 = TweenService:Create(playbutton, info2, {Position = Vector3.new(733.86, 20.13, -841.05)}) -- play button\n--local tween3 = TweenService:Create(rope, info2, {Position = Vector3.new(733.86, 41.93, -841.05)})\n\nevent.OnServerEvent:Connect(function()\n print(&quot;received&quot;)\n tween:Play()\n wait(1.4)\n print(&quot;wait&quot;)\n tween4:Play()\n print(&quot;tween 4&quot;)\n SoundService.splash:Play()\n enableWater()\n tween4.Completed:Connect(function()\n disableWater()\n enableExplosion()\n SoundService.explosion:Play()\n wait(3)\n disableExplosion()\n enableFire()\n SoundService.fire:Play()\n \n wait(2)\n \n tween2:Play()\n --tween3:Play()\n SoundService.Elevator:Play()\n end)\nend)\n</code></pre>\n<p>In the above script I simply just replaced <code>event.Event:Connect(function()</code> with <code>event.OnServerEvent:Connect(function()</code>.</p>\n<p>Another issue is that you are using <code>:Fire</code> instead of <a href="https://create.roblox.com/docs/reference/engine/classes/RemoteEvent#FireServer" rel="nofollow noreferrer"><code>:FireServer</code></a> on your first script. Since you are firing to the server you need to use change <code>:Fire</code> to <a href="https://create.roblox.com/docs/reference/engine/classes/RemoteEvent#FireServer" rel="nofollow noreferrer"><code>:FireServer</code></a>. Below is the corrected script.</p>\n<pre class="lang-lua prettyprint-override"><code>local frame = game.Players.LocalPlayer.PlayerGui.Credits.Frame\nlocal text = frame.Presents\nlocal stroke = text.UIStroke\nlocal CurrentCamera = workspace.CurrentCamera\nlocal TweenService = game:GetService(&quot;TweenService&quot;)\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal finishcredits = ReplicatedStorage.Credits\nlocal SoundService = game:GetService(&quot;SoundService&quot;)\nlocal song = SoundService.Song\nlocal boom = SoundService.Boom\nlocal RunService = game:GetService(&quot;RunService&quot;)\n\n\nlocal targetTransparency = 1\nlocal tweenDuration = 2\nlocal tweenDuration2 = 4\nlocal tweenInfo = TweenInfo.new(tweenDuration)\nlocal tween = TweenService:Create(frame, tweenInfo, {BackgroundTransparency = targetTransparency})\nlocal tween2 = TweenService:Create(text, tweenInfo, {TextTransparency = targetTransparency})\nlocal tween3 = TweenService:Create(stroke, tweenInfo, {Transparency = targetTransparency})\n\n\nwait(1)\nprint(&quot;1&quot;)\nlocal camera = workspace.MainCamera\nlocal function updateCamera()\nCurrentCamera.CFrame = camera.CFrame\nend\n\nprint(&quot;2&quot;)\nframe.Visible = true\nwait(1)\nboom:Play()\nwait(5)\nsong:Play()\nCurrentCamera.CameraType = Enum.CameraType.Scriptable\nprint(&quot;script&quot;)\n\ntween:Play()\nprint(&quot;tweened&quot;)\ntween2:Play()\ntween3:Play()\n\nwait(2)\nfinishcredits:ServerFire(print(&quot;fired&quot;))\n\n\nRunService.RenderStepped:Connect(updateCamera)\n</code></pre>\n"^^ . "Can you share a test GitHub repository with all the necessary files so that per-chapter references are created?. Because I can not even get per-chapter bibliography, let alone at the end bibliography. I am having [the same issue now](https://github.com/pandoc-ext/section-bibliographies/issues/13)"^^ . . . "SCRIPT ERROR: @qb-core/server/player.lua:164: attempt to index a nil value (field 'Jobs')"^^ . "1"^^ . . . . "0"^^ . . . . . "0"^^ . . "0"^^ . "0"^^ . . "@darkfrei - Yes, you can rename the function to `getTriangleDoubleArea`, it will not affect `pointInConvexPolygon`"^^ . . "0"^^ . "<p>I have this directories</p>\n<p>project/src/main.lua<br />\nproject/assets/font.ttf</p>\n<p>And I want to define the path to <code>font.ttf</code> in <code>main.lua</code> so I can load it.</p>\n<p>I've tried defining <code>FONT_PATH = '../assets/font.ttf'</code> and many variations but they don't work</p>\n"^^ . . . . ":GetChildren() not working for an unknown reason"^^ . "1"^^ . . . "dry"^^ . . . "0"^^ . "0"^^ . "<p>In Lua, C packages are libraries of native code loaded from <a href="https://www.lua.org/manual/5.1/manual.html#pdf-package.cpath" rel="nofollow noreferrer">CPATH</a>. There are <a href="https://stackoverflow.com/q/4845984/2441747">two types of libraries that can be loaded dynamically</a>: shared libraries and modules. The difference being that shared libraries can be linked against and modules can not. The dynamic loading aspects are similar for both types, so both will load the same with Lua.</p>\n<p>In PiL, <a href="https://www.lua.org/pil/8.2.html" rel="nofollow noreferrer">it's suggested</a> that shared libraries should be used. This chapter even mentions &quot;dynamic linking&quot; multiple times, when in my opinion, it should be &quot;dynamic loading&quot;. Am I misinterpreting this chapter?</p>\n<p>Unfortunately, I couldn't find any definitive answer in PiL about how to build C packages correctly. To me it seems that they should be compiled as modules rather than shared libraries, because they should not be linked against. Is this assumption correct?</p>\n<p>I first started researching this because on macOS shared libraries have to have <code>.dylib</code> extension, and modules (or &quot;bundles&quot; in macOS terminology), <a href="https://stackoverflow.com/a/2339910/2441747">can have <strong>any</strong> extension</a>, and it's a very common practice in ported software to use <code>.so</code> extension (for example, CMake defaults when targeting macOS are <code>CMAKE_SHARED_LIBRARY_SUFFIX=.dylib</code> and <code>CMAKE_SHARED_MODULE_SUFFIX=.so</code>). Lua on macOS will only try to load libraries with <code>.so</code> extension with default CPATH.</p>\n"^^ . . "0"^^ . . "<p>I am learning how to create a c library with embedded Lua. Sounds simple with everyone but I stuck at compiling the code. Please points me to what I did wrong in follow steps. The important key is I need to use MinGW-w64 toolchain, this is the reason I use Cygwin.</p>\n<ol>\n<li><p>First I install lua and liblua-dev in Cygwin. I chose version 5.3.6-4.\nFrom Cygwin, I can run lua script.lua which print a string on the Cygwin terminal.</p>\n<p>print('Hi from script.lua!')</p>\n</li>\n<li><p>Then I install MinGW-w64 toolchain and add &quot;C:\\msys64\\ucrt64\\bin&quot; to the user environment variables.\nFrom Cygwin, I can test the gcc version work correctly.</p>\n<p>$ cc --version\ncc.exe (Rev3, Built by MSYS2 project) 13.2.0\nCopyright (C) 2023 Free Software Foundation, Inc.<br />\nThis is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>\n</li>\n</ol>\n<p>I create a doscript.c file as below</p>\n<pre><code>#include &quot;lauxlib.h&quot;\n#include &quot;lua.h&quot;\n#include &quot;lualib.h&quot;\n\nint main(){\n lua_State *L = luaL_newstate();\n luaL_openlibs(L);\n luaL_dofile(L, &quot;script.lua&quot;);\n lua_close(L);\n return 0;\n}\n</code></pre>\n<p>When I ran command to compile, I got below error</p>\n<pre><code>$ cc doscript.c -o doscript -llua\nC:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64\n-mingw32/bin/ld.exe: cannot find -llua: No such file or directory\ncollect2.exe: error: ld returned 1 exit status\n</code></pre>\n<p>From Cygwin if I list the usr/lib, I can see the liblua5.3.dll.a</p>\n<pre><code>$ ls /usr/lib\ncharset.alias engines-3 liblua-5.3.dll.a ossl-modules pkgconfig\ncsih gawk liblua.dll.a p11-kit-proxy.so sasl2_3\nengines-1.0 groff liblua5.3.dll.a perl5 security\nengines-1.1 libcbor.a lua pkcs11 terminfo\n</code></pre>\n<p>I also tried with the actual library name but still get error</p>\n<pre><code>$ cc doscript.c -o doscript -L/usr/lib -llua-5.3.dll\nC:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64\n-mingw32/bin/ld.exe: cannot find -llua-5.3.dll: No such file or directory\ncollect2.exe: error: ld returned 1 exit status\n</code></pre>\n<p>Is there anything else I should try?\nThank you in advance!</p>\n"^^ . "1"^^ . . . "macos"^^ . . "1"^^ . "0"^^ . . . . . . . . . . . . . . "Yep that looks like the issue."^^ . . "Expurious newlines when setting buffer content in Neovim with Lua"^^ . . "1"^^ . . . "thanks, seems to work with `let list: Cars = value.as_userdata().unwrap().take().unwrap();`"^^ . "Add relative line numbers in neo-tree using Lazy in Neovim"^^ . . . "1"^^ . "0"^^ . . . . "Is the question about Roblox?"^^ . . . "I tried it originally like how you had it. And then I got “attempted to compare a number (being the 1 as an integer) with nil (meaning lastIDInt can’t be found). Apparently my SQL query doesn’t work"^^ . . . . . "1"^^ . "2"^^ . "0"^^ . "random"^^ . "0"^^ . . . . "0"^^ . "2"^^ . "0"^^ . . . . . . . . "0"^^ . "Need the latest entry in a specific column for Fivem Lua/MySQL"^^ . "I've been trying but it's not working, i find the same problem, previousX will always equal currentX. how should i do the timer then? thanks for your help"^^ . "Pandoc Lua filter wraps the space or the symbols with an element instead of wrapping the keys with an arrow element"^^ . . . . "0"^^ . "-1"^^ . . "<p>so, i'm trying to make a baldi's basics type game</p>\n<p>(here's my code for the hearing script)</p>\n<pre><code>local baldi = script.Parent\nlocal neededConfig = require(game.ReplicatedStorage.modules.configs.tags)\nlocal targ = baldi.Target\nlocal crime = targ.Crime\nlocal minDistance = 200\n\nfunction getHRP(c:Model)\n local t = c:GetChildren()\n\n for _, part in pairs(t) do\n if part:IsA(&quot;BasePart&quot;) then\n if part.Name == &quot;HumanoidRootPart&quot; then\n return part\n end\n end\n end\n\n return nil\nend\n\nfunction speedup(boostTime, briefSpeedup)\n baldi.Speed.Value += briefSpeedup\n\n task.delay(boostTime, function()\n baldi.Speed.Value -= briefSpeedup\n end)\nend\n\nfunction listen()\n local nearest = minDistance\n\n crime.Value = &quot;baldi&quot;\n\n for _, p in pairs(game.Players:GetPlayers()) do\n local c = game.Players:FindFirstChild(p.Name, true).Character\n\n if getHRP(c) ~= nil then\n local hrp = getHRP(c)\n local dist = (hrp.Position - baldi.HumanoidRootPart.Position).magnitude\n\n if dist &lt;= nearest and c:HasTag(neededConfig.tags.sound) then\n nearest = dist\n targ.Value = p\n\n if baldi.Wandering.Value ~= 0 then\n speedup(15, 1.25)\n baldi.Wandering.Value = 0\n\n task.delay(30, function()\n baldi.Wandering.Value = 1\n end)\n end\n end\n end\n end\nend\n\nspawn(function()\n repeat\n task.wait()\n listen()\n until baldi == nil\nend)\n</code></pre>\n<p>on line 8 when i call GetChildren, it errors saying <code>attempted to index nil with GetChildren</code> and i cant figure out why</p>\n<p>i havent seen any solutions yet, so i'm just kind of confused as to why my code is failing</p>\n"^^ . "2"^^ . . . "4"^^ . . "fivem"^^ . . "I am learning this so I follow a note from my previous coworker. I tried to use MSYS2 UCRT64 as you say and I received the same result:\nC:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:\n cannot find -llua: No such file or directory\ncollect2.exe: error: ld returned 1 exit status"^^ . . "2"^^ . . "registry"^^ . "<p>I solved it.</p>\n<pre><code>ch = &quot;A&quot;\nif string.match(ch, &quot;%u&quot;) then\n --Press Shift\nend\n</code></pre>\n<p>This will check if a character is an uppercase letter and do whatever.</p>\n"^^ . "4"^^ . "Random string in lua"^^ . . . . . . . . . "<p>So basically im trying to make it where the citizenID in a qbcore server is numerical only (this bit was easy as) but issue is, I cannot figure out how to grab the latest entry into the citizenID column in my DB, so that i can increment it by 1. So say my ID is 1, the next character someone makes should be 2 and so forth.</p>\n<pre><code>function QBCore.Player.CreateCitizenId()\n local UniqueFound = false\n local CitizenId = nil\n while not UniqueFound do\n local lastID = MySQL.prepare.await('SELECT MAX(citizenid) FROM players')\n local lastIDStr = tostring(lastID)\n local lastIDInt = tonumber(lastIDStr)\n if lastIDInt == 0 then\n CitizenId = 1\n elseif lastIDInt &gt;= '1' then\n CitizenId = lastID + 1\n end\n local result = MySQL.prepare.await('SELECT COUNT(*) as count FROM players WHERE citizenid = ?', { CitizenId })\n if result == 0 then\n UniqueFound = true\n end\n end\n return CitizenId\nend\n</code></pre>\n<p>Honestly it is a mess of code. Right now the error I get in my terminal is (attempting to index a string with nil (the string being the '1' in the elseif line, and the nil being the lastIDInt</p>\n<p>I need the SQL query to be in the one line too. Im still learning all this stuff so i apologise if the answer is simple but it eludes me</p>\n"^^ . "0"^^ . "0"^^ . . "0"^^ . . "0"^^ . . "treesitter"^^ . . . "<p>this is the first time I try to apply OOP in Lua. This class is a derivative of the &quot;Frame&quot; class already present in the game</p>\n<pre><code>LibListView = {}\n\nfunction LibListView:New(self)\n local listviewmt = {\n buttons = {}, \n data = {},\n initiated = true,\n \n OldSetScript = SetScript,\n SetScript = nil,\n -- more parameters and methods\n SetScript = function(self,handler,fnctn)\n local scripts = &quot;OnHide,OnLoad,OnMouseWheel,OnSizeChanged,OnShow,OnUpdate&quot;\n if string.find(scripts,handler) then\n self:HookScript(handler,fnctn)\n else\n self.OldSetScript(handler,fnctn)\n end\n end,\n }\n setmetatable(self, { __index = setmetatable(listviewmt, getmetatable(self)) })\n -- not simply setmetatable(main, class) to avoid already present meta overwritting\nend\n</code></pre>\n<p>If I write</p>\n<pre><code>listview = LibListView:New(self)\n</code></pre>\n<p>the code works fine. At this point, I would like to make sure that the class is created without passing <code>self</code> as a parameter: in short, using the wording</p>\n<pre><code>listview = LibListView:New()\n</code></pre>\n<p>to make the code more elegant.</p>\n<p>Some advice?</p>\n"^^ . . . . "class"^^ . "Oh god thank you! Because of your comment i search for commas and there is another one missing in\n'sfx/dlc_p60b40/p60b40_npc.awc'"^^ . . "<pre class="lang-lua prettyprint-override"><code>return {\n &quot;nvim-neo-tree/neo-tree.nvim&quot;,\n opts = {\n event_handlers = {\n {\n event = &quot;neo_tree_buffer_enter&quot;,\n handler = function(arg)\n vim.cmd([[\n setlocal relativenumber\n ]])\n end,\n },\n },\n }\n}\n</code></pre>\n<p>You can refer to <a href="https://www.reddit.com/r/neovim/comments/16siats/show_my_neotree_config_allow_you_to_telescope/" rel="noreferrer">https://www.reddit.com/r/neovim/comments/16siats/show_my_neotree_config_allow_you_to_telescope/</a></p>\n"^^ . . "FFI arrays start from 0, as in C."^^ . "Deleting E-Mails Programmatically with Lua in Neomutt"^^ . . "0"^^ . . "<p>I'm a newbie in Neovim and I've built my <a href="https://github.com/DrShahinstein/dotfiles/tree/main/.config/nvim/custom" rel="nofollow noreferrer">almost overall configuration</a> based on Nvchad.</p>\n<p>And, here's an only thing that I could never find the way to change:</p>\n<p><a href="https://i.sstatic.net/gyBwt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gyBwt.png" alt="enter image description here" /></a></p>\n<p>Notice the texts that I pointed out with yellow on the screenshot. I don't even know what those are called. Code &quot;descriptions,&quot; I guess?</p>\n<p>So, they remain a little bit of too much disturbing to me and I want to remove them. If I'm not mistaken, this must be something related to the cmp plugin although I read <a href="https://github.com/hrsh7th/nvim-cmp/blob/main/doc/cmp.txt" rel="nofollow noreferrer">doc/cmp.txt</a> and found nothing helpful. I also checked out <a href="https://github.com/neovim/nvim-lspconfig/blob/master/doc/lspconfig.txt" rel="nofollow noreferrer">doc/lspconfig.txt</a> if this was related to lsp.</p>\n<p>I would appreciate if anyone could teach me the way.</p>\n"^^ . "2"^^ . . . . "0"^^ . . "<p>Tried to run a FXManifest for my Resource and got</p>\n<blockquote>\n<p>&quot; Error: CAK-Sounds failed to load: Could not parse resource metadata\nfile\nD:/txData/ESXLegacy_99D8F7.base/resources//[carsounds]/CAK-Sounds/fxmanifest.lua:\nCAK-Sounds/fxmanifest.lua:85: '}' expected (to close '{' at line 5)\nnear ''audioconfig/488sound_game.dat151.rel''&quot;</p>\n</blockquote>\n<p>My Manifest looks like this</p>\n<pre><code>fx_version 'adamant'\n\ngame 'gta5'\n\nfiles {\n 'audioconfig/lambov10_game.dat151.rel',\n 'audioconfig/lambov10_sounds.dat54.rel',\n 'sfx/dlc_lambov10/lambov10.awc',\n 'sfx/dlc_lambov10/lambov10_npc.awc',\n 'audioconfig/musv8_game.dat151.rel',\n 'audioconfig/musv8_sounds.dat54.rel',\n 'sfx/dlc_musv8/musv8.awc',\n 'sfx/dlc_musv8/musv8_npc.awc',\n 'audioconfig/brabus850_game.dat151.rel',\n 'audioconfig/brabus850_sounds.dat54.rel',\n 'sfx/dlc_brabus850/brabus850.awc',\n 'sfx/dlc_brabus850/brabus850_npc.awc',\n 'audioconfig/shonen_game.dat151.rel',\n 'audioconfig/shonen_sounds.dat54.rel',\n 'sfx/dlc_shonen/shonen.awc',\n 'sfx/dlc_shonen/shonen_npc.awc',\n 'audioconfig/toysupmk4_game.dat151.nametable',\n 'audioconfig/toysupmk4_game.dat151.rel',\n 'audioconfig/toysupmk4_sounds.dat54.nametable',\n 'audioconfig/toysupmk4_sounds.dat54.rel',\n 'sfx/dlc_toysupmk4/toysupmk4.awc',\n 'sfx/dlc_toysupmk4/toysupmk4_npc.awc',\n 'audioconfig/rb26dett_amp.dat10.rel',\n 'audioconfig/rb26dett_game.dat151.rel',\n 'audioconfig/rb26dett_sounds.dat54.rel',\n 'sfx/dlc_rb26dett/rb26dett.awc',\n 'sfx/dlc_rb26dett/rb26dett_npc.awc',\n 'audioconfig/rotary7_game.dat151.rel',\n 'audioconfig/rotary7_sounds.dat54.rel',\n 'sfx/dlc_rotary7/rotary7.awc',\n 'sfx/dlc_rotary7/rotary7_npc.awc',\n 'audioconfig/m297zonda_amp.dat10.nametable',\n 'audioconfig/m297zonda_amp.dat10.rel',\n 'audioconfig/m297zonda_game.dat151.nametable',\n 'audioconfig/m297zonda_game.dat151.rel',\n 'audioconfig/m297zonda_sounds.dat54.nametable',\n 'audioconfig/m297zonda_sounds.dat54.rel',\n 'sfx/dlc_m297zonda/m297zonda.awc',\n 'sfx/dlc_m297zonda/m297zonda_npc.awc',\n 'audioconfig/m158huayra_amp.dat10.nametable',\n 'audioconfig/m158huayra_amp.dat10.rel',\n 'audioconfig/m158huayra_game.dat151.nametable',\n 'audioconfig/m158huayra_game.dat151.rel',\n 'audioconfig/m158huayra_sounds.dat54.nametable',\n 'audioconfig/m158huayra_sounds.dat54.rel',\n 'sfx/dlc_m158huayra/m158huayra.awc',\n 'sfx/dlc_m158huayra/m158huayra_npc.awc',\n 'audioconfig/k20a_amp.dat10.nametable',\n 'audioconfig/k20a_amp.dat10.rel',\n 'audioconfig/k20a_game.dat151.nametable',\n 'audioconfig/k20a_game.dat151.rel',\n 'audioconfig/k20a_sounds.dat54.nametable',\n 'audioconfig/k20a_sounds.dat54.rel',\n 'sfx/dlc_k20a/k20a.awc',\n 'sfx/dlc_k20a/k20a_npc.awc',\n 'audioconfig/gt3flat6_amp.dat10.nametable',\n 'audioconfig/gt3flat6_amp.dat10.rel',\n 'audioconfig/gt3flat6_game.dat151.nametable',\n 'audioconfig/gt3flat6_game.dat151.rel',\n 'audioconfig/gt3flat6_sounds.dat54.nametable',\n 'audioconfig/gt3flat6_sounds.dat54.rel',\n 'sfx/dlc_gt3flat6/gt3flat6.awc',\n 'sfx/dlc_gt3flat6/gt3flat6_npc.awc',\n 'audioconfig/predatorv8_amp.dat10.nametable',\n 'audioconfig/predatorv8_amp.dat10.rel',\n 'audioconfig/predatorv8_game.dat151.nametable',\n 'audioconfig/predatorv8_game.dat151.rel',\n 'audioconfig/predatorv8_sounds.dat54.nametable',\n 'audioconfig/predatorv8_sounds.dat54.rel',\n 'sfx/dlc_predatorv8/predatorv8.awc',\n 'sfx/dlc_predatorv8/predatorv8_npc.awc',\n 'audioconfig/p60b40_amp.dat10.nametable',\n 'audioconfig/p60b40_amp.dat10.rel',\n 'audioconfig/p60b40_game.dat151.nametable',\n 'audioconfig/p60b40_game.dat151.rel',\n 'audioconfig/p60b40_sounds.dat54.nametable',\n 'audioconfig/p60b40_sounds.dat54.rel',\n 'sfx/dlc_p60b40/p60b40.awc',\n 'sfx/dlc_p60b40/p60b40_npc.awc'\n 'audioconfig/488sound_game.dat151.rel',\n 'audioconfig/488sound_sounds.dat54.rel',\n 'sfx/dlc_488sound/488sound.awc',\n 'sfx/dlc_488sound/488sound_npc.awc',\n 'audioconfig/apollosv8_game.dat151.rel',\n 'audioconfig/apollosv8_sounds.dat54.rel',\n 'sfx/dlc_apollosv8/apollosv8.awc',\n 'sfx/dlc_apollosv8/apollosv8_npc.awc',\n 'audioconfig/c6v8sound_game.dat151.rel',\n 'audioconfig/c6v8sound_sounds.dat54.rel',\n 'sfx/dlc_c6v8sound/c6v8sound.awc',\n 'sfx/dlc_c6v8sound/c6v8sound_npc.awc',\n 'audioconfig/diablov12_game.dat151.rel',\n 'audioconfig/diablov12_sounds.dat54.rel',\n 'sfx/dlc_diablov12/diablov12.awc',\n 'sfx/dlc_diablov12/diablov12_npc.awc',\n 'audioconfig/f40v8_game.dat151.rel',\n 'audioconfig/f40v8_sounds.dat54.rel',\n 'sfx/dlc_f40v8/f40v8.awc',\n 'sfx/dlc_f40v8/f40v8_npc.awc',\n 'audioconfig/f50v12_game.dat151.rel',\n 'audioconfig/f50v12_sounds.dat54.rel',\n 'sfx/dlc_f50v12/f50v12.awc',\n 'sfx/dlc_f50v12/f50v12_npc.awc',\n 'audioconfig/ferrarif12_game.dat151.rel',\n 'audioconfig/ferrarif12_sounds.dat54.rel',\n 'sfx/dlc_ferrarif12/ferrarif12.awc',\n 'sfx/dlc_ferrarif12/ferrarif12_npc.awc',\n 'audioconfig/sestov10_game.dat151.rel',\n 'audioconfig/sestov10_sounds.dat54.rel',\n 'sfx/dlc_sestov10/sestov10.awc',\n 'sfx/dlc_sestov10/sestov10_npc.awc',\n 'audioconfig/urusv8_game.dat151.rel',\n 'audioconfig/urusv8_sounds.dat54.rel',\n 'sfx/dlc_urusv8/urusv8.awc',\n 'sfx/dlc_urusv8/urusv8_npc.awc',\n 'audioconfig/viperv10_game.dat151.rel',\n 'audioconfig/viperv10_sounds.dat54.rel',\n 'sfx/dlc_viperv10/viperv10.awc',\n 'sfx/dlc_viperv10/viperv10_npc.awc',\n 'audioconfig/gtaspanov10_game.dat151.rel',\n 'audioconfig/gtaspanov10_sounds.dat54.rel',\n 'sfx/dlc_gtaspanov10/gtaspanov10.awc',\n 'sfx/dlc_gtaspanov10/gtaspanov10_npc.awc',\n 'audioconfig/laferrarisound_game.dat151.rel',\n 'audioconfig/laferrarisound_sounds.dat54.rel',\n 'sfx/dlc_laferrarisound/laferrarisound.awc',\n 'sfx/dlc_laferrarisound/laferrarisound_npc.awc',\n 'audioconfig/mclarenv8_game.dat151.rel',\n 'audioconfig/mclarenv8_sounds.dat54.rel',\n 'sfx/dlc_mclarenv8/mclarenv8.awc',\n 'sfx/dlc_mclarenv8/mclarenv8_npc.awc',\n 'audioconfig/murciev12_game.dat151.rel',\n 'audioconfig/murciev12_sounds.dat54.rel',\n 'sfx/dlc_murciev12/murciev12.awc',\n 'sfx/dlc_murciev12/murciev12_npc.awc',\n 'audioconfig/perfov10_game.dat151.rel',\n 'audioconfig/perfov10_sounds.dat54.rel',\n 'sfx/dlc_perfov10/perfov10.awc',\n 'sfx/dlc_perfov10/perfov10_npc.awc',\n 'audioconfig/veyronsound_game.dat151.rel',\n 'audioconfig/veyronsound_sounds.dat54.rel',\n 'sfx/dlc_veyronsound/veyronsound.awc',\n 'sfx/dlc_veyronsound/veyronsound_npc.awc'\n 'audioconfig/*.dat151.rel',\n 'audioconfig/*.dat54.rel',\n 'sfx/**/*.awc'\n}\n\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/lambov10_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/lambov10_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_lambov10'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/musv8_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/musv8_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_musv8'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/brabus850_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/brabus850_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_brabus850'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/shonen_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/shonen_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_shonen'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/toysupmk4_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/toysupmk4_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_toysupmk4'\ndata_file 'AUDIO_SYNTHDATA' 'audioconfig/rb26dett_amp.dat'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/rb26dett_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/rb26dett_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_rb26dett'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/rotary7_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/rotary7_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_rotary7'\ndata_file 'AUDIO_SYNTHDATA' 'audioconfig/m297zonda_amp.dat'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/m297zonda_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/m297zonda_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_m297zonda'\ndata_file 'AUDIO_SYNTHDATA' 'audioconfig/m158huayra_amp.dat'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/m158huayra_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/m158huayra_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_m158huayra'\ndata_file 'AUDIO_SYNTHDATA' 'audioconfig/k20a_amp.dat'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/k20a_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/k20a_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_k20a'\ndata_file 'AUDIO_SYNTHDATA' 'audioconfig/gt3flat6_amp.dat'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/gt3flat6_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/gt3flat6_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_gt3flat6'\ndata_file 'AUDIO_SYNTHDATA' 'audioconfig/predatorv8_amp.dat'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/predatorv8_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/predatorv8_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_predatorv8'\ndata_file 'AUDIO_SYNTHDATA' 'audioconfig/p60b40_amp.dat'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/p60b40_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/p60b40_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_p60b40'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/apollosv8_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/apollosv8_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_apollosv8'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/c6v8sound_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/c6v8sound_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_c6v8sound'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/diablov12_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/diablov12_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_diablov12'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/f40v8_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/f40v8_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_f40v8'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/f50v12_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/f50v12_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_f50v12'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/ferrarif12_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/ferrarif12_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_ferrarif12'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/sestov10_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/sestov10_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_sestov10'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/urusv8_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/urusv8_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_urusv8'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/viperv10_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/viperv10_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_viperv10'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/488sound_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/488sound_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_488sound'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/avesvv12_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/avesvv12_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_avesvv12'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/gtaspanov10_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/gtaspanov10_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_gtaspanov10'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/laferrarisound_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/laferrarisound_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_laferrarisound'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/mclarenv8_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/mclarenv8_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_mclarenv8'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/murciev12_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/murciev12_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_murciev12'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/perfov10_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/perfov10_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_perfov10'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/veyronsound_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/veyronsound_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_veyronsound'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/aq68lam52v10_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/aq68lam52v10_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_aq68lam52v10'\ndata_file 'AUDIO_GAMEDATA' 'audioconfig/b58b30_game.dat'\ndata_file 'AUDIO_SOUNDDATA' 'audioconfig/b58b30_sounds.dat'\ndata_file 'AUDIO_WAVEPACK' 'sfx/dlc_b58b30'```\n\n\nI am quite new to this so i cant do much. Tried to google itand tried to fix it myself but it didnt work. Just want to load my resource.\n</code></pre>\n"^^ . . . . . "autocommand"^^ . "Would you like to add any motivation for why you don't think that is a good idea?"^^ . . "0"^^ . "1"^^ . "0"^^ . . . . . . "lua-patterns"^^ . . . . . . . "0"^^ . "Some Neovim plugins need a `setup` function to read options from the configuration or to initialize starting state."^^ . . . "Check if the point is inside of half-plane and cut the segment"^^ . "1"^^ . . "`y1 - y2` vs `x2 - x1` doesn't look right. One of these is probably swapped."^^ . . . . . "0"^^ . . . "this is not possible with current lua implementation in neomutt. Describe the parameters you want to select messages for deletion, perhaps it's doable within neomutt itself."^^ . . . "cygwin-64"^^ . . "0"^^ . . . . . "polygon"^^ . . . "0"^^ . . . . . . "2"^^ . "build"^^ . "vlc"^^ . . . "<p>`Hi, sorry first time asking a question.\nStraight to the point, I've started learning Lua and how to program on ROBLOX last night, and so far I've learnt a lot of things. I'm having quite a few issues, more than what's listed in the title even. The first is that I don't fully understand how my script works.\nMy script is simple.\nThe player presses W twice in quick succession to sprint. Right now, all it does is change the players speed value. I want the animation for the character to change as well.</p>\n<p>THIS IS THE SCRIPT IN QUESTION:</p>\n<pre><code>local Player = {\n [&quot;Player&quot;] = game.Players.LocalPlayer,\n [&quot;Character&quot;] = script.Parent,\n [&quot;Humanoid&quot;] = script.Parent:WaitForChild(&quot;Humanoid&quot;),\n}\n\nlocal Speeds = {\n [&quot;Normal&quot;] = 16,\n [&quot;Extra&quot;] = 32,\n}\n\nlocal Debounces = {\n [&quot;MaxTicks&quot;] = 0.2,\n [&quot;Cooldown&quot;] = 0,\n [&quot;Debounce&quot;] = false,\n [&quot;Running&quot;] = false,\n [&quot;LastTime&quot;] = tick()\n}\n-- What do Debounces do? How do they work?\nlocal Services = {\n [&quot;UIS&quot;] = game:GetService(&quot;UserInputService&quot;)\n}\n\n-- What does Connect Function do\nServices.UIS.InputBegan:Connect(function(input, isTyping)\n if isTyping then return end\n -- ^^^ Why do we put this line of code\n if input.KeyCode == Enum.KeyCode.W then\n if not Debounces.Debounce and not Debounces.Running then\n \n if tick() - Debounces.LastTime &lt;= Debounces.MaxTicks then\n Debounces.Debounce = true\n Debounces.Running = true\n \n Player.Humanoid.WalkSpeed = Speeds.Extra\n \n Debounces.LastTime = tick()\n \n else\n Debounces.LastTime = tick()\n -- What are all these Debounces stuff for\n end\n end\n end\n \n \nend)\n\nServices.UIS.InputEnded:Connect(function(input, isTyping)\n if isTyping then return end\n \n if Debounces.Running and input.KeyCode == Enum.KeyCode.W then\n Debounces.Running = false\n \n Player.Humanoid.WalkSpeed = Speeds.Normal\n \n wait(Debounces.Cooldown)\n Debounces.Debounce = false\n -- Same for these\n end\n \nend)`\n</code></pre>\n"^^ . "@JakubJindra, Like you said I couldn't find a lua/neomutt based solution and prepared a shell script to resolve my issue. Btw, I have benefited a lot from your mutt/neomutt related answers and questions on this platform, thanks."^^ . . . . "0"^^ . "0"^^ . "1"^^ . . "contains"^^ . . . "0"^^ . . . . . "0"^^ . . . . . . . "debugging"^^ . . . "1"^^ . "Hi iThorgrim, thanks for your answer, i'me a little busy irl but i will test this soon.\n\nBest regards"^^ . . . "1"^^ . . "1"^^ . "1"^^ . . "Why not measuring it yourself?"^^ . "2"^^ . "How do I check if a character in a string is uppercase in Standard Lua 5.1?"^^ . . . . . "0"^^ . . "lua-5.1"^^ . "0"^^ . . . "1"^^ . . . . "Probably there is no Lua stack because you have already exited `lua_pcall`."^^ . "1"^^ . "0"^^ . "<p>As @AKX pointed out, the error is telling you that for some reason <code>c</code> is nil. So you need to look where you call <code>getHRP</code>...</p>\n<pre class="lang-lua prettyprint-override"><code> for _, p in pairs(game.Players:GetPlayers()) do\n local c = game.Players:FindFirstChild(p.Name, true).Character\n\n if getHRP(c) ~= nil then\n</code></pre>\n<p>When a player joins the game or has just died, there is a brief time where their Character model doesn't exist. So <code>player.Character</code> will be <code>nil</code> until their character respawns in the world.</p>\n<p>So you need to add safety checks so you aren't trying to access an object that doesn't exist :</p>\n<pre class="lang-lua prettyprint-override"><code> for _, player in pairs(game.Players:GetPlayers()) do\n local c = player.Character\n if c and getHRP(c) ~= nil then\n</code></pre>\n"^^ . . . . . . . . . "<p>I would like to emphasise how bad of an idea using Instances to store data like this is, especially parts, since they can be influenced in a number of ways by other unrelated systems in your game.</p>\n<p>You should instead have a variable set as a table inside your script that stores if players are banned or not, this also means that it would be trivial to enable bans saving over a server restart.</p>\n<p>Something like the Below:</p>\n<pre class="lang-lua prettyprint-override"><code>\nlocal bannedPlayers = {}\n\ngame.Players.PlayerAdded:Connect(function(plr)\n if bannedPlayers[plr.Name] then\n plr:Kick(&quot;Banned&quot;)\n print(plr.Name .. &quot; tried to join while banned&quot;)\n end\nend)\n\n\nscript.Parent[&quot;Kick/Ban&quot;].OnServerEvent:Connect(function(plr, plrname, reason, kb)\n if game.Players:FindFirstChild(plrname) then\n local target = game.Players:FindFirstChild(plrname)\n if kb == &quot;Kick&quot; then\n if reason ~= &quot;&quot; then\n target:Kick(reason)\n elseif reason == &quot;&quot; then\n target:Kick()\n end\n elseif kb == &quot;Ban&quot; then\n print(target.Name .. &quot; has been banned&quot;)\n\n bannedPlayers[plrname] = reason\n target:Kick(&quot;Banned&quot;)\n elseif kb == &quot;Unban&quot; then\n if bannedPlayers[plrname] then\n bannedPlayers[plrname] = nil\n print(target.Name .. &quot; has been unbanned&quot;)\n else\n print(target.Name .. &quot; is not banned&quot;)\n end\n end\n end\nend)\n</code></pre>\n"^^ . . "<p>I'm trying to code a shotgun in Roblox Studio. The code isn't working because its not getting the gun. When it activates, the gun should be equipped.</p>\n<p>I've tried a bunch of different ways to get the gun from the player's character, including &quot;:WaitForChild&quot; and for loops, but they never end up working.\nHere is my code:</p>\n<pre><code>local players = game:GetService(&quot;Players&quot;)\nlocal replicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\n\nlocal function getEquippedTool(player: Player): Tool?\n local character = player.Character\n if not character then\n print(&quot;no character&quot;)\n return nil\n else\n local shotgun = character:WaitForChild(&quot;Shotgun&quot;)\n if not shotgun then\n print(&quot;no shotgun&quot;)\n return nil\n else\n print(&quot;success&quot;)\n return shotgun\n end\n end\n \n end\n\nreplicatedStorage:WaitForChild(&quot;ShotgunShoot&quot;).OnServerEvent:Connect(function(plr,part,pos,damage)\n print(&quot;Server: Triggered&quot;)\n local char = plr.Character\n local tool = getEquippedTool(plr)\n if tool == nil then \n print(&quot;tool doesnt exist&quot;)\n else\n print(tool.Name)\n local handle = tool:WaitForChild(&quot;Handle&quot;)\n if part then\n print(&quot;part=true&quot;)\n if part.Parent and part.Parent:FindFirstChild(&quot;Humanoid&quot;) then\n local humanoid = part.Parent.Humanoid\n humanoid:TakeDamage(damage)\n print(&quot;HIT&quot;)\n else\n print(&quot;MISS&quot;)\n local bullet = Instance.new(&quot;Part&quot;)\n bullet.Size = Vector3.new(0.1,0.1,0.1)\n bullet.Position = pos\n bullet.BrickColor = BrickColor.Black()\n bullet.Anchored = true\n bullet.CanCollide = false\n bullet.Parent = workspace\n game.Debris:AddItem(bullet, 5)\n end\n end\n if handle:FindFirstChild(&quot;ShotgunSound&quot;) then\n local sound = handle.ShotgunSound\n sound:Play()\n end\n end\nend)\n</code></pre>\n<p>Can someone help me fix this?\nEDIT: To clarify, the function <code>getEquippedTool()</code> is returning <code>nil</code> and I want it to return <code>player.Character.Shotgun</code> which I know is equipped when running the script.</p>\n"^^ . . "0"^^ . "`math.random()` seems to return `nil`. What happens if you do not call `math.randomseed()`? Also, I would recommend to declare all variables as `local`, unless you *must* use globals."^^ . . "0"^^ . "0"^^ . "2"^^ . . . "0"^^ . "1"^^ . . . . . "1"^^ . . . . . . . . . "5"^^ . . . . . . . . . "1"^^ . . . . "@harold indeed, I made an EDIT 4 regarding that statement"^^ . "-1"^^ . "0"^^ . . "<p>I am using LunarVim in a Nix environment to program Haskell. The environment has a haskell-language-server of its own, which starts promptly when I open a file by LunarVim. The problem is that after some time, LunarVim's Mason installs its own HLS, which conflicts with the environment's HLS, stopping both from working. I would like to disable Mason's overly-eager installation of the LS somehow.</p>\n<p>So far I have tried the following:</p>\n<p>Adding the following to init.lua and/or config.lua (or elsewhere in a file\nlinked to in config.lua):</p>\n<pre><code>lvim.lsp.automatic_servers_installation = false\nlvim.lsp.automatic_configuration.skipped_servers = {&quot;haskell-language-server&quot;}\nlvim.lsp.LvimCacheReset()\n</code></pre>\n<p>Enabling and disabling Mason in plugins.lua (linked to in config.lua)</p>\n<pre><code> { &quot;williamboman/mason.nvim&quot;,\n require(&quot;mason&quot;).setup() },\n {\n { &quot;williamboman/mason-lspconfig.nvim&quot;\n },\n</code></pre>\n<p>Whatever I do, Mason jumps in and installs the hls. How to stop it?</p>\n"^^ . "<p><strong><a href="https://github.com/aharoJ/nvim-config/tree/main" rel="nofollow noreferrer">My NVIM-CONFIG</a></strong></p>\n<p>I woudl not recommend any of the ones you listed, I primarly code in Java/Spring-Boot.</p>\n<p>My recommendation:</p>\n<ul>\n<li>Formatting:\n<ul>\n<li>google_java_format</li>\n</ul>\n</li>\n<li>Linting:\n<ul>\n<li>checkstyle</li>\n</ul>\n</li>\n</ul>\n<pre class="lang-lua prettyprint-override"><code> config = function()\n local null_ls = require(&quot;null-ls&quot;)\n null_ls.setup({\n sources = {\n -- JAVA\n null_ls.builtins.formatting.google_java_format,\n null_ls.builtins.diagnostics.checkstyle.with({\n extra_args = { &quot;-c&quot;, &quot;/google_checks.xml&quot; },\n }),\n -- --------------------------------------------\n -- rest of config...\n },\n })\n\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;cf&quot;, vim.lsp.buf.format, {})\n end,\n}\n</code></pre>\n<p>My Configurations are linked <strong>above</strong>. In case you want to see my overall setup for other languages like Js, Ts, Py, Bash.</p>\n"^^ . . "0"^^ . "<p><strong>PROBLEM:</strong></p>\n<p>Hi The output says:</p>\n<blockquote>\n<p>Players.username.PlayerGui.GameGui.GameController:63: attempt to index nil with 'Stats'</p>\n</blockquote>\n<p>This is my code:</p>\n<blockquote>\n<p>local maxTowers = towerToSpawn.Stats.MaxPlaced.Value</p>\n</blockquote>\n<blockquote>\n<p>local PlacedTowers = towerToSpawn.Stats.Placed.Value</p>\n</blockquote>\n<p>What the problem ?</p>\n<p><strong>CONTEXT:</strong></p>\n<p>I make a tower defense and I want to restrict the number of each type of tower that can be placed.</p>\n<p>ps :</p>\n<blockquote>\n<p>local towerToSpawn =\nReplicatedStorage:WaitForChild(&quot;Towers&quot;):FindFirstChild(name):Clone()</p>\n</blockquote>\n<p><a href="https://i.sstatic.net/8Jefb.jpg" rel="nofollow noreferrer">enter image description here</a></p>\n"^^ . . . "print call issue in Lua based function"^^ . . . "0"^^ . . . "It is precisely because of these two functions that x always exists? If you have too much "local x = nil" in one function, I bet you will still see the error. You need to read this: [Garbage Collection](https://www.lua.org/manual/5.4/manual.html#2.5)"^^ . "Try `cmdRunExifTool = 'cmd /c "'..cmdRunExifTool..'"'` before executing it."^^ . . "2"^^ . "<p>I'm trying to translate a specific vimscript code that moves visual blocks up and down using Ctrl + arrow keys to lua.</p>\n<p>Here’s the Vimscript code in my .vimrc:</p>\n<pre class="lang-json prettyprint-override"><code>vnoremap ^[[1;5A :m '&lt;-2&lt;CR&gt;gv=gv\nvnoremap ^[[1;5B :m '&gt;+1&lt;CR&gt;gv=gv\n</code></pre>\n<p>And here’s the Lua code in my init.lua:</p>\n<pre class="lang-lua prettyprint-override"><code>-- Global Variable \nlocal opts = { noremap = true, silent = true }\n-- Key Mappings\nvim.api.nvim_set_keymap('v', '&lt;C-Up&gt;', ':m \\'&lt;-2&lt;CR&gt;gv=gv', opts)\nvim.api.nvim_set_keymap('v', '&lt;C-Down&gt;', ':m \\'&gt;+1&lt;CR&gt;gv=gv', opts)\n</code></pre>\n<p>However, the issue is that when I reach the top or bottom of the file, I get an <code>E16: Invalid range error</code> and the visual selection gets deselected. To handle this in Vim, I added a check in my .vimrc as follows:</p>\n<pre class="lang-json prettyprint-override"><code>vnoremap &lt;expr&gt; ^[[1;5A (line(&quot;'&lt;&quot;) == 1 ? &quot;&quot; : &quot;:m '&lt;-2&lt;CR&gt;gv=gv&quot;)\nvnoremap &lt;expr&gt; ^[[1;5B (line(&quot;'&gt;&quot;) == line(&quot;$&quot;) ? &quot;&quot; : &quot;:m '&gt;+1&lt;CR&gt;gv=gv&quot;)\n</code></pre>\n<p>Translating this to lua, I came up with the following:</p>\n<pre class="lang-lua prettyprint-override"><code>-- Global Variable \nlocal opts = { noremap = true, silent = true }\n\n-- Custom function to move visual block up\nfunction _G.move_visual_block_up()\n if vim.fn.line(&quot;'&lt;&quot;) &gt; 1 then\n vim.cmd(&quot;:m '&lt;-2&lt;CR&gt;gv=gv&quot;)\n end\nend\n\n-- Custom function to move visual block down\nfunction _G.move_visual_block_down()\n if vim.fn.line(&quot;'&gt;&quot;) &lt; vim.fn.line(&quot;$&quot;) then\n vim.cmd(&quot;:m '&gt;+1&lt;CR&gt;gv=gv&quot;)\n end\nend\n\n-- Key Mappings\nvim.api.nvim_set_keymap('v', '&lt;C-Up&gt;', '&lt;Cmd&gt;lua _G.move_visual_block_up()&lt;CR&gt;', opts)\nvim.api.nvim_set_keymap('v', '&lt;C-Down&gt;', '&lt;Cmd&gt;lua _G.move_visual_block_down()&lt;CR&gt;', opts)\n</code></pre>\n<p>However, hitting ctrl + up has no effect; on the other hand, pressing ctrl + down results in an error…</p>\n<pre class="lang-py prettyprint-override"><code>E5108: Error executing lua vim/_editor.lua:0: nvim_exec2(): Vim(move):E20: Mark\nnot set\nstack traceback:\n [C]: in function 'nvim_exec2'\n vim/_editor.lua: in function 'cmd'\n /etc/nvim/init.lua:206: in function 'move_visual_block_down'\n [string &quot;:lua&quot;]:1: in main chunk\n</code></pre>\n<p>The issue appears unclear to me… What exactly is this mark? I tried looking up for the error, but there aren't any leads available.</p>\n<h4>PS:</h4>\n<p>While this <a href="https://stackoverflow.com/questions/73270146/converting-conditional-vimscript-mapping-into-lua-neovim-submit-cr-in-lua">question</a> appears alike, it doesn’t aid in resolving my problem.</p>\n"^^ . . . . . . "scripting"^^ . "<p>Finally, after trying other things, I added</p>\n<p><code>redis.setresp(3)</code></p>\n<p>inside the lua function and it is working now.</p>\n"^^ . "Using Lua to Create Conditional Key Mappings in Neovim"^^ . . . . . "Creating advanced loot systems based on a "luck" value"^^ . . "0"^^ . . . "0"^^ . . . . "@harold porting your C++ link to lua worked, ty ;) But this thread is sadly not solved, maybe u wanna make an answer"^^ . "1"^^ . . . . "0"^^ . "0"^^ . . "Also: I'd avoid using `_G` and use a table/array instead. It could be that the Pawn class is also using globals, which would explain the aliasing."^^ . "@MartinF yeah, this is the "standard" OOP approach found e.g. in the PIL. It is okay. It is not my personal favorite. I'm not a fan of setters and getters in Lua; I'd directly use field access instead (even if you want to change what field access does later on, you can do that via `__index` and `__newindex` metamethods)."^^ . . . "bitwise-operators"^^ . . . "@ESkri You are of course right - It is not 'above 0' it is 'except 0' - Thanks"^^ . . . . . . . . . "0"^^ . "0"^^ . "I check that but the archivable index is set to true"^^ . . "traffic-simulation"^^ . "```math.ramdom(1, 5400)``` will fix it, because with arguments the first argument has to be an integer above 0. See the Lua Reference."^^ . . . . . . . . "0"^^ . . . "1"^^ . . . . . "0"^^ . . . "<p>Have you enabled studio access? If not, you could read this documentation on how to enable it: <a href="https://create.roblox.com/docs/cloud-services/datastores" rel="nofollow noreferrer">https://create.roblox.com/docs/cloud-services/datastores</a></p>\n<blockquote>\n<p>By default, experiences tested in Studio can't access data stores, so you must first enable them. Accessing data stores in Studio can be dangerous for live experiences because Studio accesses the same data stores as the client application. To avoid overwriting production data, do not enable this setting for live experiences. Instead, enable it for a separate test version of the experience.</p>\n<p>To enable Studio access in a published experience:</p>\n<ol>\n<li>Go to Home &gt; Game Settings &gt; Security.</li>\n<li>Enable the Enable Studio Access to API Services toggle.</li>\n<li>Click Save.</li>\n</ol>\n</blockquote>\n"^^ . . "0"^^ . . "0"^^ . "1"^^ . "I don't thing you understand me. I want to use the inserted parameters while I call index of a table as function like the myIndex but I want to call it like a function ( myIndex(params) ) and I want to know if there's a metamethod which's activating while I use the index as function because the only one I know is __call but __call is using when you call the table as function like myTbl(params) not any of the indexes like myTbl.myIndex(params). That's what I want to know. I hope you understand me now and I appologize if I made mistake in the English because the English isn't my mother language."^^ . "@MechWright\nThe code you shared in your example is not working code though. I was trying to point out that the name of the language server you are trying to disable is "hls", not "haskell-language-server". To make sure that that was a problem I tried adding "haskell-language-server" to skipped servers locally and that did nothing (as you say). "hls", however, worked.\n\nI'm sorry if that still doesn't help you."^^ . "1"^^ . . . "For example you may get `_G["_IoioIooIOOIo"] = print` finally, then you know that `_IoioIooIOOIo` maps to `print`. But this will be a tedium process."^^ . . . . "Probably you can do nothing in GHub to solve the issue."^^ . "lua"^^ . "0"^^ . . . "1. if I define global functions increment_x() and get_x() in script.lua and then run them in main.lua, they will return 1. So, lua still keeps x value in memory. And if you write "local x = nil" 201 times, you'll get an error "too much locals""^^ . "Neovim: Making a function that checks the beginning of line and acts depending on it"^^ . "@ESkri well nvm, I don't even have to do this. If you take my backport and pasting it inside https://www.jdoodle.com/execute-lua-online/ the generated MAC is correct, so numbers don't exceed 53-bits for sure"^^ . . . . . . . "There are quite a lot of possible "slots": you can match on all of the pandoc document AST's types of nodes (blocks and inlines) See https://pandoc.org/lua-filters.html#type-pandoc"^^ . . . "Lua filter to preserve HTML comments"^^ . . . "curl"^^ . "<p>I am about to try to create simple 2D game using Lua. I have watched a couple of videos and tutorials and also checked the syntax, but I am confused by multiple developers pursuing different approaches to OOP.</p>\n<p>Some uses metatables, some consider it too much complex and create object using like functions that return table.</p>\n<p>And I am lost... It is not straightforward what I should use.</p>\n<p>I want to use real OOP, like for example Java or C# have.</p>\n<p>I saw many videos where they are creating 2D games where they don't use metatables because of the difficulty to read and work with metatables.</p>\n<p>What shall I choose though?</p>\n"^^ . . . . . "<p>i think, i found a valid solution by myself:</p>\n<pre><code> actions.command7 = function ()\n\nif (f5) then\n\n if (Lift) then\n ms.up(UseButton);\n kb.up(&quot;e&quot;);\n Lift = not Lift;\n else\n kb.stroke(&quot;f5&quot;);\n f5 = not f5;\n end\nelse\n kb.stroke(&quot;f5&quot;);\n ms.down(UseButton);\n kb.down(&quot;e&quot;);\n f5 = true;\n Lift = true;\nend\nend\n</code></pre>\n"^^ . . "0"^^ . . . . "Thanks for explanation, I was trying to understand it in the easiest way and come to conclusion that I could use similar structure like in java. For example create just class or table like this\n`local Human = {}\n\nfunction Human:new(name, gender)\n local obj = {\n _name = name,\n _gender = gender,\n }\n setmetatable(obj, self)\n self.__index = self\n return obj\nend`\nand then here use setters and getters\n\n`function Human:getName()\n return self._name\nen\nfunction Human:setName(newName)\n self._name = newName\nend\n...\nreturn Human`"^^ . "10"^^ . . "0"^^ . . "Neovim, change background of all splits not just one"^^ . . . "Lua error "mutating non-standard global variable 'love'""^^ . "3"^^ . "<p>I have the exact same content on the file, but I get an error, maybe I'm missing install something?</p>\n<pre><code>return {\n &quot;nvimtools/none-ls.nvim&quot;,\n dpendencies = {\n &quot;nvimtools/none-ls-extras.nvim&quot;,\n },\n config = function()\n local null_ls = require(&quot;null-ls&quot;)\n\n null_ls.setup({\n sources = {\n null_ls.builtins.formatting.stylua,\n null_ls.builtins.formatting.prettier,\n require(&quot;none-ls.diagnostics.eslint_d&quot;),\n },\n })\n\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;gf&quot;, vim.lsp.buf.format, { desc = &quot;Format file&quot; })\n end,\n}\n</code></pre>\n<p>here is the error message when I start nvim</p>\n<pre><code>Failed to run `config` for none-ls.nvim\n\n/Users/zlnk/.config/nvim/lua/zlnk/plugins/none-ls.lua:13: module 'none-ls.diagnostics.eslint_d' not found:\n^Ino field package.preload['none-ls.diagnostics.eslint_d']\ncache_loader: module none-ls.diagnostics.eslint_d not found\ncache_loader_lib: module none-ls.diagnostics.eslint_d not found\n^Ino file './none-ls/diagnostics/eslint_d.lua'\n^Ino file '/opt/homebrew/share/luajit-2.1/none-ls/diagnostics/eslint_d.lua'\n^Ino file '/usr/local/share/lua/5.1/none-ls/diagnostics/eslint_d.lua'\n^Ino file '/usr/local/share/lua/5.1/none-ls/diagnostics/eslint_d/init.lua'\n^Ino file '/opt/homebrew/share/lua/5.1/none-ls/diagnostics/eslint_d.lua'\n^Ino file '/opt/homebrew/share/lua/5.1/none-ls/diagnostics/eslint_d/init.lua'\n^Ino file '/Users/zlnk/.local/share/nvim/lazy-rocks/telescope.nvim/share/lua/5.1/none-ls/diagnostics/eslint_d.lua'\n^Ino file '/Users/zlnk/.local/share/nvim/lazy-rocks/telescope.nvim/share/lua/5.1/none-ls/diagnostics/eslint_d/init.lua'\n^Ino file './none-ls/diagnostics/eslint_d.so'\n^Ino file '/usr/local/lib/lua/5.1/none-ls/diagnostics/eslint_d.so'\n^Ino file '/opt/homebrew/lib/lua/5.1/none-ls/diagnostics/eslint_d.so'\n^Ino file '/usr/local/lib/lua/5.1/loadall.so'\n^Ino file '/Users/zlnk/.local/share/nvim/lazy-rocks/telescope.nvim/lib/lua/5.1/none-ls/diagnostics/eslint_d.so'\n^Ino file '/Users/zlnk/.local/share/nvim/lazy-rocks/telescope.nvim/lib64/lua/5.1/none-ls/diagnostics/eslint_d.so'\n^Ino file './none-ls.so'\n^Ino file '/usr/local/lib/lua/5.1/none-ls.so'\n^Ino file '/opt/homebrew/lib/lua/5.1/none-ls.so'\n^Ino file '/usr/local/lib/lua/5.1/loadall.so'\n^Ino file '/Users/zlnk/.local/share/nvim/lazy-rocks/telescope.nvim/lib/lua/5.1/none-ls.so'\n^Ino file '/Users/zlnk/.local/share/nvim/lazy-rocks/telescope.nvim/lib64/lua/5.1/none-ls.so'\n\n# stacktrace:\n - lua/zlnk/plugins/none-ls.lua:13 _in_ **config**\n - lua/zlnk/lazy.lua:16\n - init.lua:3\n</code></pre>\n"^^ . "I want to disable Lua obfuscation"^^ . . . . "<p>I cannot get to save data in a roblox game.</p>\n<pre><code>local players = game:GetService(&quot;Players&quot;) \nlocal dss = game:GetService(&quot;DataStoreService&quot;)\nlocal gameData = dss:GetDataStore(&quot;Nara&quot;)\nplayers.PlayerAdded:Connect(function(player) \n\n\n local leaderstats = Instance.new(&quot;Folder&quot;) \n leaderstats.Name = &quot;leaderstats&quot; \n leaderstats.Parent = player \n\n\n local coins = Instance.new(&quot;IntValue&quot;)\n coins.Name = &quot;Coins&quot;\n coins.Parent = leaderstats\n\n local success, result = pcall(function()\n local r = gameData:GetAsync(player.UserId)[&quot;Coins&quot;]\n \n return r\n end)\n\n if success then\n print(&quot;success: &quot; .. result)\n coins.Value = result\n else\n print(result)\n end\n\n\n\n\nend)\n\nplayers.PlayerRemoving:Connect(function(player)\n print(&quot;player removed&quot;)\n local key = player.UserId\n \n local data = {\n [&quot;Coins&quot;] = player:WaitForChild(&quot;leaderstats&quot;).Coins.Value\n }\n \n local success, err = pcall(function()\n gameData:SetAsync(key, data)\n end)\n\n if success then\n print(&quot;Data saved successfully&quot;)\n else\n print(&quot;Failed to save data with error: &quot;, err)\n end\n \nend)\n\n\n\ngame.ReplicatedStorage.Buy.OnServerInvoke = function(player, item)\n if not player:FindFirstChild(item) then\n if player.leaderstats.Coins.Value &gt;= game.ReplicatedStorage.Items:WaitForChild(item).cost.Value then\n player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - game.ReplicatedStorage.Items:WaitForChild(item).cost.Value\n local owned = Instance.new(&quot;BoolValue&quot;)\n owned.Name = item\n owned.Parent = player\n player.Backpack:ClearAllChildren()\n game.ReplicatedStorage.Items:WaitForChild(item):Clone().Parent = player.Backpack\n return item\n else\n return &quot;not enough coins&quot;\n end\n else\n player.Backpack:ClearAllChildren()\n game.ReplicatedStorage.Items:WaitForChild(item):Clone().Parent = player.Backpack\n return &quot;owned &quot; .. item\n end\nend\n</code></pre>\n<p>i tried more ways i dont know whats wrong.</p>\n<p>I was expecting for the Coins IntValue to be saved then loaded when player joins. I tried everything but didnt get it to work. The value is created and nothing destroyed it. The code gets stuck at pcall for saving, tried to see where using <code>print</code>. Thanks</p>\n"^^ . "0"^^ . . . . . . . "0"^^ . "0"^^ . "<pre><code>local stmt = db:prepare [[INSERT INTO tips_table (id, time, date, counter) VALUES (NULL, ?, ?, ?);]]\nstmt:bind_values(os.date('%H:%M:%S'), os.date('%y/%m/%d'), counter)\n</code></pre>\n<p>@Alexander the above code works. Thanks for the help</p>\n"^^ . . "callback"^^ . . "0"^^ . . . . . "Lua 5.1 does not have 64-bit integers. It has "double" numbers with 53-bit mantissa which can be used as if they were 53-bit integers. Are 53-bit integers enough for poly1305?"^^ . "0"^^ . "@Ctx yes sorry, for testing I was basically skipping the if (!lua_isnumber(L, -1)) check.\nEdited the code."^^ . "0"^^ . . "@ESkri Well, when I did monitor the bitwise operations, especially on bit shifting, with e.g a << b = c, the result c would always differ in my restricted env"^^ . . . . "<p>Thanks to <a href="https://stackoverflow.com/users/11740758/koyaanisqatsi">koyaanisqatsi</a> for the comment, the issue lied in the specific function I was using to get a random number. Lua's <code>math.random()</code> function cannot take in <code>0</code> as an argument. This was solved by simply changing it to <code>1</code> instead.</p>\n"^^ . "<p>Okay, I found this in &quot;The implementation of Lua&quot;:\n--Once a closed upvalue is no longer referred by any closure, it is eventually garbage collected--\nClick noice!</p>\n"^^ . . "I don't know what to do tbh, my knowledge in both bit manipulation and cryptography is ridiculous"^^ . "linear-algebra"^^ . . . . . "<p>I'm totally ignorant of Lua or NeoVim. However, you can't say NeoVim without also saying Vim. The plain Vim way to accomplish what you're trying to do would be the following one-line command:</p>\n<pre class="lang-none prettyprint-override"><code>:s/^\\s*\\zs\\ze\\(.\\)/\\=submatch(1)=='#'?'#':'# '\n</code></pre>\n<p>This uses the <code>:substitute</code> command to match from the beginning of the line <code>^</code>, any number of whitespace <code>\\s*</code>. Now, <code>\\zs</code> starts the match and <code>\\ze</code> immediately ends it (we're using this as a poor man's lookaround) and <code>\\(.\\)</code> matches any character and puts it in a capture group. To put it in plain English: we match in front of the first non-whitespace character in a line and capture said character.<br />\nSee <a href="https://vimhelp.org/change.txt.html#%3Asubstitute" rel="nofollow noreferrer"><code>:help :substitute</code></a>, <a href="https://vimhelp.org/pattern.txt.html#pattern" rel="nofollow noreferrer"><code>:help pattern</code></a> and <a href="https://vimhelp.org/pattern.txt.html#%2F%5Czs" rel="nofollow noreferrer"><code>:help /\\zs</code></a>.</p>\n<p>To have a condition, we use <code>\\=</code> to evaluate the replacement as an expression. Our expression is a ternary condition. If the captured character <code>submatch(1)</code> is a &quot;#&quot;, put another &quot;#&quot; in front of it, else put &quot;# &quot;.<br />\nReferences: <a href="https://vimhelp.org/change.txt.html#sub-replace-expression" rel="nofollow noreferrer"><code>:help sub-replace-expression</code></a>, <a href="https://vimhelp.org/builtin.txt.html#submatch%28%29" rel="nofollow noreferrer"><code>:help submatch()</code></a> and <a href="https://vimhelp.org/eval.txt.html#ternary" rel="nofollow noreferrer"><code>:help ternary</code></a>.</p>\n<p>Going forward with this command, you could create a mapping, you could call it from a function or you could create a user command.</p>\n"^^ . "ServerScriptService Script doesn't see changes of player value"^^ . . . . "unix"^^ . . "<p>in\nif a table is created in the following way</p>\n<pre><code>db:exec [[CREATE TABLE IF NOT EXISTS tips_table (id INTEGER PRIMARY KEY,time TIME,date DATE, counter INTEGER)]]\n</code></pre>\n<p>and data is inserted as below into the above table</p>\n<pre><code>local stmt = db:prepare [[INSERT INTO tips_table (time, date, counter) VALUES (?, ?, ?);]]\n\nstmt:bind_values(os.date('%H:%M:%S'), os.date('%y/%m/%d'), counter)\n</code></pre>\n<p>Why am I getting the following error</p>\n<p><code>lua: Test.lua:247: attempt to index local 'stmt' (a nil value)</code></p>\n<p>I played around with different variable and tried to convert the date and time to strings.</p>\n<p>I looked at the lsqlite3 syntax from different websites and endlessly Googled, but I cant seem to get it right</p>\n"^^ . "0"^^ . . "0"^^ . "0"^^ . "<p>From section 9 of <a href="https://www.lua.org/manual/5.4/manual.html" rel="nofollow noreferrer">the manual</a> (<i>sic</i>):</p>\n<blockquote>\n<h1>9 – The Complete Syntax of Lua</h1>\n<pre class="lang-none prettyprint-override"><code>[...]\n\nvar ::= Name | prefixexp ‘[’ exp ‘]’ | prefixexp ‘.’ Name\n\n[...]\n\nprefixexp ::= var | functioncall | ‘(’ exp ‘)’\nfunctioncall ::= prefixexp args | prefixexp ‘:’ Name args\n\n[...]\n</code></pre>\n</blockquote>\n<p>Basically:</p>\n<ul>\n<li>A &quot;method&quot; <code>functioncall</code> is made of four parts: <code>prefixexp</code>, the colon, the name of the method, and its arguments.</li>\n<li>A <code>prefixexp</code> can be either a <code>functioncall</code> itself, an <code>exp</code> wrapped inside a pair of parentheses, or a <code>var</code>.</li>\n<li>A <code>var</code> can be an identifier, or its indexed/dotted counterpart.</li>\n</ul>\n<p>This effectively disallows using the shorthand <code>:method</code> syntax on all kinds of literal expressions, not just strings. That said, these are all invalid syntax:</p>\n<pre class="lang-lua prettyprint-override"><code>nil:has_no_methods()\ntrue:or_false()\n2:too()\n[[long strings]]:same_thing()\nfunction() end:really('?')\n{}:h_yes_definitely('!')\n</code></pre>\n<p>...but this is valid:</p>\n<pre class="lang-lua prettyprint-override"><code>foo:bar 'baz':qux() -- Parsed as foo:bar('baz'):qux()\n</code></pre>\n<p>In conclusion, either use a variable, or just wrap your literal value in parentheses.</p>\n"^^ . . . . . "<p>It is guaranteed that <code>o2</code> will be finalized before <code>o1</code></p>\n<p>Objects will be finalized in the reverse order that they were &quot;marked&quot;. An object is &quot;marked&quot; for finalization when the metatable is set with a <code>__gc</code> metamethod.</p>\n<p>Reference: <a href="https://www.lua.org/manual/5.4/manual.html#2.5.3" rel="nofollow noreferrer">https://www.lua.org/manual/5.4/manual.html#2.5.3</a></p>\n<blockquote>\n<p>At the end of each garbage-collection cycle, <strong>the finalizers are called in the reverse order that the objects were marked for finalization</strong>, among those collected in that cycle; that is, the first finalizer to be called is the one associated with the object marked last in the program. The execution of each finalizer may occur at any point during the execution of the regular code.</p>\n</blockquote>\n<blockquote>\n<p>For an object (table or userdata) to be finalized when collected, you must mark it for finalization. <strong>You mark an object for finalization when you set its metatable and the metatable has a __gc metamethod.</strong> Note that if you set a metatable without a __gc field and later create that field in the metatable, the object will not be marked for finalization.</p>\n</blockquote>\n<hr />\n<p>In this example <code>o1</code> will be finalized before <code>o2</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>function fun()\n local o1 = foo:new() -- object without __gc metamethod\n local o2 = bar:new() -- object without __gc metamethod\n\n setmetatable(o2, metaWithGC)\n setmetatable(o1, metaWithGC)\n\nend\n</code></pre>\n"^^ . "<p>I hope you all can help me. So, I want to know when I call function in table like this which metamethod is activating:</p>\n<pre class="lang-lua prettyprint-override"><code>local myTbl = setmetatable({\n myIndex = function(myParam)\n print(myParam)\n end\n}, {\n -- Which is the metamethod that activates itself while using myIndex\n})\n</code></pre>\n<p>I tried EVERYTHING!!! I mean. I made metatable and I used every single metamethod and nothing is called from the metamethods I used.</p>\n"^^ . . "Just tried it on my Markdown - works brilliantly - thanks! I guess the main trick here was to overload the Pandoc function itself ! I'm going to slightly edit your answer to include the cmdline needed to run this - since it might be useful for others."^^ . "0"^^ . . "0"^^ . . . "1"^^ . . "In your example, both variables are on the stack and thus not "collected", and the strings are constant and thus not collected either. So the answer would be "at the same time". Afaik."^^ . . "<p>With Roblox, I already tried 3-4 Times but this error still pops up:</p>\n<blockquote>\n<p>Zone4Tp is not a valid member of Workspace &quot;Workspace&quot; - Client -\nLocalScript:3</p>\n</blockquote>\n<p>And if you are wondering, yes it is in Workspace. Here is my Code:</p>\n<pre><code>local but = script.Parent\nlocal localplayer = game:GetService(&quot;Players&quot;).LocalPlayer\nlocal tppart = game:GetService(&quot;Workspace&quot;).Zone4Tp -- Replace with your TpPart name if you changed it.\n\nbut.MouseButton1Click:Connect(function(plr)\n localplayer.Character:MoveTo(tppart.Position)\nend)\n</code></pre>\n<p>When I test it it keeps spamming that it is not available for workspace. Any help?</p>\n"^^ . . . . . . . "1"^^ . "0"^^ . . . . "0"^^ . . . "0"^^ . . . . "Try to normalize every result of addition. For example, after `h0 = h0 + ...` insert `h0 = h0 % 2^32`"^^ . . . "0"^^ . . . . "What's the zeroth character in that line?"^^ . . . "1"^^ . . . . . "0"^^ . . . . . "lightroom"^^ . . "Visual Studio debug LUA scripts withing C++ Project"^^ . . "Where I can get activation from the metamethods while using function in table like this: tbl.myIndex(myParameters)?"^^ . . . . "@Andreas you should rewrite your example to demonstrate that, something like `local o1 = foo:new() -- object with __gc metamethod`"^^ . . . "arrays"^^ . . "Please explain your answer. And [workspace.StreamingEnabled](https://create.roblox.com/docs/reference/engine/classes/Workspace#StreamingEnabled) is locked behind Plugin Security so you can't actually write to it as a script."^^ . . . . "0"^^ . . . . "0"^^ . . "1"^^ . . "10"^^ . "1"^^ . "global"^^ . . "@harold I'm really not into cryptography, I just backported this : https://github.com/philanc/plc/blob/master/plc/poly1305.lua and it's working on an unrestricted lua 5.4 env"^^ . "<p>I have tested this, but the separator still opaque:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.api.nvim_set_hl(0, &quot;Normal&quot;, { bg = &quot;none&quot;})\nvim.api.nvim_set_hl(0, &quot;NormalFloat&quot;, { bg = &quot;none&quot;})\nvim.api.nvim_set_hl(0, &quot;NeoTreeNormal&quot;, { bg = &quot;none&quot;})\nvim.api.nvim_set_hl(0, &quot;NeoTreeNormalNC&quot;, { bg = &quot;none&quot;})\n</code></pre>\n"^^ . . . . "1"^^ . . . . "Well, but "how to preserve HTML comments and to not preserve other HTML elements" is what my question is about. So in its current form, this code is not what I need, though the answer and our discussion are nevertheless useful on their own, of course. Could you show what exactly I need to do with `el.format = 'markdown'` (so that the code will work in the way I've just described)?"^^ . . "0"^^ . . . . "c++"^^ . . . . "0"^^ . "1"^^ . . . "0"^^ . . "<pre><code>--workspace.StreamingEnabled=false\n</code></pre>\n"^^ . "2"^^ . . . . . . "3"^^ . "<p>You can just use <code>QBCore.Functions.GetPlayerData().citizenid</code> client-side, to get the citizenid of the player</p>\n"^^ . "0"^^ . "0"^^ . . "0"^^ . . . "@ESkri It disappears but it is the main line for reducing recoil for such games."^^ . . . "0"^^ . . "1"^^ . . . "nul"^^ . . . . . "<p>Here is the issue:</p>\n<pre><code>width_in_chars = &quot;11&quot;,\n</code></pre>\n<p>This must be a numeric value, not a string! Or even better:</p>\n<pre><code>width = LrView.share 'labelWidth',\n</code></pre>\n"^^ . . . . "what the code above give you? I presume you don't see a `white` panel, right? So, after inserting it in a sizer you need to call `SetBackgroundColor()` on that panel. Check the docs for the info."^^ . "<p>I'm configuring neovim with none-ls and when I'm trying to add eslint_d to the setup I have this error :</p>\n<p><strong>[null-ls] failed to load builtin eslint_d for method diagnostics; please check your config</strong></p>\n<p>Here is what my none-ls.lua file looks like</p>\n<pre class="lang-lua prettyprint-override"><code> return {\n &quot;nvimtools/none-ls.nvim&quot;,\n config = function()\n local null_ls = require(&quot;null-ls&quot;)\n\n null_ls.setup({\n sources = {\n null_ls.builtins.formatting.stylua,\n null_ls.builtins.formatting.prettier,\n null_ls.builtins.diagnostics.eslint_d,\n },\n })\n \n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;gf&quot;, vim.lsp.buf.format, {})\n end,\n }\n\n</code></pre>\n<p>I only have an issue with eslint_d (I tried eslint-lsp too, same issue)</p>\n<p>I have installed eslint_d with Mason (even tried to uninstall and install it again)\nI have installed eslint_d globally using npm\nI have checked none-ls' documentation and it looks like it should work</p>\n<p>Does anyone know what could be the issue?\nThanks a lot!</p>\n"^^ . . . . . "2"^^ . "5"^^ . . . "<p>I really like the Kanagawa theme and want to use it in my Neovim editor. However I do not like italicized words in my code and I cannot figure out how to fully disable italics. I have this config now based on the <a href="https://github.com/rebelot/kanagawa.nvim?tab=readme-ov-file#configuration" rel="nofollow noreferrer">README</a>:</p>\n<pre class="lang-lua prettyprint-override"><code>require(&quot;kanagawa&quot;).setup({\n commentStyle = { italic = false },\n keywordStyle = { italic = false },\n})\n</code></pre>\n<p>And this disables <em>most</em> italics in the theme, however keywords like <code>self</code> in Rust or <code>this</code> in Java/Javascript are still showing italicized.</p>\n<p>I've tried looking for answers in the repo and elsewhere, but haven't found a solution to this.</p>\n"^^ . . . . . . . . "0"^^ . . "Lua not allowing global variables in a table"^^ . . . . . "Teleport Bug - (Lua)"^^ . . . "1"^^ . . . "0"^^ . . . . . "The implementation you posted a link to requires only 32-bit numbers"^^ . . . . "1"^^ . . . "How to change buffer size for lua socket?"^^ . "0"^^ . "using stmt = db:prepare and stmt:bind_values to Insert date and a number in to a table"^^ . . . "Since `Players:GetPlayerFromCharacter()` can return `nil` it's always a good idea to add safety checks. `if not player then return end` is a great way to ensure that your code doesn't throw errors when other non-character objects trigger the Touch event."^^ . . . "@ESkri It was actually working before a GHub update. I solved this problem by installing an older version. I formatted my pc 2 months ago and now the old version doesn't work too."^^ . "The error means that it couldn't find `Zone4Tp` in `workspace`. Make sure that there is a intance called `Zone4Tp` parented to Workspace."^^ . . . . . "0"^^ . "0"^^ . . "<p>For <a href="https://luarocks.org/modules/lunarmodules/luasocket" rel="nofollow noreferrer">luasocket</a>, since version 3.0.0, you can change the size with <code>setoption</code>.</p>\n<pre><code>local sock = socket.udp()\nsock:setoption('send-buffer-size', bytes)\n</code></pre>\n<p>By default sending is not buffered, but you can actually achieve buffering by concatenating strings in Lua on your own.</p>\n"^^ . . "you need to specify the "sqlite" library"^^ . "All I really want is for users of the lib to have as much IntelliSense as possible. This feels a little bit excessive, and adds some unneeded overhead in a config for an editor with an accent on speed."^^ . "0"^^ . "<p>I have problem with my lua script to roblox. Script has to firstly create team and add player to it. When the first player join to the game everything work correctly but if the second player join, then team will be created correctly but second player will be added to the first player's team.</p>\n<pre><code>local teamsFolder = game:GetService(&quot;Teams&quot;)\n\ngame.Players.PlayerAdded:Connect(function(player)\n local team = Instance.new(&quot;Team&quot;)\n team.Name = player.Name\n team.Parent = teamsFolder\n team.AutoAssignable = false\n \n player.Team = team\nend)\n</code></pre>\n<p>I also tried to replace 9 line for\n<code>player.Team = teamsFolder[player.Name]</code>\nbut it also doesn't work.</p>\n"^^ . "0"^^ . . . . . . . "Why are you requiring `love` at all? `love` will be present in `main.lua`, you don't need to require it."^^ . "My function doesn't need keys, but several args. Updating my question with more info. How would client take the responsibility to redirect to a specific master node? The client only knows a servicename offered by the Kubernetes cluster."^^ . . . . . . . . . . . . . "I do not see a problem here, this ought to work. Please provide more context, maybe this reveals the cause."^^ . "2"^^ . . . . "<p><a href="https://i.sstatic.net/rU5RM.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rU5RM.gif" alt="enter image description here" /></a></p>\n<pre><code>EnablePrimaryMouseButtonEvents(true);\nfunction OnEvent(event, arg)\nif IsKeyLockOn(&quot;numlock&quot; )then\n\n\n if IsMouseButtonPressed(1) then\n \n Sleep(50)\n MoveMouseRelative(0, 1)\n Sleep(100)\n MoveMouseRelative(0, 16)\n Sleep(100)\n MoveMouseRelative(0, 26)\n Sleep(100)\n MoveMouseRelative(-2, 25)\n Sleep(100)\n MoveMouseRelative(10, 28)\n Sleep(100)\n MoveMouseRelative(8, 25)\n Sleep(100)\n MoveMouseRelative(10, 15)\n Sleep(100)\n MoveMouseRelative(-14, 15)\n Sleep(100)\n MoveMouseRelative(-34, -1)\n Sleep(100)\n MoveMouseRelative(-18, 0)\n Sleep(100)\n MoveMouseRelative(10, 10)\n Sleep(100)\n MoveMouseRelative(-13, 5)\n Sleep(100)\n MoveMouseRelative(-20, -5)\n Sleep(100)\n \n end\n coroutine.resume(cor)\n repeat\n Sleep(100)\n coroutine.resume(cor)\n until not IsMouseButtonPressed(1)\n end\n end\n\n</code></pre>\n<p>Trying to move mouse to one direction and after sometime move to another and loop need to be stopped soon as i left go of the button.</p>\n<p>Currently its running entire loops even after let go of the button and it won't repeat when i don't let go of the mouse. please check the gif.</p>\n<p>Thanks</p>\n"^^ . "0"^^ . "0"^^ . . . "<p>Did you try adding <code>luasnip</code> to the sources table while setting up <code>nvim-cmp</code>.</p>\n<p>Check <a href="https://github.com/neovim/nvim-lspconfig/wiki/Autocompletion" rel="nofollow noreferrer">here</a> for configuration template.</p>\n"^^ . . "luau"^^ . "@ESkri and as mentionned in my env specs: `bit.lshift(2147483648, 1) = 0, because 1000 0000 0000 0000 0000 0000 0000 0000 -> 0000 0000 0000 0000 0000 0000 0000 0000)`"^^ . . . . . . . . . . . . "<p>For WIN_ENV you have to surround the whole cmdline with double-quotes (&quot;)</p>\n<pre><code>function cmdlineQuote()\n if WIN_ENV then\n return '&quot;'\n elseif MAC_ENV then\n return ''\n else\n return ''\n end\nend\n\ncmdRunExifTool = \n cmdlineQuote() .. \n string.format('cd &quot;'..NewTargetDir..'&quot; &amp;&amp; '.._PLUGIN.path..'\\\\bin\\\\win\\\\exiftool.exe '..(optionOverwrite or &quot;&quot;)..' optionAppend=&quot;.\\\\C+F-'..NewJson..'&quot; .') ..\n cmdlineQuote()\nLrTasks.execute(cmdRunExifTool)\n</code></pre>\n"^^ . . . "0"^^ . "0"^^ . . . "0"^^ . . "1"^^ . . . "0"^^ . "If that's not it - show what do you see when you run the code above..."^^ . "5"^^ . . "Remote event not sending from client to server"^^ . . . . . . "2"^^ . . . . . "0"^^ . . . . "1"^^ . "<p>I'm configuring my none-ls.lua file for neovim right now and I'm trying to to find the best builtin formatting for java. But there are too many different types of java formatting builtins out there. Does anyone know the the most well known formatting for java.</p>\n<p>This is what my config looks like right now:</p>\n<pre><code>return {\n &quot;nvimtools/none-ls.nvim&quot;,\n config = function()\n local null_ls = require(&quot;null-ls&quot;)\n null_ls.setup({\n sources = {\n null_ls.builtins.formatting.stylua,\n null_ls.builtins.formatting.black,\n null_ls.builtins.formatting.isort,\n },\n })\n\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;gf&quot;, vim.lsp.buf.format, {})\n end,\n}\n</code></pre>\n<p>I've been searching on google for the past hour to find the best formatting out there. But i can't find it, because there are just too many. And I don't want to waste time finding out which of the different ones work and which don't.</p>\n<p>Thank you for you help!</p>\n"^^ . . . . "3"^^ . . "0"^^ . "15"^^ . . . . "1"^^ . . . . . . . . . "4"^^ . . "1"^^ . . . . . "3"^^ . . "1"^^ . . . "0"^^ . . . "Do local variables in lua occupy memory after end of scope?"^^ . "0"^^ . "I see the individual results of the shifts, but my point is those shifts are used in a context such as `((h1 >> 6) | (h2 << 20)) & 0xffffffff` for example, and yes here `h2 << 20` could be a number that doesn't fit in 32 bits, but that doesn't matter for the overall computation."^^ . . . . "1"^^ . . . . . "0"^^ . . . . "5"^^ . . . . "I don't know what redis is but from your code it's clear that the only way this error would come is if `keyGet` is not `nil` but it's also not a number. Maybe simply check what value it actually is"^^ . . "0"^^ . . "<p>I want to share a lua table given as an argument for a registered C function and convert this table to an C array.\nLua 5.4.</p>\n<p>The table length is correctly retrieved, however the indices type are always nil.</p>\n<p>This is my C code:</p>\n<pre><code>static int myFunction(lua_State *L)\n{\n\n uint16 targetAddress = lua_tointeger(L, 1);\n\n // array1 - pay attention to use of 2, -1, and 1.\n if (lua_istable(L, 2) != 0)\n {\n unsigned int userDataSize = lua_rawlen(L, 2);\n\n ESP_LOGE(TAG, &quot;length: %d&quot;,userDataSize);\n\n uint8_t *userData = (uint8_t *)malloc(userDataSize * sizeof(uint8_t));\n\n if (!userData)\n {\n ESP_LOGE(TAG, &quot;GenericRequest Failed to allocate memory&quot;);\n }\n\n for (unsigned int i = 0; i &lt; userDataSize; i++)\n {\n lua_rawgeti(L, 2, i + 1); // Lua uses 1-based indices.\n\n ESP_LOGE(TAG, &quot;type %s&quot;, luaL_typename(L, -1));\n\n ESP_LOGI(TAG, &quot;Val: %f&quot;, lua_tonumber(L, -1));\n userData[i] = (uint8_t)lua_tonumber(L, -1);\n ESP_LOGI(TAG, &quot;%d: %d&quot;, i, userData[i]);\n\n lua_pop(L, 1); // Pop the Lua value from the stack\n }\n\n ESP_LOGI(TAG, &quot;TA: 0x%X data:&quot;, targetAddress);\n ESP_LOG_BUFFER_HEX(TAG, userData, userDataSize);\n\n free(userData);\n }\n else\n {\n ESP_LOGE(TAG, &quot;Argument #2 expected table&quot;);\n }\n return 0;\n}\n</code></pre>\n<p>And this my lua script:</p>\n<pre><code>print(\\&quot;Hello from Lua\\&quot;) \nmylib.myFunction(0xA98, {1, 2, 3, 4, 5})\n</code></pre>\n<p>I also tried to make the table as a local variable first and pass the variable name to myFunction</p>\n<p>The log output shows:<br />\nHello from Lua<br />\nE (3572) BSW: length: 5<br />\nE (3573) BSW: type nil<br />\nE (3573) BSW: Val: 0.000000<br />\nI (3573) BSW: 0: 0<br />\nE (3576) BSW: type nil<br />\nE (3579) BSW: Val: 0.000000<br />\nI (3583) BSW: 1: 0<br />\nE (3586) BSW: type nil<br />\nE (3590) BSW: Val: 0.000000<br />\nI (3594) BSW: 2: 0<br />\nE (3602) BSW: type nil<br />\nE (3605) BSW: Val: 0.000000<br />\nI (3609) BSW: 3: 0<br />\nE (3612) BSW: type nil<br />\nE (3615) BSW: Val: 0.000000<br />\nI (3619) BSW: 4: 0<br />\nI (3622) BSW: TA: 0xA98 data:<br />\nI (3627) BSW: 00 00 00 00 00</p>\n<p><strong>EDIT:</strong><br />\nThe following code works, explanations appreciated. Thanks</p>\n<pre><code> uint16 targetAddress = lua_tointeger(L, 1);\n printf(&quot;TA: 0x%X \\n&quot;, targetAddress);\n\n\n uint8_t idx_table = 2;\n // Check if the first argument is a table\n if (!lua_istable(L, idx_table)) {\n printf(&quot;Not a table.\\n&quot;);\n return 0;\n }\n\n // Push nil onto the stack to start the iteration\n lua_pushnil(L);\n\n // Iterate through the table using lua_next\n while (lua_next(L, idx_table) != 0) {\n // 'key' is at index -2 and 'value' is at index -1\n if (lua_isinteger(L, -1)) {\n printf(&quot;Value: %d\\n&quot;, lua_tointeger(L, -1));\n } else if (lua_isstring(L, -1)) {\n printf(&quot;Value: %s\\n&quot;, lua_tostring(L, -1));\n }\n\n // Pop the value, leaving the key on top for the next iteration\n lua_pop(L, 1);\n }\n\n // No need to pop the table explicitly, as it's the first argument\n\n return 0;\n\n</code></pre>\n"^^ . . . . . . . . . "I tried your first code, and it worked."^^ . . . "0"^^ . . "<p>I have a lightroom plugin that works perfect on MacOSX, but on Windows the sectionsForBottomOfDialog does not show if there is something after the —— Camera —-.</p>\n<p>I see that other plugin have sectionsForBottom with files and buttons, but I can’t find the problem. No errors\nBeen looking in code of other plugins, but my setup seems correct</p>\n<p>Pluginprovider</p>\n<pre><code>function pluginInfoProvider.sectionsForBottomOfDialog(f, propertyTable )\nreturn {\n {\n title = &quot;Configuration&quot;,\n bind_to_object = propertyTable,\n\n f:view {\n fill_horizontal = 1,\n spacing = f:control_spacing(),\n font = &quot;&lt;system&gt;&quot;,\n ConfigDialogs.DefaultDirectories(f, propertyTable),\n ConfigDialogs.CameraFilm(f, propertyTable),\n }\n },\n}\nend\n</code></pre>\n<p>The code</p>\n<pre><code>function ConfigDialogs.CameraFilm(f, propertyTable)\nreturn\n f:group_box {\n title = 'Adding Camera and Film',\n fill_horizontal = 1, \n --------- Camera --------\n f:row { \n f:static_text {\n title = &quot;Camera Name:&quot;,\n alignment = &quot;left&quot;,\n width_in_chars = &quot;11&quot;, \n }, \n f:edit_field {\n alignment = &quot;left&quot;, \n width_in_chars = 20, \n immediate = true, \n value = bind &quot;CameraName&quot;, \n },…. \n</code></pre>\n<p>Everything from f:row seems to fail</p>\n<p>My sectionsForTopOfDialog are working (if the other is disabled)</p>\n<pre><code>function pluginInfoProvider.sectionsForTopOfDialog( f, propertyTable )\nreturn {\n {\n title = &quot;Analoge Fotografie&quot;,\n f:view {\n fill_horizontal = 1,\n spacing = f:control_spacing(),\n font = &quot;&lt;system&gt;&quot;,\n ConfigDialogs.Information(f, propertyTable)\n }\n },\n}\nend\n</code></pre>\n<p>The code</p>\n<pre><code>function ConfigDialogs.Information(f, propertyTable)\nreturn\n f:row {\n spacing = f:control_spacing(),\n f:static_text {\n title = &quot;bla bla bla&quot;,\n },\n }\nend\n</code></pre>\n"^^ . . . "0"^^ . "1"^^ . . "Instead of creating teams, it would be more efficient to have the teams pre-created and set them all so that they will not auto-join the team. (unless you have a default team.) Then, just use a function to move the player to a different team."^^ . . . . . "1"^^ . . "How to remove elements inside a table based on a value of those elements?"^^ . . "0"^^ . . . . . . "memory"^^ . . . "0"^^ . . "1"^^ . . "sending multible inputs to lua-script with subprocess"^^ . . . . . "<p>You're running the Lua based function with <code>print()</code>, which doesn't exist since Redis Lua implementation is sandboxed.\nYou can simply fix this by replacing <code>print</code> with <code>redis.log</code> to log the message you're trying to call.</p>\n"^^ . "0"^^ . . . . . . . . . . "Then I don't really get why the polyMAC generated on my restricted env is incorrect. The only differences that I could find are the bitwise operation results. For me it's obviously the issue but I might be wrong"^^ . . "Try to replace each `Sleep(100)` with `if not IsMouseButtonPressed(1) then return end; Sleep(100)`"^^ . "0"^^ . "0"^^ . "OK the linked implementation handles the 128-bit (and apparently 130-bit) numbers itself with multiple chunks"^^ . . . "<p>I am currently participating in an open source project, which uses Lua Scripts within a C++ Project in Microsoft Visual Studio. I am now trying to debug an issue which is happening within one of the LUA Scripts. I installed the following VS Extention <a href="https://github.com/WheretIB/LuaDkmDebugger" rel="nofollow noreferrer">https://github.com/WheretIB/LuaDkmDebugger</a>. However VS Still does not stop at the Break Points. Attached you will find Screenshots of the Warnings and Indications I am currently having.\n<a href="https://i.sstatic.net/QZ3sk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/QZ3sk.png" alt="Breakpoint during active Debugging" /></a></p>\n<p><a href="https://i.sstatic.net/t7F8C.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/t7F8C.png" alt="Extention Script List" /></a></p>\n<p>Is there any way to fix this or any external Tool I could use to debug these LUA Scripts?</p>\n<p>Thanks in Advance</p>\n"^^ . . . . "2"^^ . "Don't you need arithmetic modulo 2^128 for poly1305? You could represent numbers as several chunks of 32 bits"^^ . "0"^^ . "0"^^ . "0"^^ . . . . . . . "<p>There's deceptively a lot going on here and this is really tougher than it should be... in your original map, <code>:m '&lt;-2&lt;CR&gt;gv=gv</code>, vim is going to basically simulate all these keystrokes similar to a macro. You can press all of them yourself and get the same result. What you will notice in particular is when you have a visual selection and you press <code>:</code>, you will get <code>'&lt;,'&gt;</code> inserted automatically and you will lose the active visual selection. But <code>'&lt;,'&gt;</code> is a <em>range</em> that acts from the <code>'&lt;</code> <em>mark</em> to the <code>'&gt;</code> mark. (These are the &quot;marks&quot; it's referring to in the error message, which we’ll get to later). From <code>:h '&lt;</code> and <code>:h '&gt;</code>:</p>\n<pre><code>'&lt; &lt; To the first line or character of the last selected\n Visual area in the current buffer. For block mode it\n may also be the last character in the first line (to\n be able to define the block).\n\n '&gt; `&gt;\n'&gt; &gt; To the last line or character of the last selected\n Visual area in the current buffer. For block mode it\n may also be the first character of the last line (to\n be able to define the block). Note that 'selection'\n applies, the position may be just after the Visual\n area.\n</code></pre>\n<p>So, we no longer have the visual selection active, but this is precisely what allows that range to work, because it refers to the previous visual selection that was active. Since the area we just had selected is now considered the previous area, it targets the right section. So the desired area will be moved to the line of end of that area plus one. <code>gv=gv</code> will activate the previous visual selection, format it, and then activate the selection again.</p>\n<p>Now that we've explained why the original works, we can move on to fixing your lua version.</p>\n<p>Part of the issue is that neither <code>vim.cmd()</code> nor the <code>&lt;Cmd&gt;</code> part of a keymap simulate the <code>:</code> keystroke in the same way that your regular <code>vnoremap</code> does, but rather they just execute the command. This is the same reason you don't have to manually enter the <code>&lt;CR&gt;</code>. As a result, we don’t get that range automatically added to our <code>m</code> command like we did before, meaning it will only act on the current line by default. This also means that the visual selection won’t get deactivated before the command is executed, so if this is the first selection you’ve made in the buffer, there will be no “previous” selection as you still just have the current one active. I strongly suspect this is why you get the “mark not set” error as the <code>'&lt;</code>/<code>'&gt;</code> have no previous visual selection to hook to yet.</p>\n<p>So, to replicate this behavior using lua commands, we can either simulate the <code>:</code> keystroke properly, work around it by escaping visual mode and using the <code>'&lt;</code> and <code>'&gt;</code> markers manually or by just getting the lines of the visual area while it is still selected and working with those. I'll be showing you how to successfully use the second method in this list and I'll include the code I attempted to get working using the third method as well if you'd like to tinker with it and fix it.</p>\n<p>Simulating the escape keystroke:<br />\nWe'll write a helper function that will simulate the user pressing the escape key so as to leave visual mode.</p>\n<pre class="lang-lua prettyprint-override"><code>local function simulate_escape()\n vim.api.nvim_feedkeys(\n vim.api.nvim_replace_termcodes('&lt;Esc&gt;', true, false, true),\n -- It is essential that you include &quot;x&quot; in this string; without it, the '&lt;\n -- and '&gt; marks won't get updated correctly after &lt;Esc&gt; is simulated.\n 'nx',\n false\n )\nend\n\n</code></pre>\n<p>Next, we'll implement the actual moving:</p>\n<pre class="lang-lua prettyprint-override"><code>local function move_linewise_visual_area(move_up)\n simulate_escape()\n\n if move_up and vim.fn.line(&quot;'&lt;&quot;) &gt; 1 then\n vim.cmd(&quot;'&lt;,'&gt;m '&lt;-2&quot;)\n vim.cmd(&quot;normal gv=gv&quot;)\n elseif not move_up and vim.fn.line(&quot;'&gt;&quot;) &lt; vim.fn.line(&quot;$&quot;) then\n vim.cmd(&quot;'&lt;,'&gt;m '&gt;+1&quot;)\n vim.cmd(&quot;normal gv=gv&quot;)\n else\n vim.cmd('normal gv=gv')\n end\nend\n\n</code></pre>\n<p>This is more or less just replicating the behavior of your original keymap but also checks for start and end of file.</p>\n<p>Now, onto the keymaps. <code>vim.keymap.set</code> should be your go-to function for lua keymaps. It provides a better experience than <code>vim.api.nvim_set_keymap</code> as it has some extras built into it. Once we make that change, then instead of calling <code>'&lt;Cmd&gt;...'</code> in your keymap, you can just replace that string with the actual lua function itself.</p>\n<p>So then your keymap would become</p>\n<pre class="lang-lua prettyprint-override"><code>vim.keymap.set('v', '&lt;C-Up&gt;', function() move_linewise_visual_area(true) end, opts)\nvim.keymap.set('v', '&lt;C-Down&gt;', function() move_linewise_visual_area(false) end, opts)\n</code></pre>\n<p>Note that we have to define a function inline to call the function since we're passing the inner function an argument. Without wrapping it with a function definition, we would just call it once when the init.lua reads it, and it would return a <code>nil</code> to the actual keymap function. If we didn't require an argument to our inner command, we could just pass it <em>without parentheses</em> to achieve the same effect.</p>\n<p>Here's the final result, with the other method I attempted just for reference.</p>\n<pre class="lang-lua prettyprint-override"><code>local opts = { noremap = true, silent = true }\n\nlocal function simulate_escape()\n vim.api.nvim_feedkeys(\n vim.api.nvim_replace_termcodes('&lt;Esc&gt;', true, false, true),\n -- It is essential that you include &quot;x&quot; in this string; without it, the '&lt;\n -- and '&gt; marks won't get updated correctly after &lt;Esc&gt; is simulated.\n 'nx',\n false\n )\nend\n\nlocal function move_linewise_visual_area(move_up)\n simulate_escape()\n\n if move_up and vim.fn.line(&quot;'&lt;&quot;) &gt; 1 then\n vim.cmd(&quot;'&lt;,'&gt;m '&lt;-2&quot;)\n vim.cmd(&quot;normal gv=gv&quot;)\n elseif not move_up and vim.fn.line(&quot;'&gt;&quot;) &lt; vim.fn.line(&quot;$&quot;) then\n vim.cmd(&quot;'&lt;,'&gt;m '&gt;+1&quot;)\n vim.cmd(&quot;normal gv=gv&quot;)\n else\n vim.cmd('normal gv=gv')\n end\nend\n\n-- Key Mappings\nvim.keymap.set('v', '&lt;C-Up&gt;', function() move_linewise_visual_area(true) end, opts)\nvim.keymap.set('v', '&lt;C-Down&gt;', function() move_linewise_visual_area(false) end, opts)\n\n-- Other attempt\n\nlocal function get_visual_area_line_range()\n -- Line that cursor is on (one end of the visual area)\n local cursor_line = vim.fn.line(&quot;.&quot;)\n\n -- Line opposite the cursor's end of the visual area\n local opposite_line = vim.fn.line(&quot;v&quot;)\n\n -- Return the start and end lines of the visual area in that order\n if cursor_line &lt; opposite_line then\n return cursor_line, opposite_line\n else\n return opposite_line, cursor_line\n end\nend\n\nlocal function move_linewise_visual_area_2(move_up)\n local start_line, end_line = get_visual_area_line_range()\n if move_up and start_line &gt; 1 then\n\n vim.cmd(start_line .. &quot;,&quot; .. end_line .. &quot;m &quot; .. start_line - 2)\n vim.cmd(&quot;normal =gv&quot;)\n elseif not move_up and end_line &lt; vim.fn.line(&quot;$&quot;) then\n vim.cmd(start_line .. &quot;,&quot; .. end_line .. &quot;m &quot; .. end_line + 1)\n vim.cmd(&quot;normal =gv&quot;)\n end\nend\n\n\n-- vim.keymap.set('v', '&lt;C-Up&gt;', function() move_linewise_visual_area_2(true) end, opts)\n-- vim.keymap.set('v', '&lt;C-Down&gt;', function() move_linewise_visual_area_2(false) end, opts)\n</code></pre>\n"^^ . "0"^^ . "0"^^ . . . . "0"^^ . . . "Thanks I made sure that it was and it did fix it, my script was setup for ReplicatedStorage by accident."^^ . . . . . "0"^^ . . . . . "1"^^ . . . . "What line would you expect to move in the X axis?"^^ . . . . . . . "<p>I am a small roblox developper and I ran into a problem.\nRight now, I made a localScript for a quiz game that asks question from data and the user must answer the question in a certain amount of time (Like shown on the image)</p>\n<p><a href="https://i.sstatic.net/hYp19.png" rel="nofollow noreferrer">Result of the code</a></p>\n<p>The problem I am trying to solve is that for now, the game only works for the individual that starts de quiz, not the others</p>\n<p>But I have no idea how to modify my script so that everyone has the same questions at the same time.</p>\n<p>I tried to learn the RemoteEvent strategy but it never worked after 5 hours of trying again and again</p>\n<p>Here is the code of the Quiz right now</p>\n<pre><code>local trivialevel1 = {\n { --Math\n question = &quot;What is the mathematical constant π (pi) approximately equal to?&quot;,\n answers = {&quot;2.718&quot;,&quot;3.142&quot;,&quot;1.618&quot;,&quot;0.577&quot;},\n correctanswer = 2,\n category = &quot;Math&quot;\n },\n {\n question = &quot;What is the result of multiplying any number by zero?&quot;,\n answers = {&quot;1&quot;,&quot;The number itself&quot;,&quot;Zero&quot;,&quot;Infinity&quot;},\n correctanswer = 3,\n category = &quot;Math&quot;\n },\n {\n question = &quot;What is the term for a polygon with five sides?&quot;,\n answers = {&quot;Hexagon&quot;,&quot;Octagon&quot;,&quot;Pentagon&quot;,&quot;Heptagon&quot;},\n correctanswer = 3,\n category = &quot;Math&quot;\n },\n {\n question = &quot;What is the value of the square root of 144?&quot;,\n answers = {&quot;144&quot;,&quot;16&quot;,&quot;9&quot;,&quot;12&quot;},\n correctanswer = 4,\n category = &quot;Math&quot;\n },\n {\n question = &quot;What is the sum of all angles in a triangle?&quot;,\n answers = {&quot;270&quot;,&quot;180&quot;,&quot;360&quot;,&quot;90&quot;},\n correctanswer = 2,\n category = &quot;Math&quot;\n },\n {\n question = &quot;If a number is divisible by 2 and 3, what other number is it also divisible by?&quot;,\n answers = {&quot;4&quot;,&quot;8&quot;,&quot;6&quot;,&quot;5&quot;},\n correctanswer = 3,\n category = &quot;Math&quot;\n },\n { --Sports\n question = &quot;Which country won the most recent FIFA World Cup in 2022?&quot;,\n answers = {&quot;Brazil&quot;,&quot;Germany&quot;,&quot;France&quot;,&quot;Argentina&quot;},\n correctanswer = 4,\n category = &quot;Sports&quot;\n },\n { \n question = &quot;Which sport is associated with the term 'slam dunk'?&quot;,\n answers = {&quot;Soccer&quot;,&quot;Tennis&quot;,&quot;Baseball&quot;,&quot;Basketball&quot;},\n correctanswer = 4,\n category = &quot;Sports&quot;\n },\n { \n question = &quot;In baseball, how many strikes constitute a strikeout for a batter?&quot;,\n answers = {&quot;4&quot;,&quot;2&quot;,&quot;3&quot;,&quot;1&quot;},\n correctanswer = 3,\n category = &quot;Sports&quot;\n },\n { --Geography\n question = &quot;What is the world's largest ocean?&quot;,\n answers = {&quot;Atlantic Ocean&quot;,&quot;Idian Ocean&quot;,&quot;Artic Ocean&quot;,&quot;Pacific Ocean&quot;},\n correctanswer = 4,\n category = &quot;Geography&quot;\n },\n { \n question = &quot;What is the capital city of Japan?&quot;,\n answers = {&quot;Beijing&quot;,&quot;Seoul&quot;,&quot;Tokyo&quot;,&quot;Bangkok&quot;},\n correctanswer = 3,\n category = &quot;Geography&quot;\n },\n { \n question = &quot;What is the largest country in Africa by land area?&quot;,\n answers = {&quot;Nigeria&quot;,&quot;Egypt&quot;,&quot;South Africa&quot;,&quot;Algeria&quot;},\n correctanswer = 4,\n category = &quot;Geography&quot;\n }\n \n}\n\nlocal trivialevel2 = {\n { --Math\n question = &quot;Which of the following is the smallest prime number?&quot;,\n answers = {&quot;3&quot;,&quot;2&quot;,&quot;1&quot;,&quot;4&quot;},\n correctanswer = 2,\n category = &quot;Math&quot;\n },\n {\n question = &quot;In the equation E=mc², what does the 'c' represent?&quot;,\n answers = {&quot;Speed of light&quot;, &quot;Planck constant&quot;,&quot;Gravitational constant&quot;,&quot;Electric charge&quot;},\n correctanswer = 1,\n category = &quot;Math&quot;\n },\n { --Sports\n question = &quot;Which athelete is often referred to as The Fastest Man on Earth?&quot;,\n answers = {&quot;Michael Phelps&quot;,&quot;Usain Bolt&quot;,&quot;LeBron James&quot;,&quot;Cristiano Ronaldo&quot;},\n correctanswer = 2,\n category = &quot;Sports&quot;\n },\n { \n question = &quot;Which Winter Olympic sport involves atheletes sliding down a frozen track on a sled?&quot;,\n answers = {&quot;Ice hockey&quot;,&quot;Curling&quot;,&quot;Ski jumping&quot;,&quot;Skeleton&quot;},\n correctanswer = 4,\n category = &quot;Sports&quot;\n },\n { \n question = &quot;In American football, how many points is a safety worth? &quot;,\n answers = {&quot;2&quot;,&quot;3&quot;,&quot;6&quot;,&quot;1&quot;},\n correctanswer = 1,\n category = &quot;Sports&quot;\n },\n { \n question = &quot;Which tennis player has won the most Wimbledon titles in the men's singles category?&quot;,\n answers = {&quot;Andre Agassi&quot;,&quot;Rafael Nadal&quot;,&quot;Roger Federer&quot;,&quot;Novak Djokovic&quot;},\n correctanswer = 3,\n category = &quot;Sports&quot;\n },\n { --Geography\n question = &quot;Which continent is home to the Sahara Desert, the largest hot desert in the world?&quot;,\n answers = {&quot;South America&quot;,&quot;Africa&quot;,&quot;Asia&quot;,&quot;Australia&quot;},\n correctanswer = 2,\n category = &quot;Geography&quot;\n },\n { \n question = &quot;Which river is the longest in the world?&quot;,\n answers = {&quot;Nile&quot;,&quot;Amazon&quot;,&quot;Yangtze&quot;,&quot;Mississippi&quot;},\n correctanswer = 1,\n category = &quot;Geography&quot;\n },\n { \n question = &quot;Which European country is known as the 'Land of Fire and Ice' due to its volcanic activity and glaciers?&quot;,\n answers = {&quot;Sweden&quot;,&quot;Finland&quot;,&quot;Iceland&quot;,&quot;Norway&quot;},\n correctanswer = 3,\n category = &quot;Geography&quot;\n },\n { --Food\n question = &quot;Which Italian pasta is shaped like small rice grains?&quot;,\n answers = {&quot;Penne&quot;,&quot;Fusilli&quot;,&quot;Orzo&quot;,&quot;Linguine&quot;},\n correctanswer = 3,\n category = &quot;Food&quot;\n },\n}\n\nlocal trivialevel3 = {\n { --Math\n question = &quot;Which famous mathematician is known for his work on the theory of relativity?&quot;,\n answers = {&quot;Isaac Newton&quot;,&quot;Galileo Galilei&quot;,&quot;Albert Einstein&quot;,&quot;Archimedes&quot;},\n correctanswer = 3,\n category = &quot;Math&quot;\n },\n { --Sports\n question = &quot;What is the national sport of Japan?&quot;,\n answers = {&quot;Sumo wrestling&quot;,&quot;Judo&quot;,&quot;Karate&quot;,&quot;Kendo&quot;},\n correctanswer = 1,\n category = &quot;Sports&quot;\n },\n { \n question = &quot;Which gold major is held at Augusta National Golf Club?&quot;,\n answers = {&quot;The Open Championship&quot;,&quot;The PGA Championship&quot;,&quot;The Masters Tournament&quot;,&quot;The U.S Open&quot;},\n correctanswer = 3,\n category = &quot;Sports&quot;\n },\n { \n question = &quot;Which country is known for dominating the sport of cricket and is considered a cricket powerhouse?&quot;,\n answers = {&quot;England&quot;,&quot;Australia&quot;,&quot;South Africa&quot;,&quot;India&quot;},\n correctanswer = 4,\n category = &quot;Sports&quot;\n },\n { --Geography\n question = &quot;The Great Barrier Reef, one of the world's most famous coral reef systems, is located off the coast of which country?&quot;,\n answers = {&quot;Brazil&quot;,&quot;Australia&quot;,&quot;Indonesia&quot;,&quot;Mexico&quot;},\n correctanswer = 2,\n category = &quot;Geography&quot;\n },\n { \n question = &quot;Which mountain range stretches across seven countries in South America?&quot;,\n answers = {&quot;Rocky Mountains&quot;,&quot;Andes&quot;,&quot;Alps&quot;,&quot;Himalayas&quot;},\n correctanswer = 2,\n category = &quot;Geography&quot;\n },\n { \n question = &quot;Which famous canal connects the Mediterranean Sea to the Red Sea?&quot;,\n answers = {&quot;Suez Canal&quot;,&quot;Panama Canal&quot;,&quot;Kiel Canal&quot;,&quot;Corinth Canal&quot;},\n correctanswer = 1,\n category = &quot;Geography&quot;\n },\n { \n question = &quot;What is the smallest independent country in the world, both in terms of area and population?&quot;,\n answers = {&quot;Monaco&quot;,&quot;Vatican City&quot;,&quot;Liechtenstein&quot;,&quot;San Marino&quot;},\n correctanswer = 2,\n category = &quot;Geography&quot;\n },\n}\n\n\n\nlocal question = script.Parent.Parent.Parent.Quiz.Frame.Question\nlocal answer1 = script.Parent.Parent.Parent.Quiz.Frame.Answer1\nlocal answer2 = script.Parent.Parent.Parent.Quiz.Frame.Answer2\nlocal answer3 = script.Parent.Parent.Parent.Quiz.Frame.Answer3\nlocal answer4 = script.Parent.Parent.Parent.Quiz.Frame.Answer4\nlocal category = script.Parent.Parent.Parent.Quiz.Frame.Category\nlocal currentquestionindex = 1\nlocal selectedIndex = 0\nlocal buttons = {answer1,answer2,answer3,answer4}\n\nlocal player = game.Players.LocalPlayer\n\n --TIMER\nlocal timer = script.Parent.Parent.Parent.Quiz.Frame.Timer\nlocal countdownDuration = 10\nlocal currentCountdown = countdownDuration\nlocal isCounting = false\n\n\nlocal function updateTimer()\n while isCounting and currentCountdown &gt; 0 do\n timer.Text = tostring(currentCountdown)\n wait(1)\n currentCountdown = currentCountdown - 1\n end\n\n timer.Text = &quot;Time's up!&quot;\nend\n\nlocal function startCountdown()\n isCounting = true\n currentCountdown = countdownDuration\n updateTimer()\nend\n\nlocal function stopCountdown()\n isCounting = false\nend\n\n\n\nlocal function shuffle(array)\n local n = #array\n for i = n, 2, -1 do\n local j = math.random(i)\n array[i], array[j] = array[j], array[i]\n end\nend\n\nlocal function displayQuestionlevel1(index)\n local questionData = trivialevel1[index]\n question.Text = questionData.question\nend\n\nlocal function displayQuestionlevel2(index)\n local questionData = trivialevel2[index]\n question.Text = questionData.question\nend\n\nlocal function displayQuestionlevel3(index)\n local questionData = trivialevel3[index]\n question.Text = questionData.question\nend\n\nlocal function displayAnswerslevel1(index)\n local answersdata = trivialevel1[index]\n answer1.Text = answersdata.answers[1]\n answer2.Text = answersdata.answers[2]\n answer3.Text = answersdata.answers[3]\n answer4.Text = answersdata.answers[4]\nend\n\nlocal function displayAnswerslevel2(index)\n local answersdata = trivialevel2[index]\n answer1.Text = answersdata.answers[1]\n answer2.Text = answersdata.answers[2]\n answer3.Text = answersdata.answers[3]\n answer4.Text = answersdata.answers[4]\nend\n\nlocal function displayAnswerslevel3(index)\n local answersdata = trivialevel3[index]\n answer1.Text = answersdata.answers[1]\n answer2.Text = answersdata.answers[2]\n answer3.Text = answersdata.answers[3]\n answer4.Text = answersdata.answers[4]\nend\n\nlocal function displayCategorylevel1(index)\n local categorydata = trivialevel1[index]\n category.Text = categorydata.category\nend\n\nlocal function displayCategorylevel2(index)\n local categorydata = trivialevel2[index]\n category.Text = categorydata.category\nend\n\nlocal function displayCategorylevel3(index)\n local categorydata = trivialevel3[index]\n category.Text = categorydata.category\nend\n\nlocal function addCoins(amount)\n player:WaitForChild(&quot;leaderstats&quot;):WaitForChild(&quot;Coins&quot;).Value = player.leaderstats.Coins.Value + amount\nend\n\nscript.Parent.Parent.Parent.Quiz.bouton.MouseButton1Click:Connect(function()\n \n local error1 = script.Parent.Parent.Parent.Quiz.Frame.Error1\n local error2 = script.Parent.Parent.Parent.Quiz.Frame.Error2\n local error3 = script.Parent.Parent.Parent.Quiz.Frame.Error3\n \n error1.BackgroundColor3 = Color3.fromRGB(255, 255, 255)\n error2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)\n error3.BackgroundColor3 = Color3.fromRGB(255, 255, 255)\n \n script.Parent.Parent.Parent.Quiz.Frame.Visible = true\n \n local questionsdone = 0\n \n local errorCount = 0\n \n \n while(questionsdone &lt; 7) do\n script.Parent.Parent.Parent.Quiz.Frame.Answer1.BackgroundColor3 = Color3.fromRGB(255,122,69)\n script.Parent.Parent.Parent.Quiz.Frame.Answer2.BackgroundColor3 = Color3.fromRGB(255,122,69)\n script.Parent.Parent.Parent.Quiz.Frame.Answer3.BackgroundColor3 = Color3.fromRGB(255,122,69)\n script.Parent.Parent.Parent.Quiz.Frame.Answer4.BackgroundColor3 = Color3.fromRGB(255,122,69)\n shuffle(trivialevel1)\n displayQuestionlevel1(currentquestionindex)\n displayAnswerslevel1(currentquestionindex)\n displayCategorylevel1(currentquestionindex)\n \n startCountdown()\n \n if selectedIndex == trivialevel1[currentquestionindex].correctanswer then\n buttons[selectedIndex].BackgroundColor3 = Color3.fromRGB(35, 255, 19)\n addCoins(10)\n else\n buttons[trivialevel1[currentquestionindex].correctanswer].BackgroundColor3 = Color3.fromRGB(35, 255, 19)\n buttons[selectedIndex].BackgroundColor3 = Color3.fromRGB(255,0,0)\n \n errorCount = errorCount + 1\n if errorCount == 1 then\n error1.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Rouge\n elseif errorCount == 2 then\n error2.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Rouge\n elseif errorCount == 3 then\n error3.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Rouge\n -- Code pour le personnage qui meurt ici (ajoutez votre propre logique)\n game.Players.LocalPlayer.Character:BreakJoints()\n end\n end\n \n wait(5)\n \n questionsdone = questionsdone + 1\n end\n \n while(questionsdone &lt; 14) do\n script.Parent.Parent.Parent.Quiz.Frame.Answer1.BackgroundColor3 = Color3.fromRGB(255,122,69)\n script.Parent.Parent.Parent.Quiz.Frame.Answer2.BackgroundColor3 = Color3.fromRGB(255,122,69)\n script.Parent.Parent.Parent.Quiz.Frame.Answer3.BackgroundColor3 = Color3.fromRGB(255,122,69)\n script.Parent.Parent.Parent.Quiz.Frame.Answer4.BackgroundColor3 = Color3.fromRGB(255,122,69)\n shuffle(trivialevel2)\n displayQuestionlevel2(currentquestionindex)\n displayAnswerslevel2(currentquestionindex)\n displayCategorylevel2(currentquestionindex)\n \n startCountdown()\n\n if selectedIndex == trivialevel2[currentquestionindex].correctanswer then\n buttons[selectedIndex].BackgroundColor3 = Color3.fromRGB(35, 255, 19)\n addCoins(10)\n else\n buttons[trivialevel2[currentquestionindex].correctanswer].BackgroundColor3 = Color3.fromRGB(35, 255, 19)\n buttons[selectedIndex].BackgroundColor3 = Color3.fromRGB(255,0,0)\n \n errorCount = errorCount + 1\n if errorCount == 1 then\n error1.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Rouge\n elseif errorCount == 2 then\n error2.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Rouge\n elseif errorCount == 3 then\n error3.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Rouge\n -- Code pour le personnage qui meurt ici (ajoutez votre propre logique)\n game.Players.LocalPlayer.Character:BreakJoints()\n end\n end\n \n wait(5)\n \n questionsdone = questionsdone + 1\n end\n \n while(nil) do\n script.Parent.Parent.Parent.Quiz.Frame.Answer1.BackgroundColor3 = Color3.fromRGB(255,122,69)\n script.Parent.Parent.Parent.Quiz.Frame.Answer2.BackgroundColor3 = Color3.fromRGB(255,122,69)\n script.Parent.Parent.Parent.Quiz.Frame.Answer3.BackgroundColor3 = Color3.fromRGB(255,122,69)\n script.Parent.Parent.Parent.Quiz.Frame.Answer4.BackgroundColor3 = Color3.fromRGB(255,122,69)\n shuffle(trivialevel3)\n displayQuestionlevel3(currentquestionindex)\n displayAnswerslevel3(currentquestionindex)\n displayCategorylevel3(currentquestionindex)\n \n startCountdown()\n\n if selectedIndex == trivialevel3[currentquestionindex].correctanswer then\n buttons[selectedIndex].BackgroundColor3 = Color3.fromRGB(35, 255, 19)\n addCoins(10)\n else\n buttons[trivialevel3[currentquestionindex].correctanswer].BackgroundColor3 = Color3.fromRGB(35, 255, 19)\n buttons[selectedIndex].BackgroundColor3 = Color3.fromRGB(255,0,0)\n \n errorCount = errorCount + 1\n if errorCount == 1 then\n error1.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Rouge\n elseif errorCount == 2 then\n error2.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Rouge\n elseif errorCount == 3 then\n error3.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Rouge\n -- Code pour le personnage qui meurt ici (ajoutez votre propre logique)\n game.Players.LocalPlayer.Character:BreakJoints()\n end\n end\n \n wait(5)\n\n questionsdone = questionsdone + 1\n end\n \n \nend)\n\nscript.Parent.Parent.Parent.Quiz.Frame.Answer1.MouseButton1Click:Connect(function()\n selectedIndex = 1\n script.Parent.Parent.Parent.Quiz.Frame.Answer1.BackgroundColor3 = Color3.fromRGB(143,68,39)\n script.Parent.Parent.Parent.Quiz.Frame.Answer1.Active = false\n script.Parent.Parent.Parent.Quiz.Frame.Answer2.Active = false\n script.Parent.Parent.Parent.Quiz.Frame.Answer3.Active = false\n script.Parent.Parent.Parent.Quiz.Frame.Answer4.Active = false\nend)\n\nscript.Parent.Parent.Parent.Quiz.Frame.Answer2.MouseButton1Click:Connect(function()\n selectedIndex = 2\n script.Parent.Parent.Parent.Quiz.Frame.Answer2.BackgroundColor3 = Color3.fromRGB(143,68,39)\n script.Parent.Parent.Parent.Quiz.Frame.Answer1.Active = false\n script.Parent.Parent.Parent.Quiz.Frame.Answer2.Active = false\n script.Parent.Parent.Parent.Quiz.Frame.Answer3.Active = false\n script.Parent.Parent.Parent.Quiz.Frame.Answer4.Active = false\nend)\n\nscript.Parent.Parent.Parent.Quiz.Frame.Answer3.MouseButton1Click:Connect(function()\n selectedIndex = 3\n script.Parent.Parent.Parent.Quiz.Frame.Answer3.BackgroundColor3 = Color3.fromRGB(143,68,39)\n script.Parent.Parent.Parent.Quiz.Frame.Answer1.Active = false\n script.Parent.Parent.Parent.Quiz.Frame.Answer2.Active = false\n script.Parent.Parent.Parent.Quiz.Frame.Answer3.Active = false\n script.Parent.Parent.Parent.Quiz.Frame.Answer4.Active = false\nend)\n\nscript.Parent.Parent.Parent.Quiz.Frame.Answer4.MouseButton1Click:Connect(function()\n selectedIndex = 4\n script.Parent.Parent.Parent.Quiz.Frame.Answer4.BackgroundColor3 = Color3.fromRGB(143,68,39)\n script.Parent.Parent.Parent.Quiz.Frame.Answer1.Active = false\n script.Parent.Parent.Parent.Quiz.Frame.Answer2.Active = false\n script.Parent.Parent.Parent.Quiz.Frame.Answer3.Active = false\n script.Parent.Parent.Parent.Quiz.Frame.Answer4.Active = false\nend)\n</code></pre>\n<p>Thank you for any help you guys can give me :)</p>\n<p>I am available to give you any other information needed to solve my problem</p>\n"^^ . . "1"^^ . "but numbers are not subject to garbagecollect."^^ . "1"^^ . "1"^^ . "0"^^ . . "1"^^ . . "plugins"^^ . . . . "2"^^ . "udp"^^ . . . . "0"^^ . . "1"^^ . "@harold I have added one more edit"^^ . . . "0"^^ . "1"^^ . "<p>I'm starting to code with love2d, so I installed love2d with the love2d support extension, there is no problem running the code and it works perfectly (I can draw hello world and have it appear on a black screen for example), but I keep getting the same warning every time I write &quot;love&quot;.<a href="https://i.sstatic.net/9XJpC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9XJpC.png" alt="enter image description here" /></a></p>\n<p>I have no idea why it happens</p>\n"^^ . . "0"^^ . . "@ESkri You can notice, it kinda stucks when I look right and left while I am pressing mouse1."^^ . . . . "1"^^ . . . . . "1"^^ . . . . "0"^^ . . . . "1"^^ . . . . . "0"^^ . . . . . . "0"^^ . . . ""Attempt to index nil with 'stat'" How to fix that ? (Roblox)"^^ . . . . . . . "linux"^^ . . . "1"^^ . . . . "<p>Identity transform for the <code>Strong</code> element:</p>\n<pre><code>return {\n {\n Strong = function (elem)\n return elem\n end,\n }\n}\n</code></pre>\n<p>Or if you don't need multiple filter runs, you can do the shorthand:</p>\n<pre class="lang-lua prettyprint-override"><code>function Strong(elem)\n return elem\nend\n</code></pre>\n<p>You can return <code>nil</code> for elements that you want to filter out. For example removing all <code>Strong</code> elements would be:</p>\n<pre class="lang-lua prettyprint-override"><code>function Strong(elem)\n return nil\nend\n</code></pre>\n<p>But there are quite a lot of different elements.</p>\n<p>So perhaps what you should do is do <code>pandoc -t json</code> and pipe that to a program in your favourite programming language and extract all code blocks. See <a href="https://pandoc.org/filters.html#but-i-dont-want-to-learn-haskell" rel="nofollow noreferrer">pandoc filter tools</a> for some packages, but if you're only interested in code blocks at the top level (and you don't need to recursively walk the tree), then no package should be needed.</p>\n<p>But it's true, you can achieve the same thing with a lua filter:</p>\n<pre class="lang-lua prettyprint-override"><code>local codeBlocks = {}\n\nreturn {\n {\n CodeBlock = function (el)\n -- on each CodeBlock match,\n -- append to codeBlocks like it's an array\n table.insert(codeBlocks, el)\n end,\n -- on the next run, we simply return a new\n -- Pandoc document with the code blocks\n Pandoc = function()\n return pandoc.Pandoc(codeBlocks)\n end\n }\n}\n</code></pre>\n<p>Example usage (assuming filter code is in 'filter_codeblock.lua', and markdown document is 'main.md')</p>\n<pre><code>pandoc --lua-filter filter_codeblock.lua main.md -t markdown\n</code></pre>\n"^^ . "<p>I am working with some lua code (extracted from an English Wiktionary module) and do not understand the problem:</p>\n<pre class="lang-lua prettyprint-override"><code>t = {\n [3] = &quot;continent&quot;,\n }\n\nfunction vprint (val)\n return val or 'nil'\nend\n\nprev_qualifier, this_qualifier, bare_placetype = unpack(t)\nprint('prev_qualifier=' .. vprint(prev_qualifier) .. ', this_qualifier=' .. vprint(this_qualifier) .. ', bare_placetype=' .. vprint(bare_placetype))\n</code></pre>\n<p>In Lua5.1, I run the code and get :</p>\n<pre><code>prev_qualifier=nil, this_qualifier=nil, bare_placetype=nil\n</code></pre>\n<p>I would expect <code>bare_qualifier</code>to be equal to <code>'continent'</code>.</p>\n<p>To go further, the code :</p>\n<pre class="lang-lua prettyprint-override"><code>prev_qualifier, this_qualifier, bare_placetype = t[1], t[2], t[3]\nprint('prev_qualifier=' .. vprint(prev_qualifier) .. ', this_qualifier=' .. vprint(this_qualifier) .. ', bare_placetype=' .. vprint(bare_placetype))\n</code></pre>\n<p>Will correctly display:</p>\n<pre><code>prev_qualifier=nil, this_qualifier=nil, bare_placetype=continent \n</code></pre>\n<p>In the documentation, it seems that both assignations should be equivalent.</p>\n<p>What do I miss here ?</p>\n"^^ . . "<p>I want to have a transparent background in my neovim. And so far I have found this:</p>\n<p><code>vim.api.nvim_set_hl(0, &quot;Normal&quot;, {guibg=NONE, ctermbg=NONE})</code>(I have this placed all the way at the bottom of my init.lua) (and I also have this purely vim way: <code>hi Normal guibg=NONE ctermbg=NONE</code> that also work)</p>\n<p>which works up until I open a new split. (I am using NeoTree which opens a new split with a file tree). Then it only works for the NeoTree and not for the other splits.</p>\n<p>This is how it looks normally as I want:</p>\n<p><a href="https://i.sstatic.net/1EaUT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/1EaUT.png" alt="This is how it looks normally as I want" /></a></p>\n<p>(The darkening of the background is because of my Terminal settings)</p>\n<p>When I open neotree(or any other split):</p>\n<p><a href="https://i.sstatic.net/zZeBs.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zZeBs.png" alt="When I open neotree(or any other split)" /></a></p>\n<p>I have tried different auto scripts that were supposed to change the background of inactive splits. It didn't work and I got loads of error messages when creating new splits. Tried many different versions none of them helped</p>\n"^^ . . . . . . . "posted another question https://stackoverflow.com/questions/78001723/print-call-issue-in-lua-based-function"^^ . "bit-manipulation"^^ . . "Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking."^^ . "2"^^ . . . "2"^^ . "2"^^ . . "@neth that you don't need to implement 128-bit or 130-bit arithmetic at least. Actually I also don't see where and why it would require 64-bit arithmetic. It seems carefully designed such that any time a number larger than 32 bits may be created, only the bottom 32 bits of it are needed and `& 0xffffffff` is used to deliberately throw away the excess (equivalently you can do a 32-bit operation that never computes the excess bits). But I did not do a 100% walkthrough of every operation there."^^ . . . . "0"^^ . . . "0"^^ . . . . "So I have created the string in single quotes, and then wrapped in double quotes (cmdlineQuote().\nFor being save in MacOSX I do the reverse ? the string in double quotes and then cmdlineQuote() single quote"^^ . "So I can only assume that the bit representation of a double is leading to this incorrect result"^^ . "I want to know if there's metamethod like __call while using an index from table as function. I hope you can understand me like this."^^ . . . "<p>I want to create a mine pet system for a clicker. I create a value in player</p>\n<p>Main script in ServerScriptService:</p>\n<pre><code>local genX=Instance.new(&quot;IntValue&quot;, player) --actual player multiply by pets\ngenX.Value=10\ngenX.Name=&quot;genPetX&quot;\n</code></pre>\n<p>and I have script that change it every time I click on Pet(xClicks have every pet and means the x that it will add to click)</p>\n<p>LocalScript in Pet:</p>\n<pre><code> local player= game.Players.LocalPlayer\nlocal Equip=false\n\nscript.Parent.MouseButton1Click:Connect(function() \n if Equip==false then\n player.genPetX.Value+=script.Parent.xClicks.Value\n Equip=true\n else\n player.genPetX.Value-=script.Parent.xClicks.Value\n Equip=false\n end\nend)\n</code></pre>\n<p>I even have label that changes every time genPetX changes and print some text</p>\n<p>LocalScript in Label:</p>\n<pre><code>local localplayer=game.Players.LocalPlayer\nlocalplayer.PlayerGui.ScreenGui.xPet.Text=localplayer.genPetX.Value\n\nlocalplayer.genPetX.Changed:Connect(function ()\n localplayer.PlayerGui.ScreenGui.xPet.Text=localplayer.genPetX.Value\n game.ReplicatedStorage.getX:FireServer()\nend)\n</code></pre>\n<p>Main script in ServerScriptService:</p>\n<pre><code>game.ReplicatedStorage.getX.OnServerEvent:Connect(function(player)\n print (&quot;I watched you chaaaaangeeedddddd&quot;)\nend)\n</code></pre>\n<p>but when I click, even when the Label say that it changed, it using default genPetX=10 Value</p>\n<p>Main script in ServerScriptService:</p>\n<pre><code>game.ReplicatedStorage.click.OnServerEvent:Connect(function(player)\n player.leaderstats.Clicks.Value+=player.ClicksPerClick.Value*player.genPetX.Value\nend)\n</code></pre>\n<p>I don't know what I need to change to it work, I have tried a little changes, but as you can read it doesn't work.</p>\n"^^ . . "0"^^ . . . . . . "0"^^ . "Access data structure on different master node from within a Redis function written in Lua"^^ . "removed the coroutine, replaced all the lines, added repeat on the top and everything working perfectly now, super thanks :)"^^ . . "1"^^ . . "0"^^ . . . "0"^^ . "<p>So I finally found something that works!</p>\n<p>Using the <a href="https://github.com/xiyaowong/transparent.nvim" rel="nofollow noreferrer">transparent.nvim</a> plugin I was able to get it working.</p>\n<pre><code> return {\n &quot;xiyaowong/transparent.nvim&quot;,\n lazy = false, --this was SUPER IMPORTANT\n config = function()\n require(&quot;transparent&quot;).setup({ -- Optional, you don't have to run setup.\n groups = { -- table: default groups\n &quot;Normal&quot;,\n &quot;NormalNC&quot;,\n &quot;Comment&quot;,\n &quot;Constant&quot;,\n &quot;Special&quot;,\n &quot;Identifier&quot;,\n &quot;Statement&quot;,\n &quot;PreProc&quot;,\n &quot;Type&quot;,\n &quot;Underlined&quot;,\n &quot;Todo&quot;,\n &quot;String&quot;,\n &quot;Function&quot;,\n &quot;Conditional&quot;,\n &quot;Repeat&quot;,\n &quot;Operator&quot;,\n &quot;Structure&quot;,\n &quot;LineNr&quot;,\n &quot;NonText&quot;,\n &quot;SignColumn&quot;,\n &quot;CursorLine&quot;,\n &quot;CursorLineNr&quot;,\n &quot;StatusLine&quot;,\n &quot;StatusLineNC&quot;,\n &quot;EndOfBuffer&quot;,\n },\n extra_groups = {&quot;NeoTreeNormal&quot;,&quot;NeoTreeNormalNC&quot;}, -- and this was super important as well\n exclude_groups = {}, -- table: groups you don't want to clear\n })\n end,\n}\n</code></pre>\n<p><a href="https://i.sstatic.net/tP3rlFyf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tP3rlFyf.png" alt="enter image description here" /></a>\nRight now the only thing not working is when you run <code>:help</code>.\nOther than that everything seems to be working just fine.</p>\n"^^ . "0"^^ . . "1"^^ . . . . . . . "<p>Because the Redis Cluster command, including Lua script, runs on a single node, and it cannot access keys on other nodes in the cluster. If your command/script needs to access multiple keys, which are not located on the same slot, you get the <em>CROSSSLOT</em> error.</p>\n<p>In your case, your 3 keys, i.e. p1, p2, p3, located on different slots (maybe also on different nodes), and that's why you get the error.</p>\n<p>As @Kevin mentioned in the comment, if p1, p2 and p3 are not keys, but parameters, you can pass them as arguments, and access them with <code>args</code>. If they indeed the keys, you can try to use <a href="https://redis.io/docs/reference/cluster-spec/" rel="nofollow noreferrer">hash-tag</a> to ensure these keys located on the same slot. So that your script can access all of them.</p>\n"^^ . . "haskell-language-server"^^ . . . "<blockquote>\n<p>I see the error: (error) ERR Function not found</p>\n</blockquote>\n<p>Because you call <code>FUNCTION LOAD</code> on one node (127.0.0.1:7000), while call <code>FCALL</code> on another node (127.0.0.1:7002). The function is only loaded on 127.0.0.1:7000, and the other node does't have the function loaded.</p>\n<p>You need to call <code>FUNCTION LOAD</code> on every node in your Redis Cluster.</p>\n<blockquote>\n<p>I see the error</p>\n<p>-&gt; Redirected to slot [15495] located at 127.0.0.1:7002\n(error) ERR Function not found</p>\n</blockquote>\n<p>Because the key that your function tries to operate, located on node 127.0.0.1:7002, and your client is redirected to it, and again, it doesn't have the function loaded.</p>\n"^^ . . . . . . "cryptography"^^ . "<p>I'm making a timer for a game &amp; it works perfectly fine, but I just want it to show the milliseconds.</p>\n<p>I tried to ask AI and it was horribly wrong. (Incorrect syntax, missing numbers...)</p>\n<p>This is what I have <code>string.format(&quot;%02d:%02d:%02d&quot;, hours, minutes, seconds)</code></p>\n"^^ . "<p>Surround the literal with parentheses:</p>\n<pre class="lang-lua prettyprint-override"><code>print((&quot;%d&quot;):format((&quot;%d&quot;):byte(1)))\n</code></pre>\n"^^ . "2"^^ . . . "15"^^ . . "0"^^ . . "<p>I'm not a maths person and the formulas you see on maths type questions/answer with all the symbols is completely beyond me - I'm sorry. However I had help about 18 months ago to turn a provided formula into lua script to make the calculation for two aircraft to intercept each other. I will admit, I don't know why that formula works, and I wouldn't know how to change it to make it do other things; I need to get this working for a flight sim project, but learning all the maths for this one problem would take too long and I have no-one who could teach me. (I don't learn well from books). Please be understanding and not too critical of my lack of maths skills.</p>\n<p>The premise is one aircraft will maintain it's course (target) and the other (interceptor) will alter it's course to intercept with the target aircraft at some point in the future.</p>\n<p>The formula/code I made for that is this in lua below (It was based on a simulation page tutorial on calculating lead shots for firing a bullet in an FPS and where it will hit a moving target - obviously that works in an FPS as you intend to only shoot when pointing at a target, but here there is a change of asking for an intercept that can never happen):</p>\n<pre><code> -- Point intercept(Point const &amp;shooter, double bullet_speed, Point const &amp;target, Vector const &amp;target_velocity)\n -- {\n -- double a = bullet_speed*bullet_speed - target_velocity.dot(target_velocity);\n -- double b = -2*target_velocity.dot(target-shooter);\n -- double c = -(target-shooter).dot(target-shooter);\n\n -- return target+largest_root_of_quadratic_equation(a,b,c)*target_velocity;\n -- }\n\n local targetMINUSInterceptor = TVF.VecSubtract(interceptorVec3Point, targetVec3Point)\n local targetVelocityDotProduct = TVF.VecDot(targetVelocityAsVec3, targetVelocityAsVec3)\n\n local a = interceptorSpeedAsNumber * interceptorSpeedAsNumber - targetVelocityDotProduct\n local b = -2 * TVF.VecDot(targetVelocityAsVec3, targetMINUSInterceptor)\n local c = -TVF.VecDot(targetMINUSInterceptor, targetMINUSInterceptor)\n\n local result = TVF.VecAdd(targetVec3Point, (TVF.MultiplyVectorByNumber(targetVelocityAsVec3, TVF.GetLargestRootOfQuadraticEquation(a,b,c))))\n</code></pre>\n<p>Now, that all works perfectly, but only IF both aircraft are travelling in directions and speeds that CAN intercept (even with required turns for the Interceptor).</p>\n<p>However, if you have, for example, the target aircraft heading West, and East of that target you have the Interceptor aircraft heading East (i.e. moving away from each other and already are tail to tail to each other), and allowing for the fact that the interceptor can't go fast enough to catch up and overtake the target aircraft, then the above calculation/formula still gives a position vector, however it's either 'off the map' or in some weird direction and massive magnitude that makes no practical sense.</p>\n<p>I need to know when this calculation (or a modified version of it) gives a possible interception point, and also when it can't give an interception point. This will allow me to make a branching decision in my code to warn the players when an interception is not possible and the target aircraft would have to change it's direction and/or speed and try again.</p>\n<p>Could someone please help? My maths level is very basic trig, so I'd really appreciate it if you could spell it out for me or give me the corrected formula with explanations words for all the terms please.</p>\n"^^ . . . "sdk"^^ . . . "davinci-resolve"^^ . "@harold hold on, let me show you bitshift operations done with `auth("1234123412341234","12345678123456781234567812345678")`"^^ . "1"^^ . "roblox-studio"^^ . "1"^^ . . . . . . . "<p>You've run into a common issue with <a href="https://create.roblox.com/docs/projects/client-server" rel="nofollow noreferrer">client-server replication</a>. When the server changes something, like a value or the position of an object, it replicates that change to all of the clients. But, for security reasons, if a client changes something, that change <em>does not</em> replicate up to the server or to any other client.</p>\n<p>So the issue with your code is that the server has created the IntValue, <code>genPetX</code>, however the client is the one trying to change its value. So, the value will change on your client, but the server will never see that change. But you're on the right track with the solution, you need to use your RemoteEvent to request that the server change the IntValue's Value.</p>\n<p>So create a RemoteEvent in ReplicatedStorage specifically for updating the <code>genPetX</code> value, name it something like <code>setX</code>, and follow these steps...</p>\n<p>So in your main Script in ServerScriptService :</p>\n<pre class="lang-lua prettyprint-override"><code>local Players = game:GetService(&quot;Players&quot;)\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\n\n-- create the IntValues inside the Player when they join the game\nPlayers.PlayerAdded:Connect(function(player)\n local genX = Instance.new(&quot;IntValue&quot;, player) --actual player multiply by pets\n genX.Value = 10\n genX.Name = &quot;genPetX&quot;\n -- create any other values here...\nend)\n\n-- listen for when a client signals that they have clicked on a pet\nReplicatedStorage.click.OnServerEvent:Connect(function(player)\n local cpc = player.ClicksPerClick.Value\n local gpx = player.genPetX.Value\n player.leaderstats.Clicks.Value += cpc * gpx\nend)\n\n-- listen for when a client tells you to update the `genPetX` value, the client will tell you the amount\nReplicatedStorage.setX.OnServerEvent:Connect(function(player, amount)\n assert(type(amount) == &quot;number&quot;)\n player.genPetX.Value += amount\nend)\n</code></pre>\n<p>Then, in your Label's LocalScript :</p>\n<pre class="lang-lua prettyprint-override"><code>local localplayer = game.Players.LocalPlayer\nlocal genPetX = localplayer.genPetX\n\nlocal label = localplayer.PlayerGui.ScreenGui.xPet\nlabel.Text = tostring(genPetX.Value)\n\n-- keep the label constantly updated with changes to the IntValue's Value\ngenPetX.Changed:Connect(function(newValue)\n label.Text = tostring(newValue)\nend)\n</code></pre>\n<p>Finally, in your Pet's LocalScript, use the RemoteEvent to request that the server update your value : (I'm assuming this is in a Tool)</p>\n<pre class="lang-lua prettyprint-override"><code>local player = game.Players.LocalPlayer\nlocal setX = game.ReplicatedStorage.setX\nlocal xClicks = script.Parent.xClicks\n\nlocal equip = false\n\nscript.Parent.MouseButton1Click:Connect(function()\n -- when equipping, subtract xClicks otherwise add them\n local amount = if equip and -xClicks.Value else xClicks.Value\n\n -- tell the server to update the player's genPetX value by the amount specified\n -- NOTE : THIS IS INHERENTLY UNSAFE, DON'T TRUST THE CLIENT TO EVER TELL THE TRUTH\n setX:FireServer(amount)\n\n -- toggle the value for equip\n equip = not equip\nend)\n</code></pre>\n"^^ . . . "Since you have neither specified a language nor given a minimal reproducible example, the only other option I see for describing a solution is to express it with math. The linked paper shows that there's an algebraic solution based on the [quadratic formula](https://en.wikipedia.org/wiki/Quadratic_formula), and provides it."^^ . . . "I think I am thinking about it the wrong way - looks like the filter can 'divert' matched output - using "pandoc.pipe" mechanism.\nOr at least that is how I understand it now - looking at the code in this example: https://github.com/pandoc/lua-filters/blob/master/spellcheck/spellcheck.lua"^^ . . . . "0"^^ . . . . . . . "0"^^ . . "One scenario where the result of Clone could be nil is when the Archivable flag is set to false, can you check that? https://create.roblox.com/docs/reference/engine/classes/Instance#Clone"^^ . "Have you tried printing it? I mean, Lua is notorious for its 1-based arrays, Vim counts columns from 1. Just guessing that 0 may be the wrong index."^^ . . "There is no objective answer to the question you have asked. You should use whatever method best suits your workflow, level of knowledge, and performance requirements. Short of modifying the language, metatables provide the closest analogue to the classical OOP found in languages like Java (although metatables are actually used to implement a *prototypical* paradigm, i.e. like Self)."^^ . . . "0"^^ . . "How to stop LunarVim Mason from automatically installing a language server?"^^ . . . "I tried this.\nHowever, in the code, Unicode {06B} and {6B} both point to the same string, so I wonder if this is the right step. And even if you convert it to a string, you still don't know what it means."^^ . "0"^^ . "lua-c++-connection"^^ . "0"^^ . . . "0"^^ . "1"^^ . "@Luke100000 I mean the crosshair doesn't move in X axis while shooting. The code reduces the recoil but for example while shooting a moving target my aim stucks. It works fine in other softwares tho."^^ . "0"^^ . . "2d"^^ . "<p>I am working on a little game and I want to spice up the loot drops with a luck value every player has. For this example, let's say the rarities are r1, r2, r3, ...rn. Luck is also initialized with each character as 0.001 and luck will be used in the code as (log10(luck) + 4) which means that for every power of 10 that luck increases, the value of luck that is used in the code increases by 1. 0.001 gives 1, 0.01 gives 2, etc.</p>\n<p>Now this is where I am stalled, when the luck value increases by a &quot;tier&quot; the most common rarity should become r2 if it increases from a luck value of 1 to 2. From 3 to 4 the most common value becomes r3, and both r1 and r2 move down in probability of being selected.</p>\n<p>Any advice on how to implement this, Thanks!</p>\n<p>Also, I have been looking for a while and have found many random generators that answer the problem of getting weighted loot to work, but not implementing this system of luck.</p>\n<p>So far, someone has pointed in the direction of modular division but I cant think of a way to implement it so that as one side of rarities increases while the other decreases.</p>\n<p>On the topic of &quot;sides&quot; I have also thought about using a bell curve and cut it into symmetrical chunks using integrals and some equation that calculates how far apart to make the bounds of the integrals. Then each chunk of the bell curve would be assigned a rarity and as the luck value increases from one level to the next, each rarity slides left one chunk leaving the next rarity as the most common and decreasing the rarities before it.</p>\n"^^ . . "0"^^ . . . . "1"^^ . . "4"^^ . . . "0"^^ . "<p>The code language that the Visual Studio supported is limited.</p>\n<p>Take a look of this:</p>\n<p><a href="https://learn.microsoft.com/en-us/visualstudio/get-started/visual-studio-ide?view=vs-2022#get-started" rel="nofollow noreferrer">Demos</a></p>\n<p>Visual Studio only support these languages:</p>\n<p><a href="https://i.sstatic.net/xGcPv.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/xGcPv.png" alt="enter image description here" /></a></p>\n<p>Lua is not listed. And you can also know this when you install visual studio components via visual studio installer.</p>\n<p>Please consider using visual studio code.</p>\n"^^ . "@harold what does that imply ?"^^ . . . "<ol>\n<li>Add none-ls-extras to the dependencies.</li>\n<li>Require the modules you need.</li>\n</ol>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;nvimtools/none-ls.nvim&quot;,\n dependencies = {\n &quot;nvimtools/none-ls-extras.nvim&quot;,\n },\n config = function()\n local null_ls = require(&quot;null-ls&quot;)\n null_ls.setup({\n sources = {\n null_ls.builtins.formatting.stylua,\n null_ls.builtins.formatting.prettier,\n require(&quot;none-ls.diagnostics.eslint_d&quot;)\n },\n })\n\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;gf&quot;, vim.lsp.buf.format, {})\n end,\n}\n</code></pre>\n"^^ . . . "In a hypothetical example line? either # or text."^^ . . "1"^^ . . . . . "1"^^ . "0"^^ . . . . "Hi thx for your answer but I succeeded without knowing how I just continued the script to do something else before finding an answer and now it works thank you for trying to help me"^^ . . "3"^^ . . "0"^^ . . "obfuscation"^^ . . "0"^^ . . . . "<p>If you just want to send some numbers or strings, you can join them with line feed, then use lua's <code>n</code> or <code>l</code> flag to read these data.</p>\n<pre class="lang-python prettyprint-override"><code>p.communicate(input=&quot;5\\n6.5\\nhello\\n7&quot;)\n</code></pre>\n<pre class="lang-lua prettyprint-override"><code>local input_1 = io.read('n') --5\nlocal input_2 = io.read('n') --6.5\n io.read('l') --'n' doesn't feed the '\\n' after 6.5\nlocal input_3 = io.read('l') --hello\nlocal input_4 = io.read('n') --7\n</code></pre>\n<p>If you want to send complicated data, you can use python's <a href="https://docs.python.org/3/library/struct.html" rel="nofollow noreferrer">struct</a> + <a href="https://docs.python.org/3/library/base64.html" rel="nofollow noreferrer">base64</a> modules for encoding and use lua's <a href="https://www.lua.org/manual/5.4/manual.html#pdf-string.unpack" rel="nofollow noreferrer">string.unpack function</a> + <a href="https://github.com/iskolbin/lbase64/tree/master" rel="nofollow noreferrer">base64 module</a> for decoding. They use almost the same format, so it won't be very hard to learn. Let me show you an example to send 2 ints:</p>\n<pre class="lang-python prettyprint-override"><code>input_data = struct.pack('&lt;ii', input_data_1, input_data_2)\ninput_data = base64.standard_b64encode(input_data).decode()\n# ....\nresult: str = p.communicate(input=input_data)[0]\n</code></pre>\n<pre class="lang-lua prettyprint-override"><code>local base64 = require'base64'\nlocal input = io.read('a')\ninput = base64.decode(input)\nlocal input_1, input_2 = string.unpack('&lt;ii', input)\n</code></pre>\n<p>Using json could be another option, but the same lua does not natively support it, you still need an external module.</p>\n"^^ . "0"^^ . . "@koyaanisqatsi - `math.random(0, 2)` works for me too (in both Lua 5.4 and LuaJIT). What Lua version does not accept 0 as parameter in `math.random`? Please give a link to Lua Reference."^^ . . . "4"^^ . . . . . . . . "1"^^ . . . . . "<p>I'm working on setting up my Neovim configuration for development, specifically focusing on integrating <code>nvim-cmp</code> for autocompletion and <code>LuaSnip</code> for snippet support. However, I'm encountering an issue where the Tab key does expand snippets as expected.</p>\n<p><strong>Environment:</strong></p>\n<ul>\n<li>Neovim version: [Your Neovim version]</li>\n<li>Relevant plugins:\n<ul>\n<li><code>nvim-cmp</code></li>\n<li><code>LuaSnip</code></li>\n<li><code>lsp-zero</code></li>\n<li>Mason for automatic LSP server installation</li>\n</ul>\n</li>\n</ul>\n<p><strong>Current Configuration:</strong></p>\n<p>I've set up <code>nvim-cmp</code> and <code>LuaSnip</code> in my <code>lsp.lua</code> configuration file. Here's the relevant part of my setup:</p>\n<pre class="lang-lua prettyprint-override"><code>local lsp = require(&quot;lsp-zero&quot;)\n\nlsp.preset(&quot;recommended&quot;)\n\nlsp.ensure_installed({\n 'gopls',\n})\n\nlocal cmp = require('cmp')\nlocal cmp_select = {behavior = cmp.SelectBehavior.Select}\nlocal cmp_mappings = lsp.defaults.cmp_mappings({\n ['&lt;C-p&gt;'] = cmp.mapping.select_prev_item(cmp_select),\n ['&lt;C-n&gt;'] = cmp.mapping.select_next_item(cmp_select),\n ['&lt;C-y&gt;'] = cmp.mapping.confirm({ select = true }),\n ['&lt;Return&gt;'] = cmp.mapping.confirm({ select = true }),\n [&quot;&lt;C-Space&gt;&quot;] = cmp.mapping.complete(),\n})\n\ncmp_mappings['&lt;Tab&gt;'] = cmp.mapping.select_next_item(cmp_select)\ncmp_mappings['&lt;S-Tab&gt;'] = cmp.mapping.select_prev_item(cmp_select)\n\nlsp.setup_nvim_cmp({\n mapping = cmp_mappings\n})\n\nlsp.set_preferences({\n suggest_lsp_servers = true,\n sign_icons = {\n error = 'E',\n warn = 'W',\n hint = 'H',\n info = 'I'\n }\n})\n\nlsp.on_attach(function(client, bufnr)\n local opts = {buffer = bufnr, remap = false}\n\n vim.keymap.set(&quot;n&quot;, &quot;gd&quot;, function() vim.lsp.buf.definition() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;K&quot;, function() vim.lsp.buf.hover() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;vws&quot;, function() vim.lsp.buf.workspace_symbol() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;vd&quot;, function() vim.diagnostic.open_float() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;[d&quot;, function() vim.diagnostic.goto_next() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;]d&quot;, function() vim.diagnostic.goto_prev() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;vca&quot;, function() vim.lsp.buf.code_action() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;vrr&quot;, function() vim.lsp.buf.references() end, opts)\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;vrn&quot;, function() vim.lsp.buf.rename() end, opts)\n vim.keymap.set(&quot;i&quot;, &quot;&lt;C-h&gt;&quot;, function() vim.lsp.buf.signature_help() end, opts)\nend)\n\nlsp.setup()\n\nvim.diagnostic.config({\n virtual_text = true\n})\n\n</code></pre>\n<p>I've also used <code>mason</code> and <code>mason-lspconfig</code> to manage and automatically install LSP servers, including configuration for automatic installation of the Lua language server.</p>\n<p><strong>Issue:</strong></p>\n<ul>\n<li>When I type a prefix of a snippet (e.g., swi for a switch statement), the nvim-cmp completion menu correctly displays the snippet suggestion.</li>\n<li>Pressing Tab at this point only inserts a tab space instead of expanding the snippet or navigating through the suggestions.</li>\n<li>Using Ctrl+n navigates to the keyword in the completion menu, but it then only allows inserting the keyword itself, not expanding the snippet.</li>\n</ul>\n<p><strong>Troubleshooting Steps:</strong></p>\n<ul>\n<li>I've confirmed that all plugins are installed and up-to-date.</li>\n<li>Running <code>:verbose imap &lt;Tab&gt;</code> indicates that the Tab key is mapped by <code>nvim-cmp</code>.</li>\n<li>I've reviewed the <code>nvim-cmp</code> and <code>LuaSnip</code> documentation for any missed configuration steps.</li>\n</ul>\n<p><strong>Question:</strong></p>\n<p>How can I correctly configure the Tab key to navigate the <code>nvim-cmp</code> completion menu and expand snippets with <code>LuaSnip</code> in Neovim? Is there a potential conflict with my setup, or am I missing a critical step in my configuration?</p>\n"^^ . . "<p>The array part of a table has a length defined by the first non-<code>nil</code> entry in the array. If <code>t[1]</code> is <code>nil</code> (and it is), then the length of the array is 0. It doesn't matter if <code>t[3]</code> is non-<code>nil</code>; that's considered just a key that happens to be an integer.</p>\n<p>If you don't give <code>unpack</code> a size, it works based on the size of the array part of a table. But you <em>can</em> give <code>unpack</code> a size (more specifically, a start/end range), so you should do that.</p>\n<pre><code>prev_qualifier, this_qualifier, bare_placetype = unpack(t, 1, 3)\n</code></pre>\n"^^ . "<p>Extra details,\nThe whole code:</p>\n<pre class="lang-lua prettyprint-override"><code>local obsidianSettingsGroup = vim.api.nvim_create_augroup('Obsidian Group', { clear = true })\nvim.api.nvim_create_autocmd('FileType', {\n pattern = {'markdown'}, \n callback = function()\n\n function entitle()\n local current_line = vim.api.nvim_get_current_line()\n if current_line[0] == '#' then \n return &quot;I#&lt;Esc&gt;A&lt;Esc&gt;&quot;\n else \n return &quot;I# &lt;Esc&gt;A&lt;Esc&gt;&quot;\n end \n end\n\n local keymap = vim.api.nvim_buf_set_keymap\n local opts = {noremap = true, silent}\n keymap(0, 'n', '&lt;C-S-p&gt;', ':ObsidianWorkspace&lt;CR&gt;', opts)\n keymap(0, 'n', '&lt;C-p&gt;', ':ObsidianQuickSwitch&lt;CR&gt;', opts)\n keymap(0, 'n', '=', entitle(), opts)\n end,\n group = obsidianSettingsGroup,\n})\n\n</code></pre>\n<p>So the goal is, check if line starts with <code>#</code> if yes, add <code>#</code> to it, if not, add <code>#</code> with space after it.</p>\n<p>Everything in the code works except the condition, which always returns false. Mind you it still runs, it just gives me the wrong thing.</p>\n<p>I have checked around the internet for various things but didn't find anything like this, or rather everybody who went about matching and replacing used very similar code but never in conditionals, dunno what I am doing wrong.</p>\n"^^ . . "<p>Those locals are still referenced by the global functions.</p>\n<p><a href="https://www.lua.org/manual/5.4/manual.html#2.5" rel="nofollow noreferrer">[...] inaccessible from Lua means that neither a variable nor <strong>another live object</strong> refer to the object.</a></p>\n<p>And that reference is, if I understood correctly, a upvalue:</p>\n<p><a href="https://www.lua.org/manual/5.4/manual.html#4.2" rel="nofollow noreferrer">When a C function is created, it is possible to associate some values with it, thus creating a C closure [...]; these values are called upvalues and are accessible to the function whenever it is called.</a></p>\n"^^ . "What do I not understand about unpack in Lua"^^ . . . . . . . . "0"^^ . . "Wow, so the tutorial I was following has a mistake: https://www.tutorialspoint.com/lua/lua_object_oriented.htm"^^ . "1"^^ . "0"^^ . "0"^^ . . . "0"^^ . . "2"^^ . . . . . . . . "You should wrap `db:prepare` in `assert` in order to get an error if preparing a statement fails. The error message will then tell you what you did wrong."^^ . "<p>Iam trying to remove elements in a table which have a certain value</p>\n<pre><code>test = {\n {\n id = 473385593,\n deleted = true,\n },\n {\n id = 473385619,\n deleted = true,\n },\n {\n id = 473432275,\n deleted = false,\n },\n {\n id = 473786710,\n deleted = false,\n },\n}\n\nfor index, value in ipairs(test) do\n if value.deleted then\n table.remove(test, index)\n end\nend\n\nfor _, value in pairs(test) do\n print(value.id)\n print(value.deleted)\nend\n</code></pre>\n<p>I would like that i the output is</p>\n<pre><code>473432275\nfalse\n473786710\nfalse\n</code></pre>\n<p>But</p>\n<pre><code>{\n id = 473385619,\n deleted = true,\n },\n</code></pre>\n<p>is not deleted</p>\n<p>So i guess as im iterating over the table to access the value and then do something when deleted == true i remove that element but also reorder the table and so i skip the next element after i call table.remove. At least thats what i figured whats happening.</p>\n<p>So how do i remove in lua a tables elements based on their value?</p>\n"^^ . "lua-table"^^ . . . "0"^^ . . "datagram"^^ . . "@ESkri when I did dump, a and b, a was sometimes superior of INT_MAX"^^ . "0"^^ . "logitech-gaming-software"^^ . . . . . "<p>I want to basically hide my tabs on the top of my terminal. I know I can do it using <code>:set showtabline = 0</code> but I have to keep doing this everytime I start up neovim. I thought that I could set it up in the <code>options.lua</code> file as such:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.opt.showtabline = 0\n</code></pre>\n<p>But it doesn't work. I even tried using <code>.vimrc</code> (which doesn't work as well) and I also symlink it to <code>.nvimrc</code> which also doesn't work. How can I apply this permanently or at least on neovim startup? Note that I'm using LazyVim.</p>\n"^^ . "0"^^ . . "0"^^ . "0"^^ . . . . . . . . . . "<p>Lua doesn't have classes, where you can use a constructor to create a new instance of a type. But, being a flexible language, we can achieve something <em>like</em> classes through clever use of metatables. So let's talk for a moment about how the <code>__index</code> <a href="https://www.lua.org/pil/13.4.1.html" rel="nofollow noreferrer">metamethod</a> works.</p>\n<p>When you ask a table for a key that doesn't exist, it will return <code>nil</code>. But, if you set the <code>__index</code> property to another table, the lookup will fall-through to that table.</p>\n<pre class="lang-lua prettyprint-override"><code>local a = {\n foo = &quot;hello&quot;\n}\nlocal b = {\n bar = &quot;world&quot;\n}\n\n-- ask b for &quot;foo&quot; which isn't defined on 'b'\nprint(b.foo, b.bar) -- returns nil, &quot;world&quot;\n\n-- set the lookup table to 'a'\nsetmetatable(b, { __index = a })\n\n-- ask again for b, which still isn't defined on 'b'\nprint(b.foo, b.bar) -- returns &quot;hello&quot;, &quot;world&quot;\n</code></pre>\n<p>In this example, <code>b</code> did not become a clone of <code>a</code> with all of its properties, it is still a table with only <code>bar</code> defined. If you were to ask for <code>foo</code>, since it does not find it in <code>b</code> it then checks <code>a</code> to see if it can find it there. So <code>b</code> is not <code>a</code>, but it can act like it.</p>\n<p>Let's look at what your code is doing :</p>\n<pre class="lang-lua prettyprint-override"><code>-- create a table with some fields already defined\nlocal Cell = {\n index = nil,\n coordinates = Vector2.zero,\n wasVisited = false\n}\n\n-- create a &quot;new&quot; function that will pass the in original Cell object as the `self` variable\nfunction Cell:new(index: number, coordinates: Vector2)\n -- create an empty table that will reference the original Cell table\n -- note - the first time this is called, the __index metamethod hasn't been set yet\n local instance = setmetatable({}, self) \n\n -- set Cell's __index metamethod to itself\n self.__index = self\n\n -- overwrite the original Cell's index to the passed in index\n self.index = index\n\n -- overwrite the original Cell's coordinates to the passed in coordinates\n self.coordinates = coordinates\n\n -- return an empty table that will reference all of these new values\n return instance\nend\n</code></pre>\n<p>As you can see, your code is struggling to define copies of Cells because your constructor is constantly overwriting the values in the original Cell table, not assigning them to the newly created instance. Each new instance is able to access these fields and not fail, but they are always referencing the last values set.</p>\n<p>So, to fix it, here's what I would do :</p>\n<ul>\n<li><strong>change Cell.new to a period function, not a colon function.</strong> This is a style preference, but a constructor shouldn't need access to instance variables. But it does mean that you need to update the code that calls <code>Cell:new</code> and change them all to <code>Cell.new</code></li>\n<li><strong>define your class properties on the instance.</strong> This means that each new instance technically has its own copy of those keys and they never have to reference Cell for them.</li>\n</ul>\n<pre class="lang-lua prettyprint-override"><code>-- create a new table named Cell\nlocal Cell = {}\n\n-- set Cell's __index to itself to allow for future copies to access its functions\nCell.__index = Cell\n\n-- set the &quot;new&quot; key in Cell to a function\nfunction Cell.new(index: number, coordinates: Vector2)\n -- create a new table and set the lookup table to be the Cell table\n -- since no functions are defined on this new table, they will fall through to access Cell's functions\n local instance = setmetatable({\n -- set some properties on the new instance table\n index = index,\n coordinates = coordinates,\n wasVisited = false,\n }, Cell) \n\n -- return the new table\n return instance\nend\n\n-- set the &quot;markAsVisited&quot; key in Cell to a function\nfunction Cell:markAsVisited()\n -- here &quot;self&quot; is referring to the new instance table, not some field on Cell\n self.wasVisited = true\nend\n\nreturn Cell\n</code></pre>\n"^^ . . . "1"^^ . "5"^^ . . . "0"^^ . "Does this answer your question? [Weighted random numbers](https://stackoverflow.com/questions/1761626/weighted-random-numbers)"^^ . "2"^^ . "0"^^ . . "<p>My setup is a 3 masters, 3 slaves Redis cluster, version 7.x.</p>\n<p>I created a simple Lua based function as:</p>\n<pre><code>#!lua name=loggerLib\nlocal function logMsg(keys, args)\n redis.log(redis.LOG_NOTICE, 'Hello!');\nend\nredis.register_function('logMsg', logMsg)\n</code></pre>\n<p>and loaded it as</p>\n<p><code>cat loggerLib.lua | redis-cli -c -p 7000 -x FUNCTION LOAD REPLACE</code></p>\n<p>However, when I execute it from the redis command prompt as\n<code>127.0.0.1:7002&gt; FCALL logMsg 1</code></p>\n<p>I see the error:\n<code>(error) ERR Function not found</code></p>\n<p>What am I doing wrong here?</p>\n<p>When I run it as</p>\n<pre><code>127.0.0.1:7000&gt; FCALL logMsg 1 a\n</code></pre>\n<p>I see the error</p>\n<pre><code>-&gt; Redirected to slot [15495] located at 127.0.0.1:7002\n(error) ERR Function not found\n</code></pre>\n"^^ . . . "<p>This is probably a consequence of the changes announced here: <a href="https://github.com/nvimtools/none-ls.nvim/discussions/81" rel="noreferrer">https://github.com/nvimtools/none-ls.nvim/discussions/81</a>.</p>\n<p>You can get the code actions/diagnostics for <code>eslint_d</code> from <a href="https://github.com/nvimtools/none-ls-extras.nvim/tree/main" rel="noreferrer">none-ls-extras</a> (don't forget to add this dependency to your <code>null-ls</code> installation).</p>\n<p>Your config should be updated to something similar to this:</p>\n<pre><code>local null_ls = require(&quot;null-ls&quot;)\n\nnull_ls.setup {\n sources = {\n require(&quot;none-ls.diagnostics.eslint_d&quot;), \n ...\n }\n}\n</code></pre>\n"^^ . "In the Android app "Lua Interpreter" I want to extract wiki text on demand"^^ . "Check out pages 993-994 of [this paper](https://www.informs-sim.org/wsc05papers/118.pdf) from the proceedings of the 2005 Winter Simulatiton Conference. (And no, we don’t simulate winter at that conference, that’s when the conference is held each year.)"^^ . . . . . . "0"^^ . . "roblox"^^ . . "simulation"^^ . . "mason"^^ . . . . "1"^^ . . . "1"^^ . "0"^^ . . . . "-1"^^ . "jupyter-notebook"^^ . . . . . "0"^^ . . "Pandoc Jupyter filter to allow/prevent code blocks"^^ . . . "0"^^ . . . . . "<p>Does anyone know of any way possible through either 3rd party viewers that have automation features, usually with LUA (CoolVL, Radegast), RLV/LSL or any other way to make the agent touch an object in a scripted/automated fashion in Second Life? Thanks for the insight.</p>\n<p>I've explored LSL and came to the conclusion it's not possible using LSL. (Though I'd be happy to be proven wrong if anyone knows anything more.) I've also searched CoolVL documentation but see no mention of achieving this result.</p>\n"^^ . . . . . . . . . "9"^^ . . "0"^^ . "1"^^ . . . . . "neovim"^^ . . . "0"^^ . . "1"^^ . . "0"^^ . . . . . . . "@ESKri I tried your proposal without good results, probably because I have no clue about what I'm actually doing :/"^^ . "It's possible, but it looks fairly annoying to me, particularly managing the large products and adding them. Maybe it's easier to port the [version of the C code that doesn't use 64-bit types for those products](https://github.com/floodyberry/poly1305-donna/blob/master/poly1305-donna-16.h)"^^ . "0"^^ . "0"^^ . "0"^^ . . . . "0"^^ . "2"^^ . . "Lua 5.1 bitwise operations using arithmetic for 64bit numbers"^^ . . "<p>Lua 5.1 does not yet support bitwise operators. The Lua environment I'm using is restricted and provides a bit32 library that allows bitwise operations with 32-bit numbers.</p>\n<p>The issue is that I'm trying to backport an algorithm written in Lua 5.4 (poly1305), which you can find here: https://github.com/philanc/plc/blob/master/plc/poly1305.lua And this algorithm uses numbers larger than 32 bits, which makes the result incorrect in my environment.</p>\n<p>You can find my backport of poly1305 https://pastebin.com/mfNhDqvw</p>\n<p>I've done some research to perform bitwise operations using arithmetic, and I found functional wrappers, but they don't work with numbers larger than 32 bits. Would any of you be able to make them work with 64-bit numbers, or rewrite them completely if necessary?</p>\n<pre class="lang-lua prettyprint-override"><code>local MOD = 2 ^ 32\nlocal MODM = MOD - 1\n \nlocal function memoize(f)\n local mt = { }\n local t = setmetatable( { }, mt)\n function mt:__index(k)\n local v = f(k)\n t[k] = v\n return v\n end\n return t\nend\n \nlocal function make_bitop_uncached(t, m)\n local function bitop(a, b)\n local res, p = 0, 1\n while a ~= 0 and b ~= 0 do\n local am, bm = a % m, b % m\n res = res + t[am][bm] * p\n a =(a - am) / m\n b =(b - bm) / m\n p = p * m\n end\n res = res +(a + b) * p\n return res\n end\n return bitop\nend\n \nlocal function make_bitop(t)\n local op1 = make_bitop_uncached(t, 2 ^ 1)\n local op2 = memoize( function(a) return memoize( function(b) return op1(a, b) end) end)\n return make_bitop_uncached(op2, 2 ^(t.n or 1))\nend\n \nlocal bxor1 = make_bitop( { [0] = { [0] = 0, [1] = 1 }, [1] = { [0] = 1, [1] = 0 }, n = 4 })\n \nlocal function bxor(a, b, c, ...)\n local z = nil\n if b then\n a = a % MOD\n b = b % MOD\n z = bxor1(a, b)\n if c then z = bxor(z, c, ...) end\n return z\n elseif a then\n return a % MOD\n else\n return 0\n end\nend\n \nlocal function band(a, b, c, ...)\n local z\n if b then\n a = a % MOD\n b = b % MOD\n z =((a + b) - bxor1(a, b)) / 2\n if c then z = bit32_band(z, c, ...) end\n return z\n elseif a then\n return a % MOD\n else\n return MODM\n end\nend\n \nlocal function bnot(x) return(-1 - x) % MOD end\n \nlocal function rshift1(a, disp)\n if disp &lt; 0 then return lshift(a, - disp) end\n return math.floor(a % 2 ^ 32 / 2 ^ disp)\nend\n \nlocal function rshift(x, disp)\n if disp &gt; 31 or disp &lt; -31 then return 0 end\n return rshift1(x % MOD, disp)\nend\n \nlocal function lshift(a, disp)\n if disp &lt; 0 then return rshift(a, - disp) end\n return(a * 2 ^ disp) % 2 ^ 32\nend\n \nlocal function rrotate(x, disp)\n x = x % MOD\n disp = disp % 32\n local low = band(x, 2 ^ disp - 1)\n return rshift(x, disp) + lshift(low, 32 - disp)\nend\n</code></pre>\n<p>================================================================================\nEDIT:<br />\nFollowing the feedback, I would like to add some additional information. Since you're not certain that the algorithm only deals with 32-bit numbers, I have decided to monitor the bitshift operations to demonstrate otherwise. Here are the modifications made to capture the values used in the bitshift operations of this algorithm:</p>\n<pre class="lang-lua prettyprint-override"><code>lshift = function(a,b) print(&quot;a=[&quot;..a..&quot;] b=[&quot;..b..&quot;] - a &lt;&lt; b = [&quot;..(a &lt;&lt; b)..&quot;]&quot;) return a &lt;&lt; b end;\nrshift = function(a,b) print(&quot;a=[&quot;..a..&quot;] b=[&quot;..b..&quot;] - a &gt;&gt; b = [&quot;..(a &gt;&gt; b)..&quot;]&quot;) return a &gt;&gt; b end;\n</code></pre>\n<p>Results on a standard 5.4 lua environnement with <code>text=1234123412341234</code> and <code>secret32B=12345678123456781234567812345678</code>:</p>\n<pre><code>[1] a=[926299444] b=[2] - a &gt;&gt; b = [231574861]\n[2] a=[842086455] b=[4] - a &gt;&gt; b = [52630403]\n[3] a=[892613426] b=[6] - a &gt;&gt; b = [13947084]\n[4] a=[943142453] b=[8] - a &gt;&gt; b = [3684150]\n[5] a=[858927412] b=[2] - a &gt;&gt; b = [214731853]\n[6] a=[842085427] b=[4] - a &gt;&gt; b = [52630339]\n[7] a=[825504562] b=[6] - a &gt;&gt; b = [12898508]\n[8] a=[875770417] b=[8] - a &gt;&gt; b = [3420978]\n[9] a=[10084375459231865] b=[26] - a &gt;&gt; b = [150268904]\n[10] a=[6482263059657534] b=[26] - a &gt;&gt; b = [96593246]\n[11] a=[2170453620770289] b=[26] - a &gt;&gt; b = [32342279]\n[12] a=[2440835001604485] b=[26] - a &gt;&gt; b = [36371275]\n[13] a=[3412223033429668] b=[26] - a &gt;&gt; b = [50846085]\n[14] a=[271497234] b=[26] - a &gt;&gt; b = [4]\n[15] a=[50524994] b=[26] - a &gt;&gt; b = [0]\n[16] a=[17909233] b=[26] - a &gt;&gt; b = [0]\n[17] a=[54122885] b=[26] - a &gt;&gt; b = [0]\n[18] a=[30232228] b=[26] - a &gt;&gt; b = [0]\n[19] a=[3061778] b=[26] - a &gt;&gt; b = [0]\n[20] a=[3061783] b=[26] - a &gt;&gt; b = [0]\n[21] a=[50524994] b=[26] - a &gt;&gt; b = [0]\n[22] a=[17909233] b=[26] - a &gt;&gt; b = [0]\n[23] a=[54122885] b=[26] - a &gt;&gt; b = [0]\n[24] a=[4258090660] b=[31] - a &gt;&gt; b = [1]\n[25] a=[50524994] b=[26] - a &lt;&lt; b = [3390674950946816]\n[26] a=[50524994] b=[6] - a &gt;&gt; b = [789453]\n[27] a=[17909233] b=[20] - a &lt;&lt; b = [18779191902208]\n[28] a=[17909233] b=[12] - a &gt;&gt; b = [4372]\n[29] a=[54122885] b=[14] - a &lt;&lt; b = [886749347840]\n[30] a=[54122885] b=[18] - a &gt;&gt; b = [206]\n[31] a=[30232228] b=[8] - a &lt;&lt; b = [7739450368]\n[32] a=[1013049923] b=[32] - a &gt;&gt; b = [0]\n[33] a=[2538816002] b=[32] - a &gt;&gt; b = [0]\n[34] a=[2861859653] b=[32] - a &gt;&gt; b = [0]\n[35] a=[1013049923] b=[8] - a &gt;&gt; b = [3957226]\n[36] a=[3957226] b=[8] - a &gt;&gt; b = [15457]\n[37] a=[15457] b=[8] - a &gt;&gt; b = [60]\n[38] a=[60] b=[8] - a &gt;&gt; b = [0]\n[39] a=[2538816002] b=[8] - a &gt;&gt; b = [9917250]\n[40] a=[9917250] b=[8] - a &gt;&gt; b = [38739]\n[41] a=[38739] b=[8] - a &gt;&gt; b = [151]\n[42] a=[151] b=[8] - a &gt;&gt; b = [0]\n[43] a=[2861859653] b=[8] - a &gt;&gt; b = [11179139]\n[44] a=[11179139] b=[8] - a &gt;&gt; b = [43668]\n[45] a=[43668] b=[8] - a &gt;&gt; b = [170]\n[46] a=[170] b=[8] - a &gt;&gt; b = [0]\n[47] a=[92658435] b=[8] - a &gt;&gt; b = [361947]\n[48] a=[361947] b=[8] - a &gt;&gt; b = [1413]\n[49] a=[1413] b=[8] - a &gt;&gt; b = [5]\n[50] a=[5] b=[8] - a &gt;&gt; b = [0]\n</code></pre>\n<p>Inputs on my restricted env are the same, but the results mismatch on large numbers e.g <code>10084375459231865</code>. I guess it overflows ?</p>\n<p>============================ EDIT2<br />\nResults on my restricted environnement:</p>\n<pre class="lang-lua prettyprint-override"><code>[1] a=[926299444] b=[2] - a &gt;&gt; b = [231574861]\n[2] a=[842086455] b=[4] - a &gt;&gt; b = [52630403]\n[3] a=[892613426] b=[6] - a &gt;&gt; b = [13947084]\n[4] a=[943142453] b=[8] - a &gt;&gt; b = [3684150]\n[5] a=[858927412] b=[2] - a &gt;&gt; b = [214731853]\n[6] a=[842085427] b=[4] - a &gt;&gt; b = [52630339]\n[7] a=[825504562] b=[6] - a &gt;&gt; b = [12898508]\n[8] a=[875770417] b=[8] - a &gt;&gt; b = [3420978]\n[9] a=[1.0084375459232e+16] b=[26] - a &gt;&gt; b = [40]\n[10] a=[6.4822629093887e+15] b=[26] - a &gt;&gt; b = [28]\n[11] a=[2.1704535241771e+15] b=[26] - a &gt;&gt; b = [5]\n[12] a=[2.4408349692622e+15] b=[26] - a &gt;&gt; b = [11]\n[13] a=[3.4122229970584e+15] b=[26] - a &gt;&gt; b = [4]\n[14] a=[17266828] b=[26] - a &gt;&gt; b = [0]\n[15] a=[34473854] b=[26] - a &gt;&gt; b = [0]\n[16] a=[55533743] b=[26] - a &gt;&gt; b = [0]\n[17] a=[21780611] b=[26] - a &gt;&gt; b = [0]\n[18] a=[60969828] b=[26] - a &gt;&gt; b = [0]\n[19] a=[17266828] b=[26] - a &gt;&gt; b = [0]\n[20] a=[17266833] b=[26] - a &gt;&gt; b = [0]\n[21] a=[34473854] b=[26] - a &gt;&gt; b = [0]\n[22] a=[55533743] b=[26] - a &gt;&gt; b = [0]\n[23] a=[21780611] b=[26] - a &gt;&gt; b = [0]\n[24] a=[4288828260] b=[31] - a &gt;&gt; b = [1]\n[25] a=[34473854] b=[26] - a &lt;&lt; b = [4160749568]\n[26] a=[34473854] b=[6] - a &gt;&gt; b = [538653]\n[27] a=[55533743] b=[20] - a &lt;&lt; b = [183500800]\n[28] a=[55533743] b=[12] - a &gt;&gt; b = [13558]\n[29] a=[21780611] b=[14] - a &lt;&lt; b = [371245056]\n[30] a=[21780611] b=[18] - a &gt;&gt; b = [83]\n[31] a=[60969828] b=[8] - a &lt;&lt; b = [2723374080]\n[32] a=[5053786813] b=[32] - a &gt;&gt; b = [758819517]\n[33] a=[1886001423] b=[32] - a &gt;&gt; b = [1886001423]\n[34] a=[3133030454] b=[32] - a &gt;&gt; b = [3133030454]\n[35] a=[758819517] b=[8] - a &gt;&gt; b = [2964138]\n[36] a=[2964138] b=[8] - a &gt;&gt; b = [11578]\n[37] a=[11578] b=[8] - a &gt;&gt; b = [45]\n[38] a=[45] b=[8] - a &gt;&gt; b = [0]\n[39] a=[1886001423] b=[8] - a &gt;&gt; b = [7367193]\n[40] a=[7367193] b=[8] - a &gt;&gt; b = [28778]\n[41] a=[28778] b=[8] - a &gt;&gt; b = [112]\n[42] a=[112] b=[8] - a &gt;&gt; b = [0]\n[43] a=[3133030454] b=[8] - a &gt;&gt; b = [12238400]\n[44] a=[12238400] b=[8] - a &gt;&gt; b = [47806]\n[45] a=[47806] b=[8] - a &gt;&gt; b = [186]\n[46] a=[186] b=[8] - a &gt;&gt; b = [0]\n[47] a=[2504579774] b=[8] - a &gt;&gt; b = [9783514]\n[48] a=[9783514] b=[8] - a &gt;&gt; b = [38216]\n[49] a=[38216] b=[8] - a &gt;&gt; b = [149]\n[50] a=[149] b=[8] - a &gt;&gt; b = [0]\n</code></pre>\n<p>As you can see, bitshift results are incorrect on large numbers</p>\n<p>================= EDIT 3<br />\nAs you can see on both outputs line 9</p>\n<ul>\n<li>On lua 5.4: <code>[9] a=[10084375459231865] b=[26] - a &gt;&gt; b = [150268904]</code></li>\n<li>On lua 5.1: <code>[9] a=[1.0084375459232e+16] b=[26] - a &gt;&gt; b = [40]</code></li>\n</ul>\n<p>On Lua 5.1, a double conversion is done, losing precision.\nOn Lua 5.4, the number is kept as a long number keeping the precision.</p>\n<p>So for Lua 5.1 we actually have <code>10084375459232000</code> which is incorrect, as it should be <code>10084375459231865</code> (last 3 digits wiped and replaced by 0, and rounded)</p>\n<p>Any idea to prevent this ?</p>\n<p>============ EDIT 4</p>\n<p>Still, <code>print(10084375459232000 &gt;&gt; 26)</code> on Lua 5.4 does <code>150268904</code> and not <code>40</code>, so it's not even related to precision. But more likely an issue with doubles ? I'm a bit confused now</p>\n"^^ . . . . "Neovim nvim-cmp and LuaSnip: Tab Key Not Navigating Completion Menu or Expanding Snippets"^^ . "<p>After digging through the source code, I found that the option <code>&quot;@variable.builtin&quot;</code> is <a href="https://github.com/rebelot/kanagawa.nvim/blob/bfa818c7bf6259152f1d89cf9fbfba3554c93695/lua/kanagawa/highlights/treesitter.lua#L13" rel="noreferrer">hardcoded</a> to <code>italic = true</code>. Using the overrides configuration, this particular option can be given an <code>italic = false</code> option:</p>\n<pre class="lang-lua prettyprint-override"><code>require(&quot;kanagawa&quot;).setup({\n commentStyle = { italic = false },\n keywordStyle = { italic = false },\n overrides = function()\n return {\n [&quot;@variable.builtin&quot;] = { italic = false },\n }\n end\n})\n</code></pre>\n<p>I opened <a href="https://github.com/rebelot/kanagawa.nvim/issues/216" rel="noreferrer">this issue</a> in the repo with a suggested enhancement to make this configuration more obvious.</p>\n"^^ . . "0"^^ . . "0"^^ . . . . "0"^^ . . "0"^^ . . "By looking at [the C code](https://github.com/floodyberry/poly1305-donna/blob/master/poly1305-donna-32.h), one thing that stands out to me now is that eg `h0*r0` (and related expressions) compute a 26+26 = 52-bit result, summing 5 of them can be too much for a Lua number, depending on the exact values involved. For the right shift that takes `d0` (etc) it's fine if it makes a 32-bit result, but it needs to take a large number as input so it must not do `x % MOD` on its input."^^ . . . . . . . . . . . . "@user207421 The question is about UDP and what I was talking about is the buffering behavior of the extension, rather than whether the send buffer exists."^^ . "<p>A function can only access keys on the shard it was called on. If you try to access a key on a different shard you'll either get a <code>MOVED</code> or a <code>CROSSSLOT</code> error.</p>\n<blockquote>\n<p>The function doesn't need any keys, but some args.</p>\n</blockquote>\n<p>This is contradictory in the context of your question, you have a sorted set you need to access. That is your key argument. With each call to <code>FCALL</code> you specify the keys that your function needs to access, that sorted set would be the key. By specifying your keys you give your client what it needs to direct your function call to the correct shard. If you only have the one sorted set you need to access, then your client should just direct everything for you without any other intervention.</p>\n<p>If however you want to access multiple keys in your function you must ensure they are in the same hash-slot so that you will not encounter cross-slot issues. See <a href="https://redis.io/docs/reference/cluster-spec/#hash-tags" rel="nofollow noreferrer">Hash Tags</a> in the redis cluster spec, that explains how to ensure you are scoping your key-names correctly so you guarantee they are on the right shard.</p>\n"^^ . . "Lua reading table as array in C returns nil for indices"^^ . "0"^^ . "wxlua"^^ . "Lua key event with variables (unified remote)"^^ . . "How to tell when calculating an Intercept Point between two moving objects, when it will never intercept?"^^ . . "No, I don't think any such metamethod exists. The closest is `__index`, which will be called if an index is missing from the table. But see the updated answer."^^ . "@jsx97 yes, this is expected and correct. Elements that cannot be expressed in Markdown syntax, such as figures, are output as HTML. You can prevent that by using `-t gfm-raw_html` and, to avoid losing the comments, modify the filter to set `el.format = 'markdown'` on the raw elements that you'd like to keep."^^ . . . "0"^^ . "Why do you think it stil exists?"^^ . . "1"^^ . "0"^^ . "1"^^ . . . "<p>In your LocalScript, you fire the event located in ReplicatedStorage :</p>\n<p><code>game.ReplicatedStorage.SG_FlightAnnouncementSystem.Events.startAnnouncement</code></p>\n<p>But in your Script in ServerScriptService, you register a listener to an event that is also in ServerScriptService :</p>\n<p><code>local announcementReciever = script.Parent.Parent.Events.startAnnouncement</code></p>\n<p>To solve this issue, I would double check that your Script is actually in ServerScriptService and not ReplicatedStorage. And if that's not the case, I would update the paths of your Script to properly locate the events in ReplicatedStorage.</p>\n<pre class="lang-lua prettyprint-override"><code>local Events = game.ReplicatedStorage.SG_FlightAnnouncementSystem.Events\nlocal announcementReciever = Events.startAnnouncement\nlocal announcementSender = Events.startClientAnnouncement\n\nannouncementReciever.OnServerEvent:Connect(function(plr, announcement)\n print(&quot;Server Received Announcement&quot;)\n script.Parent.Parent[&quot;Sound Effects&quot;].announcementChime.Playing = true\n \n announcementSender:FireAllClients(announcement)\nend)\n</code></pre>\n"^^ . . "0"^^ . "Lua script code doesn't work on Battlefield1"^^ . "<p>On my devices since a few months we have installed WiFi modules, from user interface you can scan available wifi networks and connect to one of them.\nIf the connection is successful I store data about that connection to make it possible to automatically reconnect at a later device startup.</p>\n<p>My UI application is ralized in LUA and from code I have the ability to run linux commands (I work in Buildroot environment), for various reasons I don't have connman available so I manage the network connection with <em>wpa_supplicant</em>.</p>\n<p>Currently let's say my solution is pretty lousy, it works but it certainly can't be called a good job.</p>\n<p>I will try to summarize it quickly:\nEvery 10 seconds I update the list of available networks with the command</p>\n<pre><code>iwlist wlan0 scan\n</code></pre>\n<p>then I update the list of available wifi and their characteristics.\nIn parallel I have another routine (Lua) that every 5 seconds checks the connection status, if the connection is established OK, otherwise it tries to establish a connection with one of the stored networks.\nTo establish a connection I use wpa_supplicant, the problem is that wpa_supplicant is not instantaneous and I need some time frame (variable) to understand if the connection has been established or not.</p>\n<p>the portion of code that manage this part is the following:</p>\n<pre><code>if(counter_500ms % 10 == 0 )then\n local file = io.open(&quot;/tmp/connesso&quot;,&quot;r&quot;)\n if(not(file)) then\n Connesso_A_Internet = false\n else\n local lettura = tonumber(file:read(&quot;*a&quot;))\n file:close()\n if(lettura == 1)then\n print(&quot;connesso&quot;)\n Connesso_A_Internet = true\n Tempo_Last_Check_Connection = gre.mstime() / 1000\n else\n if(Connesso_A_Internet and math.abs(Tempo_Last_Check_Connection - gre.mstime() / 1000) &gt;= 20)then\n Connesso_A_Internet = false\n First_Connection_Wifi(mapargs)\n elseif(Connesso_A_Internet and math.abs(Tempo_Last_Check_Connection - gre.mstime() / 1000) &lt; 10)then\n Connesso_A_Internet = true\n else\n Connesso_A_Internet = false\n if( math.abs(Tempo_Last_Check_Connection - gre.mstime() / 1000) &gt;= 20)then\n First_Connection_Wifi(mapargs)\n end\n end\n \n end\n end\nend\n\n-----\nfunction First_Connection_Wifi(mapargs)\n -- enter only if internet connection is not present\n if(not Connesso_A_Internet)then\n local index = 0\n local f,p\n local nome_temp = nil\n -- parse the structure that contains information about available internet connection\n for i=1,#struttura_reti do\n local stringa_da_cercare = struttura_reti[i].name\n -- extract the ssid of available connections\n stringa_da_cercare = string.gsub(stringa_da_cercare,&quot; &quot;,&quot;\\\\ &quot;)\n\n -- check if this ssid has been used in the past\n local file = io.open(&quot;/mnt/tables/wpa_supplicant_&quot;..stringa_da_cercare..&quot;.conf&quot;,&quot;r&quot;)\n if(not(file)) then\n -- this ssid has never been used in the past\n -- it seems that in this case a [sh] process is addes to ps output\n print(&quot;non c'è file&quot;, struttura_reti[i].name)\n else\n -- this ssid has never been used in the past since I have a .conf file with connection information\n print(&quot;c'è il file -&gt;&quot;,struttura_reti[i].name)\n nome_temp = struttura_reti[i].name\n file:close()\n break\n end\n end\n\n -- if I found a ssid in memory I try to connect to this network\n -- since the connection is established, the [sh] problem is solved\n if(nome_temp ~= nil)then\n os.execute(&quot;killall wpa_supplicant &amp;&quot;)\n\n gre.timer_set_timeout(function()\n Tempo_Last_Check_Connection = gre.mstime() / 1000\n Rete_In_Connessione = nome_temp\n local stringa_da_cercare = nome_temp\n stringa_da_cercare = string.gsub(stringa_da_cercare,&quot; &quot;,&quot;\\\\ &quot;)\n os.execute(&quot;wpa_supplicant -B -D nl80211 -i wlan0 -c /mnt/tables/wpa_supplicant_&quot;..stringa_da_cercare..&quot;.conf &amp;&quot;)\n end,500)\n end\n end\nend\n</code></pre>\n<p>To understand if the connection is established I run the following script:</p>\n<pre><code>#!/bin/sh\nFirstIP=&quot;8.8.8.8&quot; #(Google public DNS)\nSecondIP=&quot;8.8.4.4&quot; #(OpenDNS public DNS)\nIDX=&quot;208&quot;\nDomoIP=&quot;192.168.1.103&quot;\nDomoPort=&quot;8080&quot;\n\npingo=&quot;ping -c 5 -w 1 -q &quot;$FirstIP&quot;&quot;;\nif $pingo | grep -E &quot;min/avg/max&quot; &gt; /tmp/OutputPing;\nthen\n echo &quot;1&quot; &gt; /tmp/connesso\nelse\n #echo &quot;--&gt; No response from first IP (&quot;$FirstIP&quot;), now trying second one (&quot;$SecondIP&quot;)&quot;\n pingo=&quot;ping -c 5 -w 1 -q &quot;$SecondIP&quot;&quot;;\n if $pingo | grep -E &quot;min/avg/max&quot; &gt; /tmp/OutputPing;\n then\n echo &quot;1&quot; &gt; /tmp/connesso\n\n else\n echo &quot;0&quot; &gt; /tmp/connesso\n fi\nfi\n</code></pre>\n<p>By checking the value of /tmp/connection I am able to determine whether the connection has been established or not.\nNow, since this solution works but seems quite idiotic, how can I use wpa_supplicant more intelligently?</p>\n"^^ . . "How can I fully disable italics with the Kanagawa theme in Neovim?"^^ . "<p>I am trying to make an announcement system in Roblox Studio using remote events to transmit the data but the remote events arent firing.</p>\n<p>Local Script (ADMIN):</p>\n<pre><code>...\ngame.ReplicatedStorage.SG_FlightAnnouncementSystem.Events.startAnnouncement:FireServer(announcement)\nprint(&quot;Client Sent Announcement&quot;)\n</code></pre>\n<p>Script (SERVER SCRIPT SERVICE):</p>\n<pre><code>local announcementReciever = script.Parent.Parent.Events.startAnnouncement\nlocal announcementSender = script.Parent.Parent.Events.startClientAnnouncement\n\nannouncementReciever.OnServerEvent:Connect(function(plr, announcement)\n print(&quot;Server Received Announcement&quot;)\n script.Parent.Parent[&quot;Sound Effects&quot;].announcementChime.Playing = true\n \n announcementSender:FireAllClients(announcement)\nend)\n</code></pre>\n<p>Local Script (CLIENT RECIEVER):</p>\n<pre><code>startClientAnnouncement.OnClientEvent:Connect(function(announcement)\n print(&quot;Client Received Announcement&quot;)\nend)\n</code></pre>\n<p>I expect it to output 2 client prints and 1 server print but I only get 1 client print from firing the event.</p>\n"^^ . . "Should wrap to_number with a function returning a default value?"^^ . . . . . "0"^^ . . . . . . "3"^^ . "java"^^ . . . . . . "I don't seem to get DataStoreService working on Roblox"^^ . . . . "0"^^ . "Format Milliseconds aswell in Lua?"^^ . . . . . "0"^^ . "0"^^ . "0"^^ . . . . . . . "1"^^ . . "2"^^ . . . . . . . . . "<p>I try to create a Lua filter to preserve HTML comments (but not any other HTML elements).</p>\n<pre class="lang-lua prettyprint-override"><code>local function starts_with(start, str)\n return str:sub(1, #start) == start\nend\n\nfunction RawInline(el)\n if starts_with('&lt;!--', el.text) then\n return el\n else\n return nil\n end\nend\n\nreturn {{Inline = RawInline}}\n</code></pre>\n<p><em>(Based on mb21's answer here: <a href="https://stackoverflow.com/q/78052121">From HTML to Markdwon: As clean Markdown markup as possible, and to preserve HTML comments</a>.)</em></p>\n<p>It doesn't currently work. What might be the problem?</p>\n<pre class="lang-bash prettyprint-override"><code>pandoc -f html+raw_html from.html -o to.md -t gfm --lua-filter preserve-comments.lua\n</code></pre>\n"^^ . "0"^^ . "1"^^ . . "0"^^ . . "Is it really necessary to make `love` a global variable rather than local?"^^ . . . . . "0"^^ . . "0"^^ . . . . . . . . "0"^^ . . "0"^^ . "0"^^ . . . . "Call string method on string literal"^^ . . . . "...or: ```eval 'return(("millis: %s"):format(redis.call("TIME")[2]))' 0```"^^ . "In Lua, is there a way to document a function type including a description for its parameters?"^^ . . "<p>This is Lua from some game.\nI would like to modify and use this.\nBut it's obfuscated.</p>\n<p>Here's the structure I figured out:</p>\n<p>For example, entering a chat calls the following Lua file.</p>\n<p><code>return function (self,type,message) _G[&quot;\\u{5F}\\u{49}\\u{06B}\\u{49}\\u{6B}\\u{6B}\\u{6C}\\u{06B}\\u{49}\\u{069}\\u{6B}\\u{69}\\u{006C}\\u{6C}\\u{049}\\u{0069}\\u{06C}\\u{6C}\\u{006B}\\u{69}\\u{6C}\\u{06B}\\u{06C}\\u{49}\\u{6B}\\u{0069}\\u{06C}\\u{0069}\\u{49}\\u{006B}\\u{0069}\\u{6C}\\u{69}&quot;][&quot;\\u{049}\\u{0069}\\u{6B}\\u{69}\\u{049}\\u{6B}\\u{049}\\u{006C}\\u{69}\\u{6B}\\u{006C}\\u{69}\\u{06C}\\u{6B}\\u{6B}\\u{69}\\u{6C}\\u{6C}\\u{0069}\\u{06B}\\u{6B}\\u{6B}\\u{006C}\\u{69}\\u{6C}\\u{06C}\\u{49}\\u{006C}\\u{049}\\u{49}\\u{49}\\u{6C}&quot;][(530247052)-(442715560)+(417474590)](self,type,message) end</code></p>\n<p>The code calls an unknown global variable.\nI also found a file with many unreadable global variables defined.</p>\n<p>First, I performed the following calculation (530247052)-(442715560)+(417474590).\nThe result is 505006082</p>\n<p>There was a similar pattern in the &quot;chunk.lua&quot; file where global variables were defined.\nHere are some of them:</p>\n<p><code>[(1437643653)+(1949875078)-(2882512649)]=function(__a0,__a1,__a2)local ikiikkiKKk=223266510;ikiikkiKKk+=1811079080;(function(_iI0l1liIioIl,_o01ilio0oI00,_io0l1lioiIo1)local _1o0iIi1o1lo1=_iI0l1liIioIl[_G[&quot;\\u{5F}\\u{6C}\\u{6B}\\u{6B}\\u{049}\\u{006C}\\u{49}\\u{06B}\\u{6B}\\u{049}\\u{06B}\\u{49}\\u{69}\\u{0069}\\u{006B}\\u{6B}\\u{049}\\u{0049}\\u{6C}\\u{6B}\\u{49}\\u{49}\\u{6C}\\u{6C}\\u{69}\\u{69}\\u{049}\\u{0049}\\u{049}\\u{06C}\\u{0069}\\u{069}\\u{6C}&quot;][&quot;\\u{69}\\u{06C}\\u{6C}\\u{6C}\\u{069}\\u{006C}\\u{49}\\u{69}\\u{6B}\\u{0049}\\u{69}\\u{06B}\\u{0049}\\u{6C}\\u{6C}\\u{69}\\u{69}\\u{49}\\u{006B}\\u{006B}\\u{06C}\\u{006B}\\u{69}\\u{069}\\u{0049}\\u{06B}\\u{069}\\u{049}\\u{06B}\\u{0049}\\u{69}\\u{049}&quot;][(1155173479)+(1577632519)-(1688057523)]][_G[_G[&quot;\\u{05F}\\u{0049}\\u{6C}\\u{69}\\u{06B}\\u{49}\\u{49}\\u{6C}\\u{006C}\\u{69}\\u{6B}\\u{49}\\u{6B}\\u{6C}\\u{006B}\\u{0049}\\u{69}\\u{69}\\u{49}\\u{6C}\\u{0069}\\u{69}\\u{06C}\\u{6C}\\u{06B}\\u{049}\\u{69}\\u{006C}\\u{6C}\\u{0049}\\u{49}\\u{006C}\\u{0069}&quot;][&quot;\\u{06C}\\u{006C}\\u{6C}\\u{6C}\\u{006B}\\u{0069}\\u{49}\\u{49}\\u{6C}\\u{69}\\u{6C}\\u{0049}\\u{49}\\u{6C}\\u{6C}\\u{6C}\\u{6C}\\u{69}\\u{0069}\\u{49}\\u{0069}\\u{6C}\\u{6B}\\u{6C}\\u{6C}\\u{49}\\u{0049}\\u{6C}\\u{6C}\\u{6B}\\u{06B}\\u{69}&quot;][(1334598761)+(865866175)-(2122149422)]][_G[&quot;\\u{005F}\\u{006C}\\u{006B}\\u{06B}\\u{49}\\u{6C}\\u{49}\\u{006B}\\u{6B}\\u{49}\\u{6B}\\u{49}\\u{069}\\u{0069}\\u{6B}\\u{6B}\\u{49}\\u{0049}\\u{6C}\\u{6B}\\u{0049}\\u{49}\\u{06C}\\u{006C}\\u{0069}\\u{0069}\\u{049}\\u{49}\\u{49}\\u{6C}\\u{69}\\u{69}\\u{06C}&quot;][&quot;\\u{69}\\u{6C}\\u{006C}\\u{06C}\\u{0069}\\u{6C}\\u{49}\\u{0069}\\u{6B}\\u{49}\\u{69}\\u{06B}\\u{49}\\u{6C}\\u{6C}\\u{69}\\u{69}\\u{49}\\u{06B}\\u{006B}\\u{006C}\\u{06B}\\u{69}\\u{69}\\u{49}\\u{6B}\\u{0069}\\u{49}\\u{6B}\\u{0049}\\u{069}\\u{49}&quot;][(475540248)+(1474562382)-(1625698704)]]]local _1oiI0I1o1l0i={}for _1l0IoI1l1ioi=1,10000 do _1oiI0I1o1l0i[_1l0IoI1l1ioi]=_G[&quot;\\u{5F}\\u{06C}\\u{06B}\\u{006B}\\u{049}\\u{6C}\\u{49}\\u{006B}\\u{6B}\\u{049}\\u{06B}\\u{0049}\\u{069}\\u{069}\\u{06B}\\u{006B}\\u{49}\\u{49}\\u{6C}\\u{6B}\\u{049}\\u{49}\\u{6C}\\u{6C}\\u{69}\\u{0069}\\u{49}\\u{49}\\u{0049}\\u{006C}\\u{0069}\\u{69}\\u{6C}&quot;][&quot;\\u{69}\\u{6C}\\u{06C}\\u{6C}\\u{69}\\u{6C}\\u{49}\\u{0069}\\u{06B}\\u{49}\\u{069}\\u{006B}\\u{0049}\\u{006C}\\u{06C}\\u{0069}\\u{0069}\\u{049}\\u{6B}\\u{6B}\\u{6C}\\u{006B}\\u{69}\\u{0069}\\u{49}\\u{6B}\\u{069}\\u{49}\\u{06B}\\u{49}\\u{069}\\u{49}&quot;][(460084513)+(758444488)-(-873305452)]end</code></p>\n<p>(1437643653)+(1949875078)-(2882512649) A function is defined in a global variable.\nThe reason I imported this part is because the result of (1437643653)+(1949875078)-(2882512649) is the same as the result &quot;505006082&quot; calculated in the file above.\nAnd it has the same three parameters.</p>\n<p>But I don't know how to proceed from here.</p>\n<p>What should I try next?\nand Is what I'm currently trying getting closer to the answer?</p>\n<p>Everything is described above.\nI need a tool or someone who knows how to solve this.</p>\n"^^ . "Try ```os.clock()``` and use variables to set or reset your timers depending on the runtime."^^ . "comments"^^ . . . "<p>As I like to quote, &quot;Lua gives you the power, you build the mechanisms&quot;. It is no different for OOP in Lua. This is probably what's leaving you confused.</p>\n<blockquote>\n<p>I want to use real OOP, like for example Java or C# have.</p>\n</blockquote>\n<p>I think this is the first misconception we need to eliminate: Java / C# OOP isn't &quot;real&quot; OOP. It is a particular implementation / variant of OOP called &quot;class-based OOP&quot; which has good language support both in Java and C#. It is as real as Lua's (or JavaScript's, for that matter) prototype-based OOP implementations are, though these tend to leave you more degrees of freedom.</p>\n<p>Let's get started. First, we'll look at some ways to build class-based OOP in terms of metatable-based OOP. For that, we first need to understand what a metatable is.</p>\n<h3>Metatables</h3>\n<p>Consider the following snippet:</p>\n<pre class="lang-lua prettyprint-override"><code>local my_math = {tau = 2 * math.pi}\n...\nprint(my_math.pi) -- oops, nil!\n</code></pre>\n<p>Suppose we want to throw an error if we try to access an absent field. We can't do that, right? Because <code>.</code> is not a normal function. It's built in to the language. We can't change what it does. We could introduce a function, but writing <code>get(my_math, &quot;pi&quot;)</code> or <code>my_math.get&quot;pi&quot;</code> or similar would be pretty verbose. No, we want to keep the concise <code>my_math.pi</code> notation, but we want to change what it does.</p>\n<p>Enter metatables: They let you do just this - change the behavior of <code>t.name</code> (technically, more generally the behavior of <code>t[k]</code>; <code>t.name</code> is just syntactic sugar for <code>t[&quot;name&quot;]</code>).</p>\n<p>When you do <code>t[k]</code>, Lua actually does the following work behind the scenes:</p>\n<ol>\n<li>Look up the value corresponding to key <code>k</code> in <code>t</code>. If this is not <code>nil</code>, <code>t[k]</code> evaluates to this value.</li>\n<li>Otherwise, look up the metatable. If no metatable is set, <code>t[k]</code> evaluates to <code>nil</code>.</li>\n<li>If there is a metatable, and this metatable has an <code>__index</code> field which stores a function <code>f</code>, call <code>t[k]</code> evaluates to <code>f(t, k)</code>. This lets you customize what happens when absent keys are accessed!\nThat's exactly what we want. <code>my_math.tau</code> should do nothing special, it should just give us the value of 2 pi.</li>\n</ol>\n<p>But if and only if we access an absent field - as is the case for <code>my_math.pi</code> - the <code>__index</code> &quot;metamethod&quot; of the metatable of <code>my_math</code> will be called! This lets us throw an error:</p>\n<pre class="lang-lua prettyprint-override"><code>local metatable = {}\nfunction metatable.__index(tab, key)\n error(&quot;no such field. if you're looking for pi, it's not here!&quot;)\nend\nsetmetatable(my_math, metatable)\n</code></pre>\n<p>Now, if you access <code>my_math.pi</code>, you'll get an error. But <code>__index</code> is more powerful than that even. You can return another value. The most frequent use for <code>__index</code> is for &quot;defaults&quot; however, which is why Lua provides language support for this: <code>__index</code> can be a table <code>mt</code>, in which case <code>t[k]</code> evaluates to <code>t[k]</code> if <code>t[k]</code> is not <code>nil</code> and <code>mt[k]</code> otherwise. Consider the following example:</p>\n<pre class="lang-lua prettyprint-override"><code>local defaults = {x = 1}\nlocal t = {y = 2}\nsetmetatable(t, defaults)\nprint(t.x) -- 1, default! without the metatable, this would be nil\nprint(t.y) -- 2\n</code></pre>\n<p><code>__index</code> is not the only metamethod - there are also metamethods for arithmetic, concatenation, comparisons, table length (<code>#</code>), each with their own rules (see the <a href="https://www.lua.org/manual/5.1/manual.html#2.8" rel="nofollow noreferrer">metatable</a> docs in the 5.1 reference manual) - but it is the only one that's really necessary for implementing metatable-based OOP. Some scripting languages, like JavaScript, <em>only</em> have the equivalent of <code>__index</code> (called <code>__prototype__</code> in JS).</p>\n<h3>Some syntactic sugar</h3>\n<p>It's also helpful to be aware of the following frequently used syntactic sugar:</p>\n<ul>\n<li><code>function class:method(...) ... end</code> is equivalent to <code>function class.method(self, ...) ... end</code>: It adds an implicit <code>self</code> as a first parameter. (As my naming suggests, this is frequently used for methods.)</li>\n<li><code>instance:method(...)</code> is roughly equivalent to <code>instance:method(instance, ...)</code>. This is usually used for method calls, passing the object as the first argument (note how this corresponds to the <code>class:method</code> syntactic sugar in the function definition: the <code>instance</code> is passed for <code>self</code>).</li>\n</ul>\n<h3>Your first class</h3>\n<p>Now we can get back to the core of the issue: How can we implement a class? Well, what is an instance, if not a table where absent keys should be looked up as &quot;method&quot; names - as opposed to fields - in the parent (class) table? Since you're interested in gamedev, let's start work on a rudimentary 2d vector class. I will meticulously separate all tables here to make it clear which is which. There are various variants on this. Some variants conflate metatable &amp; class table. Others conflate class table &amp; method table. All of this works, but is not helpful in understanding it.</p>\n<p>First, let's make the tables. They are all closely tied: The methods may need to call constructors or other &quot;static&quot; (using Java terminology) functions, which are stored in the class table. The constructors will need to set the metatable. The metatable needs to have its <code>__index</code> field set to the methodtable, such that accessing <code>instead.method</code> gives us the proper method:</p>\n<pre class="lang-lua prettyprint-override"><code>local vector2d = {} -- &quot;class&quot; table\nlocal methods = {}\nlocal metatable = {__index = methods}\n</code></pre>\n<p>Let's start with the method table. This will be the table behind the <code>__index</code> field in our metatable. Now we can write the constructors.</p>\n<pre class="lang-lua prettyprint-override"><code>function vector2d.new(x, y)\n local instance = {x = x, y = y}\n setmetatable(instance, metatable)\n return instance\nend\nfunction vector2d.new_zero()\n return vector2d.new(0, 0)\nend\n</code></pre>\n<p>Let's have a method to add two vectors, and a method to multiply a vector by a scalar.</p>\n<pre class="lang-lua prettyprint-override"><code>function methods.add(v, w)\n return vector2d.new(v.x + w.x, v.y + w.y)\nend\nfunction methods:multiply(scalar)\n return vector2d.new(self.x * scalar, self.y * scalar)\nend\n</code></pre>\n<p>Et voilà! Your first class! You can now do:</p>\n<pre class="lang-lua prettyprint-override"><code>local v = vector2d.new(1, 2)\nlocal w = vector2d.new(3, 4)\nlocal u = v:add(w):scale(2)\nprint(u.x, u.y) -- 8 12\n</code></pre>\n<p>This is really the fundament of metatable-based (prototype-based) OOP. You can now build on this, adding support for:</p>\n<ul>\n<li>&quot;typeof&quot; checks (just compare <code>getmetatable(instance)</code> against <code>metatable</code>)</li>\n<li>&quot;inheritance&quot; (effectively set the metatable of <code>methods</code> to the parent's <code>methods</code> table) - I'd urge you to consider &quot;composition over inheritance&quot; though;</li>\n<li>operator overloading (just define the respective metamethods in <code>metatable</code>);</li>\n<li>even fancier features like multiple inheritance (prototype-based OOP is more flexible than any class-based OOP systems)</li>\n</ul>\n<p>Note that you get polymorphism &quot;for free&quot; through the metatable, and field access &quot;for free&quot; through the fact that your object is just a table.</p>\n<p>But, this is indeed not the only way to implement OOP. Another popular way is what I call &quot;closure-based OOP&quot;, which has its advantages and disadvantages. Many consider it simpler to understand.</p>\n<h3>Closures</h3>\n<p>Lua has first-class <em>closures</em>: These functions hold references to the variables surrounding them (&quot;upvalues&quot;), allowing them to read &amp; write these &quot;upvalues&quot;. A simple example:</p>\n<pre class="lang-lua prettyprint-override"><code>local foo = 1\nfunction set_foo(x)\n foo = x\nend\nfunction get_foo()\n return foo\nend\nset_foo(2)\nprint(get_foo()) -- 2\n</code></pre>\n<p><code>set_foo</code> can write <code>foo</code>, and <code>get_foo</code> can read it. <code>foo</code> is what I call a &quot;shared&quot; upvalue of <code>set_foo</code> and <code>get_foo</code>: Both could read &amp; write it, and the changes are visible in the respective other closure.</p>\n<p>Closures - and with them, the (fresh) set of upvalues - get created by <code>function</code> definitions. Closures are what allows Lua's lexical scoping to work so seamlessly.</p>\n<p>We can use this to write a vector class using closures. Here's how it looks:</p>\n<pre class="lang-lua prettyprint-override"><code>local vector2d = {}\nfunction vector2d.new(x, y)\n instance = {x = x, y = y} -- you would usually call this &quot;self&quot;\n function instance.add(other_instance)\n return vector2d.new(instance.x + other_instance.x, instance.y + other_instance.y)\n end\n function instance.multiply(scalar)\n return vector2d.new(instance.x * scalar, instance.y * scalar)\n end\n return instance\nend\nfunction vector2d.new_zero()\n return vector2.new(0, 0)\nend\n</code></pre>\n<p>This lets us change the way we call methods; we no longer have to pass the instance, because the methods already know the instance as an upvalue:</p>\n<pre class="lang-lua prettyprint-override"><code>local v = vector2d.new(1, 2)\nlocal w = vector2d.new(3, 4)\nlocal u = v.add(w).scale(2) -- note: . instead of :\nprint(u.x, u.y) -- 8 12\n</code></pre>\n<h3>Comparison</h3>\n<p>I'll let you be the judge which of these two approaches you consider simpler. Since you're still new to Lua, I would recommend starting with that one. After that, learn the other one; you should know both.</p>\n<p>The metatable-based approach shines in terms of performance: You don't need to create many upvalues or closures for each instantiation. It also enables operator overloading further down the road (you will likely want this for vectors, for example). I'd prefer this the more objects and instantiations you expect there to be (for example I would prefer it for vectors, which may be used very frequently).</p>\n<p>Where metatable-based OOP doesn't shine is encapsulation: There are no &quot;private&quot; variables. You can only have &quot;private by convention&quot; table fields. In the closure-based approach, you can use <code>local</code> variables as true private fields only accessible to the set of closures (methods).</p>\n<p>(There are some more nuances, but this is the gist of it.)</p>\n"^^ . . . "0"^^ . "Many thanks. But are you sure this really works? I tried this with the following input: https://pastebin.com/raw/nHCxp7vk, and I get the following output: https://pastebin.com/raw/Ti6yciat. The output does include several HTML elements, namely `div`, `figure`, `img`, `blockquote`, `p`, whereas what I want is to get as clean output as possible: https://pastebin.com/raw/LiGBMBDG"^^ . . . . "1"^^ . . "1"^^ . . "Hi. Thanks, I'm not sure how that helps, and remember when I said I didn't understand all those mathematical symbols and formal formulas? Well that paper is full of them... so it's not really of any help at all."^^ . . "0"^^ . . "2"^^ . "haskell"^^ . "0"^^ . "1"^^ . "I did some researches and lua 5.3+ came with a new type: Integers. As you can see on both output results, first results (on lua 5.4) have integers. On the second, we clearly see the double conversion, and doubles lose precision right?"^^ . "wpa-supplicant"^^ . . "2"^^ . . "2"^^ . . "3"^^ . "<p>I'm using LazyVim for my setup and in my <code>options.lua</code> I have both <code>vim.opt.virtualedit = &quot;block&quot;</code> and <code>vim.opt.scrolloff = 999</code>, because that's the way I like it.</p>\n<p>But yesterday this strange behavior started happening where in the middle of editing a file, my <code>virtualedit</code> and <code>scrolloff</code> options get unset.</p>\n<p>That is, when I fire up nvim everything is how I want it, but after a while (and I haven't figured out a consistent trigger) my cursor will stop sticking to the center of the screen. And then when I check <code>set virtualedit?</code> and <code>set scrolloff?</code>, I get <code>virtualedit=</code> and <code>scrolloff=0</code>, respectively. What the heck?</p>\n<p>I'm assuming it's some plugin I have installed that's messing something up, but I'm a relatively new vim user so I'm not sure how to track down what is changing my options. Does anybody have any advice?</p>\n<p>I can't find reference to any similar issues online.</p>\n<p>Currently, my workaround is a keybinding that calls <code>:set vim.opt...</code> to fix it on the fly. But sometimes this still doesn't work (I'll call <code>:set vim.opt.scrolloff=999</code> and <code>scrolloff</code> won't change). When that happens, I exit nvim and re-open, and everything is back to how I want it.</p>\n"^^ . . "1"^^ . . . . . . . . . "1"^^ . "0"^^ . . . "0"^^ . "0"^^ . . . . "1"^^ . . "local"^^ . "1"^^ . . . "4"^^ . "<p>As you figured out already, this snippet</p>\n<pre class="lang-lua prettyprint-override"><code>for index, value in ipairs(test) do\n if value.deleted then\n table.remove(test, index)\n end\nend\n</code></pre>\n<p>is doing the grave mistake of removing table elements - shifting subsequent elements down - while iterating a table. <code>for index, value in ipairs(test) do &lt;body&gt; end</code> is roughly equivalent to</p>\n<pre class="lang-lua prettyprint-override"><code>do\n local index = 0\n while true do\n index = index + 1\n local value = test[index]\n if value == nil then\n break\n end\n &lt;body&gt;\n end\nend\n</code></pre>\n<p>So of course if <code>&lt;body&gt;</code> does a <code>table.remove(test, index)</code>, then in the next iteration <code>test[index]</code> will be the previous <code>test[index+1]</code> and you will skip an element.</p>\n<p>I would suggest &quot;filtering&quot; test, and building a new table containing only the elements you want to keep. This would look as follows:</p>\n<pre class="lang-lua prettyprint-override"><code>local test_filtered = {}\nfor index, value in ipairs(test) do\n if not value.deleted then\n table.insert(test_filtered, value)\n end\nend\nfor _, value in ipairs(test_filtered) do\n print(value.id)\n print(value.deleted)\nend\n</code></pre>\n<p>This is asymptotically optimal runtime-wise (linear time). Very often it's cleaner to not mutate the original table; that can lead to surprises.</p>\n<p>In case you really want to modify <code>test</code>, you could iterate in reverse order, e.g. using <code>for i = #test, 1, -1 do</code>. Then <code>table.remove</code> will work fine. But be warned that this has a time complexity bound of O(n²).</p>\n<p>By keeping a second index you can also do in-place bulk removal of elements in O(n).</p>\n<p>Also: Why do you use a &quot;list&quot; here at all? Assuming that you don't care about order, a &quot;hash table&quot; (which lets you remove elements while iterating) would make more sense, given that you have IDs. Consider</p>\n<pre class="lang-lua prettyprint-override"><code>test = {\n [473385593] = {deleted = true},\n [473385619] = {deleted = true},\n [473432275] = {deleted = false},\n [473786710] = {deleted = false},\n}\n</code></pre>\n<p>then you could just do</p>\n<pre class="lang-lua prettyprint-override"><code>for id, value in pairs(test) do\n if value.deleted then\n test[id] = nil\n end\nend\n</code></pre>\n"^^ . "1"^^ . . "meta-method"^^ . . . . . . . . . "0"^^ . . "1"^^ . "Why FiveM script client callback does not receive the right variable type?"^^ . "luadoc"^^ . "1"^^ . . . "0"^^ . . . . . . . "<p>I've a Redis cluster v7.x with 3 masters each having a slave.\nI've defined a Lua function as following:</p>\n<pre><code>local keyGet = redis.call('GET', timeSlotKey)\n\nlocal currentValue = 0\nif keyGet ~= nil then\n currentValue = tonumber(keyGet)\nelse\n currentValue = 0\nend\n\nredis.log(redis.LOG_NOTICE, currentValue)\nif currentValue &lt; 5 then\n redis.call('INCR', timeSlotKey)\n redis.call('EXPIRE', timeSlotKey, expiryDuration)\n return 1\nelse\n return 0\nend\n</code></pre>\n<p>When I call the function from command line it throws an error:</p>\n<p><code>attempt to compare nil with number</code> at line <code>if currentValue &lt; 5 then</code></p>\n<p><strong>What is the issue here? How to use the return value of GET call from the Redis?</strong></p>\n"^^ . "0"^^ . . "0"^^ . . . "-1"^^ . . . . "2"^^ . "0"^^ . "Where do you have an end comment tag?"^^ . "1"^^ . . . "I presumed that you wanted to use `myTbl.myIndex (myParam)` syntax. In that case, as I said, to invoke the metamethod `__index`, `myTbl.myIndex` ought to be `nil`. But after your comment, I no longer presume that I understand your purpose; in partucular, I don't understand why you cannot do whatever you want with `myTbl` in `myIndex()`."^^ . . . . . "0"^^ . . "This code looks good, but it does not match the output you present. Please show the actual code."^^ . "`Pawn:new` is implemented with mistakes. Post its code please."^^ . . . . . "Thanks - I saw that - my main use-case here is to extract specific sections - code blocks for instance - but I want to reject the majority of other parts of the AST - basically, looking for a fancy 'grep'. I'll add more detail to my original post."^^ . . . . "code-snippets"^^ . "buildroot"^^ . "0"^^ . . . . . "_"But I don't know how to proceed from here."_ - You proceed by _not stopping_. Try doing 1 line at a time - but keep on at it and eventually it'll add-up and a more complete picture of the program will reveal itself."^^ . . . . "The sorted set is a fixed named and it's hardcoded within the function definition. It's not passed through `fcall`. My calls is like `fcall myFunction 0 arg1 arg2`"^^ . "0"^^ . . "lunarvim"^^ . . . "Simply return it, like ```eval 'return(redis.call("TIME"))' 0```"^^ . "0"^^ . "0"^^ . . . "@Luatic: Actually, the string was just for illustration purposes. In the real life example the objects to be collected have finalizers attached and I was wondering about the order in which those finalizers get called."^^ . . "0"^^ . "0"^^ . "0"^^ . . . . . . . . "1"^^ . "How do I make this function go to Players instead of Workspace"^^ . . . . . . "1"^^ . . "<p>--script.lua\nlocal x = 0</p>\n<p>--main.lua\ndofile(&quot;script.lua&quot;)</p>\n<p>Now we are out of script.lua scope, so we can't directly access x variable. But it still exists and its definition occupies memory even if x == nil.\nHow can I delete x completely? Or How can I load thousands of scripts to do some stuff and release these scripts one by one completely?\nI dont need their locals in my memory anymore</p>\n<p>The only thing that worked is BAD EVIL globals. If i use global x = 0, then x = nil do what i want, but every pro lua user keep saying that globals are bad.</p>\n"^^ . . . . "<p>I created a script to generate a maze and it works as expected but during coding, I discovered I should create object instances differently, so I refactored this:</p>\n<pre class="lang-lua prettyprint-override"><code>local Cell = {\n index = nil,\n coordinates = Vector2.zero,\n wasVisited = false,\n\n markAsVisited = function (self) \n self.wasVisited = true\n end,\n \n new = function(self, index: number, coordinates: Vector2)\n local cell = table.clone(self)\n cell.index = index\n cell.coordinates = coordinates\n \n return cell\n end,\n}\n\nreturn Cell\n</code></pre>\n<p>to</p>\n<pre class="lang-lua prettyprint-override"><code>local Cell = {\n index = nil,\n coordinates = Vector2.zero,\n wasVisited = false\n}\n\nfunction Cell:new(index: number, coordinates: Vector2)\n local instance = setmetatable({}, self) \n self.__index = self\n\n self.index = index\n self.coordinates = coordinates\n\n return instance\nend\n\nfunction Cell:markAsVisited()\n self.wasVisited = true\nend\n\nreturn Cell\n</code></pre>\n<p>and instead of</p>\n<p><a href="https://i.sstatic.net/RWCAd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RWCAd.png" alt="enter image description here" /></a></p>\n<p>I get</p>\n<p><a href="https://i.sstatic.net/vh8WS.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vh8WS.png" alt="enter image description here" /></a></p>\n<p>can someone explain to me why?</p>\n"^^ . . . . . "<p>Thanks, quite stupid of me. It was the only one.\nThe reason for using this was for alignment.\nGoing to open a bug ticket at Adobe, On MacOSX it works, but should not.</p>\n"^^ . "<p>If you <em>remove</em> <code>myIndex</code> from the table, <code>myTbl.myIndex ()</code> will activate the <code>__index</code> metamethod, which can either be a function <code>(table, key)</code> or a table.</p>\n<p><code>myIndex ()</code> will only be called if <code>__index (table, key)</code> takes care of that, or if there is <code>__index.myIndex</code> function doing what you want.</p>\n<p>See <a href="https://www.lua.org/pil/13.4.1.html" rel="nofollow noreferrer">13.4.1 – The __index Metamethod</a> from <a href="https://www.lua.org/pil/contents.html" rel="nofollow noreferrer">Programming in Lua</a>.</p>\n<p><strong>Update</strong>, after reading comments:\nBy manipulating metatables and redefining functions you can effectively add new metamethods (e.g., by redefining the globals <code>pairs()</code> and <code>ipairs()</code> you can enable in Lua 5.1 <code>__pairs</code> and <code>__ipairs</code> metamethods, introduced in Lua 5.2).</p>\n<p>The metatable is usually set in a 'wrapper' function that receives a table and returns its extended / enriched version. Like this:</p>\n<pre class="lang-lua prettyprint-override"><code>local new_metamethod_name = '__method'\n\nlocal function set_extended_metatable (t, mt)\n local old__index = mt.__index -- remember to emulate later, if any.\n mt.__index = function (table, index)\n if type (mt [new_metamethod_name]) == 'function' and type (t [index]) == 'function' then\n -- invoke the new metamethod for methods only, not properties:\n mt [new_metamethod_name] (table, index)\n end\n return t [index] -- return data from the original table, if any.\n -- emulate mt.__index, if any:\n or type (old__index) == 'function' and old__index (table, index)\n or type (old__index) == 'table' and old__index [index]\n end\n return setmetatable ({}, mt) -- for {}, __index will be always called.\nend\n\nlocal dumb_table = {\n myIndex = function (myParam)\n return ('In myIndex(). myParam is ' .. tostring (myParam))\n end,\n someProperty = 43\n}\n\nlocal smart_table = set_extended_metatable (dumb_table, { __method = function (tbl, key)\n print ('Invoking the new metamethod')\nend })\n\nprint (smart_table.myIndex (42)) -- __method() called.\nprint (smart_table.someProperty) -- __method() not called.\n</code></pre>\n"^^ . . "Can't modify my script for multiplayer quiz? Roblox Studio"^^ . . . . "0"^^ . "`127.0.0.1:7000> FCALL logMsg 1 a\n-> Redirected to slot [15495] located at 127.0.0.1:7002\n(nil)\n`\nI loaded the function on all the 3 masters. Why did the function call redirected to the 7002 port master node if the function is also available on the 7000 port master where I am attempting to execute?"^^ . "python"^^ . "Redis Lua function call failing with CROSSSLOT error"^^ . "c"^^ . . . "1"^^ . "<p>You might want to check out <a href="https://grimore.org/secondlife/scripted_agents/corrade" rel="nofollow noreferrer"><strong>Corrade</strong></a>, it has a feature wherein it will order a scripted agent to touch a prim:</p>\n<p><a href="https://grimore.org/secondlife/scripted_agents/corrade/api/commands/touch" rel="nofollow noreferrer">https://grimore.org/secondlife/scripted_agents/corrade/api/commands/touch</a></p>\n"^^ . . "4"^^ . . . . . . "0"^^ . . "<p>I am using ZeroBrane Studio (2.01; MobDebug 0.805) on Windows 10.\nI need to insert a white square panel on top of the &quot;panel&quot;. This panel should be a square.\nThe panel should scale with the window size.</p>\n<p>I want to get this:</p>\n<p><a href="https://i.sstatic.net/7pvLo.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7pvLo.jpg" alt="enter image description here" /></a></p>\n<p>MWE:</p>\n<pre><code>package.cpath = package.cpath..&quot;;./?.dll;./?.so;../lib/?.so;../lib/vc_dll/?.dll;../lib/bcc_dll/?.dll;../lib/mingw_dll/?.dll;&quot;\nrequire(&quot;wx&quot;)\n\nframe = wx.wxFrame(wx.NULL, wx.wxID_ANY, &quot;wxLua sizer test frame&quot;, wx.wxDefaultPosition, wx.wxSize(450, 450), wx.wxDEFAULT_FRAME_STYLE)\n\npanel = wx.wxPanel(frame, wx.wxID_ANY)\n\nbutton1 = wx.wxButton(frame, wx.wxID_ANY, &quot;Button1&quot;)\nbutton2 = wx.wxButton(frame, wx.wxID_ANY, &quot;Button2&quot;)\n\ntopsizer = wx.wxBoxSizer(wx.wxVERTICAL)\nbottomsizer = wx.wxBoxSizer(wx.wxHORIZONTAL)\n\ntopsizer:Add(panel, 1, wx.wxGROW + wx.wxALL, 6)\n\ntopsizer:Add(bottomsizer, 0, wx.wxEXPAND + wx.wxALL, 0);\n\nbottomsizer:Add(button1, 1, wx.wxEXPAND + wx.wxALL, 6)\nbottomsizer:Add(button2, 1, wx.wxEXPAND + wx.wxALL, 6)\n\nfunction onButton1Click(event)\n wx.wxMessageBox(&quot;Button1 clicked!&quot;, &quot;Information&quot;, wx.wxOK + wx.wxICON_INFORMATION)\nend\n\nbutton1:Connect(wx.wxEVT_COMMAND_BUTTON_CLICKED, onButton1Click)\n\nfunction onButton2Click(event)\n wx.wxMessageBox(&quot;Button2 clicked!&quot;, &quot;Information&quot;, wx.wxOK + wx.wxICON_INFORMATION)\nend\n\nbutton2:Connect(wx.wxEVT_COMMAND_BUTTON_CLICKED, onButton2Click)\n\nframe:SetAutoLayout(true)\nframe:SetSizer(topsizer)\n\nwx.wxGetApp():SetTopWindow(frame)\nframe:Show(true)\n\nwx.wxGetApp():MainLoop()\n</code></pre>\n<p>I tried using Sizer.</p>\n"^^ . . . . "<p>Ah, here's the solution:</p>\n<pre><code>function Div(el)\n if el.classes:includes(&quot;code&quot;) then\n if el.attributes['hide_input'] == &quot;true&quot; then\n if el.content[1].t == &quot;CodeBlock&quot; then\n el.content:remove(1)\n end\n end\n end\n return el\nend\n</code></pre>\n"^^ . "4"^^ . "1"^^ . . . . "0"^^ . "1"^^ . . "0"^^ . "1"^^ . . . "You don't have to care about GC order for strings; that's not observable (except for counting garbage). The only thing you have to care about are finalizers (`__gc` metamethod), which are guaranteed to run in a particular order (reverse order of "marking"). See the [5.4 reference manual](https://www.lua.org/manual/5.4/manual.html#2.5.3)."^^ . . . "0"^^ . "<p>I'm trying to call a javascript function with a single parameter from Lua using Fengari, but the parameter value is always undefined.</p>\n<p>The following code correctly invokes the &quot;display&quot; function but the argument (64) is not correctly passed into the function, and &quot;digit&quot; is always undefined. Could anyone advise please?</p>\n<pre><code>const lua = fengari.lua;\nconst lauxlib = fengari.lauxlib;\nconst lualib = fengari.lualib;\nconst interop = fengari.interop;\n\nfunction display(digit) {\n console.log(`digit is ${digit}`);\n}\n\nlet L = lauxlib.luaL_newstate();\nlualib.luaL_openlibs(L);\ninterop.luaopen_js(L);\n\ninterop.push(L,display);\nlua.lua_setglobal(L,fengari.to_luastring(&quot;display&quot;));\n\nconst result = lauxlib.luaL_dostring(L, fengari.to_luastring('display(64)'));\n\nif (result !== lua.LUA_OK) {\n // Error occurred\n const errorMessage = lua.lua_tostring(L, -1);\n console.error(&quot;Lua error:&quot;, fengari.to_jsstring(errorMessage));\n lua.lua_pop(L, 1);\n} else {\n // Execution was successful\n console.log(&quot;Lua code executed successfully&quot;);\n}\n</code></pre>\n"^^ . "0"^^ . . "Connect via wpa_supplicant from Lua Application and .sh scripts"^^ . . "1"^^ . . . . "loop is not repeating and won't stop"^^ . . "1"^^ . . . . . . "1"^^ . "0"^^ . . "Yes, I know of the `redis.log()`. But I wanted the output messages to appear on the screen where I am calling the function through `FCALL` on the redis cli prompt."^^ . "Yes, this is the "RTFM" answer, which however, does not work for me - the 'skipped servers' are not skipped. The only thing that has helped so far is to Nuke the language server:\n\nrm -r ~/.local/share/lvim/mason/packages/haskell-language-server"^^ . "0"^^ . . . "0"^^ . . . . "0"^^ . . . . "0"^^ . . "1"^^ . . . "pandoc"^^ . "Issue with none-ls configuration error with eslint_d"^^ . . "0"^^ . . "0"^^ . "0"^^ . . . . "1"^^ . "0"^^ . "<p>My scrolloff setting wasn't working even on startup. I tried puting the <code>vim.opt.scrolloff = 8</code> line after all my remaps (it was previously already after the Lazy plugins were imported), and it seems to be working fine now.</p>\n"^^ . "<p>I have a lua script which takes multiple inputs and I now want to run this lua script from a python program.</p>\n<p>I used a subprocess to run the lua script and it works fine with one input.</p>\n<p>python code:</p>\n<pre class="lang-py prettyprint-override"><code>import subprocess as sp\n\ninput_data: int = 5\n\np = sp.Popen([&quot;lua-5.4.2\\\\lua54.exe&quot;, &quot;test.lua&quot;], stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE, text=True)\nresult: str = p.communicate(input=str(input_data))[0]\n</code></pre>\n<p>Lua file:</p>\n<pre class="lang-lua prettyprint-override"><code>local input = io.read()\nlocal output = input * 10 \nprint(output)\n</code></pre>\n<p>I now want to send multiple inputs to this lua script to do something like this:</p>\n<pre class="lang-py prettyprint-override"><code>import subprocess as sp\n\ninput_data_1: int = 5\ninput_data_2: int = 6\n\np = sp.Popen([&quot;lua-5.4.2\\\\lua54.exe&quot;, &quot;test.lua&quot;], stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE, text=True)\nresult: str = p.communicate(input=[str(input_data_1), str(input_data_2)[0]\n</code></pre>\n<pre class="lang-lua prettyprint-override"><code>local input_1 = io.read()\nlocal input_2 = io.read()\n\nlocal output = input_1 * input_2\nprint(output)\n</code></pre>\n<p>The problem is that the <code>input</code> of <code>p.communicate()</code> only takes strings.</p>\n<p>i tried combining the inputs into a string and then separating them in the lua script but while it works, it's not really an elegant solution.</p>\n<pre class="lang-py prettyprint-override"><code>data = [5, 6]\ndata_str = (str(data).replace(&quot;'&quot;, &quot;&quot;)\n .replace(&quot;,&quot;, &quot;&quot;)\n .replace(&quot;[&quot;, &quot;&quot;)\n .replace(&quot;]&quot;, &quot;&quot;))\n\np = sp.Popen([&quot;lua-5.4.2\\\\lua54.exe&quot;, &quot;test.lua&quot;], stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE, text=True)\nresult = p.communicate(input=data_str)[0]\n</code></pre>\n<p>How can I do this better?</p>\n"^^ . "By default every TCP socket has a socket send buffer."^^ . . "Both are in screenguis, different ones because the sender bis in an admin only gui and the receiver is in a announcement gui"^^ . "0"^^ . . "0"^^ . . "<p>Is there any way I can see the source of a function stored in the Redis server? The function has been written in the Lua language.</p>\n"^^ . "<p>To use <code>unpack</code> with sparse arrays, you need to pass two more parameters to it:</p>\n<pre class="lang-lua prettyprint-override"><code>local one, two, three = unpack ({ [3] = 'Three' }, 1, 3 })\n</code></pre>\n<p>The second parametre is the first element to uppack, <code>1</code> by default; the third is the last item to unpack, <code>#{ [3] = 'Three' }</code> by default, which is zero for tables with absent first (<code>…[1]</code>) item, so you have to know it.</p>\n<p>See <a href="https://www.lua.org/manual/5.1/manual.html#pdf-unpack" rel="nofollow noreferrer">Lua 5.1 Reference Manual</a></p>\n<blockquote>\n<p><code>unpack (list [, i [, j]])</code></p>\n<p>Returns the elements from the given table. This function is equivalent to\n<code>return list[i], list[i+1], ···, list[j]</code>\nexcept that the above code can be written only for a fixed number of elements. By default, <code>i</code> is <code>1</code> and <code>j</code> is the length of the list, as defined by the length operator (see §2.5.5).</p>\n</blockquote>\n"^^ . . . . "0"^^ . . . . . . "@Alexandra, I am new to this Lua and Sql thing. So how would supplying an id look like in code. because I tried local stmt = db:prepare [[INSERT INTO tips_table (NULL, time, date, counter) VALUES (?, ?, ?);]] and that still did not work"^^ . . "0"^^ . . . . "javascript"^^ . "1"^^ . . . . . "1"^^ . "0"^^ . . "0"^^ . "To clarify, bitshifting gives a wrong result as soon as the number is converted to double"^^ . . . . "0"^^ . . . . . . . "0"^^ . . "1"^^ . . . . . "2"^^ . . . "Thanks for your suggestion, using wpa_cli shuold be a better solution.\nUsing only ping does not let me know whether the connection to the AP was successful or not, it only tells me whether the machine is connected to the Internet or not. If I use wpa_cli on the other hand, I am able to tell if the connection was successful; to check for internet connection instead I will continue to use ping, but only after checking that the connection to the router is ok.\nRegarding lua instead, how can I check the socket connection from lua code?"^^ . "1"^^ . . . . . "3"^^ . . "0"^^ . "okay, got it. @for_stack has suggested to use args."^^ . . . . "Get Lua function definition stored in Redis"^^ . . "0"^^ . . . . . . "0"^^ . "2"^^ . . . . . "<p>I'm doing some maintenance in my NeoVim config, almost entirely written in Lua.<br />\nFor convenience, I created a mini-lib of useful tools to ease this configuration.<br />\nI have several friends who keep a close eye on my NeoVim config, or even using it, and for that reason I like my toolings to be well documented to ease their experience with it.<br />\nComing mainly from a TypeScript background, you can imagine that I like to go deep with it. </p>\n<p>In this example, I have a module that reduces the hassle of setting up mappings, also making it more readable.</p>\n<pre class="lang-lua prettyprint-override"><code>--- Set a keymap using Vim's API\n---@param desc string The descritpion that will be shown for your mapping when calling :map\n---@param mode MapModeStr The mode that your keymap will work in\n---@param lhs string A NeoVim keymap string\n---@param rhs MapRHS The action yout keymap will trigger\n---@param opts? MapOptions A table of options\nlocal set = function(desc, mode, lhs, rhs, opts)\n opts = opts or {}\n local finalopts = vim.tbl_deep_extend(&quot;keep&quot;, { desc = desc }, opts)\n vim.keymap.set(mode, lhs, rhs, finalopts)\nend\n\nreturn {\n set = set,\n\n --- Set a keymap for Insert mode\n ---@param desc string The descritpion that will be shown for your mapping when calling :map\n ---@param lhs string A NeoVim keymap string\n ---@param rhs MapRHS The action yout keymap will trigger\n ---@param opts? MapOptions A table of options\n i = function(desc, lhs, rhs, opts) set(desc, &quot;i&quot;, lhs, rhs, opts) end,\n\n --- Set a keymap for Normal mode\n ---@param desc string The descritpion that will be shown for your mapping when calling :map\n ---@param lhs string A NeoVim keymap string\n ---@param rhs MapRHS The action yout keymap will trigger\n ---@param opts? MapOptions A table of options\n n = function(desc, lhs, rhs, opts) set(desc, &quot;n&quot;, lhs, rhs, opts) end,\n\n ---@param desc string The descritpion that will be shown for your mapping when calling :map\n ---@param lhs string A NeoVim keymap string\n ---@param rhs MapRHS The action yout keymap will trigger\n ---@param opts? MapOptions A table of options\n o = function(desc, lhs, rhs, opts) end,\n\n --- Set a keymap for Visual and Select mode\n ---@param desc string The descritpion that will be shown for your mapping when calling :map\n ---@param lhs string A NeoVim keymap string\n ---@param rhs MapRHS The action yout keymap will trigger\n ---@param opts? MapOptions A table of options\n x = function(desc, lhs, rhs, opts) set(desc, &quot;x&quot;, lhs, rhs, opts) end,\n\n --- Set a keymap for Visual mode\n ---@param desc string The descritpion that will be shown for your mapping when calling :map\n ---@param lhs string A NeoVim keymap string\n ---@param rhs MapRHS The action yout keymap will trigger\n ---@param opts? MapOptions A table of options\n v = function(desc, lhs, rhs, opts) set(desc, &quot;v&quot;, lhs, rhs, opts) end,\n}\n</code></pre>\n<p>To reduce copypasta, I would like to &quot;typedef&quot; the mapper functions that are exposed to my users in a meta file with the other types I've defined for this module. I know this is something I can do:</p>\n<pre class="lang-lua prettyprint-override"><code>---@meta\n\n...\n\n---@alias MapperFunction fun(desc: string, lhs: string, rhs: MapRHS, opts: MapOptions?)\n</code></pre>\n<p>And then I could simply <code>---@type MapperFunction</code> on them, but the issue then is that I lose the descriptions of what each parameter does, and I would like to avoid that.</p>\n<p>The best I could come up with was some spicy little curry (functional programming rocks!). It works, but I wanted to know if there was a way to do it with only typings.<br />\n<a href="https://i.sstatic.net/yAh8W.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/yAh8W.png" alt="capture of factory function that returns the correct setter for a given mode, with parameters typed and correctly described" /></a><br />\nAn annoying side effect is that I lose some of the completion annotations.<br />\n<a href="https://i.sstatic.net/ogpzC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ogpzC.png" alt="module method i doesn't have its signature shown in the completion suggestions anymore" /></a></p>\n<p><a href="https://i.sstatic.net/77uOz.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/77uOz.png" alt="non-curry-generated methods still have their &quot;Set a keymap for MODE&quot;" /></a></p>\n<p><a href="https://i.sstatic.net/etfFM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/etfFM.png" alt="enter image description here" /></a></p>\n<p>So, is there a way I could simply slap a type on top of my functions and retain all IntelliSense, or am I doomed to use one of those two techniques ?</p>\n<p>Thanks!</p>\n"^^ . . . "0"^^ . . . "1"^^ . . "I might suggest that you first attempt to only complete the hex-decode step - otherwise you'll keep on running into identifiers you haven't seen before."^^ . . "Why is the x value in my lua table changing after being created by a for loop?"^^ . . "0"^^ . . "0"^^ . . . . . "0"^^ . . "10"^^ . . "0"^^ . ""If i use global x = 0, then x = nil do what i want, but every pro lua user keep saying that globals are bad" - nitpick: setting fields to nil does *not* reclaim any memory, or even enable the GC to collect any memory, because Lua allows deleting fields while traversing tables. Only *adding* new fields lets Lua rehash."^^ . . "abstract-syntax-tree"^^ . . . . "0"^^ . . . . . "0"^^ . "love2d"^^ . . . "<p>The thing I'm trying to do here is that when the player touches this randomly spawning ball it adds to his leaderstats score.</p>\n<pre class="lang-lua prettyprint-override"><code>local spawned = 0\n\nwhile true do\n if spawned &gt;= 5 then\n break\n end\n local Randombumber1 = math.random(1, 30)\n local Randombumber2 = math.random(1, 30)\n spawned = spawned + 1\n wait(3)\n \n local PointBall = Instance.new(&quot;Part&quot;, workspace)\n\n PointBall.Size = Vector3.new(1,1,1)\n PointBall.BrickColor = BrickColor.new(&quot;White&quot;)\n PointBall.Material = &quot;Neon&quot;\n PointBall.Shape = Enum.PartType.Ball -- Makes it a sphere\n PointBall.Anchored = true -- Anchors the part so it doesn't move\n PointBall.CanCollide = false -- Makes it so that players can walk through the ball\n PointBall.Position = Vector3.new(Randombumber1,3,Randombumber2)\n \n \n PointBall.Touched:Connect(function(player)\n local PlayerPoints = player.Parent.leaderstats.Dookie\n PlayerPoints.Value = PlayerPoints.Value + 1\n PointBall:Destroy()\n end)\nend\n</code></pre>\n<p>The error message is leaderstats is not a valid member of Model &quot;Workspace.ASWXDYC2&quot;<br />\nI want it to go to the player in the Players thing, any idea on how to fix this?</p>\n"^^ . "0"^^ . . "Neovim configuration setup with none_ls"^^ . . . "Problem passing parameter to javascript function called from Lua using Fengari-Web"^^ . . . . . . . . . . "@ESkri i've added one more important edit"^^ . "Heyo, how are you getting the variables for hours, minutes, and seconds? Is there anything more to your code sample?"^^ . . . . . "10084375459231865 would indeed be rounded when converted to a double, but I think the printed result is misleading (simply dropping some decimals, which is not how doubles work) since it would be rounded to 10084375459231864"^^ . "0"^^ . . "wxwidgets"^^ . . . "Why my Roblox script doesn't work correctly"^^ . . "1"^^ . . "0"^^ . . . . "0"^^ . "1"^^ . . "1"^^ . . . . . "0"^^ . "1"^^ . . "0"^^ . . "1"^^ . "0"^^ . "2"^^ . . . . . . "0"^^ . . . "0"^^ . . "0"^^ . . "0"^^ . . "0"^^ . "0"^^ . "0"^^ . "0"^^ . . . . . . . . . . . . . "2"^^ . "0"^^ . . "<p>I have some code in Lua:</p>\n<pre><code>math.randomseed(os.time())\namount = 0 --math.random(0, 54000)\nbgItem = mediaPool:AppendToTimeline({ {\n mediaPoolItem = clip[1],\n trackIndex = 1,\n recordFrame = 216000,\n startFrame = amount,\n endFrame = amount+total,\n mediaType = 1\n} })[1]\n</code></pre>\n<p>Having <code>amount</code> as <code>0</code> works perfectly fine, but when I set it to <code>math.random(0, 54000)</code> it gives an error: <code>attempt to perform arithmetic on field 'amount' (a nil value)</code>. I am extremely confused as to why it works differently when it's set normally and when it's set by the output of a function.</p>\n"^^ . "<p><code>PointBall.Touched:Connect(function(player)</code> This function will simply respond with the part that touched the <code>PointBall</code>. This part is of course in the <code>Workspace</code> hence why it isn't working. We have to get the player from the Players folder.</p>\n<p>To fix this we have the <code>GetPlayerFromCharacter()</code> function, then we can apply the leaderstats change.</p>\n<pre><code>local Players = game:GetService(&quot;Players&quot;)\n\nPointBall.Touched:Connect(function(hitPart)\n local player = Players:GetPlayerFromCharacter(hitPart.Parent)\n local PlayerPoints = player.leaderstats.Dookie\n PlayerPoints.Value = PlayerPoints.Value + 1\n PointBall:Destroy()\nend)\n</code></pre>\n"^^ . . . . "I still do not understand the problem after viewing the video. I do not see a crosshair on the video. What exactly should move on X axis?"^^ . . . . . "hey @Ctx I tested another method, which gives me the actual values. I would appreciate it if you could give an explanation for this."^^ . . "0"^^ . . . . . . . . . "How to set configurations for my neovim in my lazyvim folder?"^^ . . "0"^^ . . . "OK but to put it another way, just because some numbers larger than 32 bits temporarily existed, does not mean that the "extra" bits participate in the algorithm in a meaningful way. It looks to me like they are always thrown away soon after their creation, though I may have missed some case here or there."^^ . "@Dai I try to proceed to the next line, but I don't know what it means. :("^^ . "0"^^ . . . . . . . . . . . . "0"^^ . . . . . . . "0"^^ . . "<p>I’m porting my lightroom plugin to Windows. On MacOSX everything works perfect.</p>\n<p>Now i’m stuck with one command, Normally I try to use as mutch of LR commands because they are compatible with both OS’s.</p>\n<pre><code>cmdRunExifTool = string.format('cd &quot;'..NewTargetDir..'&quot; &amp;&amp; '.._PLUGIN.path..'\\\\bin\\\\win\\\\exiftool.exe '..(optionOverwrite or &quot;&quot;)..' optionAppend=&quot;.\\\\C+F-'..NewJson..'&quot; .') \nLrTasks.execute(cmdRunExifTool)\n</code></pre>\n<p>I have added a pop-up window with the command and it show me this:</p>\n<pre><code>cd &quot;c:\\Users\\patri\\Pictures\\TEST-IMAGES\\FF690-KTMX-000869\\_scans\\positives\\C+F_exiftool&quot; &amp;&amp; c:\\Users\\patri\\Documents\\AnalogeFotografie.lrplugin\\bin\\win\\exiftool.exe optionAppend=&quot;.\\C+F-mybeelden&quot; .\n</code></pre>\n<p>But nothing happens.\nIf I run this on the command line it works !</p>\n"^^ . . . "<p>I have a Redis 7.x cluster with 3 master nodes running on ports 7000, 7001, 7002. Each master has 1 slave/replica.</p>\n<p>I am trying to load and run this Lua based function:</p>\n<pre><code>#!lua name=printTestLib\nlocal function printTest(keys, args)\n local time = redis.call('TIME');\n print(&quot;current timestamp in millis: &quot; .. time)\nend\nredis.register_function('printTest', printTest)\n</code></pre>\n<p>When I run it as</p>\n<p><code>127.0.0.1:7000&gt; fcall printTest 0</code></p>\n<p>I see the error:</p>\n<p><code>(error) ERR user_function:4: Script attempted to access nonexistent global variable 'print' script: printTest, on @user_function:4.</code></p>\n<p>What is the issue with the call to <code>print</code> statement?</p>\n"^^ . . . . "neovim-plugin"^^ . . . . . "0"^^ . . . "Lua execute windows command in Lightroom SDK"^^ . . "@jsx97 Please include this kind of information, i.e., input and expected output, in the question next time, this will allow us to write better answers."^^ . . "1"^^ . . "1"^^ . "0"^^ . "<blockquote>\n<p>I have also thought about using a bell curve and cut it into symmetrical chunks</p>\n</blockquote>\n<p>Yes, the idea is correct.<br />\nJust round the floating point value on the bell curve to the nearest integer rarity.<br />\nThe random generator formula is from <a href="https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform" rel="nofollow noreferrer">here</a></p>\n<pre><code>local function random_norm()\n return (-2 * math.log(math.random()))^.5 * math.cos(2 * math.pi * math.random())\nend\n\n-- luck = 0.001 makes &quot;r1&quot; the most probable, luck = 0.01 makes &quot;r2&quot;, etc.\nlocal luck = 8.4\n\n-- the more bell_shape_width_factor the bigger the probability to get other rarities\nlocal bell_shape_width_factor = 0.4 -- number from 0 to inf\n\nlocal central_rarity = 4 + math.log(luck)/math.log(10)\nprint(&quot;central_rarity = &quot;..central_rarity)\n\nfor j = 1, 20 do\n local rarity\n repeat\n rarity = math.max(1, math.floor(central_rarity + random_norm() * bell_shape_width_factor + 0.5))\n until 1/rarity ~= 0 -- skip inf values\n print(&quot;r&quot;..rarity)\nend\n</code></pre>\n<p>Output:</p>\n<pre><code>central_rarity = 4.9242792860619\nr6\nr5\nr5\nr5\nr4\nr5\nr5\nr5\nr5\nr6\nr5\nr5\nr5\nr5\nr5\nr5\nr5\nr5\nr4\nr5\n</code></pre>\n"^^ . . . "0"^^ . . . "Indeed, `local amount = math.random(0, 54000)` might fix the problem"^^ . "1"^^ . "0"^^ . . . "0"^^ . . . "@harold am I right ?"^^ . "<p>i need some help with unified remote (lua) scriptfile for a keyboard / mouse action.\nneed this events:\n&quot;F5&quot; toggles (enable / disable) an elevator\ndown right mouse button while key.down &quot;e&quot; start the elevator.</p>\n<p>action on a button:</p>\n<ol>\n<li>press: lift goes up &gt;&gt;OK!works!</li>\n<li>press: lift stops &gt;&gt;OK!Works!</li>\n<li>press: lift jumps back too ground. &gt;&gt;OK!Works!</li>\n</ol>\n<p>but:\nit seems, there is an open Mouse.up event, so i had to do a 4. press only for final mouse.up...</p>\n<p>my code:</p>\n<pre><code>--@help Command 7\nactions.command7 = function ()\n \n use = not use;\nif (use) then\n kb.down(&quot;f5&quot;);\n ms.down(UseButton);\n kb.down(&quot;e&quot;);\n\nelse\n kb.stroke(&quot;f5&quot;);\n ms.up(UseButton);\n \n end \n \nend \n\n</code></pre>\n<p>any help would be fine. would like to have a code only in three steps with an ended mouse up\n...LUA is not mine...</p>\n"^^ . "0"^^ . . . . . "Request for explanation about objects/classes"^^ . "1"^^ . . "2"^^ . "1"^^ . . . "var"^^ . . . "1"^^ . . . . "0"^^ . "0"^^ . "0"^^ . . "<p>The system can't find the path\n&quot;/storage/emulated/0/iGO_Pal/save/wiki_data.lua&quot;\ncheck the path\nor give storage permission to &quot;curl&quot;.</p>\n<p>PS: &quot;%D0%91%D0%B0%D1%80%D0%B0% D1%85%D1%82%D0%B8&quot; - has an unnecessary space</p>\n"^^ . . "1"^^ . . "Sorry, I am not now sure now that it because of `id`. Seems that sqlite automatically makes a field of the type `INTEGER PRIMARY KEY` (`id` in your table) an alias for always existing `ROWID`, which is `AUTOINCREMENT` and therefore needs no explicit assignment, although its uniqueness is not guaranteed. However, `NULL` is column's name, not value; and there should be as many columns as values; so, try this: `INSERT INTO tips_table (id, time, date, counter) VALUES (NULL, ?, ?, ?);`."^^ . . . . . . . . . . . "I think it does yea, let me monitor what numbers are passed to bitwise functions and will report it here"^^ . . . . "0"^^ . . . . . "<pre class="lang-lua prettyprint-override"><code>function Cell:new(index: number, coordinates: Vector2)\n local instance = setmetatable({}, self) \n self.__index = self\n\n self.index = index\n self.coordinates = coordinates\n\n return instance\nend\n</code></pre>\n<p>You create a new instance, but then continue using <code>self</code>, which is Cell, the class. Use instance to set instance fields.</p>\n"^^ . "1"^^ . . "0"^^ . "Using metatables in Lua or functions for OOP"^^ . . . "The sorted set you need to access is your key."^^ . "1"^^ . . "0"^^ . "@koyaanisqatsi - even `math.random(-4, -2)` works correctly for me."^^ . "0"^^ . . . . "0"^^ . "1"^^ . "1"^^ . "redis-cluster"^^ . "1"^^ . "0"^^ . . . "Why `coroutine.resume(cor)` is here? BTW, coroutines are excluded from GHub implementtion."^^ . "4"^^ . . . "0"^^ . "sqlite"^^ . . "0"^^ . . . "0"^^ . . . "<p>I'm (mostly successfully) converting Jupyter to LaTex.</p>\n<p>I can allow/prevent Jupyter code blocks from appearing in the LaTex by using this Lua filter:</p>\n<pre><code>function Div(el)\n if el.classes:includes(&quot;code&quot;) then\n if el.content[1].t == &quot;CodeBlock&quot; then\n el.content:remove(1)\n end\n end\n return el\nend\n</code></pre>\n<p>Now looking for a Lua filter or other solution to prevent only those Jupyter code blocks that are set to not display. Can you help me?\nAlternatively, how about a filter to prevent only Jupyter code blocks that contain specific text?</p>\n<p>Many thanks.</p>\n"^^ . "1"^^ . "1"^^ . . . . "<p>Consider the following code:</p>\n<pre><code>function fun()\n local o1 = foo:new() -- object with __gc metamethod\n local o2 = bar:new() -- object with __gc metamethod\nend\n</code></pre>\n<p>Will Lua call the <code>o2</code> finalizer before <code>o1</code>'s because <code>o2</code> was created later than <code>o1</code> or is the order finalizers are called undefined?</p>\n"^^ . "0"^^ . "1"^^ . "1"^^ . . "0"^^ . . . . "Neovim scrolloff and virtualedit options randomly changing"^^ . "0"^^ . "<p>There are two small problems that prevent this filter from working. I'm listing them below and include explanations and solutions for each.</p>\n<ol>\n<li><p>The main issue is <code>return {{Inline = RawInline}}</code>. This causes the <code>RawInline</code> function to be called for <em>all</em> Inline elements, such as <em>Str</em>, <em>Emph</em>, <em>Space</em>, etc. This is causing issues, because some elements don't have a <code>.text</code> attribute, and calling <code>starts_with</code> with <code>nil</code> as the second argument triggers an error.</p>\n<p>The solution for this is to either use <code>return {{RawInline = RawInline}}</code>, or to leave the line out entirely. Both solutions are equivalent due to the way pandoc constructs filters from global functions if no explicit filter table is returned.</p>\n</li>\n<li><p>The <code>RawInline</code> function does nothing, because <code>return el</code> and <code>return nil</code> do the same thing in this case. Not returning anything from a filter function causes pandoc to keep the object unaltered. Deleting an object is possible by returning <code>{}</code>.</p>\n</li>\n</ol>\n<p>To summarize, this should work:</p>\n<pre class="lang-lua prettyprint-override"><code>local function starts_with(start, str)\n return str:sub(1, #start) == start\nend\n\nfunction RawInline(el)\n if not starts_with('&lt;!--', el.text) then\n return {}\n end\nend\n</code></pre>\n<hr />\n<p>To make ensure that no HTML at all is included in the output, we can use <code>gfm-raw_html</code> as the output format, i.e., we disable the <code>raw_html</code> extension. This will also suppress any HTML comment, so we modify the filter to pretend that these comments are raw Markdown, which will be included verbatim.</p>\n<pre class="lang-lua prettyprint-override"><code>local function starts_with(start, str)\n return str:sub(1, #start) == start\nend\n\nfunction RawInline (el)\n return starts_with('&lt;!--', el.text)\n and pandoc.RawInline('markdown', el.text) -- pretend it's md\n or {} -- not an HTML comment, thus drop it\nend\n</code></pre>\n"^^ . . "0"^^ . . . . . "formatting"^^ . . "<p>The issue is that currentValue is set to nil in the call to tonumber(keyGet).</p>\n<p>From the lua manual for tonumber:</p>\n<blockquote>\n<p>Tries to convert its argument to a number. If the argument is already a number or a string convertible to a number, then tonumber returns this number; otherwise, it returns nil.</p>\n</blockquote>\n<p>So, even though keyGet is not nil, whatever it is, it is still not convertible into a number.</p>\n<p>Add a line to log the value of keyGet after local keyGet = redis.call(...)</p>\n<p>redis.log(redis.LOG_NOTICE, keyGet)</p>\n<p>Hopefully, that will tell you why the value of keyGet isn't working with tonumber.</p>\n"^^ . . . "0"^^ . . . . . . "1"^^ . "0"^^ . . . "linden-scripting-language"^^ . . . . "0"^^ . . . . . . . . "Are these parameters keys or not? If so, they all have to reside on the same server. If not, you should pass `0` instead of `3`, since that argument indicates the number of keys."^^ . "I'm sure I said Lua... and reproducible example?! I've posted the original code (in commented form) and the lua code I made from that formula to do the calculation.\n\nI haven't repeated the standard vector maths formulas because those are just that - standard!"^^ . "All functions exported from JS to Lua follow colon syntax in Lua expressions (that is, they always have "self" argument). So, try `display(nil,64)`."^^ . "@harold so, I have no way to fix it ?"^^ . "Are finalizers called in the reverse order of making?"^^ . . . . . "oop"^^ . "2"^^ . . "1"^^ . . "<p>In the Android app &quot;Lua Interpreter&quot; I want to extract wiki text on demand.\nI'm going to use the additional system command &quot;curl&quot;.</p>\n<pre class="lang-bash prettyprint-override"><code>curl -s &quot;https://uk.wikipedia.org/w/api.php?action=query&amp;format=json&amp;prop=extracts&amp;exintro&amp;explaintext&amp;titles=%D0%91%D0%B0%D1%80%D0%B0%D1%85%D1%82%D0%B8&quot; &gt; &quot;/storage/emulated/0/iGO_Pal/save/wiki_data.lua&quot;\n</code></pre>\n<p>It works in TerMux&quot; for Android successfully. <strong>Only one thing: the target file must exist!!</strong>\nRequest\n<a href="https://uk.wikipedia.org/w/api.php?action=query&amp;format=json&amp;prop=extracts&amp;exintro&amp;explaintext&amp;titles=%D0%91%D0%B0%D1%80%D0%B0%D1%85%D1%82%D0%B8" rel="nofollow noreferrer">https://uk.wikipedia.org/w/api.php?action=query&amp;format=json&amp;prop=extracts&amp;exintro&amp;explaintext&amp;titles=%D0%91%D0%B0%D1%80%D0%B0%D1%85%D1%82%D0%B8</a>\nsuccessful in the browser.</p>\n<p>If I try to use this request</p>\n<pre class="lang-lua prettyprint-override"><code>os.execute('curl -s &quot;https://uk.wikipedia.org/w/api.php?action=query&amp;format=json&amp;prop=extracts&amp;exintro&amp;explaintext&amp;titles=%D0%91%D0%B0%D1%80%D0%B0%D1%85%D1%82%D0%B8&quot; &gt; &quot;/storage/emulated/0/iGO_Pal/save/wiki_data.lua&quot;')\n</code></pre>\n<p>in the Lua interpreter - nothing happens.\nThe file is just empty.\nAll necessary permissions are in the Lua interpreter!\nWhat could be the problem?</p>\n"^^ . . . "2"^^ . "0"^^ . "<p>The best approach is to not restart <code>wpa_supplicant</code> all the time, but instead use <a href="https://linux.die.net/man/8/wpa_cli" rel="nofollow noreferrer"><code>wpa_cli</code></a> to dynamically reconfigure it.</p>\n<p><code>wpa_cli</code> connects to a socket that <code>wpa_supplicant</code> listens on - instead of using <code>wpa_cli</code>, you can also connect to this socket directly from your Lua code. That gives you a bit more flexibility.</p>\n<p>To be able to use either <code>wpa_cli</code> or the sockets, you need to enable this during the build. Use the Buildroot option <code>BR2_PACKAGE_WPA_SUPPLICANT_CLI</code> for this (it automatically enables <code>BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE</code> which is what you need to listen on the socket).</p>\n"^^ . . "1"^^ . . "typing"^^ . "0"^^ . "0"^^ . "0"^^ . . . . . . "So those are upvalues!\n♂Ahhh♂, thank you so much, Mister!"^^ . . . "Exactly, where do you account for the closing of comments? what if there is a `<!--` within a comment? This is just a guess. I have not used pandoc, but it seems somehow anti-symmetric."^^ . . . "eslint"^^ . . "redis"^^ . . . . . "1"^^ . "For MacOS you do not need quotes of any kind around the whole command: build the command as string as if you would enter it in a terminal. Another hint: using '/' in paths works also for Windows, nicer than '\\\\'."^^ . . . . "0"^^ . "vector"^^ . "@Eskri Edited again the thread with results on my restricted env, if it gives you a better idea of the problem. Let me try your proposal ESKri but I'm really uncomfortable with this algorithm"^^ . . "0"^^ . . "<p>Even in Lua, it is necessary to check that the returned object is not nil, before calling its methods.</p>\n<p>Your <code>db:prepare</code> returned nil. Is suppose it's because you had not supplied <code>id</code>, which is a primary key not accepting null.</p>\n"^^ . . . "0"^^ . "1"^^ . . . . . . . . . "Lua function in Redis - error attempt to compare nil with number"^^ . . . "Pandoc Lua Filter: Is there an 'identity function' example?"^^ . . . . "0"^^ . "0"^^ . "<p>With Lazyvim buffers/tabs are displayed via <a href="https://github.com/akinsho/bufferline.nvim" rel="nofollow noreferrer">bufferline.nvim</a> plugin, see <a href="https://www.lazyvim.org/plugins/ui" rel="nofollow noreferrer">https://www.lazyvim.org/plugins/ui</a></p>\n<p>If you don't want to use it, you can disable it in <code>lua/plugins/disabled.lua</code> file (see <a href="https://www.lazyvim.org/configuration/plugins" rel="nofollow noreferrer">https://www.lazyvim.org/configuration/plugins</a>). Specifically, you should add:</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n {\n &quot;akinsho/bufferline.nvim&quot;,\n enabled = false,\n },\n}\n</code></pre>\n"^^ . . . . "types"^^ . "You literally print `pan7A` eight times: `print(pawn7A.x)`. Also, I suggest that you use a two-domentional array: `pieces[7].A = newPiece(0, i, 2)` and further, that you do not store piece's coordinates fior the second time within it."^^ . "0"^^ . . . . . . . "0"^^ . "<p>Is there is an equivalent of the <a href="https://en.wikipedia.org/wiki/Identity_transform" rel="nofollow noreferrer">identity transform</a> for <a href="https://pandoc.org/lua-filters.html" rel="nofollow noreferrer">Lua Filters for Pandoc</a> available anywhere?</p>\n<p>This would be a useful starting point for experimentation, assuming such an identity transform explicitly defined all possible function 'slots'.</p>\n<p>For context: my use-case here is to extract specific parts of Markdown documents - mostly codeblocks - and I want to ignore everything else.</p>\n"^^ . . "0"^^ . . . . "0"^^ . "2"^^ . . . "latex"^^ . "Hmm, and `towerToSpawn` is definitely within scope and executed before the other two lines of code?"^^ . . "deobfuscation"^^ . "<p>If I have a variable of string type, I can use the <code>:</code> syntax to call functions on the string metatable:</p>\n<pre class="lang-lua prettyprint-override"><code>local s = &quot;%d&quot;\nprint(s:format(s:byte(1))) -- 37\n</code></pre>\n<p>But this doesn't work for string literals:</p>\n<pre class="lang-lua prettyprint-override"><code>print(&quot;%d&quot;:format(&quot;%d&quot;:byte(1)))\n-- ')' expected near ':'\n</code></pre>\n<p>Why? Is there a trick to make this work?</p>\n"^^ . . "<p>It looks like &quot;haskell-language-server&quot;'s server name is <code>hls</code> (<a href="https://github.com/williamboman/mason-lspconfig.nvim/blob/8db12610bcb7ce67013cfdfaba4dd47a23c6e851/README.md?plain=1#L257" rel="nofollow noreferrer">source</a>).</p>\n<p>Therefore, you should be able to include this in your config:</p>\n<pre class="lang-lua prettyprint-override"><code>lvim.lsp.automatic_configuration.skipped_servers = {&quot;hls&quot;}\n</code></pre>\n<p>and afterward run <code>:LvimCacheReset</code> to be safe. This works for me locally.</p>\n<p>In addition, LunarVim has a list of <a href="https://github.com/LunarVim/LunarVim/blob/85ccca97acfea9a465e354e18bb2f6109ba417f8/lua/lvim/lsp/config.lua#L1" rel="nofollow noreferrer">default skipped servers</a> that you may not want to override:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, {&quot;hls&quot;})\n</code></pre>\n<p>as is recommended in the <a href="https://www.lunarvim.org/docs/configuration/language-features/language-servers#by-overriding-the-setup" rel="nofollow noreferrer">LunarVim documentation</a>.</p>\n"^^ . . "<p>I have the following lua function that creates, connects, and sends information on a udp socket.</p>\n<pre class="lang-lua prettyprint-override"><code>local udp = ngx.socket.udp\nlocal function write_to_socket(conf, bytes)\n local sock = udp()\n sock:settimeout(conf.timeout)\n sock:setpeername(conf.socket_host, conf.socket_port)\n sock:send(bytes)\n sock:close()\nend\n</code></pre>\n<p>(I've omitted error handling)</p>\n<p>I would like to increase the writing buffer size with an option similar to <code>so_sndbuf</code>, but as far as I can tell both <a href="https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#ngxsocketudp" rel="nofollow noreferrer">ngx socket</a> and <a href="https://w3.impa.br/%7Ediego/software/luasocket/udp" rel="nofollow noreferrer">lua socket</a> don't offer this ability. Is there a way to change writing buffer size in lua?</p>\n<p>I did look into writing C functions to do the socket logic but this is a small part of an application written in lua so I can't change my entry point to run C with <code>lua_register</code>.</p>\n"^^ . . . "1"^^ . . . "great explanation, appreciate :)"^^ . "0"^^ . "1"^^ . . . . . "<p>I am not sure, if the below suggestion would be useful to you in your particular environment, but it may be interesting to Lua programmers in general.</p>\n<p>It is a 'decorator' that allows to create Lua functions with typed arguments and returns. Function specification is a string, e.g.:</p>\n<pre class="lang-lua prettyprint-override"><code>[[\nSquares its argument.\n@param number x Number to square\n@return number The squared number\n]]\n\n</code></pre>\n<p>Nullable types (starting with <code>?</code>) are allowed; so are multiple types, e.g. <code>number|string</code>.</p>\n<pre class="lang-lua prettyprint-override"><code>local unpack = unpack or table.unpack\n\nlocal tags = {\n author = 'An author of the module or file',\n copyright = 'The copyright notice of the module or file. LuaDoc adds a © sign between the label (Copyright) and the given text (e.g. 2004-2007 Kepler Project)',\n field = 'Describe a table field definition',\n param = 'Describe function parameters. It requires the name of the parameter and its description',\n release = 'Free format string to describe the module or file release',\n ['return'] = 'Describe a returning value of the function. Since Lua can return multiple values, this tag should appear more than once',\n see = 'Refers to other descriptions of functions or tables',\n usage = 'Describe the usage of the function or variable',\n class = 'If LuaDoc cannot infer the type of documentation (function, table or module definition), the programmer can specify it explicitly',\n description = 'The description of the function or table. This is usually infered automatically',\n name = 'The name of the function or table definition. This is usually infered from the code analysis, and the programmer does not need to define it. If LuaDoc can infer the name of the function automatically it\\'s even not recomended to define the name explicitly, to avoid redundancy',\n type = 'Set &quot;type&quot; of a table.',\n precondition = 'A function that should return true for passed parameters',\n postcondition = 'A function that should return true for returned parameters'\n}\n\nlocal tag_fields = { param = 2 }\n\n-- Makes an array of possible types out of string '[?]type1|[?]type2|...|[?]typen'.\nlocal function type_spec (spec)\n local variants = {}\n for type in spec:gmatch '[^|]+' do\n if type:sub (1, 1) == '?' then\n variants ['nil'] = true\n type = type:sub (2)\n end\n variants [type] = true\n end\n return variants\nend\n\nlocal function get_tag (line)\n local tag, def = line:match '^%s*-*%s*@(%S+)(.*)$'\n if def and tags [tag] then\n local pattern = '^' .. ('%s+(%S+)'):rep (tag_fields[tag] or 1) .. '(.*)$'\n local args = { def:match (pattern) }\n if #args &gt; 0 then\n return tag, args\n end\n end\n return 'comment', line\nend\n\n-- Returns an or-separated list of types, with nullable types prefixed by '?'.\nlocal function serialise_types (type_set)\n local types = {}\n for type, _ in pairs (type_set) do\n types [#types + 1] = type\n end\n return table.concat (types, ' or ')\nend\n\n-- Convert @param / @return tag to precondition / postcondition:\nlocal function tag2condition (tag, spec, no)\n local expected, name, desc = type_spec (spec [1]), #spec &gt; 1 and spec [2] or nil, spec [#spec]\n local serialised = serialise_types (expected)\n local message\n = 'Type mismatch. ' .. (tag == 'return' and 'Returned value' or 'Parameter') .. ' '\n .. tostring (no) .. (name and ' (' .. name .. ': ' .. (desc or '(no description)') .. ')' or '')\n .. ': ' .. serialised .. ' is expected, '\n .. 'but %s %s is ' .. (tag == 'return' and 'returned' or 'supplied')\n return function (...)\n local value = ({...}) [no]\n local actual = type (value) == 'table' and value.type or type (value)\n if not expected [actual] then\n error (message:format (actual, tostring (value)))\n end\n return true\n end\nend\n\n-- Parse the docs:\nlocal function parse_doc (doc)\n local parsed = {}\n if type (doc) == 'table' then\n parsed = doc\n else\n for line in doc:gmatch '[^\\n]+' do\n local tag, args = get_tag (line)\n parsed [tag] = parsed [tag] or {}\n parsed [tag] [#parsed [tag] + 1] = args\n end\n end\n -- Convert @param to preconditions and @return to postconditions:\n for tag, class in pairs { param = 'precondition', ['return'] = 'postcondition' } do\n for no, spec in ipairs (parsed [tag]) do\n parsed [class] = parsed [class] or {}\n parsed [class] [#parsed [class] + 1] = tag2condition (tag, spec, no)\n end\n end\n return parsed\nend\n\n-- Checks an array of values against an array of expected type specifications.\n-- Aborts with error, if any of values is of wrong type.\nlocal function check_conditions (conditions, ...)\n for _, condition in ipairs (conditions) do\n condition (...)\n end\n return true\nend\n\n-- Wraps documented with a callable table with type checks for parameters and returns as defined by spec.\nlocal function document (doc, documented)\n local parsed = parse_doc (doc)\n parsed.doc, parsed.raw = doc, documented\n -- Use f.validate_params (...) to get true/false, [error text].\n parsed.validate_params = function (...)\n return pcall (check_conditions, parsed.precondition or {}, ...)\n end\n local t, mt = {}, {}\n if type (documented) == 'function' then\n t = parsed\n mt.__call = function (self, ...) -- simply call f(...).\n check_conditions (parsed.precondition or {}, ...) -- check parameters against the specification.\n local returned = { documented (...) } -- actually call the function.\n check_conditions (parsed.postcondition or {}, unpack (returned))\n return unpack (returned) -- return the validated return values.\n end\n elseif type (documented) == 'table' then\n t = documented\n t.type = t.type or (parsed.type [1] or {}) [1] or 'table'\n for key, values in pairs (parsed) do\n t [key] = t [key] or values\n end\n end\n return setmetatable (t, mt)\nend\n\n-- That's how functions are decorated to make them typed.\nlocal squared = document ([[\nSquares its argument\n--- @param number x Number to square\n--- @return number The squared number\n]],\n function (x) return x ^ 2 end\n)\n\nprint ('Description: ', squared.doc)\n\nfor _, arg in ipairs { 2, 'two' } do\n print ('x = ', arg, 'validation: ', squared.validate_params (arg))\n print ('x = ', arg, 'squared (x) = ', squared (arg))\nend\n</code></pre>\n"^^ . "0"^^ . . "And it stucks this way ONLY when you run the game with this Lua script?"^^ . . "0"^^ . "0"^^ . . . "Can you share a complete, runnable [mcve]? Thanks."^^ . "<p>I've a Redis cluster v7.x with 3 masters, each having 1 slave.</p>\n<p>A function <code>myFunction</code> written in Lua scripting is loaded in all the 3 masters. The function doesn't need any keys, but some args.</p>\n<p>Is it possible for the function to access a data structure, e.g. a <code>SortedSet</code> which is stored on another master node?</p>\n<p>Alternatively, is it possible to direct the call to that node which hosts the targeted sorted set? I'm using ioredis library for node.js. The redis cluster IPs are not exposed to the client, but only a service name configured through the Kubernetes.</p>\n<p>This is required because the call coming from various client might be redirected to any node and the function definition present there needs to access a specific data structure which may not be on the same node which is handling the client request.</p>\n"^^ . . . "Lua (wxLua) how to create a nested "panel1" square in the center "panel""^^ . "1"^^ . . "random"^^ . "0"^^ . . . . "Making an Agent touch an Object in Second Life"^^ . . . . . "<p>These <code>\\u{xxx}</code> are UTF-8 encoded characters, you can just print them using lua to get its original value, e.g.</p>\n<pre><code>print(&quot;\\u{5F}\\u{49}\\u{06B}\\u{49}\\u{6B}\\u{6B}\\u{6C}\\u{06B}\\u{49}\\u{069}\\u{6B}\\u{69}\\u{006C}\\u{6C}\\u{049}\\u{0069}\\u{06C}\\u{6C}\\u{006B}\\u{69}\\u{6C}\\u{06B}\\u{06C}\\u{49}\\u{6B}\\u{0069}\\u{06C}\\u{0069}\\u{49}\\u{006B}\\u{0069}\\u{6C}\\u{69}&quot;)\n</code></pre>\n<p>You will get <code>_IkIkklkIikillIillkilklIkiliIkili</code>. Keep converting all these similar strings, e.g. the first function can be deobfuscated to:</p>\n<pre><code>return function (self,type,message)\n _G[&quot;_IkIkklkIikillIillkilklIkiliIkili&quot;][&quot;IikiIkIliklilkkillikkklillIlIIIl&quot;][505006082](self,type,message)\nend\n</code></pre>\n<p>Obviously these keys and variable names are also obfuscated. You can further replace them with short names, it should be easier to search for relevant information in the code.</p>\n"^^ . . "1"^^ . . . . "0"^^ . . . "<p>I have a Redis 7.x cluster with 3 master nodes running on ports 7000, 7001, 7002. Each master has 1 slave/replica.</p>\n<p>I am trying to load and run this Lua based function:</p>\n<pre><code>#!lua name=paramsLogLib\nlocal function paramsLog(keys, args)\n local param1 = keys[1]\n local param2 = keys[2]\n local param3 = keys[3]\n redis.log(redis.LOG_NOTICE, param1, param2, param3)\nend\nredis.register_function('paramsLog', paramsLog)\n</code></pre>\n<p>The function has been loaded in all the 3 master nodes.</p>\n<p>I tried to call the function <strong>paramsLog</strong> from all the 3 master nodes:</p>\n<p><code>127.0.0.1:7000&gt; fcall paramsLog 3 p1 p2 p3</code></p>\n<p><code>127.0.0.1:7001&gt; fcall paramsLog 3 p1 p2 p3</code></p>\n<p><code>127.0.0.1:7002&gt; fcall paramsLog 3 p1 p2 p3</code></p>\n<p>I get the same error:</p>\n<p><code>(error) CROSSSLOT Keys in request don't hash to the same slot</code></p>\n<p>How can I pass different parameters to any function in the Redis? Why does Redis need to check the hash slot of the parameters itself?</p>\n"^^ . . "1"^^ . . . . . . "fivem"^^ . . . . . . "Albert's solution that really works for me is posted here: https://github.com/jgm/pandoc/discussions/9514"^^ . . "0"^^ . . "0"^^ . . "0"^^ . . . . "0"^^ . . . "0"^^ . "0"^^ . "0"^^ . "2"^^ . . "0"^^ . "Right, so THAT is the problem. you should not be accessing keys in redis that you do not specify as a key in FCALL, for exactly this reason, see https://redis.io/docs/interact/programmability/functions-intro/#input-keys-and-regular-arguments"^^ . "<p>I am creating a FiveM script and I need to get the source citizenId and I am having a problem with what my client callback function receives from a server event. The server event return a string and I know it for a fact because I tried to print the variable and it's type in the console and it was correct. But the second it goes to the function in which it got returned, it's not a string anymore, it's an &quot;object&quot;.</p>\n<p>For minimal reproduction,</p>\n<p>Here is the JS script that call my client callback on a button click (Working):\nhtml/script.js</p>\n<pre><code>const createOrg = () =&gt;{\n var orgName = document.getElementById(&quot;neworg-name-input&quot;).value;\n fetch(`https://${GetParentResourceName()}/orgcreateCb`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8',\n },\n body: JSON.stringify({\n organizationName: orgName,\n })\n }).then(resp =&gt; resp.json()).then(resp =&gt; console.log(resp));\n //console.log(orgName);\n};\n</code></pre>\n<p>Here is the server event that return the string (Working):\nserver/main.lua</p>\n<pre><code>RegisterServerEvent('getPlayerCitizenId')\nAddEventHandler('getPlayerCitizenId', function(cb)\n local currentCitizenId = QBCore.Functions.GetPlayer(source).PlayerData.citizenid\n cb(tostring(currentCitizenId))\nend)\n</code></pre>\n<p>Here is the client callback that need what the server event returns (Not working):\nclient/main.lua</p>\n<pre><code>RegisterNUICallback(&quot;orgcreateCb&quot;, function(data, cb)\n TriggerServerEvent('getPlayerCitizenId', function(citizenId)\n print('Citizen ID:', citizenId)\n end)\nend)\n</code></pre>\n<p>On the print I get -&gt; &quot;SCRIPT ERROR: error object is not a string&quot;</p>\n"^^ . . "Lightroom plugin does not show sectionsForBottomOfDialog on Windows"^^ . . "5"^^ . . . . . . "3"^^ . . "<p>Each new Team needs a unique TeamColor:</p>\n<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>local teamsFolder,tab=game:GetService("Teams"),{}\n\ngame.Players.PlayerAdded:Connect(function(player)\n local team,teamcolor=Instance.new("Team"),nil\n team.Name,team.AutoAssignable=player.Name,false\n repeat\n teamcolor=BrickColor.random()\n until not table.find(tab,teamcolor)\n table.insert(tab,teamcolor)\n team.TeamColor,team.Parent=teamcolor,teamsFolder\n player.Team=team\nend)\n\ngame.Players.PlayerRemoving:Connect(function(player)\n table.remove(tab,table.find(tab,player.TeamColor))\n teamsFolder[player.Name]:Remove()\nend)</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . . . . "@Neil, could you elaborate your question? You mean that I should take into account the closing part (`-->`) in my code, not only the opening (`<!--`) one?"^^ . . . "Where are your LocalScripts located?"^^ . "@ESkri ONLY in that game, it works fine in other apps"^^ . . . "<p>It's not clear if your white square should be a window or should be just displayed on the panel. In the latter case, you need to connect to <code>wxEVT_PAINT</code> and draw a centered rectangle in your handler.</p>\n<p>If you want to have a window, you can create one and add it to a grid sizer or use nested box sizers. The exact way to do it depends if you want to have fixed borders around your square or something more complicated.</p>\n<p>Not really related to your question, but:</p>\n<ul>\n<li>There is no need to call <code>SetAutoLayout(true)</code>, this is the default.</li>\n<li>It's confusing to use both <code>wxGROW</code> and <code>wxEXPAND</code> in the same code, they're synonyms and mean exactly the same thing.</li>\n</ul>\n"^^ . . . . "<p>I am trying to make a chess game in love2D, and I am presently trying to generate 8 black pawns in the 7th row, but they all end up in at the last spot of the row.</p>\n<p>A picture of (seemingly) 1 pawn in the 7H position on a chess board:</p>\n<p><img src="https://i.sstatic.net/KVxhK.png" alt="A picture of (seemingly) 1 pawn in the 7H position on a chess board" /></p>\n<p>I wrote a for loop as shown below:</p>\n<pre><code>for i = 1, 8, 1 do\n local column = string.char(64+i)\n _G[&quot;pawn7&quot;..column] = Pawn:new(0, i, 2)\n print(pawn7A.x)\nend\n</code></pre>\n<p>Now, I expected the following code to create a global variable of pawn7(A, B, C...etc) with the y value = 2 and an x value = i before repeating the loop. It does function in this way, but it also changes the x value of every pawn generated before the present loop and makes its x = to the current i. This causes all of the stacked pawns as described above. My question is, does setting the variable of x = i normally cause it to change whenever i changes (i didn't think so), and if so how can I avoid this so all my pawns print in the respective spot?</p>\n<p>-- Update\nOkay, so after rewriting my code to be a minimal reproducible example, I replaced the bit that uses the object library with a function that returns a table with its inputs. I also swapped from using the global table to a local table, and that seemed to fix the issue.</p>\n<pre><code>pieces = {}\n\nfunction newPiece(c, x, y)\n self = {}\n self.c = c\n self.x = x\n self.y = y\n\n return self\nend\n\nfor i = 1, 8, 1 do\n local column = string.char(64+i)\n pieces[&quot;p7&quot;..column] = newPiece(0, i, 2)\nend\n\nprint(pieces.p7A.x)\n</code></pre>\n"^^ . "@Nifim Right, I've done that now and also changed the question title."^^ . "0"^^ . "0"^^ . . . . "They are the same. And this is just the first step, you need to process all the code, then gradually replace the obfuscated parts with the known ones."^^ . . "<p>Trying to use this simple recoil reducer lua script code. But in game, cursor doesn't move in x axis. It kinda stucks in y axis.</p>\n<pre><code>EnablePrimaryMouseButtonEvents(true);\n \nfunction OnEvent(event, arg)\n if IsKeyLockOn(&quot;numlock&quot; )then\n if IsMouseButtonPressed(3)then\n repeat \n if IsMouseButtonPressed(1) then\n repeat\n MoveMouseRelative(0,1)\n Sleep(33)\n until not IsMouseButtonPressed(1)\n end \n until not IsMouseButtonPressed(3)\n end \n end\nend\n</code></pre>\n<p>I tried to use older versions of Logitech G Hub. But same result. Currently I am using 2021.11.1775 version of Logitech G Hub.</p>\n<p>Here is a video: <a href="https://youtu.be/ZJixURBzsyA" rel="nofollow noreferrer">https://youtu.be/ZJixURBzsyA</a></p>\n"^^ . "0"^^ . "Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . . "3"^^ . "3"^^ . . "0"^^ . "0"^^ . "1"^^ . . . . . . . "0"^^ . "2"^^ . . . . . . . . . . . . "0"^^ . . . "I actally got it working in lua :)"^^ . . "0"^^ . . . . "It worked with sorted set being passed as a key. Thanks!"^^ . "3"^^ . "<p>The most straightforward way to solve this issue would be to have the question and answer set selected on the side of the server and then send the information using a <code>RemoteEvent</code> to all the clients using <code>FireAllClients()</code>, then to have the clients send back a number detailing what number they have selected using <code>FireServer()</code></p>\n<hr />\n<p>The full process would then be the following:</p>\n<p>Server selects question/answer set <code>(serverscript)</code> →\nserver sends question/answer set to clients <code>(RemoteEvent:FireAllClients())</code> →\nclients receive and display question/answer set <code>(localscript)</code> →\nplayer selects → clients send information back to server <code>(RemoteEvent:FireServer())</code> → server keeps track of who answered what, and awards points or whatever you want to do <code>(serverscript)</code></p>\n<p>Provided you have your RemoteEvent able to be referenced in ReplicatedStorage, both serverscripts and localscripts will be able to talk to each other with data you supply through the RemoteEvent.</p>\n"^^ . . . "0"^^ . . "debugging"^^ . . . "Is the problem disappears when you remove (disable) the Lua script? Is the problem disappears when you comment the line `MoveMouseRelative(0,1)` ?"^^ . . . "1"^^ . . . . . . . "1"^^ . . . . . "that's quite a sophisticated example. I'll post something in an answer..."^^ . . "0"^^ . "Redis Function not found"^^ . "0"^^ . . "`math.randomseed(os.time())` should be invoked only once, at the program start."^^ . . . . . . . . . "1"^^ . . . . "1"^^ . . "-3"^^ . "0"^^ . . . . . "3"^^ . . "0"^^ . "0"^^ . . . . . "Tables with keys do not have an order, you would need an array."^^ . . . . . . . . . . . "<p>At the time the book was written (it corresponds to Lua version 5.3.0) Lua had wrong behavior of reading long integer literals: it wraparounded them.<br />\nLater, in Lua 5.3.3 this behavior <a href="https://github.com/lua/lua/commit/10b0b09555920ad2ac186274348e73ed61cede90" rel="nofollow noreferrer">has been corrected</a> to a more user-friendly.<br />\nAs for now, when a decimal integer literal in beyond int64 range, Lua reads it as float number to preserve its numeric value. Hexadecimal integer literals are wraparounded.</p>\n"^^ . . "<p>I am using Neovim (kickstart.nvim) and am new to programming and don't want all the words (auto complete) handed to me nor error messages/pop-ups so I could learn to deal with it myself, but I do want the other LSP feature like function definitions etc.</p>\n<p>In more general terms I want to know how to configure (enable and disable) different options for the LSP and a list of options.</p>\n<p>the problem is that all the things I find online are people telling you how to add them not take them away (looks like everyone wants them on but me )</p>\n<hr />\n<p>just some information: I'm very new to programming (as I've mentioned), and don't have a lot of Lua or any complete programming knowledge. I wanted a light editor (vs code feels like too much). I was using notepad++ till now (and it was pretty good ). I wanted to try vim motions but they don't have a plug-ins for that (they have an old one only for 32-bit one and even on that is broke it ‍♂️), so I got neovim (I think it's good, because I any like to work from the terminal) and here I am .</p>\n"^^ . . . . . . "Thank you for you answer. The description seems like it's what I'm looking for. However, I fail to understand how it works or how I even integrate it. I can see a getter function, which I've read about in OOP, but none of it makes sense to me. Is there something specific I could read about to be able to understand the given example a bit better?"^^ . . . "0"^^ . "resume"^^ . "<p>I would like to place the hud in the top corner and on the right, and that there would be no problem with other resolutions</p>\n<pre><code>local circleScale, sizeStroke = 50, 3\nlocal iconScale = 25\nlocal circleLeft, circleTop = circleScale + 30, y - circleScale - 20\n\naddEventHandler('onClientResourceStart', resourceRoot, function()\n createCircle('bgHealth', circleScale, circleScale)\n createCircle('bgArmor', circleScale, circleScale)\n createCircleStroke('health', circleScale, circleScale, sizeStroke)\n createCircleStroke('armor', circleScale, circleScale, sizeStroke)\n\n hiddenComponents(false)\nend)\n\naddEventHandler('onClientResourceStop', resourceRoot, function()\n hiddenComponents(true)\nend)\n\naddEventHandler('onClientRender', root, function()\n drawItem('bgHealth', circleLeft, circleTop, tocolor(28, 28, 28, 170))\n drawItem('bgArmor', circleLeft + circleScale + 10, circleTop, tocolor(28, 28, 28, 170))\n\n drawItem('health', circleLeft, circleTop, tocolor(255, 255, 255))\n dxDrawImage(circleLeft + ((circleScale/2) - (iconScale/2)), circleTop + ((circleScale/2) - (iconScale/2)), iconScale, iconScale, 'assets/health.png')\n \n drawItem('armor', circleLeft + circleScale + 10, circleTop, tocolor(255, 255, 255))\n dxDrawImage((circleLeft + circleScale + 10) + ((circleScale/2) - (iconScale/2)), circleTop + ((circleScale/2) - (iconScale/2)), iconScale, iconScale, 'assets/armor.png')\n\n setSVGOffset('health', getElementHealth(localPlayer))\n setSVGOffset('armor', getPedArmor(localPlayer))\nend)\n</code></pre>\n<p>I tried changing the number (circleScale + 30 and circleScale - 20) to another value, but in another resolution it is completely out of line with expectations.</p>\n"^^ . . "<p>Note that this should be executed in a <code>localscript</code> and can only be seen by the client itself.</p>\n<pre><code>local Backpack = game:GetService(&quot;ReplicatedStorage&quot;):Waitforchild(&quot;Backpack&quot;)\nlocal Player = game:GetService(&quot;Players&quot;).LocalPlayer\n \nPlayer.CharacterAdded:Connect(function(Character)\n local clone = Backpack:Clone()\n clone.Parent = Character:WaitForChild(&quot;Torso&quot;)\nend\n</code></pre>\n"^^ . "Calling an event with a delay in Roblox Studio. How to do?"^^ . "Ys i fixed it , thnx"^^ . "I did not understand what you want to achieve."^^ . "<p>Just as <a href="https://stackoverflow.com/users/5647862/parker-tailor">Parker Tailor</a> said <a href="https://stackoverflow.com/a/78308665/22672601">above</a>.\nThe <code>Neovim lua keymap</code>, for binding keymaps in your config,\nyou need to use the <code>vim.keymap.set()</code> function or the <code>vim.api.{func}({...})</code> utility.</p>\n<p>You will get the most of what you need to know in the <code>help docs</code> by running <code>:h vim.keymap.set()</code> and <code>:h vim.api</code> commands.</p>\n<p>Look at what the <strong>help docs</strong> say about <code>vim.api</code>, -</p>\n<pre><code>vim.api.{func}({...}) \n Invokes Nvim |API| function {func} with arguments {...}.\n Example: call the &quot;nvim_get_current_line()&quot; API function: \n</code></pre>\n<pre class="lang-lua prettyprint-override"><code> print(tostring(vim.api.nvim_get_current_line()))\n</code></pre>\n<p><strong>Few Examples</strong>:</p>\n<pre class="lang-lua prettyprint-override"><code>-- Basic keymap\nvim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;n&quot;, vim.cmd.enew, {desc=&quot;new file&quot;})\n\n-- calling the &quot;nvim_set_keymap()&quot; api function\n-- to map Ctrl+C to - copy to clipboard option\nvim.api.nvim_set_keymap(&quot;v&quot;, &quot;&lt;C-c&gt;&quot;, &quot;:w !xclip -i -sel c&lt;CR&gt;&lt;CR&gt;&quot;, { noremap = true })\n</code></pre>\n<p><em><strong>Just a Suggestion</strong></em> :- If you use <strong>which-key</strong> <em>plugin</em> in your config, add <code>desc = &quot;description of the keymap&quot;</code> in the {opts} table.</p>\n<p>So, the lua representation of the keybinding you want will be -</p>\n<pre class="lang-lua prettyprint-override"><code>vim.keymap.set('i', '&lt;c-f&gt;', &quot;&lt;Esc&gt;: silent exec '.!inkscape-figures create &quot;'.getline('.').'&quot; &quot;'.b:vimtex.root.'/figures/&quot;'&lt;CR&gt;&lt;CR&gt;:w&lt;CR&quot;, { desc=&quot;create inkscape figure&quot;, silent = true, noremap = true })\n</code></pre>\n"^^ . . "<p>inside setup <code>base.Model</code> shouldn't be a string.</p>\n<pre><code>base.Model = workspace.village:WaitForChild(&quot;Base&quot;)\n</code></pre>\n<p>If you index a string (<code>local gui</code> inside <code>updateHealth</code>) it will return a nil.</p>\n"^^ . . . . . . . . . . . . . . . "<p>Global variables in recent versions of Lua are actually storing in a table called <code>_ENV</code>. (which is an upvalue in all contexts)</p>\n<p>Note: the references are ONLY considered local when it is after the complete declaration of <code>local &lt;var&gt;...</code>. This means that a statement like <code>local test = test</code> gets compiled to <code>local test = _ENV.test</code>.</p>\n<p>With that in mind, the files end up actually being compiled like below.</p>\n<pre class="lang-lua prettyprint-override"><code>-- module.lua\n\n_ENV.test = 30\nlocal test = 20\n-- after this point, any references to `test` mean the local variable\ntest = 40\n\nprint(&quot;module.lua: &quot; .. test)\n</code></pre>\n<pre class="lang-lua prettyprint-override"><code>-- main.lua\n\nrequire(&quot;module&quot;)\nprint(&quot;main.lua: &quot; .. _ENV.test)\n</code></pre>\n"^^ . . "pattern-matching"^^ . . . "-1"^^ . "global const variables in lua 5.4"^^ . . "0"^^ . "Yes, that's what I'm saying. I used `(...)` once to be clear about precedence; it is not needed here. `expr and x or y` is sometimes called a "ternary", because if `x` is truthy it behaves like `expr ? x : y` in other languages, but it is not a "true" ternary because it doesn't work as expected if `x` is falsey. Maybe call it a "pseudo"-ternary? :-)"^^ . . "0"^^ . . "<p>I'm trying to reduce the number of objects that need to be rendered in order to fill <strong>only</strong> the occupied cells of a 2D matrix. Each cell's occupancy is binary, and the matrix extents can reach up to 512 by 512 cells. Rendering each cell independently is untenable.</p>\n<p>Grouping occupied cells into more manageable regions is my main goal. Finding the absolute minimum number of rectangular groupings isn't necessary, but the fewer the better.</p>\n<p>I originally thought that iterating over the grid and then grouping adjacent cells based on the occupancy of their neighbors would be the best way to approach this, but I've struggled to find performant solutions. I'm trying to avoid an O(n^2) type of situation (maybe this is unreasonable, I don't know).</p>\n<p>I've also considered iterating over the matrix and &quot;growing&quot; a rectangle from every occupied cell to the nearest unoccupied cell on both axes. While this works fairly well, it clearly generates more rectangles than necessary.</p>\n<p>I hypothesize that picking a coordinate at random and then &quot;growing&quot; a rectangle outward in all directions would further reduce the number of rectangles needed, but I don't know if that's true, and I haven't come up with a good test for it.</p>\n<p>I've been working on this problem in Lua, but feel free to respond with solutions in any language.</p>\n<p>Thank you,\n-SN</p>\n<p>EDIT: For context, the matrix is a table, and each cell within the matrix has its own table, such that matrix[x][y] = {occupied = true/false}. Every coordinate in the matrix has cell data, so there aren't any nil gaps in the matrix.</p>\n"^^ . . "Problems with large numbers in Lua"^^ . . "floating-accuracy"^^ . "0"^^ . . . "<p>I want to write a patterns that takes a string like this <code>/a/b/c</code> and extracts <code>a</code>, <code>b</code>, and <code>c</code>. a, b, and c are optional, so <code>///</code> is a valid input. Currently I have this: <code>&quot;^%/(.-)%/(.-)%/(.-)$&quot;</code>. This works, except if my input is <code>/&lt;/&gt;/b/c</code>, I get matches: <code>&lt;</code>, <code>&gt;</code>, <code>b/c</code>. Obviously the second <code>/</code> should be escaped like this: <code>/&lt;\\\\/&gt;/b/c</code>, however this gives me: <code>&lt;\\</code>, <code>&gt;</code>, <code>b/c</code>. Is there a way to write this pattern such that <code>/&lt;\\\\/&gt;/b/c</code> would give me: <code>&lt;\\/&gt;</code>, <code>b</code>, <code>c</code>? I know I could change the first <code>.-</code> to a <code>.+</code> and that would solve this exact issue, but it doesn't solve the larger issue(i.e. what if the escaped slash is in section b).</p>\n"^^ . . . . "0"^^ . . "<p>I'm making a roblox time trials obby, but I can't make a timer in the format of 0:00s, any help ?</p>\n<p>i tried multiple times, but nothing worked I used a very basic script but the format looks quite ugly. Please help, I've been trying for months on end to figure it out.</p>\n"^^ . "0"^^ . "scripting"^^ . . . "<p>I something like this what you're looking for?</p>\n<pre><code>local original = &quot; test&quot;\nlocal trimmed = original:match( &quot;^%s*(.*)&quot; )\nlocal spaces = #original - #trimmed\nprint(&quot;The original word is [&quot; .. original .. &quot;] and the trimmed word is [&quot; .. trimmed .. &quot;] and there are &quot; .. spaces .. &quot; spaces.&quot;)\n</code></pre>\n<p>Output:</p>\n<pre><code>The original word is [ test] and the trimmed word is [test] and there are 4 spaces.\n</code></pre>\n"^^ . "<p>If I'm correct this is a <code>LocalScript</code>. The problem is the LocalPlayer has no <a href="https://create.roblox.com/docs/physics/network-ownership" rel="nofollow noreferrer">network ownership</a> over the leaderstats value <code>Money</code> so when the LocalPlayer tries to edit it will not replicate to the server.</p>\n<p>You should make the buy system on the server. I recommend using a <a href="https://create.roblox.com/docs/reference/engine/classes/RemoteEvent" rel="nofollow noreferrer"><code>RemoteEvent</code></a> that fires the server and then the server will handle the purchase and clones the tool to the player's backpack.</p>\n"^^ . "@СиестаСоб - How `Q` key should work in the result script? With 10 sec press time, as previously? Or its turning off should be triggered somehow else?"^^ . "0"^^ . . "Hi @Sodz1aX, what question are you asking? I don't think other users will understand what you're trying to do without more details."^^ . . "<p>You can use a function like the one below to get a string in the format <code>0:00s</code>.</p>\n<pre class="lang-lua prettyprint-override"><code>--!strict\n\nfunction formatTime(seconds: number): string\n local minutes = math.floor(seconds / 60)\n local remainingSeconds = seconds % 60\n\n return string.format(&quot;%d:%02ds&quot;, minutes, remainingSeconds)\nend\n\nprint(formatTime(300)) -- 5:00s\n</code></pre>\n<p>The function takes a number which is the amount of seconds and then returns a string in the format <code>0:00s</code>.</p>\n<p>First, we use <a href="https://create.roblox.com/docs/reference/engine/libraries/math#floor" rel="nofollow noreferrer"><code>math.floor</code></a> to find the number of minutes. Then, we use <code>%</code> to divide the number of seconds by 60 and get the reminder of seconds after dividing them. Finally, we use <a href="https://create.roblox.com/docs/reference/engine/libraries/string#format" rel="nofollow noreferrer"><code>string.format</code></a> to put the minutes and remaining seconds together in a string, making sure that <code>remainingSeconds</code> has 2 digits.</p>\n"^^ . "0"^^ . "0"^^ . . "0"^^ . . . . "I did that already but it won't open at all."^^ . . "1"^^ . . . . . "0"^^ . . . . "0"^^ . "I have no idea on how to do it. Sorry just started learning. Can you show me using my code? thanks in advance"^^ . . . . "1"^^ . . "null"^^ . . "2"^^ . . . "game-development"^^ . . . . "Is there a reason that using the [RemoteEvent.OnServerEvent](https://create.roblox.com/docs/scripting/events/remote) connection isn't enough for your purposes? Because when you attach a function to an event, it is effectively waiting for the client to fire."^^ . "1"^^ . "user-interface"^^ . "0"^^ . "geometry"^^ . "Is this a LocalScript or a Script? Where is this code located in the game?"^^ . . . . . "build-system"^^ . "<p>I am trying to write a uint32_to_float function in lua where I am using math.ldexp in a condition. Upon checking the script using luacheck, I get following error:</p>\n<pre><code> scripts/CAN test.lua:58:21: accessing undefined field ldexp of global math\n</code></pre>\n<p>How do I fix the problem and could anyone suggest me with an alternative?</p>\n"^^ . . . "0"^^ . . "Snippet of current time in nvim"^^ . . . "1"^^ . "It's unclear what is needed: should `Q` be pressed while LMB is down or should it be pressed exactly 10 sec from the moment LMB was pressed for the first time?"^^ . . . "3"^^ . "Possible duplicate [Converting conditional vimscript mapping into lua (neovim) (submit <CR> in lua)](https://stackoverflow.com/questions/73270146/converting-conditional-vimscript-mapping-into-lua-neovim-submit-cr-in-lua)"^^ . . "<p>I'm trying to run code that spawn 2 squares affected by gravity. When they hit each other, they just get destroyed using setuserdata and getuserdata. When I try to getuserdata, I get a nil value. What I'm doing here is getting values for each square to create it. First square gets userdata square1 and the other square get userdata square2. When the code detects a collision, they just get destroyed by adding them to destroyedbodies. I remove them one by one from the table and from the square table.</p>\n<p>Here is my create square code:</p>\n<pre><code>Test = Class{}\n\nfunction Test:init(type, x, y, userData, world)\n\nself.world = world\n\nself.x = x \nself.y = y \n\nself.type = type\n\nself.boxBody1 = love.physics.newBody(self.world, self.x , self.y ,'dynamic')\n\nif self.type == 'square' then\n self.boxShape = love.physics.newRectangleShape(10, 10)\nend\n\nself.boxFixture1 = love.physics.newFixture(self.boxBody1, self.boxShape)\nself.boxFixture1:setRestitution(0.5)\n\nself.boxFixture1:setUserData(userData)\nend\n\nfunction Test:update(dt)\nend\n\nfunction Test:render()\n\nlove.graphics.polygon('fill', self.boxBody1:getWorldPoints(self.boxShape:getPoints()))\nend\n</code></pre>\n<p>and here is my destroy code</p>\n<pre><code>Test2 = Class{}\n\nfunction Test2:init()\nself.world = love.physics.newWorld(0, 300)\n\nself.destroyedBodies = {}\n\nself.square = {}\n\nfunction beginContact(a, b, coll)\n local types = {}\n types[a:getUserData()] = true\n types[b:getUserData()] = true\n\n -- if we collided between both the player and an obstacle...\n if types['square1'] and types['square2'] then\n\n -- grab the boxBody1 that belongs to the player\n local square1 = a:getUserData() == 'square1' and a or b\n local square2 = a:getUserData() == 'square2' and a or b\n \n table.insert(self.destroyedBodies, square1:getBody())\n table.insert(self.destroyedBodies, square2:getBody())\n end\nend\n\nself.world:setCallbacks(beginContact)\n\ntable.insert(self.square, Test('square', VIRTUAL_WIDTH/2, VIRTUAL_HEIGHT/2, 'square1', \nself.world))\ntable.insert(self.square, Test('square', VIRTUAL_WIDTH/2, VIRTUAL_HEIGHT/3, 'square2', \nself.world))\n\nself.groundBody = love.physics.newBody(self.world, 0, VIRTUAL_HEIGHT - 30, 'static')\nself.edgeShape = love.physics.newEdgeShape(0, 0, VIRTUAL_WIDTH, 0)\nself.groundFixture = love.physics.newFixture(self.groundBody, self.edgeShape)\nend\n\nfunction Test2:update(dt)\nself.world:update(dt)\n\nfor k, boxBody1 in pairs(self.destroyedBodies) do\n if not boxBody1:isDestroyed() then \n boxBody1:destroy()\n end\nend\n\nself.destroyedBodies = {}\n\nfor i = #self.square, 1, -1 do\n if self.square[i].boxBody1:isDestroyed() then\n table.remove(self.square, i)\n end\nend\nend\n\nfunction Test2:render()\nfor k, square in pairs(self.square) do\n square:render()\nend\n\nlove.graphics.setColor(255, 0, 0)\nlove.graphics.setLineWidth(3)\nlove.graphics.line(self.groundBody:getWorldPoints(self.edgeShape:getPoints())) \nend\n</code></pre>\n<p>the error I'm getting is</p>\n<pre><code>Error\n\nsrc/Test2.lua:12: table index is nil\n\n\nTraceback\n\n[love &quot;callbacks.lua&quot;]:228: in function 'handler'\nsrc/Test2.lua:12: in function &lt;src/Test2.lua:10&gt;\n[C]: in function 'update'\nsrc/Test2.lua:50: in function 'update'\nmain.lua:51: in function 'update'\n[love &quot;callbacks.lua&quot;]:162: in function &lt;[love &quot;callbacks.lua&quot;]:144&gt;\n[C]: in function 'xpcall'\n</code></pre>\n"^^ . . "0"^^ . . "0"^^ . . . . . "1"^^ . . . "In the video, you can see that its author is using Lua 5.2. As @Luatic correctly answered, there is a change of behavior between 5.2 and 5.3"^^ . . . "1"^^ . "The mistake is somewhere outside this code fragment"^^ . . . "<p>Using an LSP in Neovim, you can go to an object's definition by placing the cursor over the symbol in question and hitting <code>&lt;C-]&gt;</code> or <code>&lt;gc&gt;</code>. I'd like to be able to use this behaviour in Lua, i.e. to be able to run something like <code>:lua 'jump_to_definition(&quot;foobar&quot;)'</code> and have the definition for <code>foobar</code> open as if I had entered <code>&lt;C-]&gt;</code> with my cursor over the <code>foobar</code> symbol.</p>\n<p>Browsing the Neovim documentation, I see that <code>&lt;C-]&gt;</code> is powered by <a href="https://neovim.io/doc/user/lsp.html#vim.lsp.buf.definition()" rel="nofollow noreferrer"><code>vim.lsp.buf.definition(options)</code></a>. The documentation about what exactly <code>options</code> should be is pretty cryptic, but as far as I can tell, there's no way to manually set the symbol to be looked up.</p>\n<p><a href="https://neovim.io/doc/user/lsp.html#vim.lsp.tagfunc()" rel="nofollow noreferrer"><code>vim.lsp.tagfunc(pattern, flags)</code></a> is a related function which seems a bit more programmable, but doesn't seem to do exactly what I want. Using the R language server, I can use this function to get a tag for a particular symbol, but only if I've previously looked up the definition using <code>&lt;C-]&gt;</code>. You can test this using, e.g. <code>:lua print(vim.inspect(vim.lsp.tagfunc(&quot;foobar&quot;, &quot;cir&quot;, 0)))</code>.</p>\n<p>For context, I'm trying to create a user command to conveniently go to an object's definition even if it doesn't appear in the file I'm currently looking at.</p>\n"^^ . "Lua: is there a need to use hash of string as a key in lua tables"^^ . "0"^^ . "Match start of line or an arbitrary number of spaces"^^ . . "1"^^ . "For example in continuations lua_yield(), lua_yieldk() is the way to yield a coroutine , when? when i make lua via c-functions? or whn i use lua-create() and i create a coroutine via native lua code? I spend 3-4 days, noights wth various examples but it is very difficult to make c-api and native lua to cooperate. Have u clear the use cases btween c-api and native lua code(whth the use of for example lua_dostring() case ) and continuations?"^^ . "0"^^ . . . . . . "1"^^ . "0"^^ . "0"^^ . "0"^^ . "Overlapping rectangles would be slightly undesirable, but it would still be a valid and workable solution."^^ . "lua"^^ . "1"^^ . "Just make script to replace each digit to # OR to replace each digit to any digit."^^ . . "0"^^ . . . . . . "Matching multi-language (latin extended) characters in lua"^^ . . "Why do you check the state of CapsLock and NumLock?"^^ . . . . . . "0"^^ . . . . "1"^^ . . . . . . . "Apply leaderstat value on humanoid"^^ . . "1"^^ . "1"^^ . . . "lghub lua script presskey"^^ . . "<p>In your screenshot, there is a minus symbol before your if statement checking the character count.</p>\n<pre class="lang-lua prettyprint-override"><code>-if localPlayer:getData('charlimit') &lt;= 1 then exports.notification:create('Karakter sinıriniz dolmuş!', 'error') return end\n</code></pre>\n<p>Just remove the minus symbol before the if statement and it should fix the if statement not working.</p>\n<pre class="lang-lua prettyprint-override"><code>if localPlayer:getData('charlimit') &lt;= 1 then exports.notification:create('Karakter sinıriniz dolmuş!', 'error') return end\n</code></pre>\n<p>Since you provided a screenshot of the code I might have mistyped the above it since it's an image. Just remove the minus symbol yourself rather than copy and paste as I might get something wrong. So be sure to post your code next time.</p>\n"^^ . . . "1"^^ . . . "<p>Please try simpler solution as <code>[&quot;&amp;green&quot;] = &quot;#53FF4A&quot;</code>.</p>\n"^^ . . "SQLite3 Min and Max values with thier respective timestamp"^^ . "0"^^ . . . . . "0"^^ . "`if event == "MOUSE_BUTTON_PRESSED" and arg == 4 then ... end`"^^ . . . . . "1"^^ . "1"^^ . . . . . . . "So how would that be applied in code for a math.randomized license plates for example? Lets say a car is purchased, and it is assigned a random plate? I use \n\nPlate = string.upper(GetRanPlateNum(2) .. GetRandLetter(4)) GetRanPlate and GetRandLetter are also seperate functions."^^ . . "0"^^ . . . . . "4"^^ . "1"^^ . . . . . "0"^^ . . "rectangles"^^ . . . . . . . . . . . . "1"^^ . "0"^^ . "Lua | String Pattern Replacement"^^ . . . . . "Apply a proper indentation to your code, and the mistake will become obvious"^^ . "<p>From the error message, it says <code>Workspace.Knife.Script</code> which indicates you are using a <a href="https://create.roblox.com/docs/reference/engine/classes/Script" rel="nofollow noreferrer">Script</a> and not a <a href="https://create.roblox.com/docs/reference/engine/classes/LocalScript" rel="nofollow noreferrer">LocalScript</a> (unless you changed the name of LocalScript to Script).</p>\n<p>In your code, you use <code>local player = game.Players.LocalPlayer</code> but you can't get LocalPlayer if you are not in a LocalScript because Script runs on the server and has no LocalPlayer.</p>\n<p>Consider changing the class of your script from Script to LocalScript so you can use LocalPlayer.</p>\n"^^ . . . . . "@Gamer2VR you should read into this. [Remote Events and Callbacks](https://create.roblox.com/docs/scripting/events/remote)"^^ . . . "1"^^ . . . . "1"^^ . . "1"^^ . "1"^^ . "2"^^ . . "1"^^ . . . . . "1"^^ . "if you can't find a syntax violation yourself, then use online lua checkers, for example: https://extendsclass.com/lua.html, https://www.tutorialspoint.com/execute_lua_online.php"^^ . "0"^^ . . . . . . . . . "2"^^ . "0"^^ . . . . . . "1"^^ . . "how can i get rid of the bug when if you press shift quickly after stamina runs out you keep running?"^^ . . . "0"^^ . . . "0"^^ . . "Hexadecimal positive values from `2^63` to `2^64-1` will be converted to negative int64 values. Hexadecimal integer literals will not be converted to float, but their high bits (above 64) will be ignored, and low 64 bits will be saved to signed int64."^^ . "0"^^ . . . "2"^^ . . . . . . . "Constant may be only local variables. No globals. No table fields. Actually, it's a quite useless Lua feature."^^ . "<p>I am trying to sort this table by ID but I can't seem to figure it out, is there anyone out there that can assist me? Thank you in advance.</p>\n<p>Here is my code it basically grabs the item id as x and then reads the tooltip for item x then sends the tooltip data into the item x:</p>\n<pre><code>function ess(x)\n if not ITEMSCRAPESTATS then\n ITEMSCRAPESTATS = {}\n end\n ES:SetHyperlink(&quot;item:&quot;..x..&quot;:0:0:0:0:0:0:0&quot;)\n for i=1, ES:NumLines() do\n local text = _G[&quot;ESTooltipTextLeft&quot;..i]:GetText()\n if _G[&quot;ESTooltipTextLeft2&quot;]:GetText() then\n ITEMSCRAPESTATS[x] = ITEMSCRAPESTATS[x] or {}\n table.insert(ITEMSCRAPESTATS[x], _G[&quot;ESTooltipTextLeft&quot;..i]:GetText())\n\n else\n ITEMSCRAPESTATS[x] = ITEMSCRAPESTATS[x] or {}\n table.insert(ITEMSCRAPESTATS[x], &quot;No Stats for Item Number&quot;)\n end\n end\n if _G[&quot;ESTooltipTextLeft2&quot;]:GetText() then\n print(&quot;Scraping Stats for Item Number: &quot;..x)\n else\n print(&quot;No Stats for Item Number: &quot;..x)\n end\nend\n</code></pre>\n<p>This is what ends up in the table:</p>\n<pre><code>ITEMSCRAPESTATS = {\n [60002] = {\n &quot;Goldroar Signet&quot;, -- [1]\n &quot;Binds when picked up&quot;, -- [2]\n &quot;Unique-Equipped&quot;, -- [3]\n &quot;Finger&quot;, -- [4]\n &quot;+1 Strength&quot;, -- [5]\n &quot;Item Level 15&quot;, -- [6]\n &quot; &quot;, -- [7]\n },\n [60004] = {\n &quot;Divining Rod&quot;, -- [1]\n &quot;Binds when picked up&quot;, -- [2]\n &quot;Ranged&quot;, -- [3]\n &quot;9 - 17 Fire Damage&quot;, -- [4]\n &quot;(8.7 damage per second)&quot;, -- [5]\n &quot;Requires Level 6&quot;, -- [6]\n &quot;Item Level 12&quot;, -- [7]\n &quot; &quot;, -- [8]\n },\n [60001] = {\n &quot;Goldroar Band&quot;, -- [1]\n &quot;Binds when picked up&quot;, -- [2]\n &quot;Unique-Equipped&quot;, -- [3]\n &quot;Finger&quot;, -- [4]\n &quot;+1 Intellect&quot;, -- [5]\n &quot;Item Level 15&quot;, -- [6]\n &quot; &quot;, -- [7]\n },\n [60003] = {\n &quot;Waterlogged Dirge&quot;, -- [1]\n &quot;Binds when picked up&quot;, -- [2]\n &quot;Two-Hand&quot;, -- [3]\n &quot;17 - 26 Damage&quot;, -- [4]\n &quot;(7.2 damage per second)&quot;, -- [5]\n &quot;+1 Strength&quot;, -- [6]\n &quot;+1 Stamina&quot;, -- [7]\n &quot;Requires Level 6&quot;, -- [8]\n &quot;Item Level 10&quot;, -- [9]\n &quot; &quot;, -- [10]\n },\n [60000] = {\n &quot;Resilient Poncho&quot;, -- [1]\n &quot;Binds when picked up&quot;, -- [2]\n &quot;Back&quot;, -- [3]\n &quot;20 Armor&quot;, -- [4]\n &quot;+1 Spirit&quot;, -- [5]\n &quot;Requires Level 6&quot;, -- [6]\n &quot;Item Level 26&quot;, -- [7]\n &quot; &quot;, -- [8]\n },\n}\n</code></pre>\n<p>I would like it to sort like this:</p>\n<pre><code>ITEMSCRAPESTATS = {\n [60000] = {\n &quot;Resilient Poncho&quot;, -- [1]\n &quot;Binds when picked up&quot;, -- [2]\n &quot;Back&quot;, -- [3]\n &quot;20 Armor&quot;, -- [4]\n &quot;+1 Spirit&quot;, -- [5]\n &quot;Requires Level 6&quot;, -- [6]\n &quot;Item Level 26&quot;, -- [7]\n &quot; &quot;, -- [8]\n },\n [60001] = {\n &quot;Goldroar Band&quot;, -- [1]\n &quot;Binds when picked up&quot;, -- [2]\n &quot;Unique-Equipped&quot;, -- [3]\n &quot;Finger&quot;, -- [4]\n &quot;+1 Intellect&quot;, -- [5]\n &quot;Item Level 15&quot;, -- [6]\n &quot; &quot;, -- [7]\n }, \n [60002] = {\n &quot;Goldroar Signet&quot;, -- [1]\n &quot;Binds when picked up&quot;, -- [2]\n &quot;Unique-Equipped&quot;, -- [3]\n &quot;Finger&quot;, -- [4]\n &quot;+1 Strength&quot;, -- [5]\n &quot;Item Level 15&quot;, -- [6]\n &quot; &quot;, -- [7]\n },\n [60003] = {\n &quot;Waterlogged Dirge&quot;, -- [1]\n &quot;Binds when picked up&quot;, -- [2]\n &quot;Two-Hand&quot;, -- [3]\n &quot;17 - 26 Damage&quot;, -- [4]\n &quot;(7.2 damage per second)&quot;, -- [5]\n &quot;+1 Strength&quot;, -- [6]\n &quot;+1 Stamina&quot;, -- [7]\n &quot;Requires Level 6&quot;, -- [8]\n &quot;Item Level 10&quot;, -- [9]\n &quot; &quot;, -- [10]\n }, \n [60004] = {\n &quot;Divining Rod&quot;, -- [1]\n &quot;Binds when picked up&quot;, -- [2]\n &quot;Ranged&quot;, -- [3]\n &quot;9 - 17 Fire Damage&quot;, -- [4]\n &quot;(8.7 damage per second)&quot;, -- [5]\n &quot;Requires Level 6&quot;, -- [6]\n &quot;Item Level 12&quot;, -- [7]\n &quot; &quot;, -- [8]\n },\n}\n</code></pre>\n<p>I cant seem to get it to sort by the ID</p>\n"^^ . "2"^^ . . "lazyvim: change default settings"^^ . . . "1"^^ . . . . "0"^^ . . "Also, it is usually more convenient to use the pocket number as a key in some table `pockets`, not a s field of a pocket table. In that case you won't need to loop over pockets, just address it: `local pocket = pockets[pocketNumber]`."^^ . . "attempt to compare Instance <= number Roblox Studio"^^ . . "2"^^ . . . "0"^^ . . . . . . . "2"^^ . . . . . . . . . "0"^^ . . . "`WHERE` is lost in `FROM fivmin_tbl WHERE time >= %d AND time < %d`"^^ . . "1"^^ . "I don't know Lua but wouldn't `line, _ = string.gsub(line, "(%S+)/(%S+)", "\\\\frac{%1}{%2}")` work?"^^ . "0"^^ . "0"^^ . "0"^^ . "Is it possible to use a variable as a field name in a lua table?"^^ . . . . . . "1"^^ . "<p>In the doc for <a href="https://www.lua.org/manual/5.4/manual.html#luaL_loadstring" rel="nofollow noreferrer"><code>luaL_loadstring</code></a>, it says:</p>\n<blockquote>\n<p>this function only loads the chunk; it does not run it.</p>\n</blockquote>\n<p>As stated in the comments, you should use <a href="https://www.lua.org/manual/5.4/manual.html#luaL_dostring" rel="nofollow noreferrer"><code>luaL_dostring</code></a> instead.</p>\n<p>Note that <code>select</code> is a preexisting function in the standard library, so the error you see is coming from a whole different function.</p>\n"^^ . "How to install Cat UI for LOVE in Lua"^^ . "remap"^^ . . . . "1"^^ . . "1"^^ . . . . . "0"^^ . "0"^^ . . . . . . "<p>i want to set keymap for lua to be sinppets for example:</p>\n<pre><code>vim.api.nvim_set_keymap(&quot;n&quot;, &quot;&lt;leader&gt;rs&quot;, &quot;:call append(line('.'), [[welcome]])&lt;CR&gt;&quot;)\n</code></pre>\n<p>and now i want to make sinppets for react component</p>\n<pre><code>const welcome = =&gt; (\n &lt;&gt;\n &lt;p&gt; welcome &lt;/p&gt;\n &lt;/&gt;\n);\nexport default welcome;\n</code></pre>\n<p>i try to make the sinppets but its not working very well:</p>\n<pre><code>--\nvim.api.nvim_set_keymap(\n &quot;n&quot;,\n &quot;&lt;leader&gt;rs&quot;,\n [[ &lt;cmd&gt;call append(line('.'), 'const welcome = () =&gt; {')&lt;CR&gt;\n &lt;cmd&gt;normal! o&lt;CR&gt;\n '\\treturn (')&lt;CR&gt;\n &lt;cmd&gt;normal! o&lt;CR&gt;\n '\\t\\t&lt;&gt;\\')&lt;CR&gt;\n &lt;cmd&gt;normal! o&lt;CR&gt;\n '\\t\\t\\twelcome')&lt;CR&gt;\n &lt;cmd&gt;normal! o&lt;CR&gt;\n '\\t\\t&lt;/&gt;\\')&lt;CR&gt;\n &lt;cmd&gt;normal! o&lt;CR&gt;\n '}\\')&lt;CR&gt;\n &lt;cmd&gt;normal! o&lt;CR&gt;\n 'export default welcome;')&lt;CR&gt; ]],\n { noremap = true, silent = true }\n)\n</code></pre>\n<p>i just want to help to know how to write remap for snippets not for react only !!</p>\n"^^ . "1"^^ . "<p>Because there's a newline behind the number it reads that the first time you do <code>io.read(&quot;*l&quot;)</code>. The <code>io.read(&quot;n&quot;)</code> only takes the number without the newline. You could make this the input to make it work</p>\n<pre><code>5Amir\nHamid\nBahar\nEmad\nMaryam\n</code></pre>\n<p>or simply do an extra <code>io.read(&quot;*l&quot;)</code> right after the <code>local memberNum = io.read(&quot;n&quot;)</code></p>\n"^^ . . . . . "Players.ilippo.PlayerGui.ScreenGui.Storage.Script:15: attempt to index nil with 'Connect'"^^ . "It is impossible to explain why some content such as "example", "main1" that does not exist in the code appears in the final result."^^ . "arrays"^^ . . "0"^^ . . . . . "logitech"^^ . . . "1"^^ . . . "0"^^ . . . . "The CatUI github has an example. It starts with `require "catui"`, that should give you a hint. You need to take the catui folder from the github download and copy the whole folder to the same directory as Lua file, or somewhere where `require` will find it."^^ . "0"^^ . . "When you press the mouse button, 1 must press the Q button and within 10 seconds must press again. But within 10 seconds the recoil does not work "repeat\n MoveMouseRelative(0,4)\n Sleep(50)""^^ . . . "Lua get array size in object"^^ . . . . . "1"^^ . . . . "4"^^ . . "Replace `PocketDetails[i].[field]` with `PocketDetails[i][field]`"^^ . "Lua does not have the `-=` operator, so you have to do `x = x - 1`. Surely you are getting a syntax error pointing at this line?"^^ . . "neovim making snippets write in lua with nvim_set_keymap"^^ . "Thank you to show my bad, I think that the format of the answer is not important until it helps or has an idea how to make the solution."^^ . "0"^^ . . "is your panel in one color? Is it on the foreground or background? You can use `GetBackgroundColor() to get a color from the window/panel..."^^ . . . . . . "-1"^^ . "0"^^ . . . . . . "0"^^ . "0"^^ . "2"^^ . . . "Sorry @shingo , It was copied from my own files which had another names. I edited and corrected the question"^^ . . . "0"^^ . . "0"^^ . . . . "<p>I suggest keeping track of all the pocket details in a larger table.</p>\n<pre><code>PocketPositions.AllPocketDetails = {}\n-- keep track of all the pocket details here\n-- can reference one of the details as 'PocketPositions.AllPocketDetails[pocketNum]'\n\nfunction PocketPositions.UpdateField(pocketNum, field, newVal)\n local theseDetails = PocketPositions.AllPocketDetails[pocketNum]\n if theseDetails == nil then\n theseDetails = {\n PocketNumber = pocketNum,\n -- other default values can go here\n }\n theseDetails[field] = newVal\n PocketPositions.AllPocketDetails[pocketNum] = theseDetails\n else\n theseDetails[field] = newVal\n end\nend\n\n</code></pre>\n"^^ . "replace"^^ . "0"^^ . . . "1"^^ . "Any scripting language would solve a scripting task :-) Lua is the most easy to embed in a C host application, but has very few ready-to-use libraries."^^ . . "1"^^ . . "<p>One regular expression is:</p>\n<pre><code>function replaceFraction(str)\n str = string.gsub(str, &quot;(%S+)/(%S+)&quot;, &quot;\\\\frac{%1}{%2}&quot;)\n return str\nend\n</code></pre>\n<p>Examples:</p>\n<pre><code>print(replaceFraction(&quot;Hello a/b hi&quot;)) -- Hello \\frac{a}{b} hi\nprint(replaceFraction(&quot;a/b hi&quot;)) -- \\frac{a}{b} hi\nprint(replaceFraction(&quot;Hello a/b&quot;)) -- Hello \\frac{a}{b}\n</code></pre>\n"^^ . "0"^^ . . . . "Lua change string using a loop"^^ . . . . . . . "0"^^ . "0"^^ . "These are the letter codes from https://en.wikipedia.org/wiki/Latin-1_Supplement and what exactly are the ranges, I can't know how to do according to yours. It can be conditionally divided into Capital `[[À-Þ]]` and Small `[[ß-ÿ]]`"^^ . . . "4"^^ . . "`trigger_events = {"InsertLeave"}` this line in config defines that plugin will only save after leaving the insert mode, this means it won't save until unless you press `esc` in `insert mode`. If the plugin is saving after pressing enter in parentheses, this maybe cause of plugin conflicts. You should check the plugin conflicts, Also check which autopairs plugin you're using."^^ . . "4"^^ . "But "a" and "å" are different letters."^^ . "nvim.cmp"^^ . "1"^^ . . . "Plot with Grafana (timeseries panel) only one "field" of a Redis Stream"^^ . . . . . . . "1"^^ . "1"^^ . "1"^^ . . . . . "We'd love to help, care to share the code that you tried?"^^ . . "fonts"^^ . . "0"^^ . . . . . . . . . "<p>The commented code with the if statement does work correctly. However,\nthe ternary does not? Why is this or how can I implement this in\none simple line?</p>\n<pre class="lang-lua prettyprint-override"><code>\nlocal function dontwork()\n local args = &quot;&quot;\n local cmd_tb = {}\n cmd_tb.args = &quot;&quot;\n\n -- dont work\n args = (#cmd_tb.args == 0 and false or cmd_tb.args)\n -- dont work\n -- args = (cmd_tb.args == &quot;&quot; and false or cmd_tb.args)\n\n-- works correctly - empty\n -- if #cmd_tb.args == 0 then\n -- args = false\n -- else\n -- args = cmd_tb.args\n -- end\n\n if args then\n print(&quot;yes:&quot;,args)\n else\n print(&quot;empty&quot;)\n end\nend\n\n-- outputs 'yes'\ndontwork()\n\n\n</code></pre>\n"^^ . . . . . . . . . . "3"^^ . . . "<p>I've recently started working with suricata and don't have much experience with it yet. What I'm looking for is, If there's a way to configure suricata to be able to detect various MITRE ATT&amp;CK techniques related to network attacks ?</p>\n<p>I don't have much knowledge about this. I do know about ET Open and ET Pro ruleset but after reading certain article I get to know that ET Open doesn't includes many attack rules and currently not able to afford for PRO. I do know about lua and how it's been used with Suricata but have no clue how it can be used here. Either I collect rules which can a large number or make rules myself based on the various techniques. Can please anyone help me with this ?</p>\n"^^ . "0"^^ . . "0"^^ . . "0"^^ . . . "1"^^ . . . "Look, neither wait() or task.wait() don't run accurately. When I input there 1/60 (1 frame at 60 fps), they instead of pausing script by ~0.0167 ms, do that twice longer, which makes my script run slow. I need to find other ways to accurately measure out time.\n\nAlso about overthinking, my goal is to make accurate, realistic ECG monitor in roblox, so that is the reason why I am bothered with accuracy of wait()"^^ . "<p>I am using ZeroBrane Studio (2.01; MobDebug 0.805) on Windows 10.</p>\n<p>How to get the color of a panel point?</p>\n<p>Select a point with the left mouse button.</p>\n<p>My MWE:</p>\n<pre><code>package.cpath = package.cpath..&quot;;./?.dll;./?.so;../lib/?.so;../lib/vc_dll/?.dll;../lib/bcc_dll/?.dll;../lib/mingw_dll/?.dll;&quot;\nrequire(&quot;wx&quot;)\n\nframe = wx.wxFrame(wx.NULL, wx.wxID_ANY, &quot;How tom use GetPixel?&quot;, wx.wxDefaultPosition, wx.wxSize(450, 450), wx.wxDEFAULT_FRAME_STYLE)\n\npanel = wx.wxPanel(frame, wx.wxID_ANY)\n\nfunction OnLeftUp(event)\nlocal point = { x = event:GetX(), y = event:GetY() }\nlocal pdc = wx.wxClientDC(panel)\n-- local colour = pdc:GetPixel(point.x, point.y) -- This line results in an error\n pdc:DrawText(&quot;Left mouse button UP at x = &quot; .. tostring(point.x) .. &quot; y = &quot; .. tostring(point.y), point.x, point.y)\n-- pdc:DrawText(&quot;Left mouse button UP at x = &quot; .. tostring(point.x) .. &quot; y = &quot; .. tostring(point.y) .. &quot; Red = &quot; .. tostring(colour:GetRed()), point.x, point.y) -- This line results in an error\n pdc:delete()\nend\n\npanel:Connect(wx.wxEVT_LEFT_UP, OnLeftUp)\n\nlocal sizer = wx.wxBoxSizer(wx.wxVERTICAL)\nsizer:Add(panel, 1, wx.wxEXPAND)\nframe:SetSizer(sizer)\n\nframe:SetAutoLayout(true)\nwx.wxGetApp():MainLoop()\n</code></pre>\n<p><a href="https://i.sstatic.net/vqRZe.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vqRZe.jpg" alt="enter image description here" /></a></p>\n<p>I tried to use GetPixel but it gives an error:</p>\n<p><a href="https://i.sstatic.net/sbTbs.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/sbTbs.jpg" alt="enter image description here" /></a></p>\n"^^ . "1"^^ . . . "indexing"^^ . . . "2"^^ . . . "4"^^ . . . . "<p>I'm working on a project where you can be transported to an instructions page.</p>\n<p>I am using a site called tutorialspoint and I am on Windows 10.</p>\n<p>I need to be able the clear the terminal for a project, Is there a way to?</p>\n<p>I tried a few commands like os.execute(&quot;clear&quot;) but it didn't work.</p>\n"^^ . . . "port-scanning"^^ . . . . . "<p>This is a common pitfall.</p>\n<p><code>cond and a or b</code> is <em>not</em> a ternary. It's just <code>(cond and a) or b</code>, which, due to lazy evaluation, behaves <em>almost</em> like a ternary:</p>\n<ul>\n<li>If <code>cond</code> is truthy, <code>cond and a</code> evaluates to <code>a</code>. If <code>a</code> is truthy, <code>a or b</code> then evaluates to <code>a</code>.</li>\n<li>If <code>cond</code> is falsey, <code>cond and a</code> evaluates to <code>cond</code>, so <code>cond or b</code> evaluates to <code>b</code>.</li>\n</ul>\n<p>The problem is that if <code>a</code> is falsey (<code>nil</code> or <code>false</code>), then <code>a or b</code> evaluates to <code>b</code>, when it should evaluate to <code>a</code>.</p>\n<p>In your case, since <code>b</code> is truthy (<code>nil</code> and <code>false</code> don't support <code>#</code>, unless you mess with debug metatables), you could just negate your condition and swap <code>a</code> and <code>b</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>args = #cmd_tb.args ~= 0 and cmd_tb.args or false\n</code></pre>\n<p>The <code>or false</code> is not necessary in this case, since <code>#cmd_tb.args ~= 0</code> will already evaluate to <code>false</code>. It may be necessary if your condition could be <code>nil</code>; <code>or nil</code> is also sometimes useful when you want <code>nil</code> rather than a boolean, but your condition produces a boolean.</p>\n<p>PS: I would test for the empty string using <code>~= &quot;&quot;</code> / <code>== &quot;&quot;</code> respectively. It is clearer than comparing <code>#x</code> against <code>0</code>.</p>\n"^^ . . "1"^^ . "2"^^ . . . "c-api"^^ . "0"^^ . . . "0"^^ . . "2"^^ . "0"^^ . "Forgot to mention, the code does work, it only returns "true" though. Might help you solve this."^^ . . . "0"^^ . "1"^^ . . "4"^^ . . . "0"^^ . . . "Writing a protocol dissector with Lua does not autocomplete the Proto class"^^ . "0"^^ . "First, JCL does have some of those capabilities, and second, JCL isn't a scripting language. REXX is a scripting language. JCL is much more analogous to a CLI for z/OS, where you're specifying a program to run, various arguments to the program, and information about what data to run the program against. There's some amount of macro/symbol capability."^^ . . . . . . . "0"^^ . . "0"^^ . . "0"^^ . . "2"^^ . "Does this answer your question? [My script is not working and its giving me this specific error "Players.73737s2.PlayerScripts.LocalScript:4: attempt to index nil with 'Humanoid'"](https://stackoverflow.com/questions/74434028/my-script-is-not-working-and-its-giving-me-this-specific-error-players-73737s2)"^^ . . . "<p>I am currently using openresty nginx to proxy requests to an origin. I want to escape any unsafe characters in the uri of the request.\nBasically, I am looking for a lua equivalent for the <code>encodeURI()</code> javascript function.</p>\n<p>Is there a method in Lua, similar to encodeURI() in JS?</p>\n<p>I have looked at <code>ngx.escape_uri</code>, but this function only escapes a URI component.</p>\n<p>I want the uri <code>/test/[hello]</code> to become <code>/test/%5Bhello%5D</code> after encoding the URI.\nIf I do <code>encodeURI(&quot;/test/[hello]/&quot;);</code> in JS, I get the desired output which is <code>/test/%5Bhello%5D</code>.</p>\n<p>But, in Lua, if I do <code>ngx.escape_uri(&quot;/test/[hello]/&quot;)</code>, I get the output as '%2Ftest%2F%5Bhello%5D'.</p>\n"^^ . "0"^^ . "1"^^ . . . "How to make a ServerScript wait for a LocalScript to fire a RemoteEvent"^^ . "<p>Idk why the <code>orestring</code> don't change <a href="https://i.sstatic.net/YGFIs.png" rel="nofollow noreferrer"></a>\nwhen I write in script print(Orestring.Value) it normally works, it says that what should be in <code>orestring</code> but the <code>orestring</code> don't change</p>\n<pre><code>local proximityprompt = game.Workspace.Tycoons.Tycoon.MainItems.Cardboard_Box.Box.ProximityPrompt\nlocal StorageGui = script.Parent\nlocal x = script.Parent.Storage.Frame.X\n\nlocal Orebuttons = script.Parent.Storage.Frame.Ores:GetChildren()\nlocal OreString = script.Parent.Parent.Sell.Frame.Ore\n\nproximityprompt.Triggered:Connect(function()\n\n StorageGui.Visible = true\nend)\nx.MouseButton1Click:Connect(function()\n StorageGui.Visible = false\nend)\nfor _, button: GuiButton in pairs(Orebuttons) do\n if button:IsA(&quot;GuiButton&quot;) then\n button.MouseButton1Click:Connect(function()\n\n OreString.Value = button.Name\n end)\n end\nend\n</code></pre>\n"^^ . "1"^^ . . . . . . . . "luau"^^ . "1"^^ . . . . . . . . "0"^^ . . "0"^^ . . . . "0"^^ . "How to make toggle key to switch between two seperate functions lua script(logitech)"^^ . . "You can likely checking the `OreString.Value` wrong if the print works fine, please provide the script that handles `OreString.Value`."^^ . . . . . . . "0"^^ . . "0"^^ . . . . . . "Is there a way to split a string and preserve spaces in lua?"^^ . . . . "process-control"^^ . . "1"^^ . . . . . "<p>I'm not sure but try adding the opts directly, something like below, according to your own provided code.</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n {\n &quot;mfussenegger/nvim-jdtls&quot;,\n opts = function(opts)\n local root_dir = {{'.git', 'mvnw', 'gradlew'}}\n table.insert(opts.root_dir, root_dir)\n\n return opts\n end,\n },\n}\n</code></pre>\n"^^ . . . . "<p>I agree with @darkfrei, you seem to overcomplicate things. This is much simpler and works:</p>\n<pre><code>local MAP = {\n [&quot;&amp;red&quot;] = &quot;#FF0000&quot;,\n [&quot;&amp;blue&quot;] = &quot;#4C9FFF&quot;,\n [&quot;&amp;purple&quot;] = &quot;#C33AFF&quot;,\n [&quot;&amp;green&quot;] = &quot;#53FF4A&quot;,\n [&quot;&amp;gray&quot;] = &quot;#E2E2E2&quot;,\n [&quot;&amp;black&quot;] = &quot;#000000&quot;,\n [&quot;&amp;white&quot;] = &quot;#FFFFFF&quot;,\n [&quot;&amp;pink&quot;] = &quot;#FB8DFF&quot;,\n [&quot;&amp;orange&quot;] = &quot;#FF8E1C&quot;,\n [&quot;&amp;yellow&quot;] = &quot;#FAFF52&quot;,\n --TODO Add Colors\n}\n\nfunction colorate(text)\n assert(text and type(text) == &quot;string&quot;)\n\n local result = text\n \n for k,v in pairs(MAP) do\n result = result:gsub(k, v)\n end\n\n return result\nend\n\nlocal text = &quot;&amp;whiteHello&amp;white World Hello &amp;greenWorld&quot;\nprint(colorate(text))\n-- Output: #FFFFFFHello#FFFFFF World Hello #53FF4AWorld\n</code></pre>\n"^^ . "0"^^ . . "<p>In Lua 5.3, I have a table <code>t1</code> in which there is only a table, the latter table consisting only of a key <code>[key]</code> pointing to the value <code>1</code>.</p>\n<pre><code>t1 = {{key = 1}}\n</code></pre>\n<p>My goal is to copy and insert the inner table to an empty second table <code>t2</code>, and then ONLY manipulate the values of the table inside t2. However, when trying to do so with the code below, the table in the table t1 is also affected, which is not wanted. I am guessing this is because <code>{key = 1}</code> is a table that in both t1 and t2 is pointing to the same place in memory, which is undesired. What is a recommended way to avoid this?</p>\n<p>Thanks in advance.</p>\n<pre><code>local t1 = {{key = 1}}\nlocal t2 = {}\ntable.insert(t2,t1[1])\nt2[1].key = t2[1].key + 1\nprint(t1[1].key, t2[1].key)\n</code></pre>\n<p>Result:</p>\n<pre><code>2 2\n</code></pre>\n<p>Expected:</p>\n<pre><code>1 2\n</code></pre>\n"^^ . . . "3"^^ . . . . . "<p>Hi there guys how can I make a string change its value randomly or based on a list of names?</p>\n<p>The script I have only changes from one string to another one. Here's my code:</p>\n<pre><code>local string_to_find = 'o(*_*)o'\nlocal string_to_write = '^1o(*_*)o'\n\nms = createMemScan()\nms.firstScan(soExactValue, vtString, 0, string_to_find, &quot;&quot; , 0, 0xffffffffffffffff, &quot;&quot;, fsmNotAligned, &quot;1&quot;, false, false, false, false)\nms.waitTillDone()\n\nf=createFoundList(ms);\nf.initialize();\n\nresultToWrite = stringToByteTable(string_to_write .. string.char(0))\n\nfor i = 0, f.Count - 1 do\nwriteString(f.Address[i], string_to_write)\nwriteBytes((&quot;0x&quot; .. f.Address[i]) + 4, 0)\nend\n\nf.destroy()\nms.destroy()\n</code></pre>\n<p>Thanks in advance!</p>\n<p>I was trying to change a string.</p>\n"^^ . "mitre-attck"^^ . . . "1"^^ . . . "0"^^ . "0"^^ . "<p><code>db:exec [[CREATE TABLE IF NOT EXISTS fivmin_tbl (id INTEGER PRIMARY KEY, IDNo TEXT, time TIME, date DATE, A0 FLOAT, A1 FLOAT, A2 FLOAT, A3 FLOAT, tipper INTEGER, voltage FLOAT)]</code>]</p>\n<p>I created the table above and if I want to read the Maximum and Minimum values for A0, A1, A2 and A3, and their respective timestamps from the above table. How do I do that using SQLite3</p>\n<p>I tried the following based on the code I got from the net.</p>\n<pre><code>local query = string.format([[SELECT MIN(A0) AS min_valueA0, MAX(A0) AS max_valueA0, \n MIN(A1) AS min_valueA1, MAX(A1) AS max_valueA1,\n MIN(A2) AS min_valueA2, MAX(A2) AS max_valueA2, \n MIN(A3) AS min_valueA3, MAX(A3) AS max_valueA3,\n MIN(time) AS min_time, MAX(time) AS max_time FROM fivmin_tbl time &gt;= %d AND time &lt; %d]], StartDate, FinishtDate)\n</code></pre>\n<p>The Max and Min values need to be between StartDate and FinishtDate</p>\n<pre><code>local stmt = db:prepare(query)\nlocal result = stmt:step()\n</code></pre>\n<p>stmt statement above cause an error</p>\n<p>How do I change the code to make it work?</p>\n"^^ . . . . . "1"^^ . . . "0"^^ . "0"^^ . "1"^^ . . . . . "0"^^ . . "Thanks. I suppose this ends up being functionally the same as `[[À-ÿ]]` or `[[Ā-Í]]` respectively?"^^ . "1"^^ . "<pre><code>-- game.ServerScriptService.Modules.PlayerData\nrequire(script.Parent.DataManager)\n</code></pre>\n"^^ . . . . "4"^^ . "0"^^ . . "1"^^ . "2"^^ . . "3"^^ . "0"^^ . . . "String not changing"^^ . "It seems like the character variable is nil. How was that variable defined?"^^ . "0"^^ . . . . "2"^^ . "<p>I will suggest how to make a set of some characters from additional Latin letters - 1. By analogy, you can make sets for the necessary sets (Latin Extended A,B,C,D,E).</p>\n<pre><code>------------------------ just generate set Latin-1 Supplement\nlocal set = &quot;&quot;\nfor x = 0x80, 0xBF do\n set = set .. string.char(&quot;0xC3&quot;, string.format(&quot;0x%x&quot;,x) ) \nend\nprint(set)\n--------------------------\n\n--- get it from print above\nlocal ex = [[ÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ]]\n\n-- By analogy you can get Extended Latin A:\n-- local ext_latin_A = [[ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſÍ]]\n\ntag = &quot;språk&quot;\n\nprint(&quot;-----&quot;)\nprint( tag:match(&quot;[%w&quot;.. ex ..&quot;]+&quot;) )\n</code></pre>\n"^^ . . . . "https://stackoverflow.com/questions/67471149/how-do-i-fix-infinite-yield-possibility"^^ . . "<p>I have a table defined like so:</p>\n<pre class="lang-lua prettyprint-override"><code>local foo =\n{\n bar =\n {\n { ['baz'] = &quot;A sample string&quot;, ['qux'] = 128 },\n },\n}\n</code></pre>\n<p>Obviously, the is a small part of a much larger algorithm. I'm having trouble referencing the first entry in table <code>bar</code>.</p>\n<pre class="lang-lua prettyprint-override"><code>print(&quot;foo.bar&quot;, &quot;type&quot;, type(foo.bar), &quot;value&quot;, foo.bar)\nprint(&quot;foo.bar.first&quot;, &quot;type&quot;, type(foo.bar[0]), &quot;value&quot;, foo.bar[0])\n</code></pre>\n<p>If I try a simple print, like shown above, the second print outputs <code>nil</code> for type and value.</p>\n<pre class="lang-lua prettyprint-override"><code>foo.bar type table value table: 000001DF39D19D20\nfoo.bar.first type nil value nil\n</code></pre>\n<p>FYI, if I put it in a loop using the <code>pairs()</code> or <code>ipairs()</code> functions, I can get at the <code>baz</code> and <code>qux</code> members without any problem, but I'd prefer not to us a loop here. Is this possible? How may I reference the first entry in a keyless table without looping?</p>\n"^^ . . "0"^^ . . . . . "Please [edit✏️] to paste the text used in the image into your question so that it can be read on all devices, quoted, edited, and found through search. As it stands now, [your image makes it hard to answer‍ your question or for people with related issues to find your question](//meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question). See the [formatting documentation](/editing-help) for tips to make your text appear nicely without resorting to images."^^ . "2"^^ . . . . . . . . "0"^^ . "Thanks @shingo. The manual explains scoping in lua very well. but I still couldn't figure out what could be the use of having a **global variable** and an **in-file global** (I mean, declared as *local* but not bound to any specific block in a file) with the same name. Because when I **re-**declare a variable as *local* , I can no longer access to it's *global* instance (With My current knowledge of lua) , just like "module.lua* in my question."^^ . . . "1"^^ . . . . . . . "1"^^ . . "Backpack for roblox simulator game"^^ . "0"^^ . . "0"^^ . . . . . "<h1>12.7 - 20 + 7.3 = -8.8817841970013e-016</h1>\n<p>I got this problem when I read Programming in Lua book, and I cannot figure it out how to get zero as the result of the calculation.</p>\n<p>When I formatted the result to a float:</p>\n<p><code>io.write(string.format(&quot;%f&quot;, 12.7 - 20 + 7.3)) -- -0.000000</code></p>\n<p>But I got nil if I tried to convert it to an integer:</p>\n<p><code>io.write(math.tointeger(12.7 - 20 + 7.3) -- nil</code></p>\n<p>Is there any explaination why the result turned like this? And how to achieve the result as zero?</p>\n<p>I've tried seperate the calculation as two different variables.</p>\n<pre><code>local x = 12.7 - 20\nlocal y = 7.3\n\nio.write(x + y)\n</code></pre>\n<p>And turned out, it doesn't happen in other float calculations.</p>\n<pre><code>io.write(3.7 - 13 + 9.3) -- 0.0\nio.write(14.4 - 31 + 16.6) -- 0.0\n</code></pre>\n<p>And also it doesn't happen with -7.3 + 7.3. The result is 0.0.</p>\n<p>When I think the problem just occured with <strong>12.7 - 20 + 7.3</strong>, I got this result:</p>\n<pre><code>local x = 14.7 - 20\nlocal y = 5.3\n\nio.write(x + y) -- -8.8817841970013e-016\n</code></pre>\n<p>Any calculation with 7.3 and below doesn't return 0.0:</p>\n<pre><code>io.write(12.7 - 20 + 7.3)\nio.write(13.7 - 20 + 6.3)\nio.write(14.7 - 20 + 5.3)\nio.write(15.7 - 20 + 4.3)\n</code></pre>\n<p>But, when it is 8.3, it returns 0.0: <code>io.write(11.7 - 20 + 8.3) -- 0.0</code></p>\n"^^ . . . . "Try my [lmathx](https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/#lmathx) library."^^ . . "0"^^ . "Is there a way to execute command from array with "for do"?"^^ . . "0"^^ . . . . . "memory"^^ . . . . "Which version of premake5 do you use? (shell type detection has changed in master branch)."^^ . . . . . . . "2"^^ . . . "1"^^ . . . . . "1"^^ . "0"^^ . "<p>I have two parabolas defined by their respective focuses ((fx1, fy1) and (fx2, fy2)), and a common directrix dirY.</p>\n<p>I need to find the intersection point of these two parabolas with given height of intersection (y).</p>\n<p>I have very long solution, but is here a way to make it shorter, without a, b, c?</p>\n<pre class="lang-lua prettyprint-override"><code>local function twoParabolasCrossByHeight (fx1, fy1, fx2, fy2, dirY, y)\n local f1 = math.abs(dirY-fy1)/2\n local f2 = math.abs(dirY-fy2)/2\n\n if fy1 == fy2 then\n return (fx1+fx2)/2, y\n end\n local a1 = -1/(4*f1)\n local a2 = -1/(4*f2)\n local b1 = -2*fx1*a1\n local b2 = -2*fx2*a2\n local c1 = fx1*fx1*a1 + fy1 + f1\n local c2 = fx2*fx2*a2 + fy2 + f2\n local a = a1-a2\n local b = b1-b2\n local c = c1-c2\n\n local d = b*b-4*a*c\n if d &lt; 0 then return end\n local x1 = (-b-math.sqrt (d))/(2*a)\n local y1 = a1*x1*x1 + b1*x1 + c1\n return x1, y1\nend\n</code></pre>\n<p>Two examples:</p>\n<pre class="lang-lua prettyprint-override"><code> -- must be 400 50:\nprint (twoParabolasCrossByHeight (250, 250, 550, 250, 300, 50))\n\n -- must be aprox. 400 50:\nprint (twoParabolasCrossByHeight (250, 250, 550, 251, 300, 50))\n</code></pre>\n<p><a href="https://i.sstatic.net/ewDSx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ewDSx.png" alt="Two Parabolas and Line Crossing" /></a></p>\n"^^ . "<p>Because</p>\n<blockquote>\n<p>Assignment, parameter passing, and function returns always manipulate\nreferences to such values; these operations do not imply any kind of\ncopy.</p>\n</blockquote>\n<p><a href="https://www.lua.org/manual/5.3/manual.html#2.1" rel="nofollow noreferrer">https://www.lua.org/manual/5.3/manual.html#2.1</a></p>\n"^^ . . . . "0"^^ . "<p>So the game after the intro it switches the camera to 1st person by enabling the 1st person script:</p>\n<p>Part of the intro script that turns on the 1st person:</p>\n<pre><code>v.MouseButton1Click:Connect(function()\n script.Light:Play()\n imgout:Play()\n bout:Play()\n\n g.Visible = false\n gOL.Visible = true\n \n wait(1)\n grin:Play()\n \n \n --Function\n \n wait(2)\n local evt = script.Parent.Parent.Parent.FireMenu\n script.Parent.Parent.Parent.FireMenu.Value = false\n b.MainMenuHandler:Destroy()\n cuc.CameraType = Enum.CameraType.Custom\n game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson\n b.Parent.Parent.Parent.Parent[&quot;Camera Bobble&quot;].Enabled = true\n game.Players.LocalPlayer.Character.PrimaryPart.CFrame = workspace.SpawnRoomPlay.CFrame\n game.Players.LocalPlayer.Character.PrimaryPart.Anchored = false\n logo.Visible = false\n wait(2)\n grout:Play()\n grout.Completed:Once(function()\n b.Parent:Destroy()\n end) \nend)\n</code></pre>\n<p>This is the &quot;Camera Bobble&quot;/1st Person Script:</p>\n<pre><code>-- &lt;&lt; Variables &gt;&gt; --\n\nlocal Player = game:GetService(&quot;Players&quot;).LocalPlayer\nlocal Mouse = Player:GetMouse()\nlocal Camera = game:GetService(&quot;Workspace&quot;).CurrentCamera\nlocal UserInputService = game:GetService(&quot;UserInputService&quot;)\nlocal Character = Player.Character\nlocal Humanoid = Character:WaitForChild(&quot;Humanoid&quot;)\nlocal bobbing = nil\nlocal func1 = 0\nlocal func2 = 0\nlocal func3 = 0\nlocal func4 = 0\nlocal val = 0\nlocal val2 = 0\nlocal int = 10\nlocal int2 = 10\nlocal vect3 = Vector3.new()\n\n-- &lt;&lt; Functions &gt;&gt; --\n\nUserInputService.MouseIconEnabled = true\n\nfunction lerp(a, b, c)\n return a + (b - a) * c\nend\n\n\nHumanoid.CameraOffset = Vector3.new(0,-0.1,-0.725)\nCamera.FieldOfView = 90\n\nbobbing = game:GetService(&quot;RunService&quot;).RenderStepped:Connect(function(deltaTime)\n \n deltaTime = deltaTime * 60\n if Humanoid.Health &lt;= 0 then\n bobbing:DisConnect()\n return\n end\n local rootMagnitude = Humanoid.RootPart and Vector3.new(Humanoid.RootPart.Velocity.X, 0, Humanoid.RootPart.Velocity.Z).Magnitude or 0\n local calcRootMagnitude = math.min(rootMagnitude, 50)\n if deltaTime &gt; 3 then\n func1 = 0\n func2 = 0\n else\n func1 = lerp(func1, math.cos(tick() * 0.5 * math.random(10, 15)) * (math.random(5, 20) / 200) * deltaTime, 0.05 * deltaTime)\n func2 = lerp(func2, math.cos(tick() * 0.5 * math.random(5, 10)) * (math.random(2, 10) / 200) * deltaTime, 0.05 * deltaTime)\n end\n Camera.CFrame = Camera.CFrame * (CFrame.fromEulerAnglesXYZ(0, 0, math.rad(func3)) * CFrame.fromEulerAnglesXYZ(math.rad(func4 * deltaTime), math.rad(val * deltaTime), val2) * CFrame.Angles(0, 0, math.rad(func4 * deltaTime * (calcRootMagnitude / 5))) * CFrame.fromEulerAnglesXYZ(math.rad(func1), math.rad(func2), math.rad(func2 * 10)))\n val2 = math.clamp(lerp(val2, -Camera.CFrame:VectorToObjectSpace((Humanoid.RootPart and Humanoid.RootPart.Velocity or Vector3.new()) / math.max(Humanoid.WalkSpeed, 0.01)).X * 0.08, 0.1 * deltaTime), -0.35, 0.2)\n func3 = lerp(func3, math.clamp(UserInputService:GetMouseDelta().X, -5, 5), 0.25 * deltaTime)\n func4 = lerp(func4, math.sin(tick() * int) / 5 * math.min(1, int2 / 10), 0.25 * deltaTime)\n if rootMagnitude &gt; 1 then\n val = lerp(val, math.cos(tick() * 0.5 * math.floor(int)) * (int / 200), 0.25 * deltaTime)\n else\n val = lerp(val, 0, 0.05 * deltaTime)\n end\n if rootMagnitude &gt; 12 then\n int = 20\n int2 = 18\n elseif rootMagnitude &gt; 0.1 then\n int = 12\n int2 = 14\n else\n int2 = 0\n end\n\n Player.CameraMaxZoomDistance = 0.5\n Player.CameraMinZoomDistance = 0.5\n vect3 = lerp(vect3, Camera.CFrame.LookVector, 0.125 * deltaTime)\nend)\n</code></pre>\n<p>This part of the script from a part of the game that when the proximity prompt is triggered it disables the 1st person and enables the top down view/3rd person script and teleport the player outside:</p>\n<pre><code>ev_act.Triggered:Connect(function(plr)\n local char = plr.Character\n char.PrimaryPart.Anchored = true\n k.Parent.Visible = true\n fadein:Play()\n fadein.Completed:Connect(function()\n plr.CameraMode = Enum.CameraMode.Classic\n script3d.Enabled = true\n script1s.Enabled = false\n local sfx = script[&quot;Dumbwaiter 2 (SFX)&quot;]\n local bell = script[&quot;Elevator Bell&quot;]\n loading.Visible = true\n loading.TextLabel.Text = &quot;waiting...&quot;\n sfx:Play()\n sfx.Ended:Connect(function()\n char.PrimaryPart.CFrame = workspace.Outside.CFrame\n char.PrimaryPart.Anchored = false\n loading.TextLabel.Text = &quot;done.&quot;\n bell:Play()\n wait(0.5)\n loading.Visible = false\n fadeout:Play()\n fadeout.Completed:Connect(function()\n k.Parent.Visible = false\n end)\n end)\n end)\nend)\n</code></pre>\n<p>This is the 3rd person script:</p>\n<pre><code>local function updateCamera()\n local character = game.Players.LocalPlayer.Character\n if character then\n local rootPart = character:FindFirstChild(&quot;HumanoidRootPart&quot;)\n if rootPart then\n -- Calculate camera position\n local cameraPosition = rootPart.Position + Vector3.new(0, 10, 10)\n workspace.Camera.CFrame = CFrame.lookAt(cameraPosition,rootPart.Position)\n -- Set camera CFrame\n game.Workspace.CurrentCamera.CFrame = CFrame.new(cameraPosition, rootPart.Position)\n end\n end\nend\n\ngame:GetService(&quot;RunService&quot;).RenderStepped:Connect(updateCamera)\n\n</code></pre>\n<p>And this is what happens after the player is teleported outside and in 3rd person mode:\n<a href="https://i.sstatic.net/ZAtFN.png" rel="nofollow noreferrer">Player cannot be seen</a></p>\n<p>I want the player to be visible.</p>\n"^^ . . . . "0"^^ . "0"^^ . . "0"^^ . . "I tried it with its default configurations as mentioned above, and the plugin still saves the file when I press enter inside any parentheses"^^ . . . "0"^^ . "2"^^ . "0"^^ . . "<p>I'm trying to create a snippet for vimwiki. The snippet must change <code>__</code> to current time.</p>\n<pre class="lang-lua prettyprint-override"><code>local line_begin = require(&quot;luasnip.extras.expand_conditions&quot;).line_begin\nreturn {\n s(\n {trig='__', desc=&quot;Insert current time&quot;, snippetType = &quot;autosnippet&quot;},\n {t(&quot;_&quot;), t(vim.fn.system([[date +&quot;%H:%M&quot; | tr -d '\\n']])), t({'_', ''})},\n {condition = line_begin}\n ),\n}\n</code></pre>\n<p>Looks like it must work, but it past only fix time - the time of start of first vimwiki buffer. How to improve the snippet?</p>\n<p>I tried to find in documentation how to do this, but have not find any solution.</p>\n"^^ . "0"^^ . "0"^^ . . . . "string"^^ . . "<p>So I was wondering how possible it is to reformat a single string in a specific way with dashes depending on the number and letter combination positions. I'm working on a script for a game that handles license plates but it does not add dashes. I would like to format the string on the basis of numbers and letters the way License Plates are handled in the Netherlands. For example</p>\n<p>if the license plate is 91FKTG it will format it to 91-FK-TG, if the plate is GB000T it will reformat to GB-000-T.</p>\n<p>So the formatting would have to be done on how it detects the combination. Current combinations are</p>\n<p>9 = number obviously, X = letter</p>\n<ol>\n<li>99-XX-XX</li>\n<li>99-XXX-9</li>\n<li>9-XXX-99</li>\n<li>XX-999-X</li>\n<li>X-999-XX</li>\n</ol>\n<p>How would I go around detecting it in LUA, and have it properly dash based on what it detects? Is it even doable?</p>\n<p>I have no idea on how to approach this as I'm still a novice in LUA. Any help would be appreciated</p>\n"^^ . "The fact that you are using whitespace boundaries makes it clear you do not even need to check for whitespaces before/after the match and for the start/end of string. Simply use `string.gsub(line, "(%S+)/(%S+)", "\\\\frac{%1}{%2}")`"^^ . "3"^^ . "0"^^ . . . . . . "0"^^ . . "packet"^^ . . . "0"^^ . . . . . . . . . "1"^^ . "nginx"^^ . . . . "1"^^ . "0"^^ . . . "MongoDB: Check if a value is true or false in a collection"^^ . . . . "1"^^ . . "Which shell do you use? Does `mkdir nonExistingDir/tmp` works is that shell? Does `mkdir -p nonExistingDir/tmp` (`-p` added) works is that shell?"^^ . . "1"^^ . . . . . . . "0"^^ . . "failed to load builtin eslint_d for method diagnostics"^^ . . "2"^^ . . . . "<p>I have the following, although it does not seem any error on me, nor to AI I get the following error:</p>\n<pre class="lang-c prettyprint-override"><code>int main(void) {\nint res;\nlua_State *L = luaL_newstate();\nluaL_openlibs(L);\n\nconst char *luaCode = &quot; function select(xx) \\\n if (xx ~= nil and type(xx) == 'table') then \\ \n local y = 0 \\\n for i = 1, #xx do \\\n y = y + xx[i] \\\n end \\\n return y \\\n end \\\n end &quot;;\n\nres = luaL_loadstring(L, luaCode);\nif (res != LUA_OK) {\n printf(&quot;Error loading select function: %s\\n&quot;, lua_tostring(L, -1));\n lua_close(L);\n exit(1);\n}\n\nlua_getglobal(L, &quot;select&quot;);\nif (!lua_isfunction(L, -1)) {\n printf(&quot;Error: select is not a function.\\n&quot;);\n lua_close(L);\n exit(1);\n}\n\nlua_newtable(L); // Create a new Lua table\n\nfor (int i = 1; i &lt;= 3; ++i) {\n lua_pushinteger(L, i);\n lua_pushinteger(L, i);\n lua_settable(L, -3);\n}\n\nres = lua_pcall(L, 1, 1, 0); // Pass the table to the select function\nif (res != LUA_OK) {\n printf(&quot;Error running code: %s\\n&quot;, lua_tostring(L, -1));\n lua_close(L);\n exit(1);\n}\n\nif (lua_isinteger(L, -1)) printf(&quot;%d\\n&quot;, (int)lua_tointeger(L, -1));\nelse if (lua_isnumber(L, -1)) printf(&quot;%f\\n&quot;, lua_tonumber(L, -1));\n\nlua_close(L);\nexit(0);\n}\n</code></pre>\n<p>I get Error running code: <strong>bad argument #1 to 'select' (number expected, got table)</strong>\nShould i add anything in lua code to execute? Is it just sthing else i have to do on Stack?</p>\n"^^ . "What are JCL Alternitives for Embeded Applications?"^^ . . . "1"^^ . . . . . "0"^^ . . . . "1"^^ . . "0"^^ . . . "0"^^ . "0"^^ . . "1"^^ . "0"^^ . . . . "For given Aand B points and tangent line, defined as T points, build the circle G, that goes through A and B and tangent to the line T. So first find the intersection point P for AB and T1T2. Than find tangent lines from P to circle between AB. It gives radius PD, find point E with this radius on line T. And just make circle with points A,B, E."^^ . . . "1"^^ . . . "plugins"^^ . . "0"^^ . "2"^^ . . . . "1"^^ . . "In the general case, when table is not necessarily an array, you can call `next` to return the first pair of key / Value (but which one you get is **unspecified**)"^^ . . . . . "1"^^ . . . . "Making A Roblox Time Trial Obby and can't seem to make a timer in my format"^^ . . "0"^^ . "1"^^ . . . . "Can you use os.clock()? Can you store this value+cooldownTime in cube?"^^ . "0"^^ . . "It occurred to me that it's possible `Sanity.Value` is another type (table or userdata) and luau allows you to override the `-=` metaevent. In that case this may be detecting a bug with the metaevent they've implemented, but this is a lot of guesswork."^^ . . "0"^^ . . . . "I'm not sure I understand what you're doing: if you have only two points and a tangent line, can you first explain how you would turn those into one or two circles before diving into your code? Because your post is missing the explanation for the construction, which means there is no way to tell whether your code even does what you think it should be doing."^^ . . . . . . . "0"^^ . . "1"^^ . "0"^^ . "0"^^ . "Is this the actual code? I tried it and it printed 1,2,3,4 as expected. What compiler are you using?"^^ . . "Thank you very much!\nYes, this code works.\nHowever, I tried to write this code without using a loop because I feel that using a loop may slightly decrease the execution speed."^^ . . "1"^^ . . "0"^^ . . . . . . "Nvim-cmp throwing error when expanding snippets"^^ . . "<p><code>ngx.escape_uri</code> has an option to escape a full URI:</p>\n<blockquote>\n<p>syntax: newstr = ngx.escape_uri(str, type?)</p>\n</blockquote>\n<blockquote>\n<p>Since v0.10.16, this function accepts an optional type argument. It accepts the following values (defaults to 2):</p>\n<p><strong>0: escapes str as a full URI.</strong> [...]</p>\n<p>2: escape str as a URI component. [...]</p>\n</blockquote>\n<p>Nonetheless, <code>ngx.escape_uri(str, 0)</code> is still not the same as <code>encodeURI</code>.</p>\n<p>Fortunately, it's easy to write your own function that produce exactly the same output as <code>encodeURI</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>local function _encode_uri_char(char)\n return string.format('%%%0X', string.byte(char))\nend\n\nlocal function encode_uri(uri)\n return (string.gsub(uri, &quot;[^%a%d%-_%.!~%*'%(%);/%?:@&amp;=%+%$,#]&quot;, _encode_uri_char))\nend\n</code></pre>\n<pre class="lang-lua prettyprint-override"><code>-- prints /test/%5Bhello%5D/\nngx.say(encode_uri('/test/[hello]/')) \n</code></pre>\n<p>The <code>encode_uri</code> function escapes all characters except:</p>\n<pre><code>A–Z a–z 0–9 - _ . ! ~ * ' ( )\n\n; / ? : @ &amp; = + $ , #\n</code></pre>\n<p>as it described <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI" rel="nofollow noreferrer">here</a>.</p>\n"^^ . "0"^^ . "`function df(x, a, b, c) return (x-a) / (b-x) end` is wrong: must be `function df(x, a, b, c) return (x-a) / (b-c) end`"^^ . . "ah, good typo find. Fixed in the post."^^ . "0"^^ . . . . "1"^^ . . . . . . . . "This is explained in the section "Chunks", you can understand that the file itself is also a block."^^ . "Can you show us how you set the variable character as that is where the error seems to lie"^^ . "4"^^ . . "Lacking context or Roblox experience, but it seems that the local variable `sanity` will just be a number that is no longer connected to the player after you read it. Maybe you would be able to do `plr.Sanity.Value = sanity` or something similar after changing it."^^ . . . "<p>If you use Windows:</p>\n<pre><code>os.execute(&quot;cls&quot;)\n</code></pre>\n<p>On Unix:</p>\n<pre><code>os.execute(&quot;clear&quot;)\n</code></pre>\n<p>but I do recommend you read it: <a href="https://pt.stackoverflow.com/questions/467184/como-limpar-o-que-j%C3%A1-foi-escrito-no-terminal-em-lua">post</a></p>\n"^^ . "0"^^ . "Lua Scritp to detect Nmap scan"^^ . "0"^^ . "1"^^ . . "Hi, I am using a custom module made by another developer called "Rongo", since Roblox Lua doesn't support MongoDB natively. This does not work for me, I think it has something to do with my module."^^ . "Nitpick: `condition and false` may evaluate to `nil` instead of `false` if `condition` is `nil`."^^ . "0"^^ . . . "Hey, thanks for the reply. Since, the following characters `; / ? : @ & = + $ , #` are characters that may be part of the URI syntax, so I am looking for a way in which these should not be escaped."^^ . . . . "0"^^ . . . "2"^^ . "0"^^ . "1"^^ . "1"^^ . "0"^^ . . . . "0"^^ . "0"^^ . "continuations"^^ . . . . . . "mouse"^^ . "I think OP probably wants something like `local parts = {} ... part[i] = `; From their example"^^ . . . "Player is not visible after switching from 1st person to 3rd person"^^ . . . "Is it possible to transform coordinate system to the horizontal tangential line T with y=0? So for horizontal line AB will be one circle gx = (ax+bx)/2, gy=gr = ((bx-gx)^2/by+by)/2"^^ . "3"^^ . . "<p>you should consider using the <a href="https://create.roblox.com/docs/reference/engine/classes/Player#CharacterAdded" rel="nofollow noreferrer"><code>CharacterAdded</code></a> event inside the player object.\nalso <code>value</code> should be <code>Value</code> when indexing the IntValue.</p>\n<pre><code>local Players = game:GetService(&quot;Players&quot;)\n\nPlayers.PlayedAdded:Connect(function(Player)\n Player.CharacterAdded:Connect(function(Character) -- fires when player spawned\n local Humanoid = Character:WaitForChild(&quot;Humanoid&quot;) -- wait for it to be added to the character\n\n if not Player.leaderstats or not Player.leaderstats.Speed then return end -- leaderstats or Speed value not found?\n\n Humanoid.WalkSpeed = Player.leaderstats.Speed.Value\n end)\nend)\n</code></pre>\n"^^ . . "0"^^ . "1"^^ . "1"^^ . . "setuserdata and getuserdata in lua"^^ . "0"^^ . "0"^^ . "lua_continuation, lua_thread functions"^^ . . . . . . "0"^^ . . "1"^^ . . "suricata"^^ . "How do I use ldexp in lua 5.4 as math.ldexp(...) is deprecated"^^ . "1"^^ . "Replace shortened variables with their full string"^^ . . . . . . "0"^^ . "<p>@Luatic</p>\n<p>Nice note about method names collision.\nAlthough my code was a dummy example, I think it's worth to to be aware of such particularities. Thank you!</p>\n<p>And my impediments were mostly of the following:</p>\n<ul>\n<li><p>If I actually do not need a value/content of string, should I keep it? To keep a hash (4/8 bytes of hash value in memory looks better than let's say 5-15 chars per a word).</p>\n</li>\n<li><p>If I load those word dynamically, why &quot;intern&quot; them? and even more correctly - how can it be interned?</p>\n<pre><code>local data = load() \nif data then\n for word in data:gmatch(&quot;[^\\r\\n]+&quot;) do\n self._words[word] = true\n end \nend\n</code></pre>\n</li>\n</ul>\n<p>I totally agree with your point on premature optimisation. Just wanted to get comprehension - does lua keep in memory three entities for each table entry: hash_key, value and an &quot;origin_key&quot; (let's call it a display value)?\nMy approach was to get rid of that redundant visual representation of a &quot;pretty long&quot; key. Now I see, in my 2nd option I still have a &quot;display value&quot; - it is just a display value of a hash of string.</p>\n<p>And yes, pure strings as keys for 20k-words tables work perfectly.\nWill stick with them )</p>\n"^^ . . . "<p>If you're working with a focus <strong>x=a,y=b</strong> and directrix <strong>y=c</strong>, then we're already axis-aligned, so that saves a bunch of work.</p>\n<p>A focus/directrix definition of the parabola is based on distance equivalences, so let's see which distances we can find for the &quot;tip&quot; <strong>x,y</strong> of the parabola:</p>\n<ol>\n<li><code>dist((x,y), (a,b))</code> = <code>sqrt((x-a)² + (y-b)²)</code>, and</li>\n<li><code>dist((x,y), (x,c))</code> = <code>abs(y - c)</code></li>\n</ol>\n<p>Easy enough, we can solve the equality <code>sqrt((x-a)² + (y-b)²) = abs(y - c)</code> (either by hand or by using something like wolfram alpha) and get:</p>\n<pre><code> x² - 2ax + a² + b² -c²\nf(x) = -----------------------\n 2(b-c)\n</code></pre>\n<p>which in lua is:</p>\n<pre class="lang-lua prettyprint-override"><code>function f(x, a, b, c)\n local n = x*x - 2*a*x + a*a + b*b - c*c\n local d = 2*(b-c)\n return n / d\nend\n</code></pre>\n<p>(and we're ignoring what happens when <code>b==c</code>, because we'll never <em>call</em> this function if that is the case, because if the focus lies <em>on</em> the directrix, that's not a parabola)</p>\n<p>Which means we now have a trivial-to-implement function for getting y=f(x) given any values <strong>a</strong>, <strong>b</strong>, and <strong>c</strong>, as long as <strong>b</strong> and <strong>c</strong> are not the same value.</p>\n<p>We then want to find the equivalent Bezier expression for the segment with end points <strong>A=(xa,f(xa))</strong> and <strong>B=(xb,f(xb))</strong>, which means we're &quot;done&quot; already: for any quadratic Bezier curve, the control point lies at the intersection of the tangent line at the start, and the tangent line at the end of the segment.</p>\n<p>Also note that we <em>do not get a choice</em> in what <strong>ay</strong> and <strong>by</strong> are: you only get to pick <strong>ax</strong> and <strong>bx</strong>, because <strong>f(x)</strong> defines what the corresponding <strong>ay</strong> and <strong>by</strong> <em>must</em> be.</p>\n<p>Now, we (implicitly) know what the tangent lines are, because we know the derivative of <strong>f(x)</strong> (again, either because we worked that out by hand, or we just told a computer to do it for us):</p>\n<pre><code> x-a\nf'(x) = ---\n b-c\n</code></pre>\n<p>which in lua is:</p>\n<pre class="lang-lua prettyprint-override"><code>function df(x, a, b, c)\n return (x-a) / (b-c)\nend\n</code></pre>\n<p>And so finding that control point is a matter of calculating a standard line/line intersection, because you know <strong>A</strong> and the tangent at <strong>A</strong>, and we know <strong>B</strong> and the tangent at <strong>B</strong>. Lots of posts on Stackoverflow and pages on the web that explain how to calculate a line/line intersection, but let's use this one:</p>\n<pre class="lang-lua prettyprint-override"><code>function lli(x1, y1, x2, y2, x3, y3, x4, y4)\n -- compact this as much as you feel the need to: lots of repeating values.\n local nx = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4)\n local ny = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4)\n local d = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4)\n\n if (d == 0) then\n error(&quot;these lines don't intersect&quot;)\n end\n\n return { nx / d, ny / d}\nend\n</code></pre>\n<p>And with that, we have everything we need:</p>\n<pre class="lang-lua prettyprint-override"><code>function fdParabolaToBezier(a, b, c, ax, bx)\n if (b == c) then\n error(&quot;this is not a parabola&quot;)\n end\n\n -- y coordinate for A:\n local ay = f(ax, a, b, c)\n\n -- tangent slope for A:\n local ad = df(ax, a, b, c)\n\n -- y coordinate for B:\n local by = f(bx, a, b, c)\n\n -- tangent slope for B:\n local bd = df(bx, a, b, c)\n\n -- and then the tangent intersection:\n local C = lli(\n ax, ay, -- A, which by definition lies on A's tangent\n ax + 1, ay + ad, -- The point on A's tangent at x=ax+1\n bx, by, -- B, which by definition lies on B's tangent\n bx + a, by + bd -- The point on B's tangent at x=ab+1\n )\n\n return {ax, ay, C[1], C[2], bx, by}\nend\n</code></pre>\n<p>And then an example call for getting the Bezier equivalent of the curve segment on a parabola with focus (2,5) and directrix y=3, starting at x=-5 and ending at x=4:</p>\n<pre class="lang-lua prettyprint-override"><code>local coords = fdParabolaToBezier(2, 5, 3, -5, 4)\nprint(table.concat(coords, ', '))\n</code></pre>\n<p>Which yields <code>-5, 16.25, 6.9117647058824, 7.9117647058824, 4, 5.0</code></p>\n"^^ . "<p>To avoid your error just check whether the <code>character</code> has a PrimaryPart or not. If not then just set the variable as <code>nil</code> so we know there is no hitTarg.</p>\n<pre class="lang-lua prettyprint-override"><code>if character.PrimaryPart then\n local hitTarg = hb(Vector3.new(4,6,4), character.PrimaryPart.CFrame * Cframe.new(0,0,-3) {character}, character)\nelse\n local hitTarg = nil\nend\n</code></pre>\n<p>Just be sure that your code that handles/uses <code>hitTarg</code> will properly account for when that variable is nil.</p>\n"^^ . "<p>so the output says that Workspace.Knife.Script:58: attempt to index nil with 'Character'</p>\n<p>here is the code shown</p>\n<pre><code>local player = game.Players.LocalPlayer\nlocal Character = player.Character\nlocal hum = player.Character:FindFirstChild(&quot;Humanoid&quot;)\n \nlocal gui = Instance.new(&quot;BillboardGui&quot;)\n\ngui.Parent = hum.Parent.Head\ngui.Adornee = hum.Parent.Head\ngui.Size = UDim2.new(0, 200, 0, 50)\ngui.StudsOffset = Vector3.new(0, 2, 0)\n \nlocal text = Instance.new(&quot;TextLabel&quot;)\n \ntext.Parent = gui\ntext.Size = UDim2.new(1, 0, 1, 0)\ntext.BackgroundTransparency = 1\ntext.TextColor3 = Color3.fromRGB(223, 204, 0)\ntext.TextScaled = true\ntext.Text = &quot;1.75x&quot;\n\nwait(1)\n \ngui:Destroy()\n \nhit.Parent.Humanoid:TakeDamage(8*1.75)\nhitboxActivated = false\n\n</code></pre>\n<p>how do i this it?</p>\n"^^ . . . . "0"^^ . "<p>It is impossible to achieve using a single Lua pattern, but you can chain a few of them:</p>\n<pre><code>local s = &quot;/&lt;\\\\/&gt;//b\\\\\\\\/c&quot; -- 4 payloads here (the second one is empty)\nfor x in s\n :gsub(&quot;/&quot;, &quot;/\\1&quot;) -- make every payload non-empty by prepending string.char(1)\n :gsub(&quot;\\\\(.)&quot;, &quot;\\2%1&quot;) -- replace magic backslashes with string.char(2)\n :gsub(&quot;%f[/\\2]/&quot;, &quot;\\0&quot;) -- replace non-escaped slashes with string.char(0)\n :gsub(&quot;[\\1\\2]&quot;, &quot;&quot;) -- remove temporary symbols string.char(1) and string.char(2)\n :gmatch&quot;%z(%Z*)&quot; -- split by string.char(0)\ndo\n print(x)\nend\n</code></pre>\n<p>Output:</p>\n<pre><code>&lt;/&gt;\n\nb\\\nc\n</code></pre>\n<p>Or, if you want a single statement instead of a loop:</p>\n<pre><code>local s = &quot;/&lt;\\\\/&gt;/b/c&quot; -- 3 payloads here\nlocal a, b, c = s\n :gsub(&quot;/&quot;, &quot;/\\1&quot;) -- make every payload non-empty by prepending string.char(1)\n :gsub(&quot;\\\\(.)&quot;, &quot;\\2%1&quot;) -- replace magic backslashes with string.char(2)\n :gsub(&quot;%f[/\\2]/&quot;, &quot;\\0&quot;) -- replace non-escaped slashes with string.char(0)\n :gsub(&quot;[\\1\\2]&quot;, &quot;&quot;) -- remove temporary symbols string.char(1) and string.char(2)\n :match&quot;%z(%Z*)%z(%Z*)%z(%Z*)&quot; -- split by string.char(0)\n</code></pre>\n"^^ . . . "Neovim treesitter setup issue in init.lua"^^ . "0"^^ . "it's possible that the syntax differs. In that case, you may need to consult the documentation from Rongo."^^ . "0"^^ . . "<p>You aren't referencing Humanoid properly when you are trying to get the WalkSpeed. You are using <code>plr:FindFirstChild(&quot;Humanoid&quot;)</code> when you should be using <code>plr.Character:FindFirstChild(&quot;Humanoid&quot;)</code> or the <code>humanoid</code> variable you already have. Currently, you are trying to find Humanoid in Player but it will cause <code>attempt to index nil with 'WalkSpeed'</code> since Humanoid isn't in Player but Player.Character so it fails to find WalkSpeed and Humanoid.</p>\n<p>Below I corrected the script to use the <code>humanoid</code> variable when trying to get the Player's WalkSpeed.</p>\n<pre class="lang-lua prettyprint-override"><code>local plrs = game:GetService(&quot;Players&quot;)\n\nplrs.PlayerAdded:Connect(function(plr)\n task.wait(3)\n local humanoid = if plr.Character then plr.Character:FindFirstChild(&quot;Humanoid&quot;) else nil\n if humanoid then\n print(&quot;Found Humanoid&quot;)\n humanoid.WalkSpeed = plr.leaderstats.Speed.value \n end\nend)`\n</code></pre>\n"^^ . . "1"^^ . . "0"^^ . . "0"^^ . . . . . "<p>lua arrays start their index at index <code>1</code> not 0 like other programming languages\n<a href="https://www.lua.org/pil/11.1.html" rel="nofollow noreferrer">https://www.lua.org/pil/11.1.html</a></p>\n<pre><code>print(foo.bar[1])\n</code></pre>\n"^^ . "lua-5.4"^^ . . . . . . "thread-safety"^^ . . "0"^^ . "1"^^ . . . "roblox-studio"^^ . . "1"^^ . . . "Lua table created in C returns strange values for integers"^^ . . . . . . . . . . . "2"^^ . . "openresty"^^ . . . . . . "When working, this is a code, the button is pressed, which is good. And recoil absorption code doesn't work. we need everything to work together"^^ . "How to write an if statement in ternary form?"^^ . . "<p>just use task.wait() why do you even overthink it</p>\n"^^ . . . "What did you try?"^^ . "<p>I dont really know how to code Lua, I made a script, when &quot;Numlock&quot; is on the script clicks &quot;a&quot; for a random time duration, then releases &quot;a&quot; and it presses &quot;s&quot; for random time. repeats the script until numlock is turned off. it doesn't work tho..</p>\n<pre><code>function OnEvent(event, arg)\n OutputLogMessage(&quot;wawa&quot;)\n if event == sKeyLockOn(&quot;Numlock&quot;) then\n repeat\n PressKey(&quot;a&quot;)\n Sleep(math.random(8700, 8900))\n ReleaseKey(&quot;a&quot;)\n Sleep(2)\n PressKey(&quot;s&quot;)\n Sleep(math.random(8700, 8900))\n ReleaseKey(&quot;s&quot;)\n Sleep(2)\n until not IsKeyLockOn(&quot;Numlock&quot;)\n end\n end\n</code></pre>\n<p>this code doesn't work for some reason, I tried using mouse button instead of numlock but no luck</p>\n"^^ . . . . . . . . "lua-c++-connection"^^ . . . "NumLock does not generate GHub events (that means Lua script will not start doing smth because you pressed NumLock). Only mouse buttons (on Logitech mouse) and special G-keys (on Logitech keyboard) generate events. But if an event is generated (by a mouse button), Lua script can determine whether NumLockLED was ON or OFF at this time moment."^^ . "<p>New to lua.</p>\n<p>On example i have multiple</p>\n<pre class="lang-lua prettyprint-override"><code>local part1 = display.newImage(&quot;part1.png&quot;, 0, 0)\npart1:scale ( 0.5, 0.5)\npart1.isVisible = false\n...\nlocal part10 = display.newImage(&quot;part10.png&quot;, 0, 0)\npart10:scale ( 0.5, 0.5)\npart10.isVisible = false\n</code></pre>\n<p>How can i optimize it using array and for do?</p>\n<p>Like execute multiple commands from one for-loop whem command only has different numbers?</p>\n<p>Im sure that this wont work but there should be a way to do what i want?</p>\n<pre class="lang-lua prettyprint-override"><code>for i = 1, 10 do\n part[i]:scale ( 0.5, 0.5)\n part[i].isVisible = false\n</code></pre>\n"^^ . . "0"^^ . . . "Makes sense but now I get the same error for on_minute"^^ . . "1"^^ . . . . "0"^^ . . "Does this answer your question? [Dealing with big numbers in Lua](https://stackoverflow.com/questions/45270543/dealing-with-big-numbers-in-lua)"^^ . "0"^^ . . . . "0"^^ . "<blockquote>\n<p>However, if there is no space after the pattern, like: <code>&quot;Hello &amp;greenWorld&quot;</code> Then the code behaves incorrectly</p>\n</blockquote>\n<p>The reason for this is that <code>%w</code> &quot;represents all alphanumeric characters&quot;. So your match will be <code>&amp;greenWorld</code> rather than just <code>&amp;green</code>, hence the table lookup will return <code>nil</code> and you won't perform the replacement.</p>\n<blockquote>\n<p>Is there a way to fix this issue?</p>\n</blockquote>\n<p>Is the color name delimited? HTML escape codes for example end with a semicolon, like this: <code>&amp;amp;</code>.</p>\n<p>If your color names are guaranteed not to be followed by a lowercase letter, you could replace <code>%w</code> with <code>[a-z]</code>.</p>\n<p>Wanting to &quot;map&quot; some kind of &quot;names&quot; to &quot;values&quot; using <code>gsub</code> is a frequent occurrence, which is why <code>gsub</code> even provides a special feature for this to make this particularly convenient: The second argument need not be a function, it can also be a table. The first capture will then be used to index this table. If the resulting value is <code>nil</code>, no substitution will happen. Otherwise, the entire match will be substituted with the value.</p>\n<p>Using this, you could just write:</p>\n<pre class="lang-lua prettyprint-override"><code>local name_to_colorcode = {\n [&quot;red&quot;] = &quot;#FF0000&quot;,\n [&quot;blue&quot;] = &quot;#4C9FFF&quot;,\n [&quot;purple&quot;] = &quot;#C33AFF&quot;,\n [&quot;green&quot;] = &quot;#53FF4A&quot;,\n [&quot;gray&quot;] = &quot;#E2E2E2&quot;,\n [&quot;black&quot;] = &quot;#000000&quot;,\n [&quot;white&quot;] = &quot;#FFFFFF&quot;,\n [&quot;pink&quot;] = &quot;#FB8DFF&quot;,\n [&quot;orange&quot;] = &quot;#FF8E1C&quot;,\n [&quot;yellow&quot;] = &quot;#FAFF52&quot;,\n -- TODO add more colors\n}\n\nlocal text = &quot;&amp;whiteHello&amp;white World&quot;\nprint(text:gsub(&quot;&amp;([a-z]+)&quot;, name_to_colorcode))\n</code></pre>\n<p>This solution is pretty much <em>strictly better</em> than repeated substitution: It is more performant (linear time O(n) vs O(nm) where m is the number of words in your &quot;map&quot;). And yes, for a map of this size, the difference will be measurable in practice.</p>\n<p>It is also less error-prone; there are no issues with substitutions happening &quot;in the wrong order&quot;. Suppose you had <code>&amp;rose</code> and <code>&amp;rosegold</code>. This one-pass solution would greedily replace <code>&amp;rosegold</code> with the appropriate color code. In the multi-pass replacement solution, you would have to be careful to first replace the longer names, then the prefixes of those.</p>\n<p>That said, it has the limitation of requiring some kind of (implicit) delimiter. I would argue that this is not much of an issue in practice. Most sensible &quot;escape&quot; codes have this - consider for example string (backslash) escape codes or HTML escape codes (&quot;entities&quot;). If your spec requires you to treat <code>&amp;greenhelloworld</code> as <code>#00FF00helloworld</code>, I'd argue that that is quite confusing to tokenize for a human and thus probably a bad idea.</p>\n<p>If you wanted to write an optimally performant single-pass solution, you have two options:</p>\n<ul>\n<li>Use some kind of proper regex engine (Lua patterns are <em>not</em> regex) for Lua. Then you could write a pattern of the form <code>&amp;(red|green|blue|...)</code> and substitute based on that. This is very likely to be more performant. In particular, it can be linear time, where the constant factor is not influenced by how many colors you have.</li>\n<li>Do it yourself, manually, using a trie (prefix tree). This is indeed probably not worth your time.</li>\n</ul>\n<p>If this is the case and you can't change the spec to require color names to be delimited one way or another, you should probably just go with the multi-pass solution until you have demonstrated a performance issue; do not optimize prematurely.</p>\n<blockquote>\n<p>Also, if there's a more efficient way to implement this code, I'd appreciate your input.</p>\n</blockquote>\n<p>Your code has three <em>very minor</em> issues:</p>\n<ul>\n<li>You don't use a capture, so you resort to substringing. This is unnecessary.</li>\n<li>You prepend the <code>#</code> to the strings on-demand, rather than having them pre-prepended in the table. This is also (very slightly) wasteful.</li>\n<li>You use a function when a table would suffice.</li>\n</ul>\n<p>My proposed solution should address all three (not that they would be very relevant for performance).</p>\n<p>Much more importantly, I find it to be much simpler, and by adding a minor requirement, it can handle at least the test case you have given correctly.</p>\n"^^ . . . . . . . "Maybe. That is helpful, but actually I need some supported punctuation in the tags that are being matched. That does, nevertheless, match all the letters required but not all characters, and probably far to many otherwise. Essentially, the goal is to match all letter-like characters, plus dashes. And barring some shortcut class I'm unfamiliar with, like `%å` or some such, the `[[À-ÿ]]` seems the most direct."^^ . . "<p>It seems like you are getting the children from <code>Orebuttons</code> which returns an array and then connecting to that which returns nil because it is an array and not a button you can connect to.</p>\n<p>You need to loop through each button in <code>Orebuttons</code> and then connect to that.</p>\n<pre class="lang-lua prettyprint-override"><code>for _, button: GuiButton in pairs(Orebuttons) do\n if button:IsA(&quot;GuiButton&quot;) then\n button.MouseButton1Click:Connect(function()\n print(&quot;Click&quot;)\n OreString.Value = button.Name\n end)\n end\nend\n</code></pre>\n<p>This code goes through the <code>Orebuttons</code> array and then if the child is a <a href="https://create.roblox.com/docs/reference/engine/classes/GuiButton" rel="nofollow noreferrer"><code>GuiButton</code></a> then connect <a href="https://create.roblox.com/docs/reference/engine/classes/GuiButton#MouseButton1Click" rel="nofollow noreferrer"><code>MouseButton1Click</code></a> to that button.</p>\n"^^ . . . . "<p>I am new to Lua and am writing a program for a tool changer on my CNC machine. Each tool pocket's detail is stored as an entry in a table, the table looks like:</p>\n<pre><code>local PocketDetails = {\n PocketNumber = nil,\n X = nil,\n Y = nil,\n Z = nil,\n ClearX = nil,\n ClearY = nil,\n ClearZ = nil,\n ToolNumber = nil,\n}\n</code></pre>\n<p>I want to be able to pass in the field name as a variable in a function (X, Y, Z, etc...) then have a function that will create the table entry, or update the existing field in the table as necessary. This function looks like:</p>\n<pre><code>function PocketPositions.UpdateField(pocketNumber, field, newVal )\n -- if there are no pockets add it\n if next(PocketDetails) == nil then\n table.insert(PocketDetails, {PocketNumber = pocketNumber, [field] = newVal})\n else\n local foundPocket = false\n -- look for pocket and update it\n local i = 1\n while PocketDetails[i] ~= nil and foundPocket == false do\n if PocketDetails[i].PocketNumber == pocketNumber then\n PocketDetails[i].[field]= newVal\n end\n i = i + 1\n end\n \n -- check to see if the pocket was in the array\n if foundPocket ~= true then\n -- pocket was not in the array add it\n table.insert(PocketDetails, {PocketNumber = pocketNumber, [field] = newVal})\n end\n end\nend\n</code></pre>\n<p>The above does not compile due to the use of [field], But I am not sure how to do what I want. I would like to call the function like so (or something similar), from a button press. Some examples of possible calls:</p>\n<pre><code>PocketPositions.UpdateField(4, &quot;X&quot;, 1.234)\nPocketPositions.UpdateField(4, &quot;Z&quot;, 5.678)\nPocketPositions.UpdateField(2, &quot;ClearX&quot;, 1.234)\nPocketPositions.UpdateField(4, &quot;X&quot;, 3.456)\n\n</code></pre>\n<p>Also if there is a better way to do the above I would like to see that</p>\n<p>I've tried searching through examples here on stack exchange and the web and did not find anything similar to what I am trying to do. They were just single key value pairs in a table, it's possible I don't know the correct terminology for what I'm searching for.</p>\n<p>I've tried replacing the <code>[field]</code> value with one of the field names in my function, and the function does what I want it to do.</p>\n<p>Edit to add some details.</p>\n<p>When the program starts PocketDetails = {} or is nil. The first time this function is called it will add some info to one of the pockets. At startup which pockets and which details will be populated is unknown.</p>\n<p>The code:</p>\n<pre><code>table.insert(PocketDetails, {PocketNumber = pocketNumber, [field] = newVal})\n</code></pre>\n<p>throws the error: &quot;table index is null&quot;</p>\n<p>After this code is called from PocketPositions.UpdateField(4, &quot;X&quot;, 1.234) I am expecting this output:</p>\n<pre><code>local PocketDetails = {\nPocketNumber = 4,\nX = 1.234,\n}\n</code></pre>\n"^^ . . "<p>I'm trying to make a value stored in the player that starts at 100 and decrements until equal to 0, and once equal to 0, the player dies.</p>\n<pre><code>local players = game:GetService(&quot;Players&quot;)\nlocal plr = players.LocalPlayer.Character\nlocal sanity = plr.Sanity.Value\nlocal hum = plr:FindFirstChild(&quot;Humanoid&quot;)\n\nwhile sanity &gt; 0 do\n if sanity == 0 then\n hum.Health = 0\n end\n wait(0.05)\n sanity -= 1\n print(sanity)\nend\n</code></pre>\n<p>The problem is that even though the value exists, it is not decrementing it or printing the new value.</p>\n<p>I don't know where do start so I haven't tried much, It's supposed to decrement the value every second and kill the player once the value == 0</p>\n<p>edit: i found a different way to do it that works perfectly fine</p>\n"^^ . "2"^^ . . . "<p>Vim has a internal <code>strftime</code> function to return a date/time formatted in a way you specify with a format string (see <code>:help strftime</code>).</p>\n<p>In your code, replace <code>vim.fn.system([[date +&quot;%H:%M&quot; | tr -d '\\n']]))</code> by <code>vim.fn.strftime(&quot;%H:%M&quot;)</code>.</p>\n"^^ . . . "<p>I've some data in Redis streams</p>\n<p>which look like</p>\n<p><code>XRANGE trades-BINANCE-BTC-USDT 1711915630000 1711915637000</code></p>\n<pre><code>\n1) 1) &quot;1711915630040-0&quot;\n 2) 1) &quot;exchange&quot;\n 2) &quot;BINANCE&quot;\n 3) &quot;symbol&quot;\n 4) &quot;BTC-USDT&quot;\n 5) &quot;side&quot;\n 6) &quot;sell&quot;\n 7) &quot;amount&quot;\n 8) &quot;0.0003&quot;\n 9) &quot;price&quot;\n 10) &quot;71029.95&quot;\n 11) &quot;id&quot;\n 12) &quot;2946737379&quot;\n</code></pre>\n<p>I'd like to plot with Grafana only price in timeseries plot.</p>\n<p>I did the following</p>\n<p><a href="https://i.sstatic.net/R96Al.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/R96Al.png" alt="screenshot" /></a></p>\n<p>Query:</p>\n<p>Type: Redis</p>\n<p>Command: XRANGE</p>\n<p>Key: $trades (variable which contains trades-BINANCE-BNB-USDT)</p>\n<p>But I'm getting plot of amount, price, id, timestamp, received_timestamp as y-axis and time as x-axis.</p>\n<p>Unfortunately I don't know how to only plot price vs time</p>\n<p>Any idea?</p>\n<p>Do I need custom request with Lua for that purpose?</p>\n"^^ . . . . "0"^^ . . . "you should add context to explain your answer."^^ . . . . . . . . "servicemesh"^^ . "How to write a lua pattern that is aware of escaped characters?"^^ . "1"^^ . "0"^^ . . "1"^^ . . "0"^^ . . "0"^^ . . . "What about my string being ^1pOplol and change to ^2pOplol and ^3pOplol. can you give me an example based on my script? thanks in advance."^^ . "Variable not updating in Roblox Studio / Lua"^^ . . . . "You could simplify your code to `\nfunction on_minute()\n your_control.rotation = os.date '%H' * 15\nend`"^^ . "3"^^ . . "Why are some values disappearing?"^^ . "1"^^ . . . . . "1"^^ . . . "Infinite yield possible on 'ServerScriptService.Modules:WaitForChild("Modules")' in Leaderstats code"^^ . . . "<p>I use this <a href="https://github.com/pocco81/auto-save.nvim" rel="nofollow noreferrer">plugin</a> for autosaving in nvim. This works well.\nYou can add these lines in your plugin config file for auto saving in normal mode and after text change event.</p>\n<pre class="lang-lua prettyprint-override"><code>{\n enabled = true,\n execution_message = {\n message = function()\n return (&quot;AutoSave: saved at &quot; .. vim.fn.strftime(&quot;%H:%M:%S&quot;))\n end,\n dim = 0.18, \n },\n trigger_events = {&quot;InsertLeave&quot;, &quot;TextChanged&quot;}, \n condition = function(buf)\n local fn = vim.fn\n local utils = require(&quot;auto-save.utils.data&quot;)\n\n if\n fn.getbufvar(buf, &quot;&amp;modifiable&quot;) == 1 and\n utils.not_in(fn.getbufvar(buf, &quot;&amp;filetype&quot;), {}) then\n return true\n end\n return false \n end,\n write_all_buffers = false, \n debounce_delay = 135,\n callbacks = { \n enabling = nil, \n disabling = nil,\n before_asserting_save = nil,\n before_saving = nil,\n after_saving = nil, \n }\n}\n</code></pre>\n<p>This is the default configuration of this plugin, consider configuring yourself as you want</p>\n"^^ . . . "tcl"^^ . . "<p>I dont really know how to code lua, i made a script, when &quot;Numlock&quot; is on the script clicks &quot;a&quot; for a random time duration, then releases &quot;a&quot; and it presses &quot;s&quot; for random time. repeats the script until numlock is turned off. it doesnt work tho..</p>\n<pre><code>function OnEvent(event, arg)\n OutputLogMessage(&quot;wawa&quot;)\n if event == sKeyLockOn(&quot;Numlock&quot;) then\n repeat\n PressKey(&quot;a&quot;)\n Sleep(math.random(8700, 8900))\n ReleaseKey(&quot;a&quot;)\n Sleep(2)\n PressKey(&quot;s&quot;)\n Sleep(math.random(8700, 8900))\n ReleaseKey(&quot;s&quot;)\n Sleep(2)\n until not IsKeyLockOn(&quot;Numlock&quot;)\n end\n end\n</code></pre>\n<p>this code doesnt work for some reason, i tried using mouse button instead of numlock but no luck</p>\n"^^ . "1"^^ . "0"^^ . . "Please try the https://stackoverflow.com/a/1647577/12968803 Is it good for you?"^^ . . . "0"^^ . . "2"^^ . "0"^^ . . . "0"^^ . "Neovim Kickstart config "E5113: Error while calling lua chunk: vim/_editor.lua:0: attempt to compare two table values" everytime I open neovim"^^ . . . . . "https://idownvotedbecau.se/imageofcode - Please copy and paste your code into your question."^^ . "2"^^ . "Mta account char limit"^^ . "1"^^ . "0"^^ . . . "3"^^ . . . "1"^^ . "nw, i already fixed it"^^ . "<p>I am trying to send response to an express endpoint. It works when response doesn't have any header as content-encoding:gzip.\nIt doesn't work when this header is present. Is there any way I can decompress the response and iterate using bodychunks and send it to express endpoint\nBelow is my Lua filter</p>\n<pre><code>apiVersion: networking.istio.io/v1alpha3\nkind: EnvoyFilter\nmetadata:\n name: cle-lua-filter-traceception\n namespace: content-layout-enricher\nspec:\n workloadSelector:\n labels:\n app: content-layout-enricher-teflon\n configPatches:\n - applyTo: HTTP_FILTER\n match:\n context: SIDECAR_OUTBOUND\n listener:\n filterChain:\n filter:\n name: envoy.filters.network.http_connection_manager\n subFilter:\n name: envoy.filters.http.router\n patch:\n operation: INSERT_BEFORE\n value:\n name: envoy.lua\n typed_config:\n '@type': type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua\n inlineCode: |\n function envoy_on_request(request_handle)\n local headers = request_handle:headers()\n local optimusHeader = headers:get(&quot;x-o-optimus&quot;)\n \n if optimusHeader == &quot;x-o-tracelogs&quot; then\n local traceparent = headers:get(&quot;traceparent&quot;)\n local wmsvc = headers:get(&quot;wm_svc.name&quot;)\n local requestBody = &quot;&quot;\n for chunk in request_handle:bodyChunks() do\n if (chunk:length() &gt; 0) then\n requestBody = requestBody .. chunk:getBytes(0, chunk:length())\n end\n end\n local finalBodyString = requestBody .. &quot;|~|&quot; .. traceparent .. &quot;|~|&quot; .. &quot;content-layout-enricher&quot; .. &quot;|~|&quot; .. &quot;request&quot; .. &quot;|~|&quot; .. 200 .. &quot;|~|&quot; .. wmsvc\n request_handle:streamInfo():dynamicMetadata():set(&quot;envoy.filters.http.lua&quot;, &quot;x-condition&quot;, &quot;tracelogs&quot;)\n request_handle:streamInfo():dynamicMetadata():set(&quot;envoy.filters.http.lua&quot;, &quot;traceception&quot;, traceparent)\n request_handle:streamInfo():dynamicMetadata():set(&quot;envoy.filters.http.lua&quot;, &quot;x-svcName&quot;, &quot;content-layout-enricher&quot;)\n request_handle:streamInfo():dynamicMetadata():set(&quot;envoy.filters.http.lua&quot;, &quot;upstream-service-name&quot;, wmsvc)\n\n local headers, body, err = request_handle:httpCall(\n &quot;traceception_cluster&quot;,\n {\n [&quot;:method&quot;] = &quot;POST&quot;,\n [&quot;:path&quot;] = &quot;/logs&quot;,\n [&quot;:authority&quot;] = &quot;&lt;external express endpoint&gt;&quot;,\n [&quot;content-type&quot;] = &quot;text/plain&quot;,\n [&quot;content-length&quot;] = string.len(finalBodyString)\n },\n finalBodyString,\n 10000,\n true)\n end\n end\n function envoy_on_response(response_handle)\n local dynamic_metadata = response_handle:streamInfo():dynamicMetadata():get(&quot;envoy.filters.http.lua&quot;)\n local condition_value = dynamic_metadata and dynamic_metadata[&quot;x-condition&quot;]\n local traceparent = dynamic_metadata and dynamic_metadata[&quot;traceception&quot;]\n local svcName = dynamic_metadata and dynamic_metadata[&quot;x-svcName&quot;]\n local response_status_code = response_handle:headers():get(&quot;:status&quot;)\n local upstream_service_name = dynamic_metadata and dynamic_metadata[&quot;upstream-service-name&quot;]\n local envoyUpstreamResTime = response_handle:headers():get(&quot;x-envoy-upstream-service-time&quot;)\n\n if condition_value == &quot;tracelogs&quot; then\n local responseBody = &quot;&quot;\n for chunk in response_handle:bodyChunks() do\n if (chunk:length() &gt; 0) then\n responseBody = responseBody .. chunk:getBytes(0, chunk:length())\n end\n end\n local finalBodyString = responseBody .. &quot;|~|&quot; .. traceparent .. &quot;|~|&quot; .. svcName .. &quot;|~|&quot; .. &quot;response&quot; .. &quot;|~|&quot; .. response_status_code .. &quot;|~|&quot; .. upstream_service_name .. &quot;|~|&quot; .. envoyUpstreamResTime \n local headers, body, err = response_handle:httpCall(\n &quot;traceception_cluster&quot;,\n {\n [&quot;:method&quot;] = &quot;POST&quot;,\n [&quot;:path&quot;] = &quot;/logs&quot;,\n [&quot;:authority&quot;] = &quot;&lt;express endpoint&gt;&quot;,\n [&quot;content-type&quot;] = &quot;text/plain&quot;,\n [&quot;content-length&quot;] = string.len(finalBodyString)\n },\n finalBodyString,\n 10000,\n true)\n end\n end\n - applyTo: CLUSTER\n match:\n context: ANY\n patch:\n operation: ADD\n value:\n name: traceception_cluster\n type: STRICT_DNS\n connect_timeout: 5s\n lb_policy: ROUND_ROBIN\n load_assignment:\n cluster_name: traceception_cluster\n endpoints:\n - lb_endpoints:\n - endpoint:\n address:\n socket_address:\n address: &gt;-\n express_endpoint\n port_value: 80\n\n</code></pre>\n<p><a href="https://i.sstatic.net/YeXDr.jpg" rel="nofollow noreferrer">enter image description here</a></p>\n<p>Getting ascii formatted response when iterating through bodyChunks</p>\n"^^ . . . "@InSync, The code you posted works for printing, but does not work when trying trying to add to a table, the link you provided is similar but a different case. Unfortunately neither of those scenarios are the same as what I am doing."^^ . "0"^^ . . . "Find Intersection Point of Two Parabolas Given Their Focuses and Common Directrix [Lua]"^^ . "0"^^ . "grafana"^^ . "0"^^ . "1"^^ . . . . . . . "1"^^ . "<p>I made an health bar in Roblox Studio, but i want it to work between devices (so it scales depending on device), the problem is, its size decreases every time you lose health, so i cant use a UIAspectRatioConstraint. I tried everything for numerous hours now and couldn't find or try anything. Any help would be very much appreciated.</p>\n<p>Script:</p>\n<pre><code>local Player = game.Players.LocalPlayer\nlocal Character = Player.Character\nlocal Humanoid = Character.Humanoid\n\nwhile wait() do\n script.Parent.Size = UDim2.new(0, (Humanoid.Health / Humanoid.MaxHealth * 225), 1, 0)\nend\n</code></pre>\n<p>Like i said, i tried a lot of things. I tried rewriting the script completely, Change random values, etc.</p>\n<p>What i expected was for the health bar to be shown on all devices without needing to use a UIAspectRatioConstraint, since it will not resize with that constraint.</p>\n"^^ . "<p>I have a table with strings like <code>&quot; item&quot;, &quot; item&quot;</code>. To render this items with indentation. I want a way to split this string and count how many spaces the string have on the beginning.</p>\n"^^ . . . "I had proposed Powershell to them a while back, but they felt that it was to complex to hand to their product servicing team. Thus the interest in Lua for it's simpler syntax, and ease to learn."^^ . . . . . "0"^^ . . . "lua-table"^^ . . "0"^^ . . . "rules"^^ . . . . . "0"^^ . . . . "2"^^ . . . "envoyproxy"^^ . . "logitech-gaming-software"^^ . . . . "0"^^ . . "<p>This may have happened due to a <a href="https://github.com/nvimtools/none-ls.nvim/discussions/81" rel="noreferrer">recent change</a>. Try using <code>nvimtools/none-ls-extras.nvim</code> as depicted below.</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;nvimtools/none-ls.nvim&quot;,\n dependencies = {\n &quot;nvimtools/none-ls-extras.nvim&quot;,\n },\n config = function()\n local null_ls = require(&quot;null-ls&quot;)\n null_ls.setup({\n sources = {\n require(&quot;none-ls.diagnostics.eslint_d&quot;),\n null_ls.builtins.formatting.stylua,\n null_ls.builtins.formatting.prettier,\n },\n })\n\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;fm&quot;, vim.lsp.buf.format, {})\n end,\n}\n</code></pre>\n"^^ . . "0"^^ . . . . . . "5"^^ . . . "2"^^ . . "Thanks for the clarifying question. My matrix is a table, and each cell is defined within that table as another table, such that matrix[x][y] = cell_data, where cell_data = {}, in which cell_data["occupied"] equals a boolean value, true or false. Every coordinate in my matrix has cell_data. There will be no gaps in the matrix. I will add this to the original post."^^ . "binary-tree"^^ . "world-of-warcraft"^^ . . "0"^^ . "<p>I need to use a function that executes another function but adding an extra argument at the end, so I wrote this:</p>\n<pre><code>function ExecuteWithMyNameAtTheEnd(f, ...)\n f(..., &quot;Maxi&quot;)\nend\n\nExecuteWithMyNameAtTheEnd(print, 1, 2, 3)\n</code></pre>\n<p>But for some reason instead of printing <code>1 2 3 Maxi</code> it prints <code>1 Maxi</code> and I don't know why. I thought the <code>...</code> contained the values <code>1 2 3</code> because when I use <code>print(...)</code> it says <code>1 2 3</code>. I am using Lua 5.4 if that helps.</p>\n<p>Let me know if I did something wrong when asking this question because it's my first time using Stack Overflow and I am not a native English speaker.</p>\n"^^ . . . . "0"^^ . "1"^^ . "0"^^ . . . "1"^^ . . . "0"^^ . . . . "matrix"^^ . . . . . . "language-server-protocol"^^ . . "OP: "I started using Find and Replace in VS Code and doing each one manually, but this was taking ages as there are over 50 of them in this script alone." They obviously know the first part of your answer, and the second part is good advice but only tangential."^^ . "0"^^ . . . . "<pre><code>function insertDash(str)\n str = string.gsub(str, &quot;(%d)(%a)&quot;, &quot;%1-%2&quot;) -- digit-letter\n str = string.gsub(str, &quot;(%a)(%d)&quot;, &quot;%1-%2&quot;) -- letter-digit\n str = string.gsub(str, &quot;(%a)(%a)(%a)(%a)&quot;, &quot;%1%2-%3%4&quot;) -- 4 letters to 2 letters and 2 letters\n return str\nend\n</code></pre>\n<p>Examples:</p>\n<pre><code>print(insertDash(&quot;aa11&quot;)) -- aa-11\nprint(insertDash(&quot;11aa&quot;)) -- 11-aa\nprint(insertDash(&quot;123abc&quot;)) -- 123-abc\nprint(insertDash(&quot;abc123&quot;)) -- abc-123\nprint(insertDash(&quot;abcd123&quot;)) -- ab-cd-123\nprint(insertDash(&quot;abcd1234&quot;)) -- ab-cd-1234\n</code></pre>\n"^^ . "0"^^ . . . "0"^^ . . . . "0"^^ . . "so how do i fix it?"^^ . . "roblox"^^ . . . . . . . "iterator"^^ . . . . . . . . "0"^^ . . . "How to disable autocomplete and error pop-ups in an LSP, but keep the other LSP features in Neovim"^^ . . . . . "0"^^ . . . "0"^^ . . . . . . "calculation"^^ . "0"^^ . "2"^^ . "<p>I need vim for taking notes for math in highschool and I have a bind for vim to launch a script for making inkscape figures.</p>\n<pre><code>inoremap &lt;C-f&gt; &lt;Esc&gt;: silent exec '.!inkscape-figures create &quot;'.getline('.').'&quot; &quot;'.b:vimtex.root.'/figures/&quot;'&lt;CR&gt;&lt;CR&gt;:w&lt;CR\n</code></pre>\n<p>how would I convert this into a neovim lua keymap.</p>\n<p>I have looked online and have struggled to find a solution and I'm really new to using vim / neovim</p>\n"^^ . . . "Please, format your question properly."^^ . . "0"^^ . . . . . . . . "1"^^ . "0"^^ . . . . . . . . . "neovim"^^ . . "1"^^ . . . . . . "1"^^ . "1"^^ . . . . "<p>I'm reading &quot;Programming in Lua, Forth Edition&quot;, and I'm stuck on exercise 13.1, because Lua does not seem to behave like in the book. The section 13.2, about Unsigned Integers, states:</p>\n<pre><code>&gt; x = 13835058055282163712 -- 3ul &lt;&lt; 62ul\n&gt; x --&gt; -4611686018427387904\n</code></pre>\n<p>But if I do that in Lua 5.4, Windows x64, or Lua 5.3, WSL x64, they both behave like this:</p>\n<pre><code>&gt; x = 13835058055282163712\n&gt; x\n1.3835058055282e+19\n&gt; math.type(x)\nfloat\n</code></pre>\n<p>So, I have 2 questions:</p>\n<ol>\n<li>Why does &quot;the book&quot; about learning Lua 5.3, shows examples not matching actual Lua implementations? Is that due to some later update to the language?</li>\n<li>Is there a work-around? How to I write large &quot;unsigned integers&quot; in decimal, without them being turned into floats?</li>\n</ol>\n"^^ . . . . . "2"^^ . . "how would I convert a vim mapping to a neovim mapping?"^^ . . "what kind of drawing? Can you show the full code and screenshot?"^^ . . "1"^^ . . "0"^^ . . . . . . . . "1"^^ . . "1"^^ . . . . "1"^^ . . "I did as it says in the update."^^ . . "<p>You use <code>packer.init</code> and looking at the quickstart part of the packer <a href="https://github.com/wbthomason/packer.nvim?tab=readme-ov-file#quickstart" rel="nofollow noreferrer">README.md</a>, it seems like plugins are installed using <code>packer.startup</code>. In there, you have to pass a function that takes a parameter <code>use</code>.</p>\n<pre class="lang-lua prettyprint-override"><code>...\nlocal packer = require('packer')\npacker.startup(function(use)\n use{\n &quot;kylenchui/nvim-surround&quot;,\n tag = &quot;*&quot;,\n config = function()\n require(&quot;nvim-surround&quot;).setup({})\n end\n }\nend)\n...\n</code></pre>\n<p>And <code>packer.init</code> seems to be for <a href="https://github.com/wbthomason/packer.nvim?tab=readme-ov-file#custom-initialization" rel="nofollow noreferrer">configuration</a> of packer itself.</p>\n"^^ . "LGHUB Lua script"^^ . . . . "Why is Premake5 not creating the necessary output directories for my project?"^^ . "0"^^ . "<p>Just make list, not table as :</p>\n<pre class="lang-lua prettyprint-override"><code>local mytable = {\n {name = &quot;name10&quot;, value = 6},\n [name = &quot;name9&quot;, value = 10},\n [name = &quot;name8&quot;, value = 8},\n}\n</code></pre>\n<p>and then sort it as usually:</p>\n<pre class="lang-lua prettyprint-override"><code>function compareValuesBackwards(a,b)\n return a.value &gt; b.value\nend\ntable.sort(items, compareValuesBackwards)\n</code></pre>\n"^^ . "1"^^ . "0"^^ . . . . "1"^^ . . "3"^^ . . "You should consider reading `README.md`"^^ . . . . . . "`local PocketDetails = {\n PocketNumber = nil,\n X = nil,\n Y = nil,\n Z = nil,\n ClearX = nil,\n ClearY = nil,\n ClearZ = nil,\n ToolNumber = nil,\n}` is the same as `local PocketDetails = {}`."^^ . . . . "7"^^ . . . . . "0"^^ . . . . . . "-1"^^ . . "I was sure that you need to find the letter independent of accent, so making the string without them and search among clear Latin letters and than, if found, you can return the same from the original string."^^ . "1"^^ . . "1"^^ . . . "0"^^ . . . "1"^^ . . . . "<ol>\n<li><p>Read the manual carefully, then you'll notice the type of <code>lua_resume</code>'s last argument is <code>int*</code>, it's an output argument.</p>\n<pre class="lang-c prettyprint-override"><code>int lua_resume (lua_State *L, lua_State *from, int nargs, int *nresults);\n</code></pre>\n<p>Although in your example, it is 0, in general, you need to handle them.</p>\n<pre class="lang-c prettyprint-override"><code>lua_State* co = lua_tothread(L, 2);\nint nresults;\nstatus = lua_resume(co, NULL, 0, &amp;nresults);\nlua_pop(co, nresults); //handle the results by removing them\n</code></pre>\n</li>\n<li><p>You'd better use the <code>co</code> variable above for your 2nd <code>lua_resume</code> call too, because you put the global <em>co</em> (which doesn't exist) on the top of the stack.</p>\n</li>\n</ol>\n"^^ . . "0"^^ . . "<pre class="lang-lua prettyprint-override"><code>local formats = {\n '99-XX-XX',\n '99-XXX-9',\n '9-XXX-99',\n 'XX-999-X',\n 'X-999-XX'\n}\n\n-- Convert formats to pattern =&gt; replacement pairs:\nlocal regexes = {}\nfor _, mask in ipairs (formats) do\n -- Pattern operates over plate stripped of dashes:\n local pattern = mask:gsub ('[^X9]', ''):gsub ('[X9]', '(%0)'):gsub ('9', '%%d'):gsub ('X', '%%a')\n local capture = 0\n local replacement = mask:gsub ('.', function (char)\n if char == 'X' or char == '9' then\n capture = capture + 1\n return '%' .. tostring (capture)\n else\n return char\n end\n end)\n regexes [pattern] = replacement\nend\n\nlocal function format (plate)\n local stripped = plate:gsub ('[^%a%d]', '')\n for pattern, replacement in pairs (regexes) do\n if stripped:match (pattern) then\n local formatted = stripped:gsub (pattern, replacement)\n return formatted\n end\n end\n return plate\nend\n \nlocal cases = {\n '12-ab-cd',\n '12abcd',\n '12a-bc-d',\n 'not a plate'\n}\nfor _, case in ipairs (cases) do\n print (case, format (case))\nend\n</code></pre>\n"^^ . "0"^^ . . "1"^^ . . "0"^^ . . "So, basically, if I want to enter an "unsigned integer", that can be represented with 64 bits, but bigger than the maximum value of a 64-bit "singed integer", I *have to* use hexadecimal (but then, it *doesn't* get converted to a float?)"^^ . "There will be a drawing on the panel and I need to get the color of the specified pixel. @Igor"^^ . "0"^^ . . . "<p>I was working with Lua scripts and trying to determine if there is any way to detect Nmap scanning using Lua scripts other than Suricata rules. What I've been able to deduce is to look for a particular IP that's been sending continuous packets on different ports and then generate alerts accordingly. Is there any other method that can be used to detect Nmap scanning besides relying solely on different flags?</p>\n<p>I've searched for different available rules and scripts, but none of them are as efficient as they completely rely on flags. They can be easily misinterpreted. That's why I'm trying to build a Lua script that can detect Nmap scanning more easily and efficiently.</p>\n"^^ . "Yhnx sir, can i ask u sthing? i read programming in lua 4th edition, i am on 29 chapter, assignenments. As I read this chapter, (and a litlle for the moment) to the next ones, this book but and the docs either mentions coroutines, either mentions threads, in continuations, although coroutines are the thread implementation for lua. Does doc distinct the use cases on threads, coroutines and i confuse my code, between threads, coroutines, continuations?"^^ . "0"^^ . . . . . . "premake"^^ . . . "Health Bar GUI In Roblox Studio Device Problem"^^ . . . . . . . . "0"^^ . . . . . "@JosephSible-ReinstateMonica I have came across a lot of such answers, I don't really have a specific use case, I just couldn't understand how the guy in the link I shared can do it but I cannot, that's all."^^ . . "<p>I'm using lazyvim and I'm trying to change some default settings:</p>\n<p>According to <a href="https://www.lazyvim.org/extras/lang/java#nvim-jdtls" rel="nofollow noreferrer">documentation here</a> seems that I'm able to change default <code>root_dir</code> detection.</p>\n<p>It's not clear to how to chage that. I mean, By default, it's picking default <code>root_dir</code> detection from lspconfig.</p>\n<p>Default lspconfig jdtls configuration is here and you can find <a href="https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/jdtls.lua#L79" rel="nofollow noreferrer">jdtls.lua lspconfig file here</a>. You can also to see how to <a href="https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/jdtls.lua#L102" rel="nofollow noreferrer"><code>lsp_config</code> populate it on <code>default_config.root_dir</code> here</a>.</p>\n<p>I need to change to:</p>\n<pre><code>{'.git', 'mvnw', 'gradlew'}\n</code></pre>\n<p>Also, I've tried to change <code>nvim-jdtls</code> plugin settings using this code snipped on <code>_/lua/plugins/jdtls-change-root.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n {\n &quot;mfussenegger/nvim-jdtls&quot;,\n ---@type lspconfig.options.jdtls\n ---@diagnostic disable-next-line: missing-fields\n opts = {\n jdtls = function(opts)\n local root_dir = {{'.git', 'mvnw', 'gradlew'}}\n table.insert(opts.root_dir, root_dir)\n\n return opts\n end,\n },\n },\n}\n</code></pre>\n<p>But something is wrong in that code.\nAny ideas?</p>\n"^^ . . . . "Is there some simple solution? Maybe a library to solve this problem. @Luatic"^^ . . . . "This is explained in the manual: https://www.lua.org/manual/5.4/manual.html#3.5"^^ . . "0"^^ . . . . . . "0"^^ . . . . "0"^^ . . . "<p>Regarding the official wxWidgets's doc, <a href="https://docs.wxwidgets.org/2.8.12/wx_wxdc.html#wxdcgetpixel" rel="nofollow noreferrer">GetPixel</a> doesn't return the colour : only a boolean that indicates if all was correct.\nYou have to pass a wxColour var as 3rd parameter:</p>\n<pre><code>local colour = wx.wxColour(0, 0, 0)\n\npdc:GetPixel(point.x, point.y, colour)\n</code></pre>\n"^^ . "0"^^ . . . "0"^^ . . . . . "0"^^ . . "0"^^ . . . . "Is there a lua equivalent of the javascript encodeURI() function?"^^ . "3"^^ . . "0"^^ . . "<p>i use <a href="https://github.com/907th/vim-auto-save" rel="nofollow noreferrer">vim-auto-save</a> for vim and <a href="https://github.com/0x00-ketsu/autosave.nvim" rel="nofollow noreferrer">autosave.nvim</a> for neovim, i set both to save only in <code>InsertLeave</code> but in insert mode, when i press Enter within a pair of braces <code>{}, (), []</code>, to insert a newline, the plugin saves the file automatically, and i prevent this using: <code>autocmd TextChanged,TextChangedI &lt;buffer&gt; silent noautocmd</code> in my .vimrc and tried to apply the same to init.lua using vim.cmd: <code>vim.cmd(&quot;autocmd TextChanged,TextChangedI &lt;buffer&gt; silent noautocmd&quot;)</code> but this doesn't work</p>\n"^^ . . "0"^^ . . . . . "1"^^ . . "0"^^ . "<p>Alright, so basically I have a script that draws ECG on a SurfaceGui with pixels (frames), and the thing is, the script runs very slowly, like twice or thrice slower than supposed to, like when I need script to draw a certain wave with length 80 ms, it draws it in 160 ms or more.</p>\n<p>I figured out to use <code>os.clock()</code> to see what is going on, and found out that <code>wait()</code> and <code>task.wait()</code> become very inaccurate at very low wait times (e.g. 1/60 seconds).</p>\n<p>I tried to use the same <code>os.clock()</code> to accurately measure time. It worked on paper fine, but on practice it made my PC lag and constantly cause <code>Script exhausted execution time</code> error. I was using this function:</p>\n<pre class="lang-lua prettyprint-override"><code>local function AccurateWait(time)\n local start = os.clock()\n while os.clock() - start &lt; time do \n -- Nothing\n end\nend\n</code></pre>\n<p>Now I don't know what to do, here is full script, maybe it will help. I need to make script wait exactly 1 frame (at 60 FPS) or 0.017 seconds.</p>\n<pre class="lang-lua prettyprint-override"><code>local leadFrame = script.Parent.blackBg.I_leadFrame\nlocal leadFrameWidth = leadFrame.Size.X.Offset\nlocal leadFrameUpdateTick = 1\n\nlocal pixelSize = 2 -- def: \nlocal pixels = {}\n\nlocal step = 3 -- DO NOT CHANGE THIS VALUE, def: 4\n\nlocal colGreen = Color3.fromRGB(25, 255, 25)\n\nlocal heartBPM = 60 / 60 * 1000 -- Will need it later, for now let it remain as 60\n\nlocal linePosX = 0\nlocal linePosY = 0\nlocal linePosY_Scale = 0.5\nlocal lineAccuracy = 16 -- def: 16\nlocal lineReachedFrameWidth = false\nlocal lineLoops = true\nlocal lineClearanceOffset = 20\nlocal lineClearing = false\n\nlocal section = 0\nlocal sectionInMS = 0\nlocal sectionMaxWidth = 0\n\nlocal wholeBeatLength = 0\n\nlocal function DrawLine()\n if linePosX &gt;= leadFrameWidth - pixelSize then\n if lineLoops then\n linePosX = 0\n end\n lineReachedFrameWidth = true\n return\n end\n \n if linePosX &gt;= leadFrameWidth - pixelSize - lineClearanceOffset or lineClearing then\n lineClearing = true\n pixels[1]:Destroy()\n table.remove(pixels, 1)\n end\n \n if linePosY ~= linePosY then\n linePosY = 0\n end\n \n local pixel = Instance.new(&quot;Frame&quot;, leadFrame)\n pixel.Size = UDim2.new(0, pixelSize, 0, pixelSize)\n pixel.Position = UDim2.new(0, linePosX, linePosY_Scale, linePosY)\n\n pixel.BackgroundColor3 = colGreen\n pixel.BackgroundTransparency = 0\n pixel.BorderSizePixel = 0\n pixel.Name = &quot;pixel&quot;\n \n table.insert(pixels, pixel)\nend\n\nlocal function DrawP_Wave()\n local durationP_Wave = 80 -- In ms, assume it is normal duration at 60 bpm\n local durationPR_Segment = durationP_Wave + 40\n \n local startTime = os.clock()\n while sectionInMS &lt; durationP_Wave do\n -- At these parameters length of P wave is 90 ms\n local A = 15 * step / 4 -- Scale of P wave, def: 15\n local B = 2.4 -- Width of P wave, def: 2.2 (the higher - the shorter)\n local C = 1.5 -- Can't describe, better not touch it, def: 1.5\n local D = 0.4 -- Height of P wave, def:\n local E = 1 -- Polarity of P wave, def: 1\n \n for i = 1, lineAccuracy do\n linePosY = -E * (A * D * math.sin(B * section / A))^C\n \n DrawLine()\n \n linePosX += step/lineAccuracy\n section += step/lineAccuracy\n sectionInMS = ((section/(60*step))*1000)\n \n if sectionInMS &gt; durationP_Wave then\n break\n end\n end\n wait(1/60)\n end\n print(&quot;P wave: &quot;..((os.clock()-startTime)*1000)..&quot; ms&quot;)\n \n while sectionInMS &lt; durationPR_Segment do\n for i = 1, lineAccuracy do\n DrawLine()\n\n linePosX += step/lineAccuracy\n section += step/lineAccuracy\n sectionInMS = ((section/(60*step))*1000)\n \n if sectionInMS &gt; durationPR_Segment then\n break\n end\n end\n wait(1/60)\n wholeBeatLength += 1/60*1000\n end\n print(&quot;PQ segment: &quot;..((os.clock()-startTime)*1000)..&quot; ms&quot;)\n \n section = 0\n sectionInMS = 0\nend\n\nlocal function DrawQRS_Complex()\n local durationQRS_Complex = 90\n local durationST_Segment = 100 + durationQRS_Complex\n \n local startTime = os.clock()\n while sectionInMS &lt; durationQRS_Complex do\n local A = 1.7 -- Width of QRS, def: 1.5 (the higher A - the shorter QRS)\n local B = 1.7 -- Height of QRS, def: 1.7\n local C = 3.6\n local D = 3.5\n local E = 5 -- def: 5\n local F = 1.1 -- Proportions of Q to S (bigger num -&gt; deeper peak Q), def: 1.1\n local G = 15 * step / 4 -- Scale, def: 15\n \n for i = 1, lineAccuracy do\n linePosY = -G*((B*(math.sin(A/G * section))^E)^D-\n (math.sin(A/G*F * section))^C)\n \n DrawLine()\n \n linePosX += step/lineAccuracy\n section += step/lineAccuracy\n sectionInMS = ((section/(60*step))*1000)\n \n if sectionInMS &gt; durationQRS_Complex then\n break\n end\n end\n wait(1/60)\n wholeBeatLength += 1/60*1000\n end\n print(&quot;QRS complex: &quot;..((os.clock()-startTime)*1000)..&quot; ms&quot;)\n \n while sectionInMS &lt; durationST_Segment do\n for i = 1, lineAccuracy do\n DrawLine()\n\n linePosX += step/lineAccuracy\n section += step/lineAccuracy\n sectionInMS = ((section/(60*step))*1000)\n \n if sectionInMS &gt; durationST_Segment then\n break\n end\n end\n wait(1/60)\n wholeBeatLength += 1/60*1000\n end\n print(&quot;ST segment: &quot;..((os.clock()-startTime)*1000)..&quot; ms&quot;)\n \n section = 0\n sectionInMS = 0\nend\n\nlocal function DrawT_Wave()\n local durationT_Wave = 160\n \n local startTime = os.clock()\n while sectionInMS &lt; durationT_Wave do\n local A = 1.1\n local B = 1.6\n local C = 3.6\n local D = 0.9\n local E = 5\n local F = 1.1\n local G = 15 * step / 4\n local H = 2.1\n \n for i = 1, lineAccuracy do\n linePosY = -G*((B*(math.sin(A/G * section))^E)^D-\n ((math.sin(A/G*F * section))^H)^C)\n \n DrawLine()\n \n linePosX += step/lineAccuracy\n section += step/lineAccuracy\n sectionInMS = ((section/(60*step))*1000)\n \n if sectionInMS &gt; durationT_Wave then\n break\n end\n end\n wait(1/60)\n wholeBeatLength += 1/60*1000\n end\n print(&quot;T wave: &quot;..((os.clock()-startTime)*1000)..&quot; ms&quot;)\n \n section = 0\n sectionInMS = 0\nend\n\nlocal function BreakBetweenBeats()\n local startTime = os.clock()\n while wholeBeatLength &lt; heartBPM do\n for i = 1, lineAccuracy do\n DrawLine()\n\n linePosX += step/lineAccuracy\n section += step/lineAccuracy\n sectionInMS = ((section/(60*step))*1000)\n end\n wait(1/60)\n wholeBeatLength += 1/60*1000\n end\n print(&quot;Pause: &quot;..((os.clock()-startTime)*1000)..&quot; ms&quot;)\n \n section = 0\n sectionInMS = 0\n wholeBeatLength = 0\nend\n\nwhile true do\n DrawP_Wave()\n DrawQRS_Complex()\n DrawT_Wave()\n BreakBetweenBeats()\nend\nprint(&quot;ECG session has ended.&quot;)\n</code></pre>\n"^^ . "1"^^ . "1"^^ . . . "1"^^ . . . . "grand-theft-auto"^^ . . . . "Because you were using `loadstring` instead of `dostring`."^^ . . . "1"^^ . "Lua, like its host C implementation, has no knowledge of terminal drivers. A solution here entirely depends on the platform and terminal in use (e.g., one might use [ANSI escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code)) - can you please provide this information? There are some fairly portable libraries (e.g., [tag:curses]) that tackle this problem, but do note that asking for library *suggestions* is off-topic for Stack Overflow."^^ . . . . . "0"^^ . "-1"^^ . . "Thanks, the order is now displayed correctly, however, the values for the table SA_1 are still incorrect.\nSA_1 (table):\n 1: 0 \n 2: 3 \n 3: 3 \n 4: 3"^^ . "3"^^ . "2"^^ . . . "-2"^^ . . . "<p>You can use <strong>Transform data</strong> feature to <code>Filter by name</code> transformation to keep only the <code>price</code> field.</p>\n"^^ . . . . "0"^^ . . "cheat-engine"^^ . . "<p>how can I easily sort this table by keys? it is necessary that it displays not a key and a value, but a sorted table</p>\n<p>for example</p>\n<pre><code>local mytable = {\n [&quot;name10&quot;] = 6,\n [&quot;name9&quot;] = 10,\n [&quot;name8&quot;] = 8,\n [&quot;name7&quot;] = 4,\n [&quot;name6&quot;] = 1,\n [&quot;name5&quot;] = 7, \n [&quot;name4&quot;] = 2,\n [&quot;name3&quot;] = 3,\n [&quot;name2&quot;] = 5,\n [&quot;name1&quot;] = 9\n}\n</code></pre>\n<p>it needs to return this</p>\n<pre><code>local sorted_table = {\n [&quot;name9&quot;] = 10,\n [&quot;name1&quot;] = 9,\n [&quot;name8&quot;] = 8,\n [&quot;name5&quot;] = 7,\n [&quot;name10&quot;] = 6,\n [&quot;name2&quot;] = 5,\n [&quot;name7&quot;] = 4,\n [&quot;name3&quot;] = 3,\n [&quot;name4&quot;] = 2,\n [&quot;name6&quot;] = 1\n}\n</code></pre>\n<p>i was looking for a solution to this problem, but everywhere it gave out exactly the key and the value separately, not the table</p>\n"^^ . . . . . "<pre><code>local Backpack = game:GetService(&quot;ReplicatedStorage&quot;):Waitforchild(&quot;Backpack&quot;)\nlocal Player = game:GetService(&quot;Players&quot;).localplayer\n\nPlayer.Character.Respawned:Connect(function(Character)\n local clone = Backpack:clone(Character:Waitforchild(&quot;Torso&quot;))\nend\n</code></pre>\n"^^ . . . . . . . "1"^^ . . "<p>We can apply templates to each element in the loop.\nThe <code>gsub</code> function can also capture values in the template itself. This will help us.\n<a href="https://www.lua.org/pil/20.3.html" rel="nofollow noreferrer">Read more here..</a></p>\n<pre><code>local function MyFormat(s)\n local x = s:gsub(&quot;(%d%d)(%a%a)(%a%a)&quot;,&quot;%1-%2-%3&quot;)\n :gsub(&quot;(%d%d)(%a%a%a)(%d)&quot;,&quot;%1-%2-%3&quot;) \n :gsub(&quot;(%d)(%a%a%a)(%d%d)&quot;,&quot;%1-%2-%3&quot;) \n :gsub(&quot;(%a%a)(%d%d%d)(%a)&quot;,&quot;%1-%2-%3&quot;) \n :gsub(&quot;(%a)(%d%d%d)(%a%a)&quot;,&quot;%1-%2-%3&quot;) \n return x \nend\n\nlocal t = { &quot;99XXXX&quot;, &quot;99XXX9&quot; , &quot;9XXX99&quot; , &quot;XX999X&quot;, &quot;X999XX&quot;}\nfor k, v in pairs(t) do \n print(v,MyFormat(v))\nend\n</code></pre>\n<p>results:</p>\n<pre><code>99XXXX 99-XX-XX\n99XXX9 99-XXX-9\n9XXX99 9-XXX-99\nXX999X XX-999-X\nX999XX X-999-XX\n</code></pre>\n<p>Templates will be applied to each line 5 times. If no template is found, then <code>gsub</code> will not change anything in the line, so the first matching template will change the line as needed</p>\n"^^ . "0"^^ . . . "0"^^ . . "<p>I suppose it would not make much sense to implement in your code the ability to self-change. So you have two main options: use your editor manually to change your code, or script it (whether inside your editor, or using an independent program).</p>\n<p>I do not use VSCode but I believe you can do it using JavaScript (*), using VSCode Tasks. (You could also build an extension, but this is an overkill.)</p>\n<p>The easiest way is to just make an independent script; it can be written in anything you want. Lua is an obvious choice because you already have a Lua table with the desired changes, but with little tweaking you can do it in any language you are comfortable with. Here's Lua script that should do what you want.</p>\n<pre><code>-- Set the filename of your code here\nlocal filename = &quot;my_script.lua&quot;\n\n-- Paste your lookup table here\nlocal var = { [1] = &quot;dothis&quot;, [2] = &quot;clevermaths&quot;, [3] = &quot;longstring&quot; }\n\n-- read the file\nlocal file = io.open(filename, &quot;r&quot;)\nlocal text = file:read(&quot;a&quot;)\nfile:close()\n\n-- replace each of the table entries\nfor i, repl in pairs(var) do\n local key = &quot;var%[&quot; .. i .. &quot;%]&quot;\n text = text:gsub(key, repl)\nend\n\n-- save the changes\nfile = io.open(filename, &quot;w&quot;)\nfile:write(text)\nfile:close()\n</code></pre>\n<p>After executing this script, your file should have been updated with all the replacements you had in your lookup table.</p>\n<p>The other poster did mention an important safety tip: whenever you are performing a large-scale change on one of your files, make sure to use version control and commit beforehand (or, at the very least, make a backup), for safety.</p>\n<hr />\n<p>*) or at least, a JavaScript build system, like <code>grunt</code> or <code>npm</code> — the code itself can be any executable.</p>\n"^^ . . "0"^^ . "0"^^ . "2"^^ . . . . "1"^^ . . "yes, it needs to return sorted_table"^^ . "1"^^ . . "yes i know i set `trigger_events = {"InsertLeave"}` . i use [autoclose.nvim](https://github.com/m4xshen/autoclose.nvim) and i uninstalled it completely and the file still gets saved when pressing Enter within parentheses . am still searching and tried uninstalling multible other plugins"^^ . . "0"^^ . . . "1"^^ . "<ol>\n<li><p>Lua is able to create sequence tables, but you passed the wrong parameter, the 2nd parameter is the hint of sequence capacity, so it should be:</p>\n<pre><code>lua_createtable(L, 4, 0);\n</code></pre>\n</li>\n<li><p>When you use <code>pairs</code> to iterate over a table, <a href="https://stackoverflow.com/questions/73741252/why-does-the-same-lua-script-have-inconsistent-execution-results/73741334#73741334">its order is always unspecified</a>.</p>\n</li>\n</ol>\n"^^ . "<p>I want to keep a list of words (let's say 20k). The only purpose of it is to check if the given word exists there. So, it's going be something known as a hash set.</p>\n<pre><code>-- dict here is just an example, it's going to be loadaed from a text file\ndict = {[&quot;foo&quot;] = true, [&quot;bar&quot;] = true, ...}\n\n\nfunction dict.contains(self, word) do\n return self[word]\nend\n</code></pre>\n<p>Is this option good enough? Or maybe this one would be better:</p>\n<pre><code>-- hash(string) is an exisiting external function\n\ndict = {hash(&quot;foo&quot;) = true, hash(&quot;bar&quot;) = true, ... up to 20k}\n\nfunction dict.contains(self, word) do\n return self[hash(word)]\nend\n</code></pre>\n<p>I am inclining to vote for the 2nd option but thinking of internal implementation of lua hashes makes me a little bit confused. If it is just an address of an interned string, probably the 1st option is quite good one (in terms of memory consumption and better performance)? But from the other side, it should be good for statically defined tables (with interned strings). While I am going to load keys, maybe the 2nd options is still better?</p>\n"^^ . . "I have this error in roblox studio: ServerScriptService.Main.Base:17: attempt to index nil with 'CurrentHealth'"^^ . "2"^^ . "0"^^ . . . "2"^^ . "0"^^ . . "0"^^ . . . "0"^^ . "<p>Making a string change its value randomly, the code:</p>\n<pre class="lang-lua prettyprint-override"><code>function randomNumbers (str)\n local matches = {}\n for match in str:gmatch(&quot;#&quot;) do\n table.insert(matches, match)\n end\n\n for i = #matches, 1, -1 do\n local n = tostring(math.random(0, 9))\n str = string.gsub(str, &quot;#&quot;, n, 1)\n end\n return str\nend\n</code></pre>\n<p>Examples:</p>\n<pre class="lang-lua prettyprint-override"><code>print(randomNumbers(&quot;a#bcd&quot;)) -- a7bcd\nprint(randomNumbers(&quot;a#b#cd&quot;)) -- a6b5cd\nprint(randomNumbers(&quot;a#b#c#d&quot;)) -- a7b0c6d\nprint(randomNumbers(&quot;a#b#c#d#&quot;)) -- a3b7c4d5\nprint(randomNumbers(&quot;a#b#c#d##&quot;)) -- a1b0c9d71\n</code></pre>\n<hr />\n<pre class="lang-lua prettyprint-override"><code>strings = {\n&quot;1foo2bar3&quot;,\n&quot;foo1&quot;,\n&quot;bar1&quot;,\n}\n\nfor i, str in ipairs (strings) do\n str = string.gsub(str, &quot;(%d)&quot;, &quot;#&quot;) -- replacing any digit by #\n print(randomNumbers(str))\nend\n</code></pre>\n<p>Result:</p>\n<pre><code>7foo6bar5\nfoo7\nbar0\n</code></pre>\n"^^ . . . "0"^^ . "0"^^ . "1"^^ . . . "0"^^ . . "2"^^ . "<p>I'm unable to find a way to match all extended alphabet characters without doing so explicitly. For example, matching the tag <code>språk</code>.</p>\n<pre class="lang-lua prettyprint-override"><code>tag = &quot;språk&quot;\ntag:match([[%w+]])\n</code></pre>\n<p>This doesn't work because <code>å</code> is not contained within <code>%w</code>. This can be matched with <code>tag:match([[[%wå]+]])</code>, but then you have to explicitly add all special.</p>\n<p>One can also extend the range. This works <code>tag:match([[[a-å]+]])</code>, but I'm not 100% clear on why, or at least not where that range actually covers in the character table.</p>\n<p>So what is the correct way to match a range that includes all ascii plus all latin extended?</p>\n<hr />\n<p>The best solution I've come up with so far is:</p>\n<pre class="lang-lua prettyprint-override"><code>tag = &quot;språk&quot;\ntag:match([[[a-zA-ZÀ-ÿ]+]])\n</code></pre>\n<p>But I'm still unsure if that is completely correct, and it would be ideal if there is a shortcut class for this I'm simply overlooking.</p>\n"^^ . "<p>you should look at the humanoid's <a href="https://create.roblox.com/docs/reference/engine/classes/Humanoid#PlatformStand" rel="nofollow noreferrer"><code>PlatformStand</code></a> property</p>\n<pre><code>char.Humanoid.PlatformStand = true;\n</code></pre>\n<p>make sture to disable it when you disable the fly again!</p>\n"^^ . "Is 2 dashes - max amount of them?"^^ . . . . "0"^^ . . "<p>You might want to start by reading/referencing sections 10 (Lua Support in Wireshark) and 11 (Wireshark’s Lua API Reference Manual) in the <a href="https://www.wireshark.org/docs/wsdg_html/" rel="nofollow noreferrer">Wireshark Developer's Guide</a>. After that, you may want to reference the <a href="https://wiki.wireshark.org/Lua" rel="nofollow noreferrer">Wireshark Lua Wiki Page</a> for additional help and resources, including <a href="https://wiki.wireshark.org/Lua/Examples" rel="nofollow noreferrer">Examples</a> and user <a href="https://wiki.wireshark.org/Contrib" rel="nofollow noreferrer">Contrib</a>utions.</p>\n<p>You may also find the example <code>foo.lua</code> dissector I wrote and shared on the <a href="https://www.wireshark.org/lists/wireshark-dev/202110/msg00007.html" rel="nofollow noreferrer">wireshark-dev mailing list</a> a few years ago of some help. I included a sample <code>foo.pcap</code> file for testing it as well.</p>\n"^^ . . . "0"^^ . "0"^^ . . "<p>I have the follwing code, trying to understand C-Api , lua_resume, continuations and different cases, just for expirements as doc mentions. I am currently in lua 5.4 on an ubuntu desktop.\nI have the following code:</p>\n<pre class="lang-c prettyprint-override"><code>// Attempt to yield C-Function, into protected mode. - Continuation Function -\nstatic int finishpcall (lua_State *L, int status, intptr_t ctx) {\n(void)ctx; // unused parameter\nstatus = (status != LUA_OK &amp;&amp; status != LUA_YIELD);\nlua_pushboolean(L, (status == 0)); // status\nlua_insert(L, 1); // status is first result\n\nprintf(&quot;%s, %d\\n&quot;, &quot;From lua&quot;, lua_gettop(L)); // it is lua's stack frame = 1\nlua_getglobal(L, &quot;co&quot;);\n\n\nlua_resume(lua_tothread(L, 2), NULL, 0, 0);\nlua_resume(lua_tothread(L, lua_gettop(L)), NULL, 0, 0);\nreturn lua_gettop(L); // return status + all results\n}\n\nstatic int luaB_pcall (lua_State *L) {\nint status;\nluaL_checkany(L, 1);\nstatus = lua_pcallk(L, lua_gettop(L) - 1, LUA_MULTRET, 0, 0, finishpcall);\nreturn finishpcall(L, status, 0);\n}\n\nint main(void) {\nlua_State *L = luaL_newstate();\nluaL_openlibs(L);\n\n// Register luaB_pcall as a Lua function\nlua_register(L, &quot;pcall&quot;, luaB_pcall);\n\nconst char *str = &quot;function test() \\\n local co = coroutine.create(function() print('me') \\\n coroutine.yield() \\\n print('me me') \\\n end) \\ \n return co \\\n end \\\n pcall(test)&quot;;\n\nint res = luaL_dostring(L, str);\nif (res != LUA_OK) {\n printf(&quot;Error running Lua code: %s\\n&quot;, lua_tostring(L, -1));\n lua_close(L);\n return 1;\n} \n\nprintf(&quot;%s, %d\\n&quot;, &quot;From C-Function&quot;, lua_gettop(L)); //it is C's stack frame = 0\n\nlua_close(L);\nreturn 0;\n}\n</code></pre>\n<p>Can anyone suggest me why i get segmentaition fault on lua_resume in finishpcall() , although firstly i get From lua, 2\nme as results.</p>\n"^^ . "1"^^ . "0"^^ . "math"^^ . "<p>i know you're able to do constant variables in lua now with <code>&lt;const&gt;</code>, but they seem to only work with local variables:</p>\n<p><code>local myNumber &lt;const&gt; = 10 -- This works perfectly fine</code></p>\n<p><code>myGlobalNumber &lt;const&gt; = 10 -- This causes an error</code></p>\n<p>Is it possible to have constant global variables as well?</p>\n<p><code>myGlobalNumber &lt;const&gt; = 10</code></p>\n"^^ . . . "0"^^ . "0"^^ . "Get the circle, that is defined by two points and tangent line, Lua"^^ . . "0"^^ . "0"^^ . "3"^^ . "0"^^ . "<p>In Lua, the colon <code>:</code> is typically used for method calls, not for specifying object properties directly. Instead, you should use the equality operator <code>=</code> to specify the property and its value in a Lua table.</p>\n<p>So, in Lua, your query object should be written like this:\n<code>{ allowRebirthing = true }</code></p>\n<p>Plus, removed the square brackets around the field names. MongoDB queries do not need square brackets around field names.</p>\n<p><code>({ allowRebirthing = true })</code></p>\n<p><code>({ allowRebirthing = false })</code></p>\n"^^ . . . . "0"^^ . . . "3"^^ . . "Wrap the key name in square brackets: `local foo = 'bar'; print(({ ['baz' .. foo] = 'qux' })['bazbar']) -- qux`."^^ . . "0"^^ . "1"^^ . . "Clear Lua Output"^^ . "<p>The state machine:</p>\n<pre><code>sum = function (a, b) return a + b end\nsub = function (a, b) return a - b end\n\nStates = {sum=sum, sub=sub}\n\nState = States.sum -- current state is sum\nc1 = State (5, 4) -- 9\n\nState = States.sub -- and now current state is sub\nc2 = State (5, 4) -- 1\n</code></pre>\n<p>Just switch the state and you don't need to check condition, the state is already there.</p>\n"^^ . . . "Hello! Sorry for not responding to your answer for that long, I didn't knew I had to refresh the page. I uhh, didn't really understand some parts your solution since there is some higher level coding involved which I don't understand, but I will try to and implement it to see if it will work.\n\nThanks for your answer and help, I will reply if it worked or not, or when I will need extra assistance."^^ . "Immediately break the loop when condition is not met and go to next line"^^ . . . "watchmaker"^^ . "<p>The point of the <code>&lt;const&gt;</code> local variable attribute is to allow Lua to check, at &quot;load&quot; time (when you call <code>dofile</code> / <code>load</code> / <code>require</code> or similar), whether a local variable is not being mutated - that is, whether the only assignment is the initial one at declaration time. It is a tool to help programmers (1) express intent (2) get slightly more &quot;load time&quot; checking than just syntactic checks.</p>\n<p>This works for <code>local</code> variables precisely because they are local. They are visible only within function scope. This means Lua has all the information it needs when you load a &quot;chunk&quot; of code (effectively a function body) to check whether it abides by the <em>static</em> (load time) rules of <code>&lt;const&gt;</code>.</p>\n<p>&quot;Globals&quot; / &quot;environmental variables&quot; (as I like to call them) are effectively just syntactic sugar for accessing fields in the <code>_ENV</code> (usually <code>_G</code>) table. As such, they are much more dynamic than local variables. You could do <code>_G[some .. complex .. expression] = 42</code>, for example. With global variables, just as with any other table fields, Lua does not have all the information it needs at load time. To begin, it does not even know which fields your code will set or get. Even if it knew this, or limited itself to the <code>&lt;name&gt;</code> syntax, that would still be insufficient. Consider loading a file where a certain global variable that was not set yet is used (perhaps in some callback where the author knows it will be available in time). Lua can not warn about this at the time the file is loaded. (It could, at best, try to warn when the file containing the conflicting constant definitions was loaded, then warn when subsequent files are loaded.)</p>\n<p>As ESkri has said, you can implement run-time checks to guard against accessing constant global variables via a metatable. That could look something like this:</p>\n<pre class="lang-lua prettyprint-override"><code>local constants = {pi = math.pi}\nsetmetatable(_G, {__index = constants, __newindex = function(_, key) error(&quot;attempt to change constant global variable &quot; .. key) end})\nprint(pi) -- runs fine\npi = 3 -- errors\n</code></pre>\n<p>However, this is probably a bad idea:</p>\n<ul>\n<li>It's likely to confuse (future) you as well as whatever static analysis tools you may choose to use. (This could be alleviated to an extent using a different implementation however.)</li>\n<li>It incurs a performance penalty.</li>\n<li>It's still only a runtime check. If you don't hit a code path in your testing, you don't get an error or warning.</li>\n</ul>\n<p>Instead, I would recommend the use of <em>static analysis tools</em> such as <em>Luacheck</em>, which lets you specify [<em>read-only global variables</em> in its <a href="https://luacheck.readthedocs.io/en/stable/config.html" rel="nofollow noreferrer">configuration file</a>, and also supports a <code>new read globals</code> inline option to add read-only global variables, similar to a &quot;constant&quot; definition. Example:</p>\n<pre class="lang-lua prettyprint-override"><code>-- luacheck: globals pi\npi = math.pi\n-- luacheck: new read globals pi\npi = 3\n</code></pre>\n<p>it should be noted that while options are limited in scope to files, the <code>read_global</code> configuration field is per-&quot;project&quot; (folder) you're running Luacheck in. To establish <code>pi</code> as a read-only global project-wide, you could set <code>read_globals = {&quot;pi&quot;}</code>, then use <code>-- luacheck: globals pi</code> to make an exception where <code>pi</code> is defined (followed by <code>-- luacheck: new read globals pi</code> to revoke that exception afterwards).</p>\n"^^ . . "0"^^ . "0"^^ . "If only some specific icons are not rendering properly then you can replace those icons with unicode symbols in your lualine config file as an example replace error icons with this ` ` symbol, as same as warning icons ` `. I prefer you to read [this](https://github.com/nvim-lualine/lualine.nvim#diagnostics-component-options)"^^ . "<p>Have you tried making all your localplayer's character parts transparency 0?</p>\n"^^ . "If you're using `COC` as `completion` and `LSP`, then there is option of jumping on definition `:call CocActionAsync('jumpDefinition')` it supports in most `LSP` servers of `COC`"^^ . . . "1"^^ . . . . "0"^^ . "3"^^ . "0"^^ . "1"^^ . . . "0"^^ . "What job control advantage does Python have over some of the other embedded scripting languages mentioned above?"^^ . . . . . . . "1"^^ . "wireshark-dissector"^^ . "1"^^ . "0"^^ . . . "\n<p>For this, you want to first define a table that will store all of your parts. Then, you create a loop that runs for however many parts you want (in your code, it's 10), and create each part in that loop. Here is an example:</p>\n<pre class="lang-lua prettyprint-override"><code>local parts = {}\nfor i = 1, 10 do\n local part = display.newImage(&quot;part&quot; .. tostring(i) .. &quot;.png&quot;, 0, 0)\n part:scale(0.5, 0.5)\n part.isVisible = false\n table.insert(parts, part)\nend\n</code></pre>\n<p>After this, you'll have a table full of parts, and can access them like so:</p>\n<pre><code>parts[part_num]\n</code></pre>\n<p>Hope this helps!</p>\n"^^ . . "0"^^ . "2"^^ . . . "2"^^ . "0"^^ . "1"^^ . "By adding a very small number to such comparisions, and replacing equals by a range check. As explained in the linked question btw."^^ . "I updated Lua from 5.4.2 to 5.4.4 and now it works ..."^^ . "0"^^ . "ids"^^ . . . . . . . "0"^^ . "0"^^ . "0"^^ . "code-snippets"^^ . . "<p>Check out <code>:help vim.keymap.set()</code>. That will take you to a reference in the <em>lua.txt</em> help file.</p>\n<p>Here is one of the examples from the help file:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.keymap.set('n', '&lt;leader&gt;w', &quot;&lt;cmd&gt;w&lt;cr&gt;&quot;, { silent = true, buffer = 5 })\n</code></pre>\n<p>The general form is <code>set({mode}, {lhs}, {rhs}, {opts})</code></p>\n<p>You might need to try escaping some quotes, but it could be something like this</p>\n<pre class="lang-lua prettyprint-override"><code>vim.keymap.set('i', '&lt;c-f&gt;', &quot;&lt;Esc&gt;: silent exec '.!inkscape-figures create &quot;'.getline('.').'&quot; &quot;'.b:vimtex.root.'/figures/&quot;'&lt;CR&gt;&lt;CR&gt;:w&lt;CR&quot;, { silent = true, noremap = true })\n</code></pre>\n"^^ . "Unfortunately it doesn't work. It puts only fix time - the time of open buffer file."^^ . . "unsigned-integer"^^ . . . "1"^^ . "<p>I am using neovim for the first time after using vim. I could use some neovim distro like NvChad or lazyVim. But i thought why now start from scratch and keep it lightweight.</p>\n<p>I installed packer as my plugin manager</p>\n<p>here's the code i put in the init.lua file .</p>\n<pre class="lang-lua prettyprint-override"><code>-- Replace with your actual Neovim configuration file path\nvim.cmd([[packadd packer.nvim]])\n\n-- Replace with your actual Neovim configuration file path\nlocal packer = require('packer')\n\npacker.init({\n use{\n &quot;kylenchui/nvim-surround&quot;,\n tag = &quot;*&quot;,\n config = function()\n require(&quot;nvim-surround&quot;).setup({})\n end\n }\n})\n\n\n-- Disable compatibility with vi which can cause unexpected issues.\nvim.opt.compatible = false\n\n-- Enable type file detection. NeoVim will be able to try to detect the type of file in use.\nvim.cmd('filetype on')\n\n\n\n\n-- Enable plugins and load plugin for the detected file type.\nvim.cmd('filetype plugin on')\n\n-- Load an indent file for the detected file type.\nvim.cmd('filetype indent on')\n\n-- Enable syntax highlighting.\nvim.cmd('syntax enable')\n\n-- Set relative line numbers.\nvim.opt.relativenumber = true\n\n-- Set shift width to 4 spaces.\nvim.opt.shiftwidth = 4\n\n-- Set tab width to 4 columns.\nvim.opt.tabstop = 4\n\n-- Use space characters instead of tabs.\nvim.opt.expandtab = true\n\n-- Do not save backup files.\nvim.opt.backup = false\n\n-- Do not let cursor scroll below or above N number of lines when scrolling.\nvim.opt.scrolloff = 10\n\n-- Do not wrap lines. Allow long lines to extend as far as the line goes.\nvim.opt.wrap = false\n\n-- While searching through a file, incrementally highlight matching characters as you type.\nvim.opt.incsearch = true\n\n-- Ignore capital letters during search.\nvim.opt.ignorecase = true\n\n-- Override the ignorecase option if searching for capital letters.\n-- This will allow you to search specifically for capital letters.\nvim.opt.smartcase = true\n\n-- Show partial command you type in the last line of the screen.\nvim.opt.showcmd = true\n\n-- Show the mode you are in on the last line.\nvim.opt.showmode = true\n\n-- Show matching words during a search.\nvim.opt.showmatch = true\n\n-- Use highlighting when doing a search.\nvim.opt.hlsearch = true\n</code></pre>\n<p>and this is the error I am facing:</p>\n<p><code>Error detected while processing /home/ishtiaqdishan/.c onfig/nvim/init.lua: E5113: Error while calling lua chunk: /home/ishtiaqdis han/.config/nvim/init.lua:9: attempt to call global 'u se' (a nil value) stack traceback: /home/ishtiaqdishan/.config/nvim/init.lua:9: i n main chunk</code></p>\n<p>How can i fix this issue? Can someone help with the problem?</p>\n<p>Tried multiple method to install packer\nTried to fix some lua syntax</p>\n<p>nothing worked</p>\n"^^ . . . "parse table from c to lua"^^ . "Maybe this is because the `groundFixture` doesn't have any userdata."^^ . . . . "0"^^ . . . . . "1"^^ . . . . . . . "Does this answer your question? [LUA Variables as Table Keys](https://stackoverflow.com/questions/11359737/lua-variables-as-table-keys)"^^ . . "<p>Is this what you're looking for?</p>\n<pre><code>for i=1,10 do\n local part = display.newImage(&quot;part&quot; .. i .. &quot;.png&quot;, 0, 0)\n part:scale ( 0.5, 0.5)\n part.isVisible = false\nend\n</code></pre>\n"^^ . . "0"^^ . . . "<p><code>lua_setglobal</code> will pop the c function from the stack, causing <code>lua_pcallk</code> to call an invalid location, you need to duplicate the c function before setting global.</p>\n<pre><code>lua_pushcfunction(L1, foreach);\nlua_pushvalue(L1, -1);\nlua_setglobal(L1, &quot;foreach&quot;);\nres = lua_pcallk(L1, 0, 0, 0, 0, resume_func_continuation);\n</code></pre>\n"^^ . . . . . . . "@milk - The official Lua tutorial (the book "Programming in Lua" by Roberto, first edition is free) is enough to understand the code in that answer."^^ . . . "<p>Whenever I try running this Data Manager Module script I get a script error saying:\nInfinite yield possible on 'ServerScriptService.Modules:WaitForChild(&quot;Modules&quot;)' - Studio</p>\n<p><img src="https://i.sstatic.net/WkpaG.png" alt="the script I am using" /></p>\n<p>But for some reason the leaderboard works fine, just the rolls are not appearing next to my name in the leader board.</p>\n<p><img src="https://i.sstatic.net/WTD6W.jpg" alt="leaderboard screenshot after running the game scripts" /></p>\n<p>Also I tried adding a 1 to the rolls in the Template module script but that did not work either so I just set it back to 0.</p>\n<p>I tried asking an AI bot and it told me that this issue might be caused of the loading time, so I tried changing the script line:3 in Data Manager to :</p>\n<pre class="lang-lua prettyprint-override"><code>local modules = ServerScriptService:WaitForChild(&quot;Modules&quot;, 5) -- waits up to 5 seconds\n</code></pre>\n<p>and the same error occurs :</p>\n<blockquote>\n<p>Infinite yield possible on 'ServerScriptService.Modules:WaitForChild(&quot;Modules&quot;)' - Studio</p>\n</blockquote>\n<p>If anyone could help me solve the problem, I would be very thankful. I will put the rest of my scripts down below, Player data, Leader Stats, the Template and the server script. All of which I reread and re-scripted.</p>\n<p><img src="https://i.sstatic.net/WIMPK.png" alt="Leader Stats Module Script Code PNG" /></p>\n<p><img src="https://i.sstatic.net/gJWno.png" alt="Player Data Script Code PNG" /></p>\n<p><img src="https://i.sstatic.net/AH8rn.png" alt="Template Module Script Code PNG" /></p>\n<p><img src="https://i.sstatic.net/cys6m.png" alt="Server Script Code PNG" /></p>\n<p>If you need any other info to solve this please let me know I will gladly provide any script just ask! :D</p>\n<p>What I tried: Running Data Manager Module script</p>\n<p>What I Expected: The leaderboard at the top right of the screen to show the amount of times a player has rolled in the game.</p>\n<p>What actually resulted: Script error Infinite yield possible on 'ServerScriptService.Modules:WaitForChild(&quot;Modules&quot;)' - Studio</p>\n"^^ . . . . "0"^^ . "in Lua, how to write an iterator for a binary tree?"^^ . . "4"^^ . . . . . "0"^^ . "1"^^ . . . . . "@Mersad There's a saying: "If you have a problem and decide to solve it with RegEx, then you already have **two** problems." The slight increase in performance, which you *might* or *might not* achieve, totally doesn't worth the time you are going to spend on it. That unless you really need to decrease the execution time, but this one doesn't seem to be the case."^^ . "1"^^ . . "I got similiar problem when type `fact(21)`, my compiler shows **-4249290049419214848**. I don't know why but I convince this is because of some memory or bit-byte problems."^^ . . . . "1"^^ . . . . . . . . "0"^^ . "<p>I'm creating a tower defense game and I'm doing a base health system I tried a lot of things and I can't fix this error:</p>\n<p><code>ServerScriptService.Main.Base:17: attempt to index nil with 'CurrentHealth'</code></p>\n<p>Here's my script:</p>\n<p><img src="https://i.sstatic.net/V9pOQ.png" alt="" /></p>\n<p><img src="https://i.sstatic.net/vB19z.png" alt="" /></p>\n"^^ . "Can rectangles overlap?"^^ . . "<p>I am developing a game in Roblox Studio and while scripting I found a problem I can't seem to fix.</p>\n<p>I have attempted several times to disable the default Fall R15 Animation while in flight mode, which is activated by pressing the Space key twice. However, I seem to be missing a step or perhaps doing something incorrectly because I can't figure out how to turn it off. All I want is to utilize an Idle animation when my character is stationary, but despite having four animations assigned to the keys WASD, the fall animation continues to activate whenever I'm in flight mode and not moving. It's proving to be a persistent issue that I can't seem to resolve. Any suggestions would be greatly appreciated.</p>\n<p>Demonstration:\n<a href="https://youtu.be/Zh1jjabVJbo" rel="nofollow noreferrer">https://youtu.be/Zh1jjabVJbo</a></p>\n<p>I tried changing the Fall animation to an idle animation - didn't work.\nI tried turning it off while on the flight mode - didn't work\nI tried multiple solutions already.</p>\n<pre><code>local UIS = game:GetService(&quot;UserInputService&quot;)\n\nlocal last = tick()\nlocal isFlying = false\n\nlocal flyUpSpeed = 16\nlocal flyDownSpeed = 16\n\n\nlocal char = script.Parent\nlocal root = char:WaitForChild(&quot;HumanoidRootPart&quot;)\n\nfunction flight(isFlying)\n if isFlying then\n local bv = Instance.new(&quot;BodyVelocity&quot;)\n bv.MaxForce = Vector3.new(0, 1, 0) * 30000\n bv.Velocity = Vector3.new(0, 0, 0)\n bv.Name = &quot;FlightVelocity&quot;\n bv.Parent = root\n else\n local bv = root:FindFirstChild(&quot;FlightVelocity&quot;)\n if bv then bv:Destroy() end\n end\nend\n\n\n\n\nUIS.InputBegan:Connect(function(input, gameprocessed)\n if gameprocessed then return end\n \n if input.KeyCode == Enum.KeyCode.Space then \n if (tick() - last) &lt; 0.5 then\n isFlying = not isFlying\n flight(isFlying)\n elseif isFlying then \n local bv = root:FindFirstChild(&quot;FlightVelocity&quot;)\n if bv then \n bv.Velocity = Vector3.new(0, 1, 0) * flyUpSpeed\n end\n end\n last = tick()\n end\n \n if input.KeyCode == Enum.KeyCode.LeftControl then \n if isFlying then\n local bv = root:FindFirstChild(&quot;FlightVelocity&quot;)\n if bv then \n bv.Velocity = Vector3.new(0, -1, 0) * flyDownSpeed\n end\n end\n end\n \n local bv = root:FindFirstChild(&quot;FlightVelocity&quot;)\n if isFlying and bv then \n local currentAnim = Instance.new(&quot;Animation&quot;)\n \n if input.KeyCode == Enum.KeyCode.W then \n if playAnim then playAnim:Stop() end\n currentAnim.AnimationId = &quot;rbxassetid://16864466808&quot;\n playAnim = char.Humanoid:LoadAnimation(currentAnim)\n \n elseif input.KeyCode == Enum.KeyCode.A then \n if playAnim then playAnim:Stop() end\n currentAnim.AnimationId = &quot;rbxassetid://16864540911&quot;\n playAnim = char.Humanoid:LoadAnimation(currentAnim)\n\n elseif input.KeyCode == Enum.KeyCode.S then \n if playAnim then playAnim:Stop() end\n currentAnim.AnimationId = &quot;rbxassetid://16864534139&quot;\n playAnim = char.Humanoid:LoadAnimation(currentAnim)\n\n elseif input.KeyCode == Enum.KeyCode.D then \n if playAnim then playAnim:Stop() end\n currentAnim.AnimationId = &quot;rbxassetid://16864446697&quot;\n playAnim = char.Humanoid:LoadAnimation(currentAnim)\n\n else\n if playAnim then playAnim:Stop() end\n end\n \n if playAnim then playAnim:Play() end\n end\nend)\n\n\n\n\n\nUIS.InputEnded:Connect(function(input,gameprocessed)\n if gameprocessed then return end\n\n if playAnim then\n if UIS:IsKeyDown(Enum.KeyCode.W) then return end\n if UIS:IsKeyDown(Enum.KeyCode.A) then return end\n if UIS:IsKeyDown(Enum.KeyCode.S) then return end\n if UIS:IsKeyDown(Enum.KeyCode.D) then return end\n \n playAnim:Stop()\n end\n \n\n\n\n if input.KeyCode == Enum.KeyCode.Space or input.KeyCode == Enum.KeyCode.LeftControl then\n if isFlying then\n local bv = root:FindFirstChild(&quot;FlightVelocity&quot;)\n if bv then \n bv.Velocity = Vector3.new(0,0,0)\n end\n end\n end\nend)\n</code></pre>\n"^^ . "0"^^ . . . "1"^^ . . "0"^^ . . . . "lua_resume has segmentation faults"^^ . . . . . . . "0"^^ . . . . . . "0"^^ . . . "Your `sorted_table` is sorted by value in descending order. Is that what you want?"^^ . "0"^^ . . "0"^^ . . "<p>I'm trying to make a system in roblox studio, in which whenever a tool is activated it will play a animation and make an variable which will be the amount of gems, and then that variable will be put into the PlayerGUI but the variable is not being updated and it is being stuck on 1.This is the code I wrote -</p>\n<pre><code>local tool = script.Parent\nlocal anim = tool:WaitForChild(&quot;1&quot;)\nlocal player = game:GetService(&quot;Players&quot;).LocalPlayer\nlocal char = player.Character or player.CharacterAdded:Wait()\nlocal humanoid = char:WaitForChild(&quot;Humanoid&quot;)\nlocal loadanim = humanoid:LoadAnimation(anim)\nlocal PlayerModule = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild(&quot;PlayerModule&quot;))\nlocal Controls = PlayerModule:GetControls()\nlocal clicks = 0\nlocal c = true\nlocal confirm = false\nlocal confirm2 = false\nlocal confirm3 = false\nlocal confirm4 = false\nlocal GUI = player.PlayerGui.ScreenGui\nlocal gems= GUI.TextLabel\nlocal amount = 0\nlocal times = false\nlocal how = 0\n\ntool.Activated:Connect(function ()\namount = amount + 1\ngems.Text = tostring(amount)\nloadanim:Play()\nscript.Disabled = true\nControls:Disable()\nwait(1.5)\nControls:Enable()\nwait(.2)\nscript.Disabled = false\nclicks = 1\nconfirm = true\nend)\n</code></pre>\n<p>For your information - The variable Amount is the amount of gems and the variable Gems is the TextLabel so I can change the text. And I also printed the variable multiply times and it still showed '1' so there is no problem with the Gems TextLabel.</p>\n<p>I tried making a another variable and updating it to a special value so whenever the gems amount is still 1 even though activated twice, but it was still not working.I don't know how?!</p>\n"^^ . . "I'm guessing this feature doesn't exist because 'jump to definition' will necessarily require more context to be provided by the LSP than just the symbol itself. For example `foobar + 1` is very different to `"foobar is a variable"`. That said, my intuition is that it should be able to manually supply some fake additional context that will be correct about 95% of the time, at least for R."^^ . . . . . "0"^^ . "2"^^ . "Player moves but the custom bloxy cola can does not"^^ . "0"^^ . "<p>Trying to make the following code in lua 5.4</p>\n<pre><code>static int foreach(lua_State *L){\n luaL_checktype(L, 1, LUA_TTABLE);\n luaL_checktype(L, 2, LUA_TFUNCTION);\n\n lua_getglobal(L, &quot;print&quot;);\n if (!lua_rawequal(L, -1, 2)) {\n lua_pop(L, 1);\n return luaL_error(L, &quot;Second argument must be the 'print' function&quot;);\n}\nlua_pop(L, 1); \n\nlua_yield(L, 0);\n\nlua_pushnil(L);\nwhile (lua_next(L, 1) != 0) {\n lua_pushvalue(L, 2); // push print\n lua_pushvalue(L, -3); // push key\n lua_pushvalue(L, -3); // push value\n lua_call(L, 2, 0);\n lua_pop(L, 1);\n}\n\nreturn 0;\n}\n\n static int resume_func_continuation(lua_State * L, int status, lua_KContext ctx) {\nint res;\n(void) ctx;\nif (status != LUA_YIELD) {\n luaL_error(L, &quot;Thread was not yielding. %s&quot;, lua_tostring(L, -1));\n exit(1);\n }\n\n lua_getglobal(L, &quot;foreach&quot;);\n\n char *lua_Code = &quot;foreach({x = 10, y = 20}; print)&quot;;\n\n res = luaL_dostring(L, lua_Code);\n if (res != LUA_OK) {\n luaL_error(L, &quot;Error running lua_Code. %s\\n&quot;, lua_tostring(L, -1));\n }\n\n lua_close(L);\n exit(0);\n}\n\nint main(void) {\n int res;\n lua_State *L = luaL_newstate();\n if (L == NULL) luaL_error(L, &quot;Error creating new state. %s\\n&quot;, lua_tostring(L, -1));\n\n luaL_openlibs(L);\n\n lua_State *L1 = lua_newthread(L);\n if (L1 == NULL) {\n luaL_error(L, &quot;Error, cannot create new thread. %s&quot;, lua_tostring(L, -1));\n exit(1);\n }\n\n lua_pushcfunction(L1, foreach);\n lua_setglobal(L1, &quot;foreach&quot;);\n res = lua_pcallk(L1, 0, 0, 0, 0, resume_func_continuation);\n if (res != LUA_OK) {\n luaL_error(L, &quot;Error calling foreach function. %s&quot;, lua_tostring(L, -1));\n exit(1);\n }\n\n //lua_closethread(L1, L);\n\n return 0;\n }\n</code></pre>\n<p>I need to make a new thread, pcallk the lua cfunction, the cfunction will yield, finally close the thread, i get segmentation fault on pcallk(), also closethread is not recognised from lua 5.4. Any suggestion? I need the to follow these steps not something else...</p>\n"^^ . . . . . "0"^^ . "vim"^^ . . "<p>I want to create a nested table, that shall look like this:</p>\n<pre><code>{\n SA_1: {1,2,3,4},\n SA_2: {11,22,33,44}\n}\n</code></pre>\n<p>The code I have (I changed the SA_2 to strings for testing purposes):</p>\n<pre><code>int myRegisteredCfunc:\n{\n lua_createtable(L, 0, 2);\n\n // Create the first inner table\n lua_createtable(L, 0, 4);\n for (int i = 1; i &lt; 5; ++i) {\n lua_pushinteger(L, i); // Push the corresponding value\n lua_rawseti(L, -2, i); // Set the value at the index\n }\n // Set the first inner table as a field of the outer table\n lua_setfield(L, -2, &quot;SA_1&quot;);\n\n // Create the second inner table\n char test_str[20];\n lua_createtable(L, 0, 4);\n for (int i = 1; i &lt; 5; ++i) {\n sprintf(test_str, &quot;str %d&quot;,i);\n lua_pushstring(L, test_str); // Push the corresponding value\n lua_rawseti(L, -2, i); // Set the value at the index\n }\n // Set the second inner table as a field of the outer table\n lua_setfield(L, -2, &quot;SA2_2&quot;);\n\n return 1\n}\n</code></pre>\n<p>However, the output I get is:</p>\n<pre><code>SA_1 (table):\n 4: 3\n 1: 4\n 2: 3\n 3: 3\nSA_2 (table):\n 4: str 4\n 1: str 1\n 2: str 2\n 3: str 3\n</code></pre>\n<p>The values for SA_1 are not set correctly. I do get 3 times number 3, instead of 1-4.\nThe strange part is, the strings are actually printed correctly.</p>\n<p>This is my print function:</p>\n<pre><code> local table = LIB.myRegisteredCfunc() \n\n local function print_table(tbl, indent) \n indent = indent or 0 \n local spaces = string.rep(&quot; &quot;, indent) \n for k, v in pairs(tbl) do \n if type(v) == &quot;table&quot; then \n print(spaces .. k .. &quot; (table):&quot;) \n print_table(v, indent + 1) \n else \n print(spaces .. k .. &quot;: &quot; .. tostring(v)) \n end \n end \n end \n\n print_table(table) \n</code></pre>\n"^^ . . "ngl, I deleted all the code, so I don't have it. but kylaaa, thank you! you were the one who wrote the script for the last timer! this time, can you walk me step by step, I'm a beginner learner, thanks! (also in the format of 0.00s if possible! thanks"^^ . "<p>I am getting an error every time I start up neovim in my terminal. I am able to continue past the error and use neovim but am annoyed at getting every time and wondering what is not configuring correctly.</p>\n<p><a href="https://i.sstatic.net/KOlAy.png" rel="nofollow noreferrer">Error that displays when I open neovim</a></p>\n<p><a href="https://i.sstatic.net/kjMOf.png" rel="nofollow noreferrer">lines 150-179 in my init.lua file</a></p>\n<p><a href="https://i.sstatic.net/4Lmky.png" rel="nofollow noreferrer">neovim version</a></p>\n<p>I am using Ubuntu jammy.</p>\n<p>I was expecting to run this command from the kickstart repository readme <code>git clone https://github.com/nvim-lua/kickstart.nvim.git &quot;${XDG_CONFIG_HOME:-$HOME/.config}&quot;/nvim</code> and have a fully functional neovim configuration but I keep getting this error.</p>\n<p>I was also expecting to find a comparison of two table values of the <code>init.lua</code> file after reading the error but all I see is a keymap. And it seems to keymap fine on line 159.</p>\n<p>I googled it and found somewhat similar stuff and thought I needed to update to a newer version to neovim. after updating to the latest version I still get this error.</p>\n"^^ . "0"^^ . "0"^^ . . . "Float calculation problem. 12.7 - 20 + 7.3 not equal zero"^^ . "-1"^^ . "1"^^ . "Wrap after-loop-z-press-release into `if not IsMouseButtonPressed(3) then ... end`"^^ . "Avoid for table of table to mantain same memory allocation when inserted to another table"^^ . . "1"^^ . "1"^^ . . "0"^^ . "Thanks for the explanation, I haven't had an idea about the differences between the 2 versions, much appreciative"^^ . . . . "3"^^ . . . . . . . "0"^^ . . . . . . . "0"^^ . "0"^^ . . "0"^^ . . . "split"^^ . . . . . . . "<h1>Find and replace in Visual Studio Code</h1>\n<p>In Visual Studio Code you can find and replace all by</p>\n<ol>\n<li>hitting Ctrl + Shift + f</li>\n<li>Clicking on the &gt; icon to the left of the search text</li>\n</ol>\n<p><a href="https://i.sstatic.net/U8zH0.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/U8zH0.png" alt="enter image description here" /></a></p>\n<ol start="3">\n<li>type in what you want to find in the search box and type in what you want it to be replaced with in the replace box</li>\n<li>There is an icon to the right of the replace box, which says &quot;Replace All (Ctrl + Alt + Enter)&quot;. You can either click on that, or use the keyboard combination it has suggested to proceed with replacing all</li>\n</ol>\n<h1>Explanation of your variables</h1>\n<p><code>var</code> is an <a href="https://www.lua.org/pil/11.1.html" rel="nofollow noreferrer">array</a>, it is a variable which has elements, such as <code>var[1]</code>, <code>var[2]</code> and so on.</p>\n<h1>Precautions</h1>\n<p>Before you do your find and replace all, I recommend for you to either save the folder of your project as a copy of itself, so if things turn out wrongly, you can revert to it, or, even better, use a version controlling system, such as git. If you install git and navigate to the project folder using a terminal or a cmd (depending on your OS), then you can do</p>\n<pre><code>git init\ngit add .\ngit commit -m &quot;backup&quot;\n</code></pre>\n<p>Now, do the find and replace stuff and switch back to the terminal/cmd afterwards and run</p>\n<pre><code>git diff\n</code></pre>\n<p>to review all the changes you generated, see whether everything is correctly set, everything is in place, etc.</p>\n"^^ . . "0"^^ . . . . . "<p>The script moves the player not the item, it should work like a bloxy cola, this is the script:</p>\n<pre class="lang-lua prettyprint-override"><code>local Tool = script.Parent;\n\nenabled = true\n\n\n\n\nfunction onActivated()\n if not enabled then\n return\n end\n\n enabled = false\n Tool.GripForward = Vector3.new(0,-.759,-.651)\n Tool.GripPos = Vector3.new(1.5,-.5,.3)\n Tool.GripRight = Vector3.new(1,0,0)\n Tool.GripUp = Vector3.new(0,.651,-.759)\n\n\n Tool.Handle.DrinkSound:Play()\n\n wait(3)\n \n local h = Tool.Parent:FindFirstChild(&quot;Humanoid&quot;)\n if (h ~= nil) then\n if (h.MaxHealth &gt; h.Health + 5) then\n h.Health = h.Health + 5\n else \n h.Health = h.MaxHealth\n end\n end\n\n Tool.GripForward = Vector3.new(-.976,0,-0.217)\n Tool.GripPos = Vector3.new(0.03,0,0)\n Tool.GripRight = Vector3.new(.217,0,-.976)\n Tool.GripUp = Vector3.new(0,1,0)\n\n enabled = true\n\nend\n\nfunction onEquipped()\n Tool.Handle.OpenSound:play()\nend\n\nscript.Parent.Activated:connect(onActivated)\nscript.Parent.Equipped:connect(onEquipped)\n</code></pre>\n<p>Here is a screenshot of the can tool :</p>\n<p><img src="https://i.sstatic.net/C7Sik.png" alt="an image of the Explorer widget showing the hierarchy of the Soviet Cola tool" /></p>\n<p>it should work like a regular bloxy cola.</p>\n"^^ . "1"^^ . . . . . . . "1"^^ . "I should have made this more clear, i've been messing around with lua for less than 2 days, although I appreciate the help very much and im sure someone with a bit more knowledge than me would be thrilled with this answer, I can't make sense of it. "switching the state" doesn't compute for me"^^ . . . . "0"^^ . . . "Please delete this post as it is a duplicate of your another post https://stackoverflow.com/questions/78247619"^^ . . . . "2"^^ . "2"^^ . . . . . . "0"^^ . "I'm just trying to get the badge pls don't dislike"^^ . . . . "Lua string formatting on the basis of number and letter combinations"^^ . "<p>It was relative easy: two parabolas with given focus crossing as line.</p>\n<p>The result line is perpendicular bisector between two points:</p>\n<pre class="lang-lua prettyprint-override"><code>function focusFocusLineYCrossing (p1x, p1y, p2x, p2y, y)\n local cx = (p1x+p2x)/2\n local cy = (p1y+p2y)/2\n local m = (p2y-p1y)/(p2x-p1x) -- slope\n local x = cx - m*(y-p1y) -- perpendicular to slope\n return x\nend\n</code></pre>\n<p><a href="https://i.sstatic.net/9byJ4.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9byJ4.gif" alt="crossing of two parabolas" /></a></p>\n"^^ . . . "5"^^ . . . . "Thank you very much for your time and clear explanation. I believe this is the best way to go"^^ . . . . "1"^^ . "8 separate queries; one each for the min and max of each column."^^ . . . "0"^^ . . "1"^^ . "[In your post](/help/how-to-ask), please, not in a comment. There are important details missing from the post that everyone can find there, not in comments. Also, that describes how to get _one_ circle. You're asking about "one or two", so please elaborate on how you expect to find two circles given two points and a tangent line as well."^^ . "0"^^ . "I'm not getting a syntax error on 5.4.6 or on LuaJIT 2.1.0-beta3. Are you sure this is the actual code that's causing the error?"^^ . "1"^^ . . . "0"^^ . . "<p>It seems like you are waiting for Modules twice in the <code>DataManager</code> script according to the error.</p>\n<pre><code>Infinite yield possible on 'ServerScriptService.Modules:WaitForChild(&quot;Modules&quot;)\n</code></pre>\n<p>The error states you are using <code>ServerScriptService.Modules:WaitForChild(&quot;Modules&quot;)</code> when you want to use <code>ServerScriptService:WaitForChild(&quot;Modules&quot;)</code>.</p>\n<p>Try using the below code in the script, <code>DataManager</code>. I corrected it so it properly waits for Modules now.</p>\n<pre class="lang-lua prettyprint-override"><code>local ServerScriptService = game:GetService(&quot;ServerScriptService&quot;)\n\nrequire(ServerScriptService:WaitForChild(&quot;Modules&quot;):WaitForChild(&quot;DataManager&quot;))\n</code></pre>\n"^^ . "1"^^ . "2"^^ . "Lua imported global and local variables with the same name"^^ . "<p>To the best of my knowledge, it's not possible.</p>\n<p>Normally, in POSIX ERE a working regex would be:</p>\n<pre class="lang-none prettyprint-override"><code>^/(?:[^\\\\/]|\\\\.)*/(?:[^\\\\/]|\\\\.)*/(?:[^\\\\/]|\\\\.)*$\n</code></pre>\n<p>...where <code>(?:[^\\\\/]|\\\\.)</code> means &quot;either not <code>\\</code> (escaping) and not <code>/</code> (delimiter), or an escaped character&quot;.</p>\n<p>However, Lua patterns don't have <code>|</code>. Quantifiers are also not applicable for groups. That said, there is no way to differentiate normal and escaped characters.</p>\n<p>The solution is to write your own parser from scratch.</p>\n"^^ . . "I already do have luarocks installed."^^ . . "<p>Your table <code>ITEMSCRAPESTATS</code> is not a sequence, instead, it is a dictionary.<br />\nA regular Lua table (which essentially is a set of &quot;key-value&quot; pairs) is stored unsorted.</p>\n<p>In other words, Lua does not know that table key <code>60004</code> is greater than <code>60001</code>. Lua does not even know that these keys are comparable.<br />\nAny Lua value (a number, a string, a function, another table) could be a table key. How to compare a function with a string to determine which is greater? No way. So, there is no order of keys exists by default.</p>\n<p>Only sequences do have natural order of keys. A sequence is a Lua table with integer keys starting with key 1 without gaps. And you have to use <code>ipairs</code> instead of <code>pairs</code> to traverse all keys in their numeric order. Do you have all missing keys <code>1-59999</code> present in your table?</p>\n<p>So, try to enforce the order you expect:</p>\n<pre><code>for key = 60000, 60004 do \n do_smth_with(t[key])\nend\n</code></pre>\n<p>You may also read all the keys, collect them in an array, sort the array, and access the main table in that order of keys:</p>\n<pre><code>-- collect all keys\nlocal all_keys = {}\nfor key in pairs(t) do\n table.insert(all_keys, key)\nend\n-- sort keys\ntable.sort(all_keys)\n-- traverse table in that order of keys\nfor _, key in ipairs(all_keys) do\n do_smth_with(t[key])\nend\n</code></pre>\n"^^ . . . "1"^^ . . . "0"^^ . . "Yes, any given license plate in the Netherlands uses 2 dashes."^^ . "0"^^ . "3"^^ . "1"^^ . . "0"^^ . "<p>I've implemented solution in Python.</p>\n<p>How it works: to simpify formulas, I perform coordinate shift to place the first point in origin, then rotation to place the second point onto OX axis, then shift left by half of distance. So circle center will lie on OY axis, and it's coordinates are <code>(0,y)</code>.</p>\n<p>Now I apply transformations to line points, then transform line equation into normal equation form (<code>px+qy+r=0</code>).</p>\n<p>Then solve quadratic equation: squared radius should be equal to squared distance to the line (simple formula for chosen line equation form).</p>\n<p>Quadratic equation might give no solutions (for example, line between points), one solution (for example, line through second point and perpendicular to first-second vector) or two solutions.</p>\n<p>Then transform coordinates back. Example is given for my picture and for your data.</p>\n<p><a href="https://i.sstatic.net/BzEvt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/BzEvt.png" alt="enter image description here" /></a></p>\n<pre><code>import math\ndef circle2ptstangenettoline(ax, ay, bx, by, tx1, ty1, tx2, ty2):\n dist = math.hypot(ax-bx, ay-by)\n h = dist/2\n ang = math.atan2(by-ay, bx-ax)\n ux1 = tx1 - ax\n uy1 = ty1 - ay\n ux2 = tx2 - ax\n uy2 = ty2 - ay\n vx1 = ux1 * math.cos(-ang) - uy1 * math.sin(-ang) - h\n vy1 = ux1 * math.sin(-ang) + uy1 * math.cos(-ang)\n vx2 = ux2 * math.cos(-ang) - uy2 * math.sin(-ang) - h\n vy2 = ux2 * math.sin(-ang) + uy2 * math.cos(-ang)\n vd = math.hypot(vx2-vx1, vy2-vy1)\n p = (vy2-vy1) / vd\n q = (vx1-vx2) / vd\n r = (vx2*vy1-vx1*vy2) / vd\n a = q*q-1\n b = 2*q*r\n c = r*r - h*h\n if a==0:\n if b==0:\n return None\n else:\n y = -c/b\n cr = math.hypot(y, h)\n cx = h * math.cos(ang) - y * math.sin(ang) + ax\n cy = h * math.sin(ang) + y * math.cos(ang) + ay\n return (cx, cy, cr)\n Dis = b*b-4*a*c\n if Dis &lt; 0:\n return None\n if Dis == 0:\n y = -0.5*b/a\n cr = math.hypot(y, h)\n cx = h * math.cos(ang) - y * math.sin(ang) + ax\n cy = h * math.sin(ang) + y * math.cos(ang) + ay\n return (cx, cy, cr)\n y1 = 0.5*(-b - math.sqrt(Dis))/a\n cr1 = math.hypot(y1, h)\n cx1 = h * math.cos(ang) - y1 * math.sin(ang) + ax\n cy1 = h * math.sin(ang) + y1 * math.cos(ang) + ay\n\n y2 = 0.5*(-b + math.sqrt(Dis))/a\n cr2 = math.hypot(y2, h)\n cx2 = h * math.cos(ang) - y2 * math.sin(ang) + ax\n cy2 = h * math.sin(ang) + y2 * math.cos(ang) + ay\n return ((cx1,cy1,cr1), (cx2,cy2,cr2))\n\n\nprint(circle2ptstangenettoline(-3, 0, 3, 0, 5, 4, -7, -11))\nprint(circle2ptstangenettoline(-3, 0, 3, 0, 5, 4, 7, -11))\nprint(circle2ptstangenettoline(30, 40, 100, 110, -100, 0, 100, 0))\n\nNone\n((0.0, 3.9528611794604025, 4.962369545296388), (0.0, -5.428416735015959, 6.202234133681292))\n((-103.8083151964687, 243.8083151964687, 243.80831519646873), (83.80831519646861, 56.1916848035314, 56.191684803531416))\n</code></pre>\n"^^ . . . "@Tribhuwan which README.md ? on the github? I don't see where? if you could point to to where exactly, that could be great."^^ . . "0"^^ . . "performance"^^ . . "3"^^ . . "0"^^ . . "0"^^ . . . . "0"^^ . . . . "<p>How to make the code correctly, so that the recoil is canceled out, and the button is held down together with &quot;q&quot;?</p>\n<pre class="lang-lua prettyprint-override"><code>EnablePrimaryMouseButtonEvents(true);\n\nfunction OnEvent(event, arg)\n if IsKeyLockOn(&quot;Numlock&quot;) then\n if IsMouseButtonPressed(1) then\n if IsKeyLockOn (&quot;capslock&quot;) then\n PressAndReleaseKey(&quot;Q&quot;)\n Sleep(10000)\n PressAndReleaseKey(&quot;Q&quot;)\n end\n repeat\n MoveMouseRelative(0,4)\n Sleep(50)\n until not IsMouseButtonPressed(1)\n end\n if IsMouseButtonPressed(3)then\n repeat\n if IsMouseButtonPressed(1) then\n if IsKeyLockOn (&quot;capslock&quot;) then\n PressAndReleaseKey(&quot;Q&quot;)\n Sleep(10000)\n PressAndReleaseKey(&quot;Q&quot;)\n end\n repeat\n MoveMouseRelative(0,4)\n Sleep(1)\n until not IsMouseButtonPressed(1)\n end\n until not IsMouseButtonPressed(3)\n end\n end\nend\n</code></pre>\n<p>I'm a newbie, I made the code myself. As a result, first the button &quot;Q&quot; works by holding it down for 10 seconds and then releasing it, but I need it all together</p>\n<pre class="lang-lua prettyprint-override"><code>if IsMouseButtonPressed(1) then\n if IsKeyLockOn (&quot;capslock&quot;) then\n PressAndReleaseKey(&quot;Q&quot;)\n Sleep(10000)\n PressAndReleaseKey(&quot;Q&quot;)\n end\n repeat\n MoveMouseRelative(0,4)\n Sleep(50)\n until not IsMouseButtonPressed(1)\nend\n</code></pre>\n"^^ . . "0"^^ . "On ANSI terminals, try `io.write("\\27[H\\27[2J")`."^^ . "1"^^ . . . . "jcl"^^ . "0"^^ . . "2"^^ . . . "0"^^ . . . "0"^^ . . . . "0"^^ . "How to reference first entry in keyless table in Lua?"^^ . "Added mspaint flow chart, currently pressing and releasing left click types "z""^^ . . . . . "1"^^ . . . "1"^^ . . "<p>It looks like that you search the algorithm to convert tiles (tile size is always 1×1) to rectangles as {x=x, y=y, w=w, h=h}.</p>\n<p>Please try this solution:</p>\n<p><a href="https://love2d.org/wiki/TileMerging" rel="nofollow noreferrer">https://love2d.org/wiki/TileMerging</a></p>\n<p>Matrix example:</p>\n<pre><code>local grid = {\n {1,1,1,1,1,1,1,1,1},\n {1,0,0,1,1,1,0,0,1},\n {1,0,1,1,1,1,1,0,1},\n {1,1,1,0,1,0,1,1,1},\n {1,1,1,1,0,1,1,1,1},\n {1,1,1,0,1,0,1,1,1},\n {1,0,1,1,1,1,1,0,1},\n {1,0,0,1,1,1,0,0,1},\n {1,1,1,1,1,1,1,1,1},\n}\n</code></pre>\n<p>Result:</p>\n<p><a href="https://i.sstatic.net/k93cD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/k93cD.png" alt="rectangles" /></a></p>\n"^^ . . . . "<p>I have nvim-cmp installed and configured for Neovim. It works well and suggests code completion for all of my projects, until I recently noticed it throws an error and crashes with the Lua language.</p>\n<p>The snippets and suggestions appear correctly\n<a href="https://i.sstatic.net/3sGHr.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3sGHr.png" alt="completion suggestions working correctly" /></a></p>\n<p>but when any of them are selected, I receive this error:\n<a href="https://i.sstatic.net/L6IZ2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/L6IZ2.png" alt="nvim-cmp error" /></a></p>\n<p>I'm having trouble debugging the specific issue causing this and why it is only an issue with the Lua language.</p>\n<p>Here is my nvim-cmp.lua config file (using lazy as my plugin loader):</p>\n<pre><code>return {\n &quot;hrsh7th/nvim-cmp&quot;,\n event = &quot;InsertEnter&quot;,\n dependencies = {\n &quot;hrsh7th/cmp-buffer&quot;,\n &quot;hrsh7th/cmp-path&quot;,\n &quot;onsails/lspkind.nvim&quot;,\n &quot;L3MON4D3/LuaSnip&quot;,\n &quot;saadparwaiz1/cmp_luasnip&quot;,\n &quot;rafamadriz/friendly-snippets&quot;,\n &quot;hrsh7th/cmp-nvim-lsp&quot;,\n },\n config = function()\n local cmp = require(&quot;cmp&quot;)\n local luasnip = require(&quot;luasnip&quot;)\n local lspkind = require(&quot;lspkind&quot;)\n\n require(&quot;luasnip.loaders.from_vscode&quot;).lazy_load()\n\n vim.opt.completeopt = &quot;menu,menuone,preview,noselect&quot;\n cmp.setup({\n snippet = {\n expand = function(args)\n luasnip.lspexpand(args.body)\n end,\n },\n mapping = cmp.mapping.preset.insert({\n [&quot;&lt;C-k&gt;&quot;] = cmp.mapping.select_prev_item(),\n [&quot;&lt;C-j&gt;&quot;] = cmp.mapping.select_next_item(),\n [&quot;&lt;C-b&gt;&quot;] = cmp.mapping.scroll_docs(-4),\n [&quot;&lt;C-f&gt;&quot;] = cmp.mapping.scroll_docs(4),\n [&quot;&lt;C-Space&gt;&quot;] = cmp.mapping.complete(),\n [&quot;&lt;C-e&gt;&quot;] = cmp.mapping.abort(),\n [&quot;&lt;CR&gt;&quot;] = cmp.mapping.confirm({ select = false }),\n }),\n sources = cmp.config.sources({\n { name = &quot;nvim_lsp&quot; },\n { name = &quot;luasnip&quot; },\n { name = &quot;buffer&quot; },\n { name = &quot;path&quot; },\n }),\n formatting = {\n format = lspkind.cmp_format({\n maxwidth = 50,\n ellipsis_char = &quot;...&quot;,\n }),\n },\n })\n end,\n}\n\n</code></pre>\n<p>Please let me know any further context I can add.</p>\n"^^ . "-1"^^ . "<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>local scriptDisabled\ntool.Activated:Connect(function () if scriptDisabled then return end\namount = amount + 1\ngems.Text = tostring(amount)\nloadanim:Play()\nscriptDisabled = true\nControls:Disable()\nwait(1.5)\nControls:Enable()\nwait(.2)\nscriptDisabled = false\nclicks = 1\nconfirm = true\nend)</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . "0"^^ . "0"^^ . . . . . "Need help sorting a Lua table"^^ . "0"^^ . "0"^^ . . . "0"^^ . . "1"^^ . "0"^^ . . . "3"^^ . "<p>Quote from <a href="https://www.lua.org/manual/5.3/manual.html#8.2" rel="nofollow noreferrer">the official manual</a></p>\n<blockquote>\n<p>you can replace <code>math.ldexp(x,exp)</code> with <code>x * 2.0^exp</code></p>\n</blockquote>\n"^^ . . . . . . . . "0"^^ . "1"^^ . . "5"^^ . "it is true that `plr.Sanity.Value` would **not** change from this code, but it doesn't make sense that the local `sanity` wouldn't change. I'm wondering if this isn't a faithful reproduction and they are actually checking `plr.Sanity.Value` when they say (here) that they are looking at the local variable."^^ . . . . "<p>I am making a FFlag system for my game, I am using MongoDB for it. I wanna check if a certain value in this collection is true or false. Here is my code:</p>\n<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-html lang-html prettyprint-override"><code>if FFlagsData:FindOne({["allowRebirthing"] = true }) then\n print("Test1")\nelse if FFlagsData:FindOne({["allowRebirthing"] = false }) then\n print("Test2")\n end\nend</code></pre>\r\n</div>\r\n</div>\r\n</p>\n<p><a href="https://i.sstatic.net/NzEu1.png" rel="nofollow noreferrer">image of my collection</a></p>\n"^^ . . . . "0"^^ . . . . "2"^^ . . . "1"^^ . "Does `[^%p%s]` (everything except space+punctuation) work for your use-case?"^^ . . "0"^^ . "1"^^ . . "0"^^ . "This "CRIT" billboard GUI isn't working, how to fix it?"^^ . "3"^^ . . . "@shingo yes as mentioned just for testing. To see if strings behave different as the integers. And they do work. So it seems like the overall logic is correct, but however the integers do not."^^ . "<p>The solution was far simpler than I was making it. The plugins were installed and configured correctly, and my nerd fonts were working as intended. The issue was the terminal. I was using a command prompt to run Neovim, which cannot display special characters in nerd fonts. After switching to Windows Terminal, everything works perfectly.</p>\n"^^ . . . "3"^^ . . "0"^^ . "And how I can configure a RemoteEvent to do that?"^^ . "Yes, sure. Possible way - shift by `-tx1, -ty1`, then rotate by `-math.atan2(ty2-ty1, tx2-tx1)`"^^ . "<p>maybe this <a href="https://stackoverflow.com/questions/46155208/ngx-escape-uri-didnt-work-on">question</a> helps you</p>\n<p>Also, a quick solution would be to replace &quot;%2F&quot; to &quot;/&quot;.</p>\n<pre><code>newUrl = oldUrl:gsub(&quot;%2F&quot;, &quot;/&quot;)\n</code></pre>\n"^^ . . "<p>This is my setup file:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.cmd(&quot;set expandtab&quot;)\nvim.cmd(&quot;set tabstop=2&quot;)\nvim.cmd(&quot;set softtabstop=2&quot;)\nvim.cmd(&quot;set shiftwidth=2&quot;)\nvim.g.mapleader = &quot; &quot;\n\nlocal lazypath = vim.fn.stdpath(&quot;data&quot;) .. &quot;/lazy/lazy.nvim&quot;\nif not (vim.uv or vim.loop).fs_stat(lazypath) then\n vim.fn.system({\n &quot;git&quot;,\n &quot;clone&quot;,\n &quot;--filter=blob:none&quot;,\n &quot;https://github.com/folke/lazy.nvim.git&quot;,\n &quot;--branch=stable&quot;, -- latest stable release\n lazypath,\n })\nend\nvim.opt.rtp:prepend(lazypath)\n\nlocal plugins = {\n { &quot;catppuccin/nvim&quot;, name = &quot;catppuccin&quot;, priority = 1000 },\n {\n 'nvim-telescope/telescope.nvim', tag = '0.1.6',\n dependencies = { 'nvim-lua/plenary.nvim' }\n },\n {\n &quot;nvim-treesitter/nvim-treesitter&quot;,\n build = &quot;:TSUpdate&quot;,\n config = function()\n require(&quot;nvim-treesitter.configs&quot;).setup {\n ensure_installed = &quot;all&quot;,\n highlight = {\n enable = true,\n },\n indent = {\n enable = true,\n }\n }\n end\n },\n}\nlocal opts = {}\n\nrequire(&quot;lazy&quot;).setup(plugins, opts)\nlocal builtin = require(&quot;telescope.builtin&quot;)\nvim.keymap.set('n', '&lt;C-p&gt;', builtin.find_files, {})\nvim.keymap.set('n', '&lt;leader&gt;fg', builtin.live_grep, {})\n\n\nrequire(&quot;catppuccin&quot;).setup()\nvim.cmd.colorscheme &quot;catppuccin&quot;\n</code></pre>\n<p>When I replace nvim-treesitter part inside the plugins variable, it works. Here's what I replace it with:</p>\n<pre class="lang-lua prettyprint-override"><code>{&quot;nvim-treesitter/nvim-treesitter&quot;, build = &quot;:TSUpdate&quot;}\n</code></pre>\n<p>Here's what I see when I try to run <code>nvim .\\init.lua</code></p>\n<p><a href="https://i.sstatic.net/hpCek.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hpCek.png" alt="enter image description here" /></a></p>\n<p>I'm using Windows, NeoVim version 0.9.5, LuaJIT 2.1</p>\n"^^ . . . . "0"^^ . "0"^^ . . "having trouble installing neovim plugin"^^ . . . . "1"^^ . "0"^^ . . "love2d"^^ . . . . "Hello and welcome to SO. Please edit your post and include the code in a [properly formatted way](https://meta.stackoverflow.com/questions/251361/how-do-i-format-my-code-blocks) instead of [attaching it as an image](https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors) or external link. Also, we'll need a [MRE](https://stackoverflow.com/help/minimal-reproducible-example) in order to test."^^ . "you have broken the nesting of structures: `if ...end` and `until .. repeat`"^^ . "0"^^ . . . . . "3"^^ . . . . . "<p>I've made a code to get the circle (or two circles) for given two points and tangential line.</p>\n<p>I am making the algorithm to make a circle with given two points and tangential linde for this circle.</p>\n<p>Task:\nFor given A and B points and tangent line, defined as T points, build the circle G, that goes through A and B and tangent to the line T.</p>\n<p>This: <a href="https://www.cut-the-knot.org/Curriculum/Geometry/GeoGebra/PPL.shtml" rel="nofollow noreferrer">PPL: Apollonius' Problem with Two Points and a Line</a></p>\n<p>Solution:</p>\n<ol>\n<li>Find the intersection point P for AB and T1T2.</li>\n<li>Create circle with center in point between And B with radius CB.</li>\n<li>Find tangent line from P to circle C, the tangent point is D.</li>\n<li>Get radius PD. The radius belongs to circle P.</li>\n<li>Find two points E1 and E2 by crossing line T and circle P.</li>\n<li>Get circles G1 and G2 by given three points (A, B, G) as circumcircle.</li>\n<li>Both G circles are solution of the task.</li>\n</ol>\n<p>Desmos with one simple solution: ox2zww716t</p>\n<p>Image:\n<a href="https://i.sstatic.net/vPDm7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vPDm7.png" alt="circle with two points and tangential line" /></a></p>\n<p>Help functions:</p>\n<pre class="lang-lua prettyprint-override"><code>function tangentCircle (cx, cy, cr, px, py) -- circle, point\n local dx, dy = px-cx, py-cy\n local dist = math.sqrt(dx*dx+dy*dy)\n if dist &lt;= cr then return end\n local a, b = math.atan2 (dy, dx), math.acos (cr/dist) \n local x1 = cx + cr * math.cos (a-b)\n local y1 = cy + cr * math.sin (a-b)\n local x2 = cx + cr * math.cos (a+b)\n local y2 = cy + cr * math.sin (a+b)\n return x1, y1, x2, y2\nend\n\nfunction linesIntersect(x1, y1, x2, y2, x3, y3, x4, y4)\n local dx1, dy1 = x2 - x1, y2 - y1\n local dx2, dy2 = x4 - x3, y4 - y3\n local det = dx2 * dy1 - dx1 * dy2\n if det == 0 then return end\n local c1 = x1 * y2 - y1 * x2\n local c2 = x3 * y4 - y3 * x4\n local x = (c1 * dx2 - c2 * dx1) / det\n local y = (c1 * dy2 - c2 * dy1) / det\n return x, y\nend\n\nfunction circleWithTwoPoints (x1, y1, x2, y2)\n local cx = (x1 + x2) / 2\n local cy = (y1 + y2) / 2\n local cr = math.sqrt((cx - x1)^2 + (cy - y1)^2)\n return cx, cy, cr\nend\n\n\nfunction intersectCircleCenterLine(cx, cy, cr, tx1, ty1, tx2, ty2)\n local angle = math.atan2 (ty2-ty1, tx2-tx1)\n local ex1, ey1 = cx + cr * math.cos (angle), cy + cr * math.sin (angle)\n local ex2, ey2 = cx + cr * math.cos (angle+math.pi), cy + cr * math.sin (angle+math.pi)\n return ex1, ey1, ex2, ey2\nend\n\nfunction nearestPointOnLine(tx1, ty1, tx2, ty2, cx, cy)\n local dx = tx2 - tx1\n local dy = ty2 - ty1\n local t = ((cx - tx1) * dx + (cy - ty1) * dy) / (dx * dx + dy * dy)\n local nx = tx1 + t * dx\n local ny = ty1 + t * dy\n return nx, ny\nend\n\nfunction circleFromThreePoints(x1, y1, x2, y2, x3, y3)\n local function distance(x1, y1, x2, y2)\n return math.sqrt((x1-x2)^2 + (y1-y2)^2)\n end\n\n local a = distance(x2, y2, x3, y3)\n local b = distance(x1, y1, x3, y3)\n local c = distance(x1, y1, x2, y2)\n local s = (a + b + c) / 2\n local gr = (a * b * c) / (4 * math.sqrt(s * (s - a) * (s - b) * (s - c)))\n local A = x1*(y2-y3) - y1*(x2-x3) + x2*y3 - x3*y2\n local B = (x1*x1 + y1*y1)*(y3-y2) + (x2*x2 + y2*y2)*(y1-y3) + (x3*x3 + y3*y3)*(y2-y1)\n local C = (x1*x1 + y1*y1)*(x2-x3) + (x2*x2 + y2*y2)*(x3-x1) + (x3*x3 + y3*y3)*(x1-x2)\n local D = 2*((x1-x2)*(y3-y2) - (y1-y2)*(x3-x2))\n\n local gx = B / D\n local gy = C / D\n return gx, gy, gr\nend\n</code></pre>\n<p>Main function:</p>\n<pre class="lang-lua prettyprint-override"><code>function circlesFromTwoPointsAndTangent(ax, ay, bx, by, tx1, ty1, tx2, ty2)\n local px, py = linesIntersect(ax, ay, bx, by, tx1, ty1, tx2, ty2)\n print ('px, py', px, py) -- must be -10, 0, ok\n\n if px then\n -- two solutions\n local cx, cy, cr = circleWithTwoPoints (ax, ay, bx, by)\n print ('cx, cy, cr', cx, cy, cr) -- must be 65, 75, 49.497475, ok\n\n local dx1, dy1, dx2, dy2 = tangentCircle (cx, cy, cr, px, py)\n print ('dx1, dy1', dx1, dy1) -- must be 17.7115, 89.6218, ok\n print ('dx2, dy2', dx2, dy2) -- must be 79.6218, 27.7115, ok\n\n\n-- radius from P to D or from P to E\n local pr = math.sqrt ((dx1-px)^2+(dy1-py)^2)\n print ('pr', pr) -- must be 93.808315\n\n local ex1, ey1, ex2, ey2 = intersectCircleCenterLine(px, py, pr, tx1, ty1, tx2, ty2)\n local gx1, gy1, gr1 = circleFromThreePoints(ax, ay, bx, by, ex1, ey1)\n print ('gx1, gy1, gr1', gx1, gy1, gr1)\n -- must be 83.8083, 56.1917, 56.191685, ok\n\n local gx2, gy2, gr2 = circleFromThreePoints(ax, ay, bx, by, ex2, ey2)\n print ('gx2, gy2, gr2', gx2, gy2, gr2)\n -- must be -103.80831519647 243.80831519647 243.80831519647 ok\n\n return gx1, gy1, gr1, gx2, gy2, gr2\n else -- parallel\n local cx, cy, cr = circleWithTwoPoints (ax, ay, bx, by)\n\n local ex, ey = nearestPointOnLine(tx1, ty1, tx2, ty2, cx, cy)\n\n local gx, gy, gr = circleFromThreePoints(ax, ay, bx, by, ex, ey)\n\n return gx, gy, gr\n end\nend\n</code></pre>\n<p>Example:</p>\n<pre class="lang-lua prettyprint-override"><code>local x1, y1 = 30, 40\nlocal x2, y2 = 100, 110\nlocal tx1, ty1 = -100, 0\nlocal tx2, ty2 = 100, 0 -- horizontal line\n\nlocal gx1, gy1, gr1, gx2, gy2, gr2 = circlesFromTwoPointsAndTangent(x1, y1, x2, y2, tx1, ty1, tx2, ty2)\n\nprint ('circle 1', gx1, gy1, gr1) -- must be 83.8083 56.1917 56.191685\nprint ('circle 2', gx2, gy2, gr2) -- must be -103.808 243.808 243.808315\n</code></pre>\n<p>How to check if it has no solutions? Or the input has limitations, for example vertical or horizontal lines have issues? What limitations it has?</p>\n"^^ . . "<p>I have a script so that when I touch a cube it takes away its HP</p>\n<pre><code>local HP = cube.Healthbar\n\nlocal function Healtbar() do\n HP.Value = HP.Value - 5\nend\n\ncube.Touched:Connect(Healthbar)\n</code></pre>\n<p>But HP is taken away too quickly, literally every frame when I encounter the cube, and I would like to have a small pause after taking damage, after which the damage again passed, but a simple wait() - does not work and information on how to do it I have not found anywhere.</p>\n<p>Help please, I'm just learning and I definitely can't do it myself.... please</p>\n"^^ . "2"^^ . . "4"^^ . "<p>How can I make the examples return the result &quot;true&quot;.</p>\n<p>What are my mistakes?</p>\n<p>MWE:</p>\n<pre><code>local arr = {{a = 1, b = 3, op = &quot;&gt;=&quot;, c = 7},\n {a = 1, b = 3, op = &quot;&lt;=&quot;, c = 6}}\nlocal str1, str2, x1, x2, i\nx1 = 0\nx2 = 2 + 1/3 -- 2.(3)\ni = 1\nstr1 = arr[i].a .. &quot;*&quot; .. tostring(x1) .. &quot;+&quot; .. arr[i].b .. &quot;*&quot; .. tostring(x2) .. arr[i].op .. arr[i].c\nstr2 = arr[i].a .. &quot;*&quot; .. tostring(x1) .. &quot;+&quot; .. arr[i].b .. &quot;*&quot; .. tostring(x2)\nf = loadstring(&quot;return &quot; .. str1)\nf1 = loadstring(&quot;return &quot; .. str2)\nprint(str1, f(), str2 .. &quot; = &quot; .. f1()) -- It doesn't work that way\nprint(0 + 3 * (2 + 1/3), 7, 0 + 3 * (2 + 1/3) &gt;= 7) -- And here it seems similar, but everything works\nx1 = 1.2\nx2 = 1.6\ni = 2\nstr1 = arr[i].a .. &quot;*&quot; .. tostring(x1) .. &quot;+&quot; .. arr[i].b .. &quot;*&quot; .. tostring(x2) .. arr[i].op .. arr[i].c\nstr2 = arr[i].a .. &quot;*&quot; .. tostring(x1) .. &quot;+&quot; .. arr[i].b .. &quot;*&quot; .. tostring(x2)\nf = loadstring(&quot;return &quot; .. str1)\nf1 = loadstring(&quot;return &quot; .. str2)\nprint(str1, f(), str2 .. &quot; = &quot; .. f1()) -- It’s completely unclear here! It turns out 6 is not equal to 6\n</code></pre>\n<p>I get this result:</p>\n<p><a href="https://i.sstatic.net/MDlWc.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MDlWc.jpg" alt="enter image description here" /></a></p>\n<p>I used the manual number comparison function. Its code is presented below. This solution seemed to allow me to do what I needed.</p>\n<pre><code>local function compare(a, b, epsilon, comparison)\nif comparison == &quot;==&quot; then\n return math.abs(a - b) &lt; epsilon\nelseif comparison == &quot;&lt;&quot; then\n return a &lt; b - epsilon\nelseif comparison == &quot;&lt;=&quot; then\n return a &lt;= b + epsilon\nelseif comparison == &quot;&gt;&quot; then\n return a &gt; b + epsilon\nelseif comparison == &quot;&gt;=&quot; then\n return a &gt;= b - epsilon\nelse\n error(&quot;Invalid comparison operator: &quot; .. comparison)\nend\nend\n</code></pre>\n"^^ . . "0"^^ . . "5"^^ . "wxwidgets"^^ . . . . "1"^^ . "0"^^ . . . "I added `MyFormat(s)` function. Use `Plate = MyFormat(Plate)`"^^ . . . . "1"^^ . "<p>local hitTarg = hb(Vector3.new(4,6,4), character.PrimaryPart.CFrame * Cframe.new(0,0,-3) {character}, character)</p>\n<p>The error is &quot;attempt to index nil with &quot;PrimaryPart&quot;&quot;</p>\n<p>I can't find anything that can help me fix this</p>\n<p>And thank you in advance </p>\n"^^ . "0"^^ . "grid"^^ . "0"^^ . . . . "1"^^ . . . . . "<p>Multiple values get truncated when there's a comma after them. Something like this will work as a workaround:</p>\n<pre><code>function ExecuteWithMyNameAtTheEnd(f, ...)\n local arg = table.pack(...)\n arg[arg.n + 1] = &quot;Maxi&quot;\n f(table.unpack(arg, 1, arg.n + 1))\nend\n\nExecuteWithMyNameAtTheEnd(print, 1, 2, 3)\n</code></pre>\n"^^ . "0"^^ . . . . . "1"^^ . "0"^^ . "<pre class="lang-lua prettyprint-override"><code>local str = {\n [&quot;red&quot;] = &quot;ff0000&quot;,\n [&quot;blue&quot;] = &quot;4C9FFF&quot;,\n [&quot;purple&quot;] = &quot;C33AFF&quot;,\n [&quot;green&quot;] = &quot;53FF4A&quot;,\n [&quot;gray&quot;] = &quot;E2E2E2&quot;,\n [&quot;black&quot;] = &quot;000000&quot;,\n [&quot;white&quot;] = &quot;ffffff&quot;,\n [&quot;pink&quot;] = &quot;FB8DFF&quot;,\n [&quot;orange&quot;] = &quot;FF8E1C&quot;,\n [&quot;yellow&quot;] = &quot;FAFF52&quot;,\n --TODO Add Colors\n}\n\nfunction str:generate_string(text)\n assert(text and type(text) == &quot;string&quot;)\n\n local function replaceColor(match)\n local colorName = match:sub(2)\n local colorValue = self[colorName]\n if colorValue then\n return &quot;#&quot; .. colorValue\n else\n return match\n end\n end\n\n local pattern = &quot;(&amp;%w+)&quot;\n\n local result = text:gsub(pattern, replaceColor)\n\n return result\nend\n\nlocal text = &quot;&amp;whiteHello&amp;white World&quot;\nprint(str:generate_string(text))\n</code></pre>\n<p>Hello. I have such code. I want to pass a string as an argument and inside the function, replace parts where color names are mentioned, followed by an '&amp;' sign, with their hexadecimal code. This code works fine as long as there is a space after the last letter. For example:\n<code>&quot;Hello&amp;green World&quot;</code>\nResult:\n&quot;Hello#53FF4A World&quot;\nHowever, if there is no space after the pattern, like:\n<code>&quot;Hello &amp;greenWorld&quot;</code>\nThen the code behaves incorrectly:\nHello &amp;greenWorld\nIs there a way to fix this issue?\nAlso, if there's a more efficient way to implement this code, I'd appreciate your input.</p>\n<p>I expect the code to produce such a result:\nFor example:\n<code>&quot;Hello &amp;greenWorld&quot;</code>\nResult:\n<code>&quot;Hello #53FF4AWorld&quot;</code></p>\n"^^ . . . . . "<p>(Actually you can skip the hash function and set key value as key hashedValue)</p>\n<p>Code:</p>\n<pre class="lang-lua prettyprint-override"><code>function createHashChecker(hashFunction)\n local hashTable = {}\n return function(value)\n local hashedValue = hashFunction(value)\n if hashTable[hashedValue] then\n return true -- hahsed value is already in hashTable\n else\n hashTable[hashedValue] = true\n return false -- hahsed value was not in hashTable\n end\n end\nend\n</code></pre>\n<p>Example:</p>\n<pre class="lang-lua prettyprint-override"><code>local function hashFunction (str)\n return str\nend\n\nlocal checkHash = createHashChecker(hashFunction)\n\nprint (checkHash('foo')) -- false\nprint (checkHash('bar')) -- false\nprint (checkHash('foo')) -- true\n</code></pre>\n"^^ . . . "0"^^ . "-1"^^ . . "How can I 'go to definition' programmatically using Lua?"^^ . "scope"^^ . . . . "Looking for an approach to finding the minimum number of rectangles necessary in order to fill the occupied area of a 2D matrix?"^^ . . . "0"^^ . . "1"^^ . . "0"^^ . . . . "0"^^ . . . . "1"^^ . "<p>So here's the thing about frame rates, there is never a guarantee that you'll get a consistent frame length. The engine has stuff it has to do every frame, and it allows your scripts to run for a set amount of time before they must yield back to the engine so it can keep doing stuff. <code>task.wait()</code> and <code>wait()</code> yield your script and effectively pause the execution for 1 frame, but the amount of time it takes the engine to resume your script cannot be guaranteed.</p>\n<p>Here's a breakdown of a few of the many different methods of pausing your script for 1 frame, and the distribution of the length of those pauses.</p>\n<div class="s-table-container"><table class="s-table">\n<thead>\n<tr>\n<th>Methods</th>\n<th>RunService<br/>PreSimulation</th>\n<th>RunService<br/>Heartbeat</th>\n<th>RunService<br/>RenderStepped</th>\n<th>wait()</th>\n<th>wait(1/60)</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>minimum (seconds)</td>\n<td>0.0125</td>\n<td>0.0110</td>\n<td>0.0127</td>\n<td>0.0308</td>\n<td>0.0312</td>\n</tr>\n<tr>\n<td>maximum (seconds)</td>\n<td>0.0667</td>\n<td>0.5910</td>\n<td>0.7072</td>\n<td>0.0506</td>\n<td>0.0493</td>\n</tr>\n<tr>\n<td>median (seconds)</td>\n<td>0.0167</td>\n<td>0.0169</td>\n<td>0.0166</td>\n<td>0.0333</td>\n<td>0.0333</td>\n</tr>\n<tr>\n<td>std dev (seconds)</td>\n<td>0.0080</td>\n<td>0.0474</td>\n<td>0.0565</td>\n<td>0.0019</td>\n<td>0.0019</td>\n</tr>\n</tbody>\n</table></div>\n<p>And an example distribution of those frame-rates would look like this :\n<a href="https://i.sstatic.net/Js4XY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Js4XY.png" alt="Histogram of Heartbeat Frame Lengths" /></a></p>\n<p>We can see that <code>wait()</code> most consistently pauses frames, but it looks to be two frames before it resumes.</p>\n<h2> But here's the thing... </h2>\n<p>I think you've got a bit of an <a href="https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem">XY problem</a>. The solution to your problem might not be finding a way to pause/yield for 1 frame, but rather to simply draw a value at the point based on the current timestamp. Imagine that your drawing cursor is moving at a constant rate, and every frame you simply place a point at its calculated position.</p>\n<p>In your main script, set up the drawing segments :</p>\n<pre class="lang-lua prettyprint-override"><code>local rs = game:GetService(&quot;RunService&quot;)\n\nlocal drawPWave = require(script.p_wave)\nlocal drawRestPhase = require(script.rest)\nlocal drawQRSComplex = require(script.qrs_complex)\nlocal drawTWave = require(script.t_wave)\n\nlocal colGreen = Color3.fromRGB(25, 255, 25)\n\nlocal ecgPhases = {\n {\n name = &quot;P_Wave&quot;,\n getCursorPosition = drawPWave,\n duration = 0.300, --seconds\n color = colGreen,\n },\n {\n name = &quot;PQ_Wave&quot;,\n getCursorPosition = drawRestPhase,\n duration = 0.120, --seconds\n color = colGreen,\n },\n {\n name = &quot;QRS_Complex&quot;,\n getCursorPosition = drawQRSComplex,\n duration = 0.400, --seconds\n color = colGreen,\n },\n {\n name = &quot;ST_Segment&quot;,\n getCursorPosition = drawRestPhase,\n duration = 0.250, --seconds\n color = colGreen,\n },\n {\n name = &quot;T_Wave&quot;,\n getCursorPosition = drawTWave,\n duration = 0.400, --seconds\n color = colGreen,\n },\n {\n name = &quot;BreakBetween&quot;,\n getCursorPosition = drawRestPhase,\n duration = 0.90, --seconds\n color = colGreen,\n },\n}\n\n\nlocal function DrawPoint(targetUI : GuiBase, x : number, y : number, color : Color3, pixelSize : number)\n local pixel = Instance.new(&quot;Frame&quot;, targetUI)\n pixel.Size = UDim2.new(0, pixelSize, 0, pixelSize)\n pixel.Position = UDim2.new(x, 0, y, 0)\n pixel.BackgroundColor3 = color\n pixel.BackgroundTransparency = 0\n pixel.BorderSizePixel = 0\n pixel.Name = &quot;pixel&quot;\n\n return pixel\nend\n\n\n\n-- targetUI : A UI element to render the ECG\nlocal function drawECG(targetUI : GuiObject)\n local currentDrawState = 1\n local pixelSize = 2\n local pixels = {}\n \n local frameWidth = targetUI.AbsoluteSize.X\n local lineClearanceOffset = .3\n local lineClearing = false\n local speed = 50 -- pixels / second\n \n local currentSegmentTime = 0.0 -- seconds\n local x = 0\n \n local clearance = ((frameWidth - pixelSize) / frameWidth) - lineClearanceOffset\n \n return rs.Heartbeat:Connect(function(deltaTime)\n currentSegmentTime += deltaTime\n\n -- check if we should move onto the next segment\n local segmentDuration = ecgPhases[currentDrawState].duration\n if currentSegmentTime &gt; segmentDuration then\n currentDrawState += 1\n if (currentDrawState &gt; #ecgPhases) then\n currentDrawState = 1\n end\n currentSegmentTime = 0\n end\n\n -- calculate the value between [0, 1] for determining shape\n local percentComplete = (currentSegmentTime / segmentDuration)\n\n -- update the cursor position\n local inc = (deltaTime * speed) / frameWidth\n x = (x + inc) % 1.0\n if not lineClearing then\n lineClearing = (x &gt;= clearance)\n else\n -- clear previous pixels\n pixels[1]:Destroy()\n table.remove(pixels, 1)\n end\n\n -- calculate y and sanitize nan calculations\n local y = ecgPhases[currentDrawState].getCursorPosition(percentComplete)\n y = if (y ~= y) then 0 else y\n -- convert and scale to screen coordinates\n y = (-0.5*y) + 0.5\n \n \n -- draw and store the current pixel\n local color = ecgPhases[currentDrawState].color\n local pixel = DrawPoint(targetUI, x, y, color, pixelSize)\n table.insert(pixels, pixel)\n end)\nend\n\n\n-- draw it to the UI\nlocal leadFrame = script.Parent.blackBg.I_leadFrame\nlocal drawingConnection = drawECG(leadFrame)\nleadFrame.Destroying:Connect(function()\n drawingConnection:Disconnect()\nend)\n</code></pre>\n<p>You'll notice that your drawing functions have been moved to ModuleScripts as children of this LocalScript. The point of this is to isolate the logic so that each module handles drawing values between [0, 1].</p>\n<p>So in a ModuleScript child name <code>p_wave</code> add this :</p>\n<pre class="lang-lua prettyprint-override"><code>local a = 0.125\nlocal pi = math.pi\n\n-- given a number between [0, 1]\n-- returns a number between [-1, 1]\nreturn function(percentComplete)\n -- sine is positive from [0, pi]\n local theta = pi * percentComplete -- radians\n return a * math.sin(theta)\nend\n</code></pre>\n<p>In a ModuleScript child named <code>qrs_complex</code>, add this :</p>\n<pre class="lang-lua prettyprint-override"><code>local pi = math.pi\nlocal piOverTwo = pi / 2\nlocal a = 0.5 -- amplitude\nlocal b = 1.2 -- phase speed\nlocal c = -0.5 -- phase offset, negative pushes wave -&gt;\nlocal d = -0.2 -- overall offset, negative moves wave down\n\n-- when comparing floating point values\nlocal function fuzzy_equals(left, right)\n return math.abs(left - right) &lt; (1e-5)\nend\n\n-- given a number between [0, 1]\n-- returns a number between [-1, 1]\nreturn function(percentComplete)\n local theta = b * (pi * percentComplete) + c\n \n -- tangent is undefined where cos(theta) == 0\n -- ex) pi/2, 3pi/2\n if fuzzy_equals(theta, piOverTwo) then\n theta += 0.01\n end\n \n local spike = math.abs(a * math.tan(theta)) + d\n return math.min(spike, 1.0)\nend\n</code></pre>\n<p>In a ModuleScript child named <code>t_wave</code>, add this :</p>\n<pre class="lang-lua prettyprint-override"><code>local pi = math.pi\nlocal A = 0.31\n\n-- given a number between [0, 1]\n-- returns a number between [-1, 1]\nreturn function(percentComplete)\n \n local theta = pi * percentComplete\n return A*math.sin(theta)\nend\n</code></pre>\n<p>And finally, in a ModuleScript child named <code>rest</code>, add this :</p>\n<pre class="lang-lua prettyprint-override"><code>-- given a number between [0, 1]\n-- returns a number between [-1, 1]\nreturn function(percentComplete)\n return 0\nend\n</code></pre>\n<p>The point of all of this separation is to reduce your piecewise function into easily debug-able pieces. The main drawing function configures how long each section should be drawn for, and handles the logic for piecing them together.</p>\n<p>You'll likely need to reconstruct your equations for the different segments, I reduced them to simple equations for the sake of debugging.</p>\n"^^ . . "0"^^ . . . . "3"^^ . "So do all the cells in the rectangle have to be occupied? If you had a chessboard type occupancy, there would be no way to group them. If you have to handle all scenarios with specific performance, include such details in your question for suggestions. You may need to use a different language."^^ . . "0"^^ . "1"^^ . . . "2"^^ . . . "Try adding `printf("%f\\n", lua_tonumber(L, -1));` before `lua_rawseti`."^^ . . "Lua syntax error expected '(' near update_rotation"^^ . . "0"^^ . . "<p>I made it work</p>\n<pre><code>local HP = cube.Healthbar\nlocal Cooldown = false\n \nlocal function Healtbar() do\n if Cooldown then return() end\n HP.Value =- 5\n Cooldown = true\n wait(0.5)\n Cooldown = false\nend\n\ncube.Touched:Connect(Healthbar)\n</code></pre>\n"^^ . . . . . . "wait"^^ . "3"^^ . . . "Get third control point quadratic Bezier curve for parabola with given fucus and directrix, Lua"^^ . . . . . "<p>I have a code written in Lua with a load of variables in a string like this:</p>\n<p>local var={[1]= &quot;dothis&quot;, [2]= &quot;clevermaths&quot;, [3]= &quot;longstring&quot;}</p>\n<p>than the rest of the code uses these variables in the format of var[1], var [2] all over the place.</p>\n<p>I was to replace all the var[1]s with &quot;dothis&quot;, the var[2]s with &quot;clevermaths&quot;.</p>\n<p>I started using Find and Replace in VS Code and doing each one manually, but this was taking ages as there are over 50 of them in this script alone.</p>\n<p>I googled along the lines of &quot;how to replace shortened variables stored in a table with their full-length values&quot; - no help (unless I'm some sort of coding expert - which I'm not).</p>\n<p>I joined Stackoverflow to ask you clever people very nicely for some help, bearing in mind I'm not a coder, but get by more or less by modifying, tweaking, watching youtube tutorials etc.</p>\n<p>Sadly I have to interact with Lua code in a very specific piece of software used for my job. It makes tasks easier, but there's no resources or budget to employ someone, so it falls on my shoulders. If I can't do it, I just have to do things manually and stay late at work.</p>\n"^^ . "How to get point color (RGB) in panel Lua (wxLua)?"^^ . "0"^^ . . "0"^^ . "1"^^ . "<p>I want to make a Table in lua with io.read, This is my code:</p>\n<pre><code>local members = {}\n\nio.write(&quot;How many members you wanna add? &quot;)\nlocal memberNum = io.read(&quot;n&quot;)\n\nprint(&quot;Add new member: &quot;)\nfor i = 1, memberNum do\n local newMember = io.read(&quot;*l&quot;)\n if i == 1 then\n members[1] = newMember\n else\n table.insert(members, i, newMember)\n end\nend\n\n\nfor i = 1, #members do\n print(i, &quot;: &quot;, members[i])\nend\n</code></pre>\n<p>I expect to result be:</p>\n<pre><code>members = { &quot;Amir&quot;, &quot;Hamid&quot;, &quot;Bahar&quot;, &quot;Emad&quot;, &quot;Maryam&quot;}\n</code></pre>\n<p>but program only accept 4 input from me and insert first input as a <strong>nil</strong> value and give me this result:</p>\n<pre><code>members = {&quot;&quot;, &quot;Amir&quot;, &quot;Hamid&quot;, &quot;Bahar&quot;, &quot;Emad&quot;}\n</code></pre>\n<p>What is the problem? Help me pls</p>\n"^^ . . . "0"^^ . "You're a wizard. Thank you, this works exactly as I had hoped."^^ . . . "0"^^ . "<p>What are modern alternatives for IBM's old JCL (Job Control Language) scripting language?</p>\n<p>For the past several years a client is working on a rewrite/overhaul of their old Mainframe system porting over to the cloud. The rewrite is largely in C# .NET Framework, with a smattering of C++ creating a VM simulating the old mainframe on Azure servers. Right now they are running their old JCL to handle large parts of their database in the new rewrite.</p>\n<p>For those that aren't as familiar with JCL in a legacy environment, the client is using it to point to parts of the database, call applications/processes with parameters, and pipe file-I/O to/from the relative applications. It pretty much reads like the old punch-cards, and doesn't have any personal processing power (basic arithmetic/logic key words, memory handling, or use of any kind of module/library expansions).</p>\n<p>Right now their looking at Lua or TCL as potential replacements to embed in their new system.</p>\n<p>What are alternative languages you have used for process control scripting? Pros? Cons?</p>\n"^^ . . . "1"^^ . . "0"^^ . "2"^^ . "`(your_string):match '^ +':len ()`"^^ . . . . . . . . . "1"^^ . "-1"^^ . "0"^^ . "0"^^ . . "2"^^ . "1"^^ . . . . "1"^^ . . "0"^^ . . "Not able to parse gzip response type(content-encoding:gzip) in Lua envoy filter"^^ . . "0"^^ . "0"^^ . "Are you need just cooldown / countdown for damage?"^^ . . . . "1"^^ . . . . . . . "You can simulate const globals with _G metatable."^^ . . "0"^^ . . . "neovim-plugin"^^ . . "0"^^ . . . . . . . "0"^^ . . . . . "0"^^ . . . "I know that and it is not the question I asked. I wanted to know a good practice to achieve the result I wanted."^^ . . "0"^^ . . . . . "<pre class="lang-lua prettyprint-override"><code>args = (#cmd_tb.args == 0 and false or cmd_tb.args)\n</code></pre>\n<p>cannot work. Lua doesn't have a ternary statement. The <code>… and … or …</code> does not replace it completely. <code>(condition) and false</code> will always evaluate to <code>false</code> (or falsy <code>nil</code>, if <code>condition == nil</code>, per Luatic), and the &quot;ternary statement&quot; will always return the second alternative.</p>\n<p>If you want a one-liner, you could rewrite this statement like this:</p>\n<pre class="lang-lua prettyprint-override"><code>args = #cmd_tb.args &gt; 0 and cmd_tb.args\n</code></pre>\n"^^ . . "<p>I have a file <code>module.lua</code> in which I have a ( or 2? ) variable(s).</p>\n<pre class="lang-lua prettyprint-override"><code>-- module.lua\n\ntest = 30\nlocal test = 20\ntest = 40\n\nprint(&quot;module.lua: &quot; .. test)\n</code></pre>\n<p>I also have my main file:</p>\n<pre class="lang-lua prettyprint-override"><code>-- main.lua\n\nrequire(&quot;module&quot;)\nprint(&quot;main.lua: &quot; .. test)\n</code></pre>\n<p>Result of <code>lua main.lua</code>:</p>\n<pre><code>module.lua: 40\nmain.lua: 30\n</code></pre>\n<p>I was playing with lua variable scopes but I no longer understand What's happening here.</p>\n<p><strong>What happens when I have a Global variable and a local variable with the same name? (and then import that file in another one)</strong></p>\n<p>I guess after the <code>local</code> keyword, changes to the <code>test</code> variable are no longer global, But everything happened before it is Global. <strong>What is the use of this? why doesn't the interpreter throw an error and prevent this confusing situation?</strong> (I'm new to lua, came from the python world)</p>\n<p>-- Trying this clearly says that changes made to test before <code>local</code> are global:</p>\n<pre class="lang-lua prettyprint-override"><code>-- module.lua\n\ntest = 30\ntest = 70\nlocal test = 20\ntest = 40\n\nprint(&quot;module.lua: &quot; .. test)\n</code></pre>\n<p><code>lua main.lua</code> -&gt;</p>\n<pre><code>module.lua: 40\nmain.lua: 70\n</code></pre>\n"^^ . "0"^^ . "Please read wiki youtube for finite state machine, it's very useful tool for such multiple modes situations aka states."^^ . "<p>Avoiding recursion and writing an explicitly iterative iterator is one option. If the depth of your binary tree is reasonably bounded, your recursive implementation works just as well. If you want an actual iterator, you can easily obtain one by passing <code>coroutine.yield</code> as <code>fun</code> and &quot;wrapping&quot; the iteration in a coroutine via <code>coroutine.wrap</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>for lvl, node in coroutine.wrap(function() tree:visit(coroutine.yield) end) do\n print(('|.. '):rep(lvl)..node.x)\nend\n</code></pre>\n<p>Of course you could also write a &quot;method&quot; for this:</p>\n<pre><code>function NODE:nodes()\n local function visit(node)\n coroutine.yield(node)\n if node.left then visit(node.left) end\n if node.right then visit(node.right) end\n end\n return coroutine.wrap(function() visit(self) end)\nend\n-- Usage:\nfor node in tree:nodes() do\n print(node.x) \nend\n</code></pre>\n<p>A recursive solution has the drawback of being limited by stack size (though this limit is very large on newer Lua versions, and can again be circumvented using &quot;trampolines&quot; or even more coroutines), and coroutines add some overhead both time- and space-wise.</p>\n<p>Most of the time this isn't critical though, and I find that coroutines yield very elegant solutions for obtaining an &quot;iterative&quot; iterator from a &quot;recursive&quot; one.</p>\n<p>In this example, the difference isn't very large, because you never need to go &quot;back&quot; to a node (you're doing a &quot;preorder&quot; traversal: You visit the root first, then visit the children).</p>\n<p>As an exercise, try to implement an inorder traversal. In the &quot;recursive&quot; / coroutine-based version, this should be trivial. In the iterative version, it's not quite as easy.</p>\n"^^ . . . . . "<p>I believe I have an answer for that, and it's easy and simple, no code needed.\nThe problem is that the UI you made has to have a size that is proportional to the screen size, right?\nMy solution is that you used the offset value to scale your GUI, but, instead, you have to use the scale value. Here's an example:\nX Size {0,10}\nY Size {0,10}.\nThe reason why this won't scale proportional to the screen's size is because I set the size values in <em>pixels</em>, but I have to set it in percentage of the screen's size, so, instead of doing this:\nX Size {0,10}\nY Size {0,10},\nI do this:\nX Size {0.1,0}\nY Size {0.1,0}.\nBy moving my size value to the first number, it will scale according to the screen size. Remember that the 0.1 that I set will <strong>NOT</strong> have the same size as the 10 I set before, but you can fix that by resizing the UI manually to how it was before.</p>\n<p>Here are some images to help you:\n<a href="https://i.sstatic.net/uPTl7.png" rel="nofollow noreferrer">https://i.sstatic.net/uPTl7.png</a></p>\n<p>In this picture, you can see that the scale property is equivalent to the first value in the X size property.</p>\n<p>If you still didn't understand, you basically have to change the size property from Offset to Scale, since Scale automatically maintains the same ratio of size for any device.</p>\n<p><a href="https://i.sstatic.net/JafoO.png" rel="nofollow noreferrer">https://i.sstatic.net/JafoO.png</a></p>\n"^^ . "1"^^ . "0"^^ . . "1"^^ . "0"^^ . . "mongodb"^^ . . . "MITRE ATT&CK Framework with Suricata"^^ . . "3"^^ . . "0"^^ . . . "0"^^ . . . . . . "5"^^ . "0"^^ . . . . "lazy-evaluation"^^ . . "0"^^ . . . "2"^^ . "1"^^ . . . . "0"^^ . "From lua 5.1 ref: \nnext (table [, index])\n"When called with the last index, or with nil in an empty table, next returns nil. If the second argument is absent, then it is interpreted as nil. In particular, you can use next(t) to check whether a table is empty. ""^^ . . . . . . . . . . . "Perfect. This satisfies all my criteria. It is both simple and it works for trees of arbitrary depth (since it only computes the next level, not all levels, at the current iteration)."^^ . "1. This depends on which charset your file is saved in. 2. It's almost impossible to cover all latin extended with lua's pattern, note there are more than 10 different kinds of latin extended in Unicode, and a lot of characters are multibyte."^^ . "1"^^ . . "0"^^ . "@vitiral Roblox's implementation of Lua ("Luau") does support the `-=` and similar operators."^^ . "0"^^ . "64 unsigned integers in Lua 5.3/5.4 do not behave like in "Programming in Lua""^^ . "1"^^ . "0"^^ . . . "3"^^ . "0"^^ . . "0"^^ . . "2"^^ . . "<p>I've searched through loads of forum posts from the ROBLOX Developer Forum for any answer(s) to this, and I have had no luck finding an answer so I'm hoping you can help.</p>\n<p>Basically I want to have a ServerScript (located ServerScriptService) wait for a LocalScript (located in a GUI Button) to fire a RemoteEvent (using FireServer) with the user's selected police division.</p>\n<p>I currently only have One GUI button setup (Frontline Policing). The LocalScript can be found below;</p>\n<p><strong>LocalScript</strong></p>\n<pre class="lang-lua prettyprint-override"><code>local div = game.ReplicatedStorage.Events.divisionEvent\n\nlocal button = script.Parent\nlocal gui = script.Parent.Parent.Parent.Parent\n\nbutton.MouseButton1Down:Connect(function()\n div:FireServer(&quot;Frontline&quot;)\n gui.Enabled = false\nend)\n</code></pre>\n<p>TLDR - I am wondering if it's possible to get a ServerScript to wait for a LocalScript to fire a RemoveEvent with needed information.</p>\n<p>I've done loads of Research through around 50-60 Roblox Developer Forum posts, and none of them are either;</p>\n<ul>\n<li>The Same Issue as mine.</li>\n<li>The Proper Resolution.</li>\n<li>Not even associated with my issue.</li>\n</ul>\n"^^ . . "Don't ask a question; give an answer. Don't use rhetorical questions as answers. Edit your answer and reword it in answer format. Also, give an explanation as to why your answer solves the asker's problem."^^ . "<p>You might also look at Python or (given that you're also using C# and so probably considering running on Windows) Powershell. In a Unix environment, bash would be the first option (even if it was one you then reject).</p>\n<p>This isn't something that has a definite answer though, at least with the small amount of information you have provided; there are <em>lots</em> of options. As long as you have language or basic library support for the operations you need, you should be able to make that work.</p>\n"^^ . "<p><a href="https://i.sstatic.net/i716p.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/i716p.jpg" alt="Screen shot of error message" /></a>The syntax error does not appear until I type the = for the variable assignment on the next line. App is Watchmaker.</p>\n<p>Complete code</p>\n<pre><code>-- Calculate rotation angle based on current time\nfunction update_rotation()\n local current_hour = os.date(&quot;%H&quot;)\n local rotation_angle = (current_hour / 24) * 360\n return rotation_angle\nend\n\n-- Update rotation every minute\nfunction on_minute()\n local rotation = update_rotation()\n your_control.rotation = rotation\nend\n\n</code></pre>\n<p>I am expecting this code to rotate a watch hand around the face once in each 24 hours.</p>\n"^^ . . . "-2"^^ . . . "<p>I need a part to be incerted to the character's body everytime they respawn\nHere's the script I made:</p>\n<pre><code>local Backpack = game:GetService(&quot;ReplicatedStorage&quot;):Waitforchild(&quot;Backpack&quot;)\nlocal Player = game:GetService(&quot;Players&quot;).localplayer\n\nPlayer.Character.Respawned:Connect(function(Character)\n local clone = Backpack:clone(Character.Torso)\nend\n</code></pre>\n"^^ . . . . "0"^^ . . "0"^^ . . . "0"^^ . "1"^^ . . . . "trigonometry"^^ . . . "0"^^ . . . "<pre><code>\n\n\n\nlocal proximityprompt = game.Workspace.Tycoons.Tycoon.MainItems.Cardboard_Box.Box.ProximityPrompt\nlocal StorageGui = script.Parent\nlocal x = script.Parent.Storage.Frame.X\n\nlocal Orebuttons = script.Parent.Storage.Frame.Ores:GetChildren()\nlocal OreString = script.Parent.Parent.Sell.Frame.Ore\n\nproximityprompt.Triggered:Connect(function()\n\n StorageGui.Visible = true\nend)\nx.MouseButton1Click:Connect(function()\n StorageGui.Visible = false\nend)\nOrebuttons.MouseButton1Click:Connect(function()\n print(&quot;Click&quot;)\n OreString.Value = Orebuttons.Name\nend)\n\n\n\n\n</code></pre>\n<p>I don't know what should I do\nI tried making that all buttons in folder will work in 1 line of code, and i didn't think that gonna make me more problems</p>\n"^^ . . . "That makes sense, so in a nutshell you are saying that: -->#cmd_tb.args == 0 and false<-- produces `false` which then makes the statement: `args = false or cmd_tb.args` ? Which then gives something unexpected? Is there a reason you did not use (), I thought it was needed? What is this called z = (expr and x or y) need to look it up in my lua book."^^ . "sqlite"^^ . . "How to make table from io.read in lua"^^ . . . "2"^^ . "0"^^ . "0"^^ . . . "<p>I believe this is due to floating point arithmetic error. Floating point numbers are meant to represent any decimal point number. But since computers use binary bits and can only use so many bits per variable, they can represent only a finite set of decimal point numbers.</p>\n<p>This fact of computing means that certain decimal point numbers are approximated when converted to the binary format. Any computational result that came from the approximation will be off by a little amount, hence the unexpected answer you received.</p>\n<p>The error due to this approximation is normally very, on the order of e-16 in your case. But when asserting to floating point numbers as equal, you will always need to a tolerance to account for the error.</p>\n"^^ . . "0"^^ . "1"^^ . . "1"^^ . "0"^^ . "3"^^ . . . "0"^^ . "1"^^ . "2"^^ . . . . "2"^^ . "I changed `io.read("*n")` to `io.read("n","l')` and its worked. Thanks for replay!"^^ . . . "0"^^ . . "0"^^ . . . . "Reflecting on my answer, the thing that it is missing is the ability to fill in the gaps. If one heartbeat lags and comes `0.6` seconds after the previous one, the code needs to loop over the missing data points to fill it in. A simple for-loop in the Heartbeat connection would take care of that. Please let me know if any piece of my answer doesn't make sense."^^ . . . . "Turn off Default R15 Fall Animation in flight mode in RobloxStudio with the programming language Lua"^^ . "1"^^ . . . . . "<p>You are need to run the luarock for it: <a href="https://luarocks.org/" rel="nofollow noreferrer">https://luarocks.org/</a></p>\n"^^ . . "istio"^^ . "1"^^ . "0"^^ . "0"^^ . . "0"^^ . "1"^^ . "1"^^ . . . "0"^^ . "lua sort table by values"^^ . . . . . . "2"^^ . . . "Because in Lua arrays are 1-based."^^ . "0"^^ . . "0"^^ . "0"^^ . . . . . . "Yeah, its just that"^^ . . "2"^^ . . . . "1"^^ . . . "1"^^ . "0"^^ . . . . . . . . . "As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . "4"^^ . . . . . . "2"^^ . . . "object"^^ . . . "0"^^ . . "eslint"^^ . . . "<p>I am trying to look for a way to write a wireshark dissector. The problem is that I do not find a lot of documentation of how to do so, which is very weird for me.</p>\n<p>I installed Lua54 and I am writing it in Visual Studio code with the main Lua extension. The Lua basic runs nicely (like creating a function or adding two numbers).</p>\n<p>However when I am following a certain documentation of how to build a Wireshark dissector, I cannot test nor run it locally, and moreover there is no autocompletion so I have no idea what attribute I can access or what functions I can run... (Such as for the <code>Proto</code> class)</p>\n<p>I've read somewhere that you need to run the script sith <code>tshark -X</code> command however, it initializes a sniff and I don't want to test it like that, I want to test it by giving it bytes and seeing if it detects the protocol by going inside the <code>data</code> attribute of a TCP packet and parses it accordingly (kind of like how <code>struct</code> or <code>construct</code> work in Python)</p>\n<p>The documentation I am following:</p>\n<p><a href="https://mika-s.github.io/wireshark/lua/dissector/2017/11/04/creating-a-wireshark-dissector-in-lua-1.html" rel="nofollow noreferrer">https://mika-s.github.io/wireshark/lua/dissector/2017/11/04/creating-a-wireshark-dissector-in-lua-1.html</a></p>\n<p>The problem is that when I initiate the &quot;Proto&quot; class it does not detect it and retrieves an exception of some &quot;Global 'Proto' is undefined&quot;</p>\n<p>What are the steps of writing, executing and testing a Lua dissector for wireshark? I cannot seem to find a basic guide, nor a guide to set up all the necessary programs.</p>\n<ul>\n<li><p>Searching on google\nI expected much greater explanations</p>\n</li>\n<li><p>Running it by myself\nI expected it to work but it threw an exception</p>\n</li>\n<li><p>Following a guide I added in the main question\nI expected it to run properly but it did not...</p>\n</li>\n</ul>\n"^^ . . "0"^^ . . . . "3"^^ . "redis"^^ . . . "0"^^ . "1"^^ . "0"^^ . "1"^^ . . "0"^^ . . . . . "<p>You want to make a connection on Remote.OnServerEvent\nI recommend reading about it <a href="https://create.roblox.com/docs/scripting/events/remote" rel="nofollow noreferrer">here</a> and trying to write the code yourself. It's a good way to learn.</p>\n<p>But here's the code for your problem:</p>\n<pre class="lang-lua prettyprint-override"><code>local div = game:GetService(&quot;ReplicatedStorage&quot;).Events.divisionEvent\n\ndiv.OnServerEvent:Connect(function(Player, Team)\n --Player is the player instance who fired the remote (Assigned automatically by Roblox) Example: game:GetService(&quot;Players&quot;).Guest\n --The first argument given to :FireServer, for your case would be &quot;Frontline&quot;\nend)\n</code></pre>\n"^^ . . . . . . "hash"^^ . "1"^^ . . "for-loop"^^ . . "2"^^ . "0"^^ . . . . . "5"^^ . . . "prevent nvim unwanted TextChanged events in lua"^^ . . . "<p>make sure the <code>Ore</code> object is a string, i hope this helps :D</p>\n"^^ . . . . . "<p>I think you call wrong function.</p>\n<p><code>luasnip.lspexpand(args.body)</code></p>\n<p>It should be</p>\n<p><code>luasnip.lsp_expand(args.body)</code></p>\n"^^ . . "0"^^ . "0"^^ . "<p>Currently when Caps Lock is on, the script is enabled, and when its off, its disabled. Fairly straightforward, what I'd like to do is when caps is on, all code above else statement is enabled, and when caps is off, code below else statement is enabled. Here is the code, you can see I've got an else statement that should be turning it on when the conditions are not met of the first block, however that doesn't happen. I want the code below the <code>else</code> statement to be used when Caps Lock is toggled off. Also, while I'm on this topic, if anyone knows how i can change the toggle key from Caps Lock to the mouse buttons on the side of my mouse, that would be lovely, as in this case I can just use mouse button 4 for code above the else statement, and mouse button 5 for code below it, would be a huge help.</p>\n<pre class="lang-lua prettyprint-override"><code>EnablePrimaryMouseButtonEvents(true);\nfunction OnEvent(event,arg)\n if EnableRCS ~= false then\n if RequireToggle ~= false then\n if IsKeyLockOn(ToggleKey)then\n if IsMouseButtonPressed(3)then\n repeat\n if IsMouseButtonPressed(1) then\n repeat\n MoveMouseRelative(-1,RecoilControlStrength)\n Sleep(DelayRate)\n MoveMouseRelative(0,RecoilControlStrength)\n Sleep(DelayRate)\n MoveMouseRelative(-2,RecoilControlStrength)\n Sleep(DelayRate)\n MoveMouseRelative(0,RecoilControlStrength)\n Sleep(DelayRate)\n until not IsMouseButtonPressed(1)\n end\n until not IsMouseButtonPressed(3)\n end\n end\n\n else \n if IsMouseButtonPressed(3)then\n repeat\n if IsMouseButtonPressed(1) then\n repeat\n MoveMouseRelative(0,RecoilControlStrength)\n Sleep(DelayRate)\n until not IsMouseButtonPressed(1)\n end\n until not IsMouseButtonPressed(3)\n end\n end\n else \n end \nend\n</code></pre>\n<p>The top part of the code (before <code>else</code> statement) works as intended, when caps lock is on, that code is running, however I intended for the code following the else statement to take effect when caps lock is off, which is not the case.</p>\n"^^ . . "1"^^ . "Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . "3"^^ . "2"^^ . . "On Linux terminal, try `io.write("\\27c")`"^^ . "Besides this effectively being a duplicate of the linked question, the only relevant Lua aspect you need to know is that `tostring`ing numbers will silently round them. Use `string.format("%.17g", number)` for more exact formatting."^^ . . . . . . . . . . . . "0"^^ . . . "1"^^ . "<p>I am trying to make the quadatic Bezier curve that is equivalent to the given parabola, that was defined as focus (fx, fy) and directrix dirY. (algorithm to make Voronoi diagram with sweeping line, the Fortune's algorithm)</p>\n<p>The curve is limited by points A (ax, ay) and B (bx, by).</p>\n<p>I need to find the third control point C (cx, cy) as here:\n<a href="https://en.m.wikipedia.org/wiki/File:Quadratic_Bezier_parabola_equivalence.svg" rel="nofollow noreferrer">https://en.m.wikipedia.org/wiki/File:Quadratic_Bezier_parabola_equivalence.svg</a>\nor\n<a href="https://en.wikipedia.org/wiki/File:Relationship_between_parabola_and_quadratic_Bezier.svg" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/File:Relationship_between_parabola_and_quadratic_Bezier.svg</a></p>\n<pre><code>function getBezierControlPoint_focus_directrix(fx, fy, ax, ay, bx, by)\n -- (x-h)^2=4*p*(y-k)\n if (ay == by) then\n -- exception: horizontal AB\n local k = (fy + dirY) / 2\n local h = fx\n local cx = h\n local cy = ay + 2*(k-ay)\n return cx, cy -- it works perfect\n else\n-- [Axis direction](https://en.wikipedia.org/wiki/Parabola#Axis_direction)\n local h = fx\n local k = (fy + dirY) / 2\n local cx = (ax+bx)/2\n local f = (k-dirY)/2\n \n -- vertex\n -- h = -b/(2*a)\n -- k = (4*a*c-b*b)/(4*a)\n \n local a = -1/(dirY-ay)\n local b = -2 * a * h\n local c = h * h * a + k\n print ('h', h, -b/(2*a)) -- ok, same\n print ('k', k, (4*a*c-b*b)/(4*a)) -- ok, same\n \n -- derivative value of parabola in point A (ax):\n local day = a*2*ax + b\n local cy = ay + day * (bx-ax)/2\n \n return cx, cy -- not right, here is problem\n end\nend\n</code></pre>\n<p>usage: three control points to draw parabola:</p>\n<pre><code>controlPoints = {ax, ay, cx, cy, bx, by}\n</code></pre>\n<p><a href="https://i.sstatic.net/HFZ9k.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HFZ9k.png" alt="Parabola as beach line, drawn with bezier-curve" /></a></p>\n<p>Parabola as beach line, drawn with bezier-curve\nUpdate:\n<a href="https://www.desmos.com/calculator/joeugogi8b" rel="nofollow noreferrer">https://www.desmos.com/calculator/joeugogi8b</a></p>\n<p>Ready function:</p>\n<pre class="lang-lua prettyprint-override"><code>function getBezierControlPoint (fx, fy, ax, bx)\n local function f(x) return (x*x-2*fx*x+fx*fx+fy*fy-dirY*dirY) / (2*(fy-dirY)) end\n local function df(x) return (x-fx) / (fy-dirY) end\n if (fy == dirY) then return end -- not parabola\n local ay, by = f(ax), f(bx)\n local ad, dx = df(ax), (bx-ax)/2\n local cx, cy = ax+dx, ay+ad*dx\n return cx, cy\nend\n</code></pre>\n"^^ . . . "1"^^ . "1"^^ . . "Incorrect number comparison result (Lua)"^^ . . "<h4>Hash sets in Lua</h4>\n<p>Yes, a table with string keys and truthy values (usually <code>true</code>) is the idiomatic, and most likely most efficient, way to implement a hash set of strings (or numbers, or &quot;pointers&quot; (like functions or tables, which are compared by reference)) in Lua.</p>\n<h4>Method - data name collisions</h4>\n<p>This however:</p>\n<blockquote>\n<pre class="lang-lua prettyprint-override"><code>function dict.contains(self, word) do\n return self[word]\nend\n</code></pre>\n</blockquote>\n<p>is a bad idea, because suddenly <code>dict:contains(&quot;contains&quot;)</code> will be truthy (it will be the <code>contains</code> function).</p>\n<p>Similarly, <code>dict.word</code> will suddenly be truthy as well, even though you probably want all accesses to go through <code>contains</code>.</p>\n<p>I'd recommend just directly doing something like <code>if words[word] then</code> rather than unnecessarily complicating this by forcing it into an OOP style when it is not needed or useful. If you do want this, <em>encapsulate</em> the internal &quot;set&quot; of words, so store it in a field like <code>dict._words</code> to not have the methods conflict with the actual data you're storing.</p>\n<hr />\n<h4>Premature optimization concerns</h4>\n<blockquote>\n<p>Is this option good enough?</p>\n</blockquote>\n<p>It most probably is - <strong>try it and see</strong>. &quot;20k&quot; is a <em>very small number</em> of words for Lua to handle. I see no reason why the first solution shouldn't be <strong>fully satisfying</strong>.</p>\n<p>In asymptotical terms, accessing this table - both to insert new strings, or to get strings - has expected constant time complexity.</p>\n<p>Using the optimized hash table implementation provided by your Lua implementation is most probably a better idea than rolling your own.</p>\n<blockquote>\n<p>Or maybe this one would be better: [...] I am inclining to vote for the 2nd option</p>\n</blockquote>\n<p>So far you have provided no reason why it <em>should</em> be better, and barring exceptional circumstances, I don't think it will be. In many aspects, it's very blatantly worse:</p>\n<ul>\n<li>It's more complex. This complexity would need to be justified.</li>\n<li>It adds overhead. You need your own hashing of strings; you'll be duplicating the work Lua is already doing when it interns strings itself.</li>\n<li>A hashing algorithm written in Lua is very unlikely to outperform the optimized hashing algorithm present in your Lua implementation, especially if you're using a well-optimized one like LuaJIT.</li>\n</ul>\n<blockquote>\n<p>If it is just an address of an interned string, probably the 1st option is quite good one (in terms of memory consumption and better performance)?</p>\n</blockquote>\n<p>Yes, on Lua 5.2 and earlier, <strong>all strings are interned</strong> and there is <strong>no way to turn this off</strong>. What this practically means is that <strong>different strings have different addresses, same strings reuse the same memory</strong>. String comparison is a simple address comparison and thus constant time. This is what enables table access to always be O(1) instead of O(length of string).</p>\n<p>So indeed, on Lua 5.2 and earlier, the first option is most certainly better, and by a lot.</p>\n<p>On Lua 5.3 and later, things get a bit more complicated: Very &quot;long&quot; strings (think thousands of characters) are not interned anymore, but instead are hashed on-demand, meaning comparison for these long strings is O(n), as is table access.</p>\n<p>Now there are two &quot;exceptional circumstances&quot; where the custom hashing <em>could</em> be justified, but I consider it <strong>very unlikely</strong> that you find yourself in either one:</p>\n<ol>\n<li>You're using an older Lua / LuaJIT implementation which does not protect against hash collision attacks, and need to protect against such attacks, which can make table access O(n) and thus lead to denial of service. In this case, custom hashing can help - as does just &quot;salting&quot; the keys with a salt unknown to the attacker.</li>\n<li>With <em>very efficient</em> custom hashing (think implementing a very good hashing algorithm in C, which somehow beats Lua's general-purpose string hashing for your use case), you could potentially beat Lua's built-in hashing. But at that point, you should probably be writing this performance-critical code in C or another language suitable for maximizing performance to begin with.</li>\n</ol>\n<blockquote>\n<p>But from the other side, it should be good for statically defined tables (with interned strings).</p>\n</blockquote>\n<p>If anything, this is another plus point for using Lua's implementation.</p>\n<blockquote>\n<p>While I am going to load keys, maybe the 2nd options is still better?</p>\n</blockquote>\n<p>No.</p>\n<hr />\n<p><strong>TL;DR</strong>: <strong>Don't optimize prematurely</strong>; you'd most likely end up with <strong>more complex, less efficient code</strong>. Simply use a table with string keys.</p>\n"^^ . . "2"^^ . . "0"^^ . . . . "0"^^ . "0"^^ . . "0"^^ . . "0"^^ . "How do i make a "sanity" bar?"^^ . . "I want to change the hud to the top right corner and have no problem with other resolutions"^^ . . "0"^^ . "0"^^ . "0"^^ . . . "1"^^ . "0"^^ . "0"^^ . . "0"^^ . "@Luatic, `string.format("%.17g", number)` - this solves the first problem! For the second case it outputs: 1*1.2+3*1.6000000000000001<=6 false 1*1.2+3*1.6000000000000001 = 6"^^ . . . "RBX: How to accurately yield/pause script up to miliseconds?"^^ . . "How to make code work together ? lua script"^^ . . . . . . . . "0"^^ . "<p>I would like to convert</p>\n<ul>\n<li><code>Hello a/b hi</code> into <code>Hello \\frac{a}{b} hi</code></li>\n<li><code>a/b hi</code> into <code>\\frac{a}{b} hi</code></li>\n<li><code>Hello a/b</code> into <code>Hello \\frac{a}{b}</code></li>\n</ul>\n<p>where <code>a</code> and <code>b</code> is any non space character, using Lua patterns.</p>\n<p>I came up with a pattern for each of those 3 cases:</p>\n<pre><code>line, _ = string.gsub(line, &quot;%s+(%S+)/(%S+)%s+&quot;, &quot;\\\\frac{%1}{%2}&quot;)\nline, _ = string.gsub(line, &quot;^(%S+)/(%S+)%s+&quot;, &quot;\\\\frac{%1}{%2}&quot;)\nline, _ = string.gsub(line, &quot;%s+(%S+)/(%S+)$&quot;, &quot;\\\\frac{%1}{%2}&quot;)\n</code></pre>\n<p>Is it possible to condense them into a single regular expression?</p>\n<p>Because <code>[^%s]</code> would resolve to the complement of the <code>%s</code> character class, that is, all non-space characters (equivalent to <code>%S</code>), rather than space or start of line.</p>\n"^^ . . "0"^^ . . "<p>In Lua, how to write an iterator for a binary tree. e.g. so I could do something like:</p>\n<pre class="lang-lua prettyprint-override"><code>for node in tree:visit() do ... end\n</code></pre>\n<p>I've been trying but best I can do is to walks the tree, carrying around some function <code>fun</code> as a payload. e.g.</p>\n<pre class="lang-lua prettyprint-override"><code>function klass(s, t) t={ako=s}; t.__index=t; return t end\n\nNODE=klass&quot;NODE&quot;\nfunction NODE.new(x,l,r) return setmetatable( {x=x, left=l, right=r},NODE) end\n\nfunction NODE:visit(fun, lvl)\n lvl=lvl or 0\n fun(lvl,self)\n for _,kid in pairs{self.left, self.right} do \n if kid then kid:visit(fun, lvl+1) end end end\n\n--- eg -----------------------------\nfunction eg(x,stop, node)\n node = NODE.new(x)\n if x &lt; stop/2 then\n node.left = eg(2*x,stop)\n node.right = eg(2*x+1,stop) end\n return node end \n\ntree=eg(1,32)\ntree:visit( function(lvl,node) print(('|.. '):rep(lvl)..node.x) end )\n</code></pre>\n<p>This produces the output I want:</p>\n<pre><code>1\n|.. 2\n|.. |.. 4\n|.. |.. |.. 8\n|.. |.. |.. |.. 16\n|.. |.. |.. |.. 17\n|.. |.. |.. 9\n|.. |.. |.. |.. 18\n|.. |.. |.. |.. 19\n|.. |.. 5\n|.. |.. |.. 10\n|.. |.. |.. |.. 20\n|.. |.. |.. |.. 21\n|.. |.. |.. 11\n|.. |.. |.. |.. 22\n|.. |.. |.. |.. 23\n|.. 3\n|.. |.. 6\n|.. |.. |.. 12\n|.. |.. |.. |.. 24\n|.. |.. |.. |.. 25\n|.. |.. |.. 13\n|.. |.. |.. |.. 26\n|.. |.. |.. |.. 27\n|.. |.. 7\n|.. |.. |.. 14\n|.. |.. |.. |.. 28\n|.. |.. |.. |.. 29\n|.. |.. |.. 15\n|.. |.. |.. |.. 30\n|.. |.. |.. |.. 31\n</code></pre>\n<p>But how do I write this such that I can work it into a <code>for</code> loop?</p>\n<p>There are two solutions I'd like to avoid:</p>\n<ul>\n<li>I don't want to use <code>pairs</code> to over a list of nodes generated via the my code above (since I'd like to support incremental traversal of trees of arbitrary depth)</li>\n<li>I want the answer to be (much) less complex than <a href="https://github.com/guicaulada/lua-bintrees/blob/main/bintrees/iterator.lua" rel="nofollow noreferrer">https://github.com/guicaulada/lua-bintrees/blob/main/bintrees/iterator.lua</a></li>\n</ul>\n"^^ . . "random"^^ . . "0"^^ . . "1"^^ . . "Can you add the code where you define the `char` object, and where `noteGroup` is set if that is in some other section of the code. being able to see the actual structure of the object will help people determine your problem. Alternatively if you can write an example that reproduces the problem with as little code as possible (this might even help you to anwser the question yourself)"^^ . . . "<p>I am trying to make an application with Lua, LOVE and CatUI which I found CatUI before on <a href="https://github.com/love2d-community/awesome-love2d?tab=readme-ov-file#ui" rel="nofollow noreferrer">here</a>.\nI couldn't found any websites or even their own GitHub page for an installation guide to CatUI.</p>\n<p>I tried reaching to their GitHub page. I tried asking ChatGPT, while trying to install it on my OS which is windows by downloading its repository.</p>\n<p>Nothing seems to be working.</p>\n"^^ . . . "This is the actual code. I copy and pasted to create this post. I thought I attached a screenshot as well as the code in text form, but I don't see it now.\n\nThis code fragment is the only code there is.\n\nI am assuming there is an error somewhere other than where indicated, and the parser is misdiagnosing it, but I can't see any other error."^^ . "1"^^ . "How can I fix missing icons on Neovim Lualine plugin?"^^ . . . "<p>I am attempting to make a loop that goes though each item in an array.</p>\n<p>However, that array is in an object and the loop will only run though the first item, This is due to loop seeing the inserted value as 1.</p>\n<pre><code>function singStuff(membersIndex, noteData, noteType, char)\nif #char.noteGroup == 0 then return end --this = 1\ndebugPrint(char.noteGroup)\n--debugPrint(char.noteGroup[2]) --This doesn't work\nfor e,curNote in pairs(char.noteGroup) do --Loops once cus it counds how the number of noteGroups, not how many are in it\n\n --debugPrint(curNote[4]) -- #curNote = 4 (Correct)\n if noteType == curNote[e] then -- Removing these do not effect the loop -- curNote[e] works correctly\n char.doIdle = false\n playAnim(char.name, anims[noteData + 1], true)\n runTimer((&quot;sing_cooldown_&quot; .. char.name), 0.4, 1)\n elseif noteType == curNote[e]..char.altSuffix then\n char.doIdle = false\n playAnim(char.name, anims[noteData + 1]..char.altSuffix, true)\n runTimer((&quot;sing_cooldown_&quot; .. char.name), 0.4, 1)\n end\nend\nend\n</code></pre>\n<p>My guess is that # function is counting how many &quot;noteGroup&quot; arrays there are in the &quot;char&quot; object, rather than how many items are in the array.</p>\n<p>I attempted &quot;char.#noteGroup&quot; but that doesn't work. The code in the loop works correctly, with setting &quot;curNote[e]&quot; to &quot;curNote[2]&quot; getting the correct result. Same with the other array values.</p>\n<p>Removing the code doesn't do anything, it still only loops once.</p>\n"^^ . "2"^^ . "1"^^ . . "0"^^ . "mta"^^ . "0"^^ . . . . . . "3"^^ . "3"^^ . . "<p>i've got an annoying bug i cant in my script for roblox, if you quickly press shift after stamina reached 0 you'll keep running while stamina recharges\nif you notice any other bugs please tell me\nits probably because of gradual sped change i added, but i need it</p>\n<p>handler script:</p>\n<pre><code>local player = game:GetService(&quot;Players&quot;).LocalPlayer\nlocal character = player.Character\nlocal humanoid = character:WaitForChild(&quot;Humanoid&quot;)\nlocal StaminaGui = script.Parent\nlocal Holder = StaminaGui:WaitForChild(&quot;Holder&quot;)\nlocal Bar = Holder:WaitForChild(&quot;Bar&quot;)\nlocal AmtDisplay = Holder:WaitForChild(&quot;AmtDisplay&quot;)\nlocal UIS = game:GetService(&quot;UserInputService&quot;)\nlocal Stamina = script.Stamina\n\nlocal isRunning = false\nlocal gotTired = false\nlocal maxWalkSpeed = 35 -- Max speed when sprinting\nlocal normalWalkSpeed = 20 -- Default speed\nlocal transitioningSpeed = false\n\n-- Function to smoothly change the walk speed\nlocal function changeWalkSpeed(targetSpeed, duration)\n if transitioningSpeed then\n return\n end\n transitioningSpeed = true\n local startTime = tick()\n local initialSpeed = humanoid.WalkSpeed\n while humanoid.WalkSpeed ~= targetSpeed do\n local elapsedTime = tick() - startTime\n local t = math.clamp(elapsedTime / duration, 0, 1)\n humanoid.WalkSpeed = initialSpeed + (targetSpeed - initialSpeed) * t\n wait()\n end\n transitioningSpeed = false\nend\n\nUIS.InputBegan:Connect(function(input)\n if input.KeyCode == Enum.KeyCode.LeftShift then\n if humanoid.MoveDirection.magnitude &gt; 0 then -- Check if the player is already moving\n if Stamina.Value &gt;= 1 then\n if gotTired == false then\n isRunning = true\n script.InSprint.Enabled = true\n script.OutSprint.Enabled = false\n changeWalkSpeed(maxWalkSpeed, 1.5) -- Smoothly transition to sprint speed over 1.5 seconds\n end\n end\n end\n end\nend)\n\nUIS.InputEnded:Connect(function(input)\n if input.KeyCode == Enum.KeyCode.LeftShift then\n isRunning = false\n script.InSprint.Enabled = false\n script.OutSprint.Enabled = true\n changeWalkSpeed(normalWalkSpeed, 1.5) -- Smoothly transition back to default speed over 1.5 seconds\n end\nend)\n\nscript.Tired.Event:Connect(function()\n if Stamina.Value &lt;= 0 then\n humanoid.WalkSpeed = normalWalkSpeed\n script.InSprint.Enabled = false\n script.OutSprint.Enabled = true\n gotTired = true\n wait(1)\n gotTired = false\n end\nend)\n\nwhile true do\n wait()\n AmtDisplay.Text = &quot;STAMINA: &quot; .. Stamina.Value .. &quot;/100&quot;\n game:GetService(&quot;TweenService&quot;):Create(Bar, TweenInfo.new(0.075, Enum.EasingStyle.Quint), {Size = UDim2.new(Stamina.Value / 100, 0, 1, 0)}):Play()\nend\n</code></pre>\n<p>in sprint:</p>\n<pre><code>local player = game:GetService(&quot;Players&quot;).LocalPlayer\nlocal character = player.Character\nlocal humanoid = character:WaitForChild(&quot;Humanoid&quot;)\n\nlocal Stamina = script.Parent.Stamina\n\nwhile true do\n wait()\n \n if Stamina.Value &lt;= 0 then\n \n else\n \n repeat\n wait(0.08)\n Stamina.Value = Stamina.Value - 1\n until Stamina.Value &lt;= 0\n \n script.Parent.Tired:Fire()\n \n break\n end\nend\n\n</code></pre>\n<p>out sprint:</p>\n<pre><code>local player = game:GetService(&quot;Players&quot;).LocalPlayer\nlocal character = player.Character\nlocal humanoid = character:WaitForChild(&quot;Humanoid&quot;)\n\nlocal Stamina = script.Parent.Stamina\n\nwhile true do\n wait()\n \n \n if Stamina.Value &gt;= 100 then\n \n else\n \n repeat\n wait(0.11)\n Stamina.Value = Stamina.Value + 1\n until Stamina.Value &gt;= 100\n end\nend\n</code></pre>\n<p><a href="https://i.sstatic.net/bGbM4.png" rel="nofollow noreferrer">how it looks in explorer</a></p>\n<p>tried rewriting a code a few times, did nothing\nif i changed holding sprint to just pressing it didnt get any better too, i mean there was some improvements but its not what i need</p>\n"^^ . "2"^^ . . . . . "3"^^ . "1"^^ . . . "fivem"^^ . . "1"^^ . . . . "1"^^ . "<p>I am setting up my Neovim configuration using Lazy.nvim to install plugins. Among these is the lualine.nvim plugin. Several of its icons do not render properly, instead displaying unknown characters as if I were using an unpatched font.\n<a href="https://i.sstatic.net/N57ZD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/N57ZD.png" alt="Broken error icons displayed in nvim" /></a>\nI've installed and configured the Lualine plugin and the Nvim Web Dev Icons plugin as its dependency. Along with this, I've installed and set the Agave Nerd Font as my terminal's font. Despite all this, I am still missing icons. Some of them show up perfectly fine, such as the file icons in the Nvim Tree, the Python and Windows logo in the bottom right corner, and the warning and error icons on the left margin. However, the icon preceding diagnostic messages within the buffer and the error icons on the bottom left side of the Lualine just load as an unknown character. I've tried looking through the Lualine documentation and configuring things differently, but no luck. I've also uninstalled and reinstalled all related plugins and installed a dozen different nerd fonts to no avail. It may also be worth noting that one of the characters in the Mason.nvim UI is also missing (the &quot;X&quot; symbol to indicate uninstalled), while the others render fine.</p>\n<p>Edit, for posterity:\nThe solution was far simpler than I was making it. The plugins were installed and configured correctly, and my nerd fonts were working as intended. The issue was the terminal. I was using a command prompt to run Neovim, which cannot display special characters in nerd fonts. After switching to Windows Terminal, everything works perfectly.</p>\n"^^ . . "<p>I encountered this problem after watching typecrafts Neovim series on Youtube. I tried with AI but it didn't work. I tried adding both <code>eslint_d</code> and <code>eslint-lsp</code> and received the same error the following error for both of them.</p>\n<p><strong>[null-ls] failed to load builtin eslint_d for method diagnostics; please check your config:</strong></p>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;nvimtools/none-ls.nvim&quot;,\n config = function()\n local null_ls = require(&quot;null-ls&quot;)\n\n null_ls.setup({\n sources = {\n null_ls.builtins.formatting.stylua,\n null_ls.builtins.formatting.prettier,\n null_ls.builtins.diagnostics.eslint_d,\n },\n })\n \n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;gf&quot;, vim.lsp.buf.format, {})\n end,\n }\n</code></pre>\n"^^ . . . . . . . . . . "0"^^ . . . "0"^^ . . "@Alexander Mashin, I wasn't aware I could just have blank fields, I'm used to C and think of these table like a struct. When I attempt to use the pocketnumber as a key I get a runtime error, because at startup the PocketDetails is nil."^^ . . . . "0"^^ . . "treesitter"^^ . . "0"^^ . "Instead of passing a reference to the table, use adding an element by its value manually `t2[#t2+1] = {key = t1[1].key}` That was the essence of the answer."^^ . "2"^^ . . . "1"^^ . . "2"^^ . "<p>If you need to convert a recursive function into a loop, then you need a stack to simulate the call stack during recursion.</p>\n<p>The for-in statement in lua needs 3 values: an iterator function, a state (the stack here), an initial value (omitted here):</p>\n<pre><code>function NODE:visit()\n return function (stack)\n if #stack == 0 then return nil end\n local node = table.remove(stack)\n if node.right then stack[#stack + 1] = node.right end\n if node.left then stack[#stack + 1] = node.left end\n return node;\n end, {self}\nend\n</code></pre>\n<p>And the usage:</p>\n<pre><code>for node in tree:visit() do\n print(node.x)\nend\n</code></pre>\n"^^ . "Lua string.gmatch find empty fields between separators"^^ . . "if #char.noteGroup == 0, try next(char.noteGroup) instead, # only works for indexed 1, 2, 3, etc. tables. next will get the first member"^^ . . . . "2"^^ . "1"^^ . . . . . "<pre><code>EnablePrimaryMouseButtonEvents(true);\nfunction OnEvent(event, arg)\nif IsKeyLockOn(&quot;numlock&quot; )then\n if IsMouseButtonPressed(3)then\n \n\n repeat \n if IsMouseButtonPressed(1) then\nPressKey(&quot;z&quot;)\nReleaseKey(&quot;z&quot;)\n\n\n repeat\n if not IsMouseButtonPressed(1) then break end; Sleep(91)\n PressKey(&quot;a&quot;)\nReleaseKey(&quot;a&quot;)\n if not IsMouseButtonPressed(1) then break end; Sleep(91)\n PressKey(&quot;b&quot;)\nReleaseKey(&quot;b&quot;)\n if not IsMouseButtonPressed(1) then break end; Sleep(91)\n PressKey(&quot;c&quot;)\nReleaseKey(&quot;c&quot;)\n if not IsMouseButtonPressed(1) then break end; Sleep(91)\n PressKey(&quot;d&quot;)\nReleaseKey(&quot;d&quot;)\n if not IsMouseButtonPressed(1) then break end; Sleep(91)\n PressKey(&quot;e&quot;)\nReleaseKey(&quot;e&quot;)\n if not IsMouseButtonPressed(1) then break end; Sleep(91)\n PressKey(&quot;f&quot;)\nReleaseKey(&quot;f&quot;)\n end \n\n\n until not IsMouseButtonPressed(3)\nPressKey(&quot;z&quot;)\nReleaseKey(&quot;z&quot;)\n\n\n end \n\n\n if IsMouseButtonPressed(1) then\nPressKey(&quot;z&quot;)\nReleaseKey(&quot;z&quot;)\n repeat\n\n\n\n if not IsMouseButtonPressed(1) then break end; Sleep(91)\n PressKey(&quot;a&quot;)\nReleaseKey(&quot;a&quot;)\n if not IsMouseButtonPressed(1) then break end; Sleep(91)\n PressKey(&quot;b&quot;)\nReleaseKey(&quot;b&quot;)\n if not IsMouseButtonPressed(1) then break end; Sleep(91)\n PressKey(&quot;c&quot;)\nReleaseKey(&quot;c&quot;)\n if not IsMouseButtonPressed(1) then break end; Sleep(91)\n PressKey(&quot;d&quot;)\nReleaseKey(&quot;d&quot;)\n if not IsMouseButtonPressed(1) then break end; Sleep(91)\n PressKey(&quot;e&quot;)\nReleaseKey(&quot;e&quot;)\n if not IsMouseButtonPressed(1) then break end; Sleep(91)\n PressKey(&quot;f&quot;)\nReleaseKey(&quot;f&quot;)\n\n until not IsMouseButtonPressed(1)\n\nPressKey(&quot;z&quot;)\nReleaseKey(&quot;z&quot;)\n end \n\n\n\n end\nend\n</code></pre>\n<p>Z key need to be pressed once and type &quot; A B C D E F G&quot; in loop, loop should Immediately stop when let go of the left mouse button and when let go the right mouse button Z key need to pressed once again.</p>\n<p>Currently when let go of the left mouse its completely stops the script and Z key is getting pressed again. I want Z key to be controlled by right mouse button.</p>\n<p><a href="https://i.sstatic.net/HinZ4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HinZ4.png" alt="enter image description here" /></a></p>\n"^^ . . "2"^^ . . . . . "lua-patterns"^^ . . "1"^^ . . . . . . . "0"^^ . . . . . . "1"^^ . . . "<p>Before Lua 5.3, Lua had 64-bit floats as its only number type (*). Floats use a mantissa-exponent representation. This allows them to represent very big numbers with a loss of precision. Very big or small floats are usually formatted using exponent notation (so something like <code>4.2e+42</code>).</p>\n<p>So on on Lua 5.2 and earlier, you're getting an inaccurate result from your calculation, since the 20!, or even 100! is much larger than the maximum integer a float can accurately represent (2^53), but can still be inaccurately represented.</p>\n<p>Lua 5.3 introduced 64-bit signed integers (*). These overflow silently. Usually they use two's complement. This is what you're seeing here: Your program only uses integers. If you multiply two large integers and the result doesn't fit, it overflows and becomes negative. (The result is correct modulo 2^64, which is often desired).</p>\n<p>Simple example: <code>0xFFFFFFFF*0xFFFFFFFF = -8589934591</code>. <code>0xFFFFFFFF</code> is much smaller than 64-bit, but square it and you get a number which doesn't fit. Lua <em>could</em> theoretically silently &quot;upgrade&quot; to floats in this case, but it doesn't, so float and integer arithmetic behave differently: Integer arithmetic overflows, float arithmetic becomes inaccurate (and may result in infinities for large enough numbers).</p>\n<p>In your particular case, 100! contains at least 50 even factors (2, 4, ..., 100). If we look at the powers of two, we have 2, 4, 8, 16, 32, 64, 128. These contribute 0 + 1 + 2 + 3 + 4 + 5 + 6 additional two's in the product. So we have 100! = 2^(50 + 21) * c where c is some integer. Now what is 2^71 mod 2^64? 0. Hence why you're getting 0.</p>\n<p>This is among the 5.2 / 5.3 incompatibilities: If you try to &quot;just&quot; upgrade, you get integer arithmetic where you had float arithmetic before (division is an exception). This can lead to issues such as this one. To be on the safe side, you could make all numbers floats (append <code>.0</code>). This would work in your program as well.</p>\n<p>If you really want to accurately compute big fibonacci numbers, you will need a big integer library. Lua does not have one built in.</p>\n<p>(*) custom builds of Lua (e.g. for embedded devices) may still use integers or 32-bit floats / 32-bit integers, but by default, you can expect Lua to use 64-bit numbers.</p>\n"^^ . "-1"^^ . . "<p>I'm using Premake5 as my build system for a C project on Windows. I'm using three scripts for my project:</p>\n<ul>\n<li><code>premake5.lua</code></li>\n</ul>\n<pre><code>workspace &quot;epoch&quot;\n configurations { &quot;Debug&quot;, &quot;Release&quot;, &quot;Dist&quot; }\n architecture &quot;x86_64&quot;\n startproject &quot;sandbox&quot;\n\ninclude &quot;runtime/runtime.lua&quot;\ninclude &quot;sandbox/sandbox.lua&quot;\n</code></pre>\n<ul>\n<li><code>runtime/runtime.lua</code></li>\n</ul>\n<pre><code>project &quot;runtime&quot;\n kind &quot;SharedLib&quot;\n language &quot;C&quot;\n\n targetdir &quot;../bin/%{cfg.buildcfg}&quot;\n objdir &quot;../obj/%{cfg.buildcfg}&quot;\n\n files {\n &quot;runtime/src/**.c&quot;,\n &quot;runtime/src/**.h&quot;\n }\n\n filter &quot;configurations:Debug&quot;\n symbols &quot;On&quot;\n\n filter &quot;configurations:Release or configurations:Dist&quot;\n optimize &quot;On&quot;\n</code></pre>\n<ul>\n<li><code>sandbox/sandbox.lua</code></li>\n</ul>\n<pre><code>project &quot;sandbox&quot;\n kind &quot;WindowedApp&quot;\n language &quot;C&quot;\n\n targetdir &quot;../bin/%{cfg.buildcfg}&quot;\n objdir &quot;../obj/%{cfg.buildcfg}&quot;\n\n files {\n &quot;sandbox/src/**.c&quot;,\n &quot;sandbox/src/**.h&quot;\n }\n\n filter &quot;configurations:Debug&quot;\n symbols &quot;On&quot;\n\n filter &quot;configurations:Release or configurations:Dist&quot;\n optimize &quot;On&quot;\n</code></pre>\n<p>I;m using the <code>gmake2</code> generator, but when I call <code>make</code> on the resulting Makefile, I get the following error:</p>\n<pre><code>==== Building runtime (debug) ====\nCreating ../bin/Debug\nmkdir: cannot create directory '..\\\\bin\\\\Debug': No such file or directory\nmake[1]: *** [Makefile:88: ../bin/Debug] Error 1\nmake: *** [Makefile:36: runtime] Error 2\n</code></pre>\n<p>My understanding is that this is due to the <code>bin</code> directory not existing prior to the <code>mkdir</code> call. How can I fix this?</p>\n"^^ . "0"^^ . . "0"^^ . "wireshark"^^ . . . . . . . "1"^^ . "<p>I'm currently trying to convert a string into a table via separators. The separating itself works perfectly fine. In my example, I have two different separators. A ';' which leaves a string separated via ','.</p>\n<p>In the optimal case, my data looks like this, after the first separation has been run through.\n{'xxxx,xxxx,xxxx,xxxx,xxxx'}\nHowever, the form that is providing the data, has some fields as optional, which leaves the data I receive like this:\n{'xxxx,,xxxx,,xxxx'} -- there were two optional fields which leaves me with two separators right next to each other.</p>\n<p>With the following function, I tried to accomplish this and fill fields with no content between separators with a '-'. However this doesn't work. Then Lua detects the separators and empty spaces, but also when there's only one ',' for example.</p>\n<p>This problem shouldn't be something rare, yet I seem to have been unable to find anything that helps me.</p>\n<pre><code> local tbl = {}\n\n if sep1 == nil then\n sep1 = &quot;%s&quot;\n end\n\n for str in string.gmatch(inputstr, &quot;([^&quot;..sep1..&quot;]+)&quot;) do\n table.insert(tbl, str)\n end\n\n if sep2 then\n for i, v in ipairs(tbl) do\n local tbl2 = {}\n \n local matches = 0;\n \n-- my attempt to check if it's a double ',', this fails however\n for str in string.gmatch(v, &quot;([^&quot;..sep2..&quot;]*)&quot;) do\n if str == '' then\n matches = matches + 1\n \n if str == '' and matches == 1 then\n str = '-'\n matches = 0;\n end\n \n end\n \n if (str ~= '' and str ~= nil) then\n table.insert(tbl2, str)\n end\n\n end\n tbl[i] = tbl2\n end\n end\n \n return tbl \n \nend\n</code></pre>\n"^^ . . . . "<p>In our Multi Theft Auto server, we want to give each player permission to create one character in the account creation part. We couldn't find any errors in the code we shared. In our SQL table, &quot;charlimit&quot; is recorded as &quot;1&quot;, but despite this, a player can still create a second character. What is the solution?\n<a href="https://hizliresim.com/a4tmpb9" rel="nofollow noreferrer">https://hizliresim.com/a4tmpb9</a></p>\n<p>I was aiming to limit players' ability to create characters by implementing a character creation limit.</p>\n"^^ . . . . "<p>Try this code. It detects health change and maxHealth change.</p>\n<pre class="lang-lua prettyprint-override"><code>local Player = game.Players.LocalPlayer\nlocal Character = Player.Character or Player.CharacterAdded:Wait()\nlocal Humanoid = Character:WaitForChild(&quot;Humanoid&quot;)\nlocal HealthBar = script.Parent\n\nlocal function UpdateHealthbar()\n local healthPercentage = Humanoid.Health / Humanoid.MaxHealth\n HealthBar.Size = UDim2.new(healthPercentage, 0, 1, 0)\nend\n\nUpdateHealthbar()\n\nHumanoid:GetPropertyChangedSignal(&quot;Health&quot;):Connect(UpdateHealthbar)\nHumanoid:GetPropertyChangedSignal(&quot;MaxHealth&quot;):Connect(UpdateHealthbar)\n\n</code></pre>\n"^^ . . "1"^^ . . "0"^^ . "0"^^ . . . . . . . . . "Thank you very much, @Xaviou! Can you recommend a good resource with examples wxLua and documentation?"^^ . . . . . . "Note that Lua cannot natively store integers larger than 2^63 without making them float and thus losing precision. You'd have use a library specifically made for operations on arbitrarily large integers, or just store them as strings, if all you need is to write them. But that is really a different question."^^ . . "character-encoding"^^ . . . . . . . . . "0"^^ . . "1"^^ . "I could talk you through it, but I don't want to simply write your code for you. The point of this website is for you to try something first, and then figure out specifically what isn't working and then ask for help how to fix it. If you need a starting point, take a look at the docs for [string formatting](https://www.codecademy.com/resources/docs/lua/strings/format), and [some ways to get the time that has passed.](https://devforum.roblox.com/t/the-ultimate-os-time-and-tick-tutorial/1755467)"^^ . . . "0"^^ . . . . "debugging"^^ . . "i literally used scale instead of offset"^^ . . "1"^^ . . . "<p>I'm making a button increase leaderstat value of &quot;Speed&quot;, then, apply that leaderstat value on to the WalkSpeed value of the players humanoid. (make them the same)</p>\n<p>Here's the thing. I've done that part. The problem is, I need it to stay when the player dies and respawns, Also, my code seems to have broken for joining the game as well.</p>\n<p>Code for joining game, In ServerScriptService:</p>\n<pre><code>local plrs = game:GetService(&quot;Players&quot;)\n\nplrs.PlayerAdded:Connect(function(plr)\n task.wait(3)\n local humanoid = if plr.Character then plr.Character:FindFirstChild(&quot;Humanoid&quot;) else nil\n if humanoid then\n print(&quot;Found Humanoid&quot;)\n plr:FindFirstChild(&quot;Humanoid&quot;).WalkSpeed = plr.leaderstats.Speed.value \n end\nend)\n</code></pre>\n<p>Here is the error: <code>ServerScriptService.Script:10: attempt to index nil with 'WalkSpeed'</code></p>\n<p>I know the issue is the fact that it isnt finding the leaderstat value, but I don't know how to fix it. Also, I need a way for this to stay after death and respawn. It is essential for my gameplay. I think the best way to do this is to just find when the player/character respawns, then apply the leaderstat value as the WalkSpeed value on the player. I just don't know where to start after this first part of joining the game.</p>\n"^^ . . . "0"^^ . . "<p>Make your own match function, but:</p>\n<p>Take the string and replace all odd letters as å to a. Than match this new string, not the old one.\n<a href="https://stackoverflow.com/questions/50459102/replace-accented-characters-in-string-to-standard-with-lua">Replace Accented Characters in string to standard with LUA</a></p>\n"^^ . "0"^^ . . . . "1"^^ . "Thanks, now I see that I need to calculate cx = ax+dx and cy = ay+dx*ad, where ad is tangent in the point A."^^ . . "1"^^ . . "can-bus"^^ . . . . "2"^^ . . . "<p>I am new to the Lua programming language, so my first program is a factorial function which I have implemented as follows</p>\n<pre><code>function fact(n)\n if n &lt;= 1 then return 1\n else return n * fact(n-1)\n end\nend\n</code></pre>\n<p>the function works as intended for number less than 20, but once I go bigger the function starts to return negative numbers and 0</p>\n<p>I searched the internet and I found that it has something to do with the size of floating number used by Lua which is 64bits, and I've been convinced till I saw this <a href="https://asciinema.org/a/3993" rel="nofollow noreferrer">video</a></p>\n<p>Does anyone have an explanation to this? does it have something to do with my installation of Lua or there is a config that I must do?</p>\n<p>I'm using Lua 5.3</p>\n<p>NOTE: I'm learning Lua to customize my experience in Neovim so I won't need all this calculations but I got curious about it</p>\n<p>EDIT\nIn the video, the fact(100) produces a number with e expression but on my system it just gives 0</p>\n"^^ . . . . "How to fix the "attempt to index nil with 'PrimaryPart'"^^ . . . "The question is inconsistent, you first said you want `SA_2: {11,22,33,44}`, actually you got `str 1, str2...`, but you said "the strings are actually printed correctly." emm...Correctly??"^^ . "0"^^ . "1"^^ . . . . . . . "<p>Use this</p>\n<pre><code> table.sort(ITEMSCRAPESTATS, function(a,b) return a[key] &gt; b[key] end)\n</code></pre>\n"^^ . . . "0"^^ . . "0"^^ . "-1"^^ . "<p>Trying to make a basic buy system with a sword, I have 2 IntValues, one for the price of the object and another for the currency of the player. Idk what happens but the code doesn't work.</p>\n<p>Code of the buy system:</p>\n<pre><code>local lp = game.Players.LocalPlayer\nlocal ls = lp.leaderstats\nlocal backpack = lp.Backpack\nlocal rp = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal price = script.Parent.Price\n\nscript.Parent.MouseButton1Click:Connect(function()\n if ls.Money.Value &gt;= price or ls.Money.Value == price then\n local tool = rp.Tools.ClassicSword:Clone()\n tool.Parent = backpack\n ls.Money.Value = ls.Money.Value-price\n print(&quot;Player has enough money to purchase tool, player currency now is&quot;..ls.Money.Value)\n else return end\nend)\n</code></pre>\n"^^ . "This `encode_uri` implementation in Lua helped. Thanks!"^^ . . . "nope, nothing D:"^^ . . "0"^^ . . . . . . "no errors in the output D:"^^ . . . . "0"^^ . "0"^^ . "0"^^ . "0"^^ . "Monaco is a "code editor" and has nothing in particular to do with WPF."^^ . . . "0"^^ . . . "1"^^ . . "0"^^ . . "0"^^ . "<p>You can use a <a href="https://create.roblox.com/docs/tutorials/fundamentals/coding-4/intro-to-for-loops" rel="nofollow noreferrer">for loop</a> and then use the loop's index to reduce your code down to only six lines.</p>\n<p>In the below script, we iterate over <code>subject.Name</code> and see if index, a number, is in the <code>subject.Name</code> and then set the <code>inVal.Value</code> if it matches.</p>\n<pre class="lang-lua prettyprint-override"><code>for index: number = 0, 9 do\n if string.find(subject.Name, tostring(index)) then\n inVal.Value = index\n break\n end\nend\n</code></pre>\n"^^ . . "1"^^ . . . . . . "0"^^ . "0"^^ . . . . "0"^^ . "0"^^ . "3"^^ . . . . "0"^^ . . . . . "1"^^ . . "0"^^ . . . "0"^^ . "0"^^ . . . . . "<ol>\n<li>Lua patterns are not regular expressions. Regular expressions have features that Lua patterns don't have (e.g. grouping, possibly nested, and choice), and Lua patterns have feature that regular expressions (at least in the formal linguistic sense) do not have (e.g. <code>%b</code>, <code>%1</code>).</li>\n<li>You are right: Lua patterns do not operate on &quot;code points&quot;, they operate on bytes. That's why <code>\\u{4e00}-\\u{9FFF}</code> doesn't work: What Lua sees here is <code>\\228\\184\\128-\\233\\191\\191</code>, equivalent to <code>\\184\\191\\228\\128-\\233</code>, which is very different from what you want (notably, the range is suddenly from <code>\\128</code> to <code>\\233</code>). I consider the interaction of <code>-</code> with multibyte &quot;characters&quot; that appear as a single code point in the sources a bit of a footgun.</li>\n</ol>\n<p>Since you want a pure Lua solution, and given the simplicity of your pattern, a handmade solution is feasible:</p>\n<pre class="lang-lua prettyprint-override"><code>local codepoints = {}\nfor _, c in utf8.codes(s) do\n if utf8.char(c):match&quot;^%s$&quot; and codepoints[1] == nil then\n codepoints[1] = c\n elseif c &gt;= 0x4e00 and c &lt;= 0x9FFF then\n table.insert(codepoints, c)\n else\n codepoints = {}\n end\nend\nlocal match = utf8.char(table.unpack(codepoints))\nif match:match&quot;^%s?$&quot; then match = nil end -- single space or empty string\n</code></pre>\n<p><strong>Edit:</strong> Since you want to check for a full match, this can be simplified:</p>\n<pre class="lang-lua prettyprint-override"><code>local match = true\nlocal got_chinese_character = false\nfor p, c in utf8.codes(s) do\n if c &gt;= 0x4e00 and c &lt;= 0x9FFF then\n got_chinese_character = true\n elseif p &gt; 1 or not utf8.char(c):match&quot;^%s$&quot; then\n -- non-chinese character that is not a leading space\n match = false\n break\n end\nend\nmatch = match and got_chinese_character\n</code></pre>\n"^^ . . "Player holding ball in server but not on client"^^ . "It seems that while a *value* can be turned into a block via a function literal, an *expression* doesn't work: https://onecompiler.com/lua/42cfjp9yd"^^ . . . . "I haven’t published this as a group experience. This is made and listed as made by me only. I’m very confused by this since I did something similar on another game I worked on and it worked just fine. (Also made by me alone)"^^ . "scripting"^^ . "0"^^ . "How do I open a frame in my screengui from pressing a button on my surfacegui?"^^ . "0"^^ . . "0"^^ . "1"^^ . . . "0"^^ . "0"^^ . . "1"^^ . . "<p>I'm developing a plugin that will utilize treesitter and keyboard shorts for nvim dev and woulld like my nvim plugin to trigger a breakpoint after pressing a keyshortcut(defined in init.lua) that executes this lua function.</p>\n<p>Is that possible to do that with nvim easily?</p>\n<p>I did manage to degub plain lua files in nvim but not NVIm it's self and there's not much actual info about debugging nvim pluggings not even debugging lua so that's why I decided to shift my struggle to here.</p>\n<p>Any idea and tips?</p>\n"^^ . "1"^^ . . "module"^^ . . "0"^^ . "<p>You could check your network status with <code>ping</code> to a known host (for example Google DNS server 8.8.8.8) and use return code: 0 if host is alive (network ON), !=0 if host down (network OFF).</p>\n<pre class="lang-lua prettyprint-override"><code>-- ping to host 8.8.8.8 without output\nlocal ret = os.execute(&quot;ping -c 3 8.8.8.8 &gt; /dev/null 2&gt;&amp;1&quot;)\n\nif ret == 0 then\n print(&quot;Network ON&quot;)\nelse\n print(&quot;Network OFF&quot;)\nend\n</code></pre>\n"^^ . . . "cairo"^^ . "0"^^ . . "1"^^ . . . . . . "Have a look at `func` in the debugger in both cases - exists and doesn’t exist - and see what’s different: there might be something you can use. [ref](https://github.com/NLua/NLua/blob/main/src/Lua.cs#L761)"^^ . "1"^^ . . . . . . . "game-development"^^ . "is there a way to make it easier to read and less obfuscated?"^^ . . . . "geometry"^^ . . "<p>I have tried this , here is my code</p>\n<pre><code>local NumberValue = workspace.Core.Ball.Value \n\nif workspace.Core.Ball.Value &gt;= 100 then\n script.Parent.Text = &quot;Temp:&quot;..NumberValue..&quot;Stable&quot;\nend\n</code></pre>\n<p>I was expecting it to work, but I am dumb for some coding,\nI tried to take different little changes, and this is hoe far i have gotten.</p>\n"^^ . "Implementing arc-length parameterization and adaptive subdivision for Bézier curves"^^ . . "2"^^ . . . . . . . "0"^^ . . "<p>I am making a game where in a computer in the game I click a button it would open a frame where I enter a username then press enter to take me to an another frame where I type out a message then press press submit to enter it in a queue where and claim the note to deliver it to the rightfull peron (whatever person typed in the first frame) and if there is no username have it deliverd to an npc. my problem is the enter button to take me from frame one to frame two dont work</p>\n<pre><code>local NextButton = script.Parent\nlocal ScreenGui = NextButton.Parent\nlocal UsernameTextBox = ScreenGui.Frame.UsernameTextBox\n-- List of NPC names\nlocal npcNames = {&quot;ROBLOX&quot;, &quot;Bacon&quot;, &quot;builderman&quot;}\n-- Assuming you have a RemoteEvent for sending messages to NPCs\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal RemoteEvent = ReplicatedStorage:WaitForChild(&quot;RemoteEvent&quot;)\n\nUsernameTextBox.InputBegan:Connect(function(input)\n if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.Return then\n local username = UsernameTextBox.Text\n if username == &quot;&quot; then\n -- If username is empty, randomly select an NPC\n local randomIndex = math.random(1, #npcNames)\n local randomNPC = npcNames[randomIndex]\n print(&quot;Randomly selected NPC:&quot;, randomNPC)\n -- Now you can use 'randomNPC' as the recipientUsername or do further processing\n\n -- Example: Send a message to the randomly selected NPC\n local message = ScreenGui.Frame.MessageTextBox.Text .. randomNPC\n RemoteEvent:FireServer(&quot;SendMessageToNPC&quot;, message, randomNPC)\n else\n print(&quot;Enter key pressed&quot;)\n NextButton.MouseButton1Click:Fire()\n end\n end\nend)\n</code></pre>\n<p><a href="https://i.sstatic.net/K5xyaoGy.png" rel="nofollow noreferrer">hierarchy</a></p>\n<p>I expected it to take me to the second frame to type the message.</p>\n"^^ . . "0"^^ . . "0"^^ . . "<p>I am not sure where to start so asking for some help. I want to create a script that detects if the part is hit by a person.</p>\n<p>Can anyone give an idea?</p>\n<pre class="lang-lua prettyprint-override"><code>local Debris = game:GetService(&quot;Debris&quot;)\nlocal wall = script.Parent\n\nscript.Parent.Touched:Connect(function(hit)\n if hit.Name ~= &quot;Rails&quot; then\n if hit.Name ~= &quot;Baseplate&quot; then\n if hit.Name ~= &quot;Essential&quot; then\n local explode = Instance.new(&quot;Explosion&quot;)\n explode.Parent = hit\n explode.Position = hit.Position\n hit:BreakJoints()\n Debris:AddItem(hit, 5)\n end\n end\n end\nend)\n</code></pre>\n<p>Thanks</p>\n"^^ . . . . . "0"^^ . . . "1"^^ . . . . . "text"^^ . . . . . "luvit"^^ . . . . . . . . . . . . "<p>Because of my work environment I'm actually working offline quite a bit, and I have some lsp configurations that I'm trying to toggle automatically based on my current network status. Is there a way to get the current network status in lua, without needing to echo a shell command and try to parse the stdout?</p>\n"^^ . "4"^^ . . . "lua"^^ . . "Wireshark Lua: Sending http POST requests using Lua in Wireshark"^^ . . "0"^^ . . "1"^^ . . . . . . . . . . . . "AstroNVim disable neo-tree sitter and replace it with nvim-tree or other"^^ . . . "(That'd be like, if you needed a character to say their dialog to the player every time they got close, but didn't want them to keep saying it over and over if the player walked in and out of range. It also happens a lot in physical hardware, because buttons bounce when you press them!) These aren't great links, but they're something: https://resistorcapacitor.wordpress.com/2018/04/29/switch-debounce-and-edge-detection/ https://stackoverflow.com/questions/24004791/what-is-the-debounce-function-in-javascript"^^ . "0"^^ . . "1"^^ . . . . . . . . . . . . . . . . . "1"^^ . . "@Yorick You can toggle whether accessories count towards the player collision in Game Settings. You would set it to inner collision meaning only the actual rig would trigger the .Touched event and you can have accessories as big as you want while no affecting the player’s experience other than maybe visibility. See [Collision Boundaries](https://create.roblox.com/docs/characters/appearance#collision-boundaries) for more."^^ . . . "http-post"^^ . "<p>trying to write a lua script where an npc walks to the player, code that i have struggled in troubleshooting is basically as follows:</p>\n<pre><code>enemy = script.parent\ntorso = player:FindFirstChild(&quot;UpperTorso&quot;)\nposition = torso.Position\nenemy.humanoid:MoveTo(position)\n</code></pre>\n<p>my code for getting the player works so thats not something im worried about</p>\n<p>i tried doing enemy.Humanoid:MoveTo(Vector3.new(999,0,999)) and the roblox model still does not move, this model is spawned in using another script, and no errors appear, ive even tried using print statements to debug, but its like everything works except for the fact that it isnt moving. nothing is anchored or anything either.</p>\n"^^ . . "1"^^ . . "`hit.Parent` might give a false negative if a part is nested like `Character.Part.Part`. It would return false though it's still a part of the Character with your method. While it works if a part is `Character.Part`, any further than that like `Character.Part.Part.Part`, it will return false. I would suggest you use `hit:FindFirstAncestorOfClass("Model")` so we can find a parent that is a Model class but this is also prone to failure if we have `Character.Model.Model`, but my answer still has that issue as well."^^ . "spack"^^ . . . "syntax-highlighting"^^ . . . "0"^^ . . "0"^^ . . "<p>This is a really complicated question. My very first guess though would be that the server, and the client aren't deterministic. So you're checking for a HIT to determine if the ball is in contact with a player (humanoid) - but the calculation determining that is coming out different on the client, and on the server. This term is called deterministic physics, and it's the boon of EVERY game developer making real-time online games. (probably not, it's probably just me that hates this.)</p>\n"^^ . "Set CollisionFidelity of a Union obtained using a "SubtractAsync" function"^^ . "0"^^ . . . . . "0"^^ . . . . "4"^^ . . . "0"^^ . . . . "<p>I am trying but failing to send http POST requests using Lua in Wireshark. My approach is to use the <code>socket.http</code> and <code>ltn12</code> Lua modules, however, I do not know how to have Wireshark load these modules into its Lua base correctly.</p>\n<p>I am simply just adding the following lines to a Lua file which Wireshark reads on program boot up:</p>\n<pre><code> local http = require(&quot;socket.http&quot;)\n local ltn12 = require(&quot;ltn12&quot;)\n</code></pre>\n<p>The error I receive is:</p>\n<pre><code>module 'socket.http' not found:\\n\\tno field package.preload['socket.http']\\n\\tno file \n</code></pre>\n<p>Obviously, I am missing some source <code>socket.http</code> (and <code>ltn12</code>) module files but do not know how to include them or what files they should be.</p>\n<p>Thank you for any help.</p>\n"^^ . . . "Currently the code written in the text works, but if there are multiple memorized spells like in the image, they "start training at the same time". While training one spell, I want to stop training another spell."^^ . . . "robotics"^^ . "0"^^ . . . . . . "1"^^ . "0"^^ . . "Thanks for replying @dkasa, when I do ```:Lazy install, ```, I do not see lazygit mentioned there, did I do something incorrectly? I created a new file in the plugins folder called lazygit.lua and pasted the first code snippet there. I chose the first method you suggested which seemed easier. Lazygit does not open when I hit ``space lg``. Appreciate your help really."^^ . . . . . "<p>have you tried using remote events?</p>\n<p>make a remote event in replicated storage\nthen make a local script in the tool</p>\n<pre><code>local remote = game.ReplicatedStorage.yourRemoteEvent\nlocal plr = game.Players.LocalPlayer\nlocal tool = game.StarterPack:WaitForChild(&quot;OrangeJuiceTool&quot;)\n\ntool.Equipped:Connect(function(plr)\n remote:FireServer(plr) -- firing remote\nend)\n</code></pre>\n<p>and then make a script in server script service</p>\n<pre><code>local remote = game.ReplicatedStorage.yourRemoteEvent\nremote.OnServerEvent:Connect(function(plr)\n plr.leaderstats.Sips.Value += 1\nend)\n</code></pre>\n"^^ . . . . . . . "0"^^ . . "<p>I think it would be easier to handle the background image for the title slide in a different manner, since we specify the title slide background image properties in the document yaml block.</p>\n<p>With this in mind, you can try the following,</p>\n<pre class="lang-lua prettyprint-override"><code>local bg_image = &quot;beach.jpeg&quot;\nlocal bg_pos = &quot;left&quot;\nlocal bg_opacity = &quot;0.25&quot;\nlocal bg_size = &quot;33%&quot;\n\n\nfunction Header(el)\n if el.level == 1 then\n el.attributes[&quot;data-background-image&quot;] = bg_image\n el.attributes[&quot;data-background-position&quot;] = bg_pos\n el.attributes[&quot;data-background-opacity&quot;] = bg_opacity\n el.attributes[&quot;data-background-size&quot;] = bg_size\n return el\n end\nend\n\nfunction Meta(m)\n m[&quot;title-slide-attributes&quot;] = {\n [&quot;data-background-image&quot;] = bg_image,\n [&quot;data-background-position&quot;] = bg_pos,\n [&quot;data-background-opacity&quot;] = bg_opacity,\n [&quot;data-background-size&quot;] = bg_size\n }\n return m\nend\n</code></pre>\n"^^ . "<p>Your issue is coming from this line: <code>NextButton.MouseButton1Click:Fire()</code>\n<br><br>\nThe <a href="https://create.roblox.com/docs/reference/engine/classes/GuiButton#MouseButton1Click" rel="nofollow noreferrer">MouseButton1Click</a> event <strong>doesn't</strong> have a <code>:Fire()</code> method. You will have to bind another event to the function that switches the page (the function binded to <code>MouseButton1Click</code>).<br><br>\nTo do this just make a <a href="https://create.roblox.com/docs/reference/engine/classes/BindableEvent" rel="nofollow noreferrer">Bindable Event</a> and connect <code>BindableEvent.Event</code> to the function that switches the page.</p>\n"^^ . "1"^^ . . "Thank you so much, this worked. I just put the script in StarterGui"^^ . "What is [ClassName](https://create.roblox.com/docs/en-us/reference/engine/classes/Instance#ClassName) of the children in `animations`?"^^ . . "2"^^ . . . . . "1"^^ . "<p>I was following a tutorial on making a Roblox Combat System, but I ran into a problem with animation loading. For some reason, it can't load the animation and tells me that the <code>LoadAnimation()</code> function needs to load an animation object, which I've tried keyframes and even just added an Animation Object with an animation ID of &quot;17401496431&quot; and nothing changes. (This is a server script)</p>\n<pre class="lang-lua prettyprint-override"><code>local MH = require(game.ServerStorage.modules.MuchachoHitbox)\nlocal remote = game.ReplicatedStorage:WaitForChild(&quot;Combat Event&quot;)\nlocal MaxCombo = 5\n\ngame.Players.PlayerAdded:Connect(function(player)\n player.CharacterAdded:Connect(function(character)\n character:SetAttribute(&quot;Combo&quot;, 1)\n end)\nend)\n\nlocal function SetCombo(character)\n local combo = character:GetAttribute(&quot;Combo&quot;)\n\n if combo &lt; MaxCombo then\n character:SetAttribute(&quot;Combo&quot;, combo + 1)\n else\n character:SetAttribute(&quot;Combo&quot;, 1)\n end\nend\n\nremote.OnServerEvent:Connect(function(player)\n local character = player.Character\n local humanoid = character:WaitForChild(&quot;Humanoid&quot;)\n local rootPart = humanoid.RootPart\n local animator = humanoid:WaitForChild(&quot;Animator&quot;)\n\n local combo = character:GetAttribute(&quot;Combo&quot;)\n local attacking = character:GetAttribute(&quot;Attacking&quot;)\n\n if attacking then return end\n character:SetAttribute(&quot;Attacking&quot;, true)\n\n local animations = game.ReplicatedStorage[&quot;hit anims&quot;]:GetChildren()\n local animation = animator:LoadAnimation(animations[combo])\n\n local hitbox = MH.CreateHitbox()\n hitbox.Size = Vector3.new(6, 6, 6)\n hitbox.Offset = CFrame.new(0, 0, -2.5)\n hitbox.CFrame = rootPart\n -- hitbox.Visualizer = false\n\n animation.Stopped:Connect(function()\n character:SetAttribute(&quot;Attacking&quot;, nil)\n hitbox:Stop()\n end)\n\n hitbox.Touched:Connect(function(hit, hum)\n if hum == humanoid then return end\n\n hum:TakeDamage(5)\n end)\n\n animation:Play()\n task.wait(0.16)\n hitbox:Start()\n\n SetCombo(character)\nend)\n</code></pre>\n<p>I'm expecting the animation to load properly and play without any errors. I followed the tutorial exactly and it didn't have any errors then.</p>\n"^^ . "2"^^ . . . . . . "<p>I think your determination to find a solution that's &quot;scientific&quot; is keeping you from finding/settling on a practical solution. Start with a hardcoded subdivision; if needed, add adaptive midpoint subdivision (that is, recursively add samples halfway between samples, continuing to recurse if the discontinuity in derivative at the added sample is above a limit); if still needed (and it's probably not), use gradient descent to refine the solution, moving the parameters of your samples to maximize the second derivative and coalescing sample points when they run into each other.</p>\n<p>There are more complicated approaches, but honestly it seems unlikely that their effect on the quality of your application would be worth the difficulty of implementation.</p>\n"^^ . "AFAIK this is a bug in the `WideCharToMultiByte` API used by the Microsoft's terminal app. So other terminal apps that do not use this API won't have this issue."^^ . "2"^^ . "0"^^ . . . "Attach and debug NVim current running session's plugin with a lua debugger"^^ . . . "[1/2] I believe this is a problem outside of your init.lua configuration. I've run it on my side on Linux with NVIM v0.9.5 and it works just fine, here's mine `:LspInfo` https://pastebin.com/uSHXusi5 I can see that on your side nvim-lsp is trying to save the log to a very strange path `/Users/jgs/.local/state/nvim/lsp.log` which looks like an invalid (or very unusual) on Linux, not sure about Windows/MacOSX. Are you using Windows? Perhaps Neovim fails to find packages downloaded via Mason."^^ . . "luabind"^^ . . . . "Running Java files with Neovim ide"^^ . . "2"^^ . . . . "<p>i think for some reason the isdst (daylight savings) value got switched and if gave a 1 hour offset.</p>\n<p>edit: i did a bit more research and i figured that the <code>os.time</code> gets the UTC time as a <a href="https://www.lua.org/pil/22.1.html" rel="nofollow noreferrer"><code>date table</code></a> and it thinks the UTC time should be summer time (since its currently summer time). and thats why the +1 hour. your best option is to set the <code>isdst</code> to <code>nil</code> because UTC time doesnt have daylight savings time.</p>\n<pre><code>print(os.date(&quot;!%a %b %d %H:%M:%S %Y&quot;))\n\nlocal dt = os.date(&quot;!*t&quot;,os.time())\ndt.isdst = nil\nprint(os.date(&quot;%c&quot;, os.time(dt)))\n</code></pre>\n"^^ . "1"^^ . "1"^^ . "Debug info was stripped, as usual, for saving space."^^ . "<p>For those with the same problem, I've found out that <code>neo-tree</code> does not <code>cd</code> to the current directory. To correct that, you need to add this to your <code>init.lua</code> file:</p>\n<p><code>vim.cmd([[ autocmd BufEnter * silent! lcd %:p:h ]])</code></p>\n"^^ . "0"^^ . . "2"^^ . . . "1"^^ . . "1"^^ . . "2"^^ . . . "1"^^ . . "0"^^ . . "0"^^ . . . . . . . . "1"^^ . . . "0"^^ . . . . . . "0"^^ . . . . "0"^^ . . . "0"^^ . . "2"^^ . . . . "It should be false because `or` should return the right operand when the left operand is a nil."^^ . . . "3"^^ . "0"^^ . . . "Thank you for providing your helpful answer! However, the reason my logic was entirely in a LocalScript was because I don't want the story to progress for one player because another player triggers something–if Player A touches the BasementDetector, wouldn't it trigger the next message for Player B as well? If players have their own local story progression, they won't be pushed through the events of the game without being in the right area. Also, the LocalScript seems to trigger a "Players.Player.PlayerGui.ScreenGui.LocalController:12: attempt to index string with 'Text'" error."^^ . . . "0"^^ . . . "logitech"^^ . . "0"^^ . . . . "Are you sure you are running lua 5.4?"^^ . "I dont understand why i Humanoid:MoveTo isnt working like i want it to"^^ . "0"^^ . . . "error ''undefigned symbol: lua_rawgetp'' while trying to bind a love project with rust"^^ . "0"^^ . . . . . . . "0"^^ . . "Others will not know what you have done when you write "I've tried installing it like I normally would on Windows Forms App". You need to explain step by step what you have done and the error message you got. You wrote that it can be done in Window Forms. Can you share a link explaining how that is done ?"^^ . . . . . "verify that the ModuleScript is being used by the appropriate ServerScript or that workspace.Checkpoints is a Model with ModelStreamingMode set to "Persistent""^^ . . . "0"^^ . "0"^^ . . "How to enable keymap for Lazygit?"^^ . "0"^^ . "0"^^ . "2"^^ . . "<p>We can use <a href="https://create.roblox.com/docs/en-us/reference/engine/classes/Instance#FindFirstAncestorOfClass" rel="nofollow noreferrer"><code>FindFirstAncestorOfClass</code></a> and <a href="https://create.roblox.com/docs/en-us/reference/engine/classes/Instance#FindFirstChild" rel="nofollow noreferrer"><code>FindFirstChild</code></a> together for finding whether a part is a child of the <a href="https://create.roblox.com/docs/en-us/reference/engine/classes/Player#Character" rel="nofollow noreferrer"><code>Player.Character</code></a>.</p>\n<p>If <code>hit</code> has a Model ancestor and that ancestor has a <code>Humanoid</code>, we can assume that Model is the <code>Player.Character</code>.</p>\n<p>In the below script, I made it so that whenever <code>script.Parent</code> is touched we check for a Model ancestor and then if that Model has a <code>Humanoid</code>. If so we add an explosion to it.</p>\n<pre class="lang-lua prettyprint-override"><code>local Debris = game:GetService(&quot;Debris&quot;)\nlocal wall = script.Parent\n\nscript.Parent.Touched:Connect(function(hit)\n local characterModel = hit:FindFirstAncestorOfClass(&quot;Model&quot;)\n if characterModel then\n local humanoid = characterModel:FindFirstChild(&quot;Humanoid&quot;)\n if humanoid then\n local explode = Instance.new(&quot;Explosion&quot;)\n explode.Parent = hit\n explode.Position = hit.Position\n hit:BreakJoints()\n Debris:AddItem(hit, 5)\n end\n end\nend)\n</code></pre>\n<p>Note that you may need to modify the code for <code>explode</code>. It is unclear in your question what to do if we hit the Player so I left it as is.</p>\n<p>You can use <code>hit</code> for the Player's Part we hit, <code>humanoid</code> for the Player's Humanoid and <code>characterModel</code> for the the Player's Character.</p>\n"^^ . . . . "I made and published the animation so I don’t know why it’s not working. They are named from 1 to 5"^^ . . . "0"^^ . . . . "<p>As read in the documentation the second paameter in the SubtractAsync/UnionAsync is the collision fidelity</p>\n<blockquote>\n<p>collisionfidelity: Enum.CollisionFidelity\nThe Enum.CollisionFidelity value for the resulting UnionOperation.\nDefault Value: &quot;Default&quot;</p>\n</blockquote>\n<p>So use</p>\n<pre class="lang-lua prettyprint-override"><code>local fi = i:SubtractAsync({b.RemoveFromTerrain}, Enum.CollisionFidelity.PreciseConvexDecomposition) -- Cuts\n</code></pre>\n"^^ . . . "0"^^ . "1"^^ . "c++"^^ . "0"^^ . . . "0"^^ . . "1"^^ . "0"^^ . . "<p>When I add a feature or debug, I have to start or run the game repeatedly and do debug prints, which is very inefficient. However, if I could run it with VSCode debug, it might make it easier and even more efficient for me.</p>\n<p>I want to create a launch.json in VSCode to start the server along with debugging in Lua programming language. So, I can set breakpoints to stop the code inside a class without having to do debug prints.</p>\n"^^ . "<p>I have written a LocalScript (MessageController) for a story-type Roblox game called Police Raid. This script controls the flow of the story by changing the UI messages and triggering events.</p>\n<pre><code>-- This script controls the progress of the messages! (It's the GOAT)\nlocal message = script.Parent.Message\n\n-- Wait for character to load\nlocal player = game:GetService(&quot;Players&quot;).LocalPlayer\nlocal character = player.Character or player.CharacterAdded:Wait()\n\n-- Change message\ntask.wait(7)\nmessage.Text = &quot;Back there is the panic room. If there's any trouble, click the big red button and get inside. We're just going to hole up in here until someone comes to help us.&quot;\n\n-- Change message\ntask.wait(7)\nmessage.Text = &quot;[static] This is the Robloxian Police Department, Barricaded Supsects Division. We have a warrant for your arrest on counts of [static]...&quot;\nmessage.TextColor3 = BrickColor.Red().Color\nscript[&quot;Heli Sound&quot;]:Play()\n\n-- Change message\ntask.wait(5)\nmessage.Text = &quot;Uh oh...&quot;\nmessage.TextColor3 = BrickColor.Black().Color\n\n-- Change message\ntask.wait(2)\nmessage.Text = &quot;If you don't come out and surrender now, we will raid the premises!&quot;\nmessage.TextColor3 = BrickColor.Red().Color\n\n-- Change message\ntask.wait(3)\nmessage.Text = &quot;Get to the panic room! NOW!!!&quot;\n-- Enable panic room\ngame:GetService(&quot;Workspace&quot;).Button.Part.ClickDetector.MaxActivationDistance = 32\nmessage.TextColor3 = BrickColor.Black().Color\n\ngame:GetService(&quot;Workspace&quot;).TouchDetector.Touched:Connect(function(otherPart: BasePart)\n -- In the panic room\n task.wait(1)\n script[&quot;Explosion&quot;]:Play()\n \n -- Change message\n task.wait(3)\n message.Text = &quot;They're raiding the house... we should be safe in here.&quot;\n script[&quot;Loud Explosion&quot;]:Play()\n \n -- Change message\n task.wait(2)\n message.Text = &quot;They're in the panic room!&quot;\n message.TextColor3 = BrickColor.Red().Color\n script[&quot;Extra Loud Explosion&quot;]:Play()\n \n -- Change message\n task.wait(2)\n message.Text = &quot;I don't think we're as safe as I thought. Grab that rifle from the floor and get to the basement, QUICK!&quot;\n message.TextColor3 = BrickColor.Black().Color\n game:GetService(&quot;Workspace&quot;)[&quot;Panic Door&quot;].Fire.Enabled = true\n game:GetService(&quot;Workspace&quot;)[&quot;Panic Panel&quot;].CanCollide = false\n -- Change message\n game:GetService(&quot;Workspace&quot;)[&quot;Basement Detector&quot;].Touched:Connect(function(otherPart: BasePart)\n task.wait(2)\n message.Text = &quot;Okay... this basement was designed to survive a raid, so we should be okay.&quot;\n\n -- Change message\n task.wait(7)\n script[&quot;Extra Loud Explosion&quot;]:Play()\n game:GetService(&quot;Workspace&quot;)[&quot;Basement Wall&quot;].Transparency = 1\n message.Text = &quot;Put your hands up!&quot;\n message.TextColor3 = BrickColor.Red().Color\n\n -- Change message\n task.wait(2)\n message.Text = &quot;Get down, part of the wall is still up!&quot;\n message.TextColor3 = BrickColor.Black().Color\n local counter = 10\n task.wait(1)\n\n for i = counter, 0, -1 do\n task.wait(1)\n script.Gunfire:Play()\n -- Damage player\n\n -- Check if they are in a safe area\n local safezone = game:GetService(&quot;Workspace&quot;)[&quot;Wall Parts&quot;].Safezone\n safezone.Touched:Connect(function() end) -- TouchInterest\n\n local function CheckIfPlayerIsInArea(Part,Character)\n local touching = Part:GetTouchingParts()\n for i=1,#touching do\n if touching[i] == Character.HumanoidRootPart then\n return true\n end\n end\n return false\n end\n if not CheckIfPlayerIsInArea(safezone, game:GetService(&quot;Players&quot;).LocalPlayer.Character) then\n --game:GetService(&quot;ReplicatedStorage&quot;).DamagePlayer:FireServer(10)\n game:GetService(&quot;Players&quot;).LocalPlayer.Character.Humanoid.Health -= 1\n end\n end\n\n -- Change message\n message.Text = &quot;The Robloxian Freedom Fighters are here! Get into their helicopter and escape to headquarters!&quot;\n game:GetService(&quot;Workspace&quot;)[&quot;Basement Wall&quot;].CanCollide = false\n local fighters = game:GetService(&quot;Workspace&quot;)[&quot;Freedom Fighters&quot;]\n fighters[&quot;RFF-Beta-31&quot;]:MoveTo(Vector3.new(-100.242, 3.003, 39.393))\n fighters[&quot;RFF-Alpha-0&quot;]:MoveTo(Vector3.new(-103.259, 3.003, 31.674))\n fighters[&quot;RFF-Epsilon-97&quot;]:PivotTo(CFrame.new(-90.501, 9.305, 40.968))\n fighters[&quot;RFF-Sigma-69&quot;]:MoveTo(Vector3.new(-98.693, 3.003, 24.884))\n fighters[&quot;RFF-Gamma-3&quot;]:MoveTo(Vector3.new(-122.102, 3.003, 25.833))\n fighters[&quot;RFF-Foxtrot-11&quot;]:MoveTo(Vector3.new(-96.868, 3.003, 48.219))\n fighters[&quot;RFF-Delta-4&quot;]:MoveTo(Vector3.new(-113.647, 3.003, 32.763))\n game:GetService(&quot;Workspace&quot;)[&quot;RFF Heli&quot;]:PivotTo(CFrame.new(-105.629, 3.5, 49.35))\n local ChatService = game:GetService(&quot;Chat&quot;)\n local talkpart = game:GetService(&quot;Workspace&quot;)[&quot;BSD Commander Parker&quot;].Handle\n do\n ChatService:Chat(talkpart, &quot;It's an ambush!&quot;)\n end\n print(&quot;Triggered&quot;)\n task.wait(1)\n script[&quot;Machine Gun Fire&quot;]:Play()\n end)\nend)\n</code></pre>\n<p>The problem is, &quot;Triggered&quot; seems to be printed to the console 528 times, and the &quot;Gunfire&quot; sound is played on top of itself very rapidly. Parker the NPC says &quot;It's an ambush!&quot; over and over in chat bubbles above his head. The Freedom Fighters and the RFF Heli are moved so much that they end up disappearing, and the game lags due to so much rapid code execution. I have no idea why the code would execute so much. The part with the problem seems to be:</p>\n<pre><code>local counter = 10\n task.wait(1)\n\n for i = counter, 0, -1 do\n task.wait(1)\n script.Gunfire:Play()\n -- Damage player\n\n -- Check if they are in a safe area\n local safezone = game:GetService(&quot;Workspace&quot;)[&quot;Wall Parts&quot;].Safezone\n safezone.Touched:Connect(function() end) -- TouchInterest\n\n local function CheckIfPlayerIsInArea(Part,Character)\n local touching = Part:GetTouchingParts()\n for i=1,#touching do\n if touching[i] == Character.HumanoidRootPart then\n return true\n end\n end\n return false\n end\n if not CheckIfPlayerIsInArea(safezone, game:GetService(&quot;Players&quot;).LocalPlayer.Character) then\n --game:GetService(&quot;ReplicatedStorage&quot;).DamagePlayer:FireServer(10)\n game:GetService(&quot;Players&quot;).LocalPlayer.Character.Humanoid.Health -= 1\n end\n end\n\n -- Change message\n message.Text = &quot;The Robloxian Freedom Fighters are here! Get into their helicopter and escape to headquarters!&quot;\n game:GetService(&quot;Workspace&quot;)[&quot;Basement Wall&quot;].CanCollide = false\n local fighters = game:GetService(&quot;Workspace&quot;)[&quot;Freedom Fighters&quot;]\n fighters[&quot;RFF-Beta-31&quot;]:MoveTo(Vector3.new(-100.242, 3.003, 39.393))\n fighters[&quot;RFF-Alpha-0&quot;]:MoveTo(Vector3.new(-103.259, 3.003, 31.674))\n fighters[&quot;RFF-Epsilon-97&quot;]:PivotTo(CFrame.new(-90.501, 9.305, 40.968))\n fighters[&quot;RFF-Sigma-69&quot;]:MoveTo(Vector3.new(-98.693, 3.003, 24.884))\n fighters[&quot;RFF-Gamma-3&quot;]:MoveTo(Vector3.new(-122.102, 3.003, 25.833))\n fighters[&quot;RFF-Foxtrot-11&quot;]:MoveTo(Vector3.new(-96.868, 3.003, 48.219))\n fighters[&quot;RFF-Delta-4&quot;]:MoveTo(Vector3.new(-113.647, 3.003, 32.763))\n game:GetService(&quot;Workspace&quot;)[&quot;RFF Heli&quot;]:PivotTo(CFrame.new(-105.629, 3.5, 49.35))\n local ChatService = game:GetService(&quot;Chat&quot;)\n local talkpart = game:GetService(&quot;Workspace&quot;)[&quot;BSD Commander Parker&quot;].Handle\n do\n ChatService:Chat(talkpart, &quot;It's an ambush!&quot;)\n end\n print(&quot;Triggered&quot;)\n task.wait(1)\n script[&quot;Machine Gun Fire&quot;]:Play()\n\n</code></pre>\n<p>Sorry if this is a lot of code or if it's badly formatted.</p>\n<p>I have attempted to debug the code by printing the text &quot;Triggered&quot; and have looked around the script for anything that may be causing the infinite looping. I have also tried adding a <code>task.wait(math.huge)</code> to the end of the script to prevent it from executing multiple times (above the <code>end</code> statements), but this did not affect the looping. Interestingly, <code>Machine Gun Fire</code> (a looped sound) does not appear to play more than once. If it's helpful, the LocalScript is parented to a ScreenGui, which is parented to StarterGui.</p>\n<p>I am unable to post this question on the Roblox Devforum due to a lack of reputation, since I have been browsing the site without being logged in for a long time.</p>\n"^^ . . . "Can you show the ideal result that you want to get?"^^ . "Why does a roundtrip Lua UTC os.date -> os.time -> os.date result in an HOUR Time difference?"^^ . "Decompiling Lua Issue"^^ . . . "1"^^ . . . "I was running with lua54, I tried with luajit (with features modified in the cargo.toml), and it works, after that, it was working with lua54.\nI don't know what was the problem, but it solved by itself."^^ . . . . . . . "0"^^ . . "events"^^ . . . "0"^^ . "1"^^ . "1"^^ . . "Delete `else` before the last end. Just make a backup before. You most likely changed it and forgot because it is impossible for it to have worked like this before. Or you copy pasted part of it or deleted the else block. The golden rule is always backup. Then do a recursive "Read Only" setting on the all of the child files and directories inside backup. (you might accidentally keep the backup open and accidentally edit it - yes, that happened to me when I first started)."^^ . . . "Also is the resource.car file where the source code is or where is it?"^^ . "0"^^ . "Property cannot be assigned to"^^ . . . . . "1"^^ . "0"^^ . . . . . . . . "0"^^ . . . . "0"^^ . . "0"^^ . "0"^^ . . . . "<p>You can parse the int value from the string using\n<a href="https://www.lua.org/pil/20.2.html" rel="nofollow noreferrer"><code>string.match</code></a> and then use <code>tonumber</code> function on it.</p>\n<p>This would be more efficient then looping every possible answer.</p>\n<pre class="lang-lua prettyprint-override"><code>local match = string.match(subject.Name, &quot;%d&quot;)\ninVal.Value = tonumber(match)\n</code></pre>\n"^^ . "3"^^ . "hpc"^^ . "0"^^ . . "<p>I've tried restarting, and it used to work. Now it does nothing and am unsure what else to do, it just keeps saying the final like 'end' is a syntax error, and explains nothing else in the consosle if you know please help.</p>\n<pre class="lang-lua prettyprint-override"><code>--------------------------------------\n---------- Dont touch this -----------\nEnablePrimaryMouseButtonEvents (true);\nfunction OnEvent(event,arg)\nif EnableRCS ~= false then\nif RequireToggle ~= false then\n if IsKeyLockOn(ToggleKey)then\n if IsMouseButtonPressed(3)then\n repeat\n if IsMouseButtonPressed(1) then\n repeat\n MoveMouseRelative(0,RecoilControlStrength)\n Sleep(DelayRate)\n until not IsMouseButtonPressed(1)\n end\n until not IsMouseButtonPressed(3)\n end\n end\n \nelse \n\n if IsMouseButtonPressed(3)then\n repeat\n if IsMouseButtonPressed(1) then\n repeat\n MoveMouseRelative(0,RecoilControlStrength)\n Sleep(DelayRate)\n until not IsMouseButtonPressed(1)\n end\n until not IsMouseButtonPressed(3)\n end\n end\nelse \nend \nend\n</code></pre>\n"^^ . . . . . . . . . "0"^^ . "<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>local checkpoints=workspace.Checkpoints\nlocal TOTAL_STAGES_IN_GAME=#checkpoints:children()\nlocal function tp(player,x)\n local val=Instance.new"DoubleConstrainedValue"\n val.MaxValue=TOTAL_STAGES_IN_GAME-(checkpoints:FindFirstChild"0"and 1 or 0)\n val.MinValue=checkpoints:FindFirstChild"0"and 0 or 1\n local stage=player.leaderstats.Stage\n val.Value=stage.Value\n val.Value+=x\n stage.Value=val.Value\n local char=player.Character \n char=char and char:move(checkpoints[stage.Value].Position)\n --player.TeleportedStage=stage.Value\nend\nreturn {\n up=function(player)\n tp(player,1)\n end,\n up2=function(player)\n tp(player,10)\n end,\n down2=function(player)\n tp(player,-10)\n end\n}</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . "2"^^ . . . . . . . . . . . . . . "http"^^ . . . . . "0"^^ . . "Please include any errors in the [Developer Console](https://create.roblox.com/docs/studio/developer-console) or [Output Window](https://create.roblox.com/docs/studio/output) in your question along with clarifying specifics such as what the ability to go back means and how it was broken."^^ . . . . "Animations can ONLY be played if you own them. Meaning, if the animation is owned by someone else or on a group (Even it its yours), it will not play."^^ . . . . . . . "0"^^ . . . . . . "1"^^ . . . . . "2"^^ . "symbols"^^ . . "how to debug FiveM LuA Language with executable file FiveM.exe on Vscode"^^ . "1"^^ . "0"^^ . . . "0"^^ . "Can you install lrexlib?"^^ . . . "1"^^ . "This script is not full, so it can not work at all. Not defined variables and functions: `RecoilControlStrength`, `DelayRate`, `MoveMouseRelative`, `ToggleKey`"^^ . "0"^^ . . . . . "<p>This is the LSP part of my neovim config\n<a href="https://pastebin.com/3zMWCnhG" rel="nofollow noreferrer">https://pastebin.com/3zMWCnhG</a></p>\n<p>this is the entire init.lua file\n<a href="https://pastebin.com/CuB3bMmg" rel="nofollow noreferrer">https://pastebin.com/CuB3bMmg</a></p>\n<p>I don't get why the lsp does not attach to any buffers?\nWhen I run :LspInfo, I get</p>\n<pre><code> Language client log: /Users/jgs/.local/state/nvim/lsp.log\n Detected filetype: lua\n \n 0 client(s) attached to this buffer: \n \n Configured servers list: \n</code></pre>\n<p>When I run :Mason however, I can see</p>\n<pre><code> Installed\n ◍ astro-language-server astro\n ◍ chrome-debug-adapter \n ◍ clangd \n ◍ debugpy \n ◍ deno denols\n ◍ eslint-lsp eslint\n ◍ jdtls \n ◍ json-lsp jsonls\n ◍ lua-language-server lua_ls\n ◍ pyright \n ◍ rust-analyzer rust_analyzer\n ◍ standardjs \n ◍ stylua \n ◍ tailwindcss-language-server tailwindcss\n ◍ typescript-language-server tsserver\n</code></pre>\n<p>the language servers are obviously installed. What's going wrong?\nI copied this from kickstart.nvim and didn't change anything. I'm really confused why it's not working</p>\n<p>In case you don't want to open the pastebin link, here is the part</p>\n<pre class="lang-lua prettyprint-override"><code> { -- LSP Configuration &amp; Plugins\n 'neovim/nvim-lspconfig',\n dependencies = {\n 'williamboman/mason.nvim',\n 'williamboman/mason-lspconfig.nvim',\n 'WhoIsSethDaniel/mason-tool-installer.nvim',\n { 'j-hui/fidget.nvim', opts = {} },\n { 'folke/neodev.nvim', opts = {} },\n },\n config = function()\n vim.api.nvim_create_autocmd('LspAttach', {\n group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),\n callback = function(event)\n local map = function(keys, func, desc)\n vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })\n end\n map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')\n map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')\n map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')\n map('&lt;leader&gt;D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')\n map('&lt;leader&gt;ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')\n map('&lt;leader&gt;ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')\n map('&lt;leader&gt;rn', vim.lsp.buf.rename, '[R]e[n]ame')\n map('&lt;leader&gt;ca', vim.lsp.buf.code_action, '[C]ode [A]ction')\n map('K', vim.lsp.buf.hover, 'Hover Documentation')\n map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')\n \n local client = vim.lsp.get_client_by_id(event.data.client_id)\n if client and client.server_capabilities.documentHighlightProvider then\n vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {\n buffer = event.buf,\n callback = vim.lsp.buf.document_highlight,\n })\n \n vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {\n buffer = event.buf,\n callback = vim.lsp.buf.clear_references,\n })\n end\n end,\n })\n local capabilities = vim.lsp.protocol.make_client_capabilities()\n capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())\n \n local servers = {\n clangd = {},\n pyright = {},\n rust_analyzer = {},\n tsserver = {},\n lua_ls = {\n settings = {\n Lua = {\n completion = {\n callSnippet = 'Replace',\n },\n },\n },\n },\n }\n require('mason').setup()\n \n local ensure_installed = vim.tbl_keys(servers or {})\n vim.list_extend(ensure_installed, {\n 'stylua', \n })\n require('mason-tool-installer').setup { ensure_installed = ensure_installed }\n \n require('mason-lspconfig').setup {\n handlers = {\n function(server_name)\n local server = servers[server_name] or {}\n server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})\n require('lspconfig')[server_name].setup(server)\n end,\n },\n }\n end,\n },\n</code></pre>\n<p>the entire init.lua is here <a href="https://pastebin.com/CuB3bMmg" rel="nofollow noreferrer">https://pastebin.com/CuB3bMmg</a>\nit seems like the lsp part might be just fine</p>\n"^^ . . . . . "json"^^ . . "Sounds like a timing issue (race condition). When you unminimize the client, AwesomeWM will not do it immediately, but only at the end of the current main loop iteration. At that point, it will tell the X11 server "please make this window visible". The X11 server will do that and tell the program "your window became visible; please draw its content". The program will draw its content. The window manager doesn't get any information when drawing is done. It only places windows."^^ . . "raycasting"^^ . . "2"^^ . . . . . . . "0"^^ . "Did you see the plan B and C?"^^ . . . . . "0"^^ . "optimization"^^ . "3"^^ . "Roblox Studio Anti-Noclip Script"^^ . . . "How does Lua take advantage of <const> when emitting bytecode?"^^ . . . "luau"^^ . . . . "<p>I set following in <code>lua/community.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>---@type LazySpec\nreturn {\n &quot;AstroNvim/astrocommunity&quot;,\n { import = &quot;astrocommunity.pack.lua&quot; },\n { import = &quot;astrocommunity.pack.java&quot; },\n}\n</code></pre>\n<p>And I set the following in <code>lua/plugins/astrolsp.lua</code> :</p>\n<pre class="lang-lua prettyprint-override"><code> mappings = {\n n = {\n gl = { function() vim.diagnostic.open_float() end, desc = &quot;Hover diagnostics&quot; },\n gh = { function() vim.lsp.buf.hover() end, desc = &quot;Show LSP Hover&quot; },\n },\n },\n\n on_attach = function(client, bufnr)\n\n end,\n</code></pre>\n<p>But, when I try to use <code>gh</code> for the hover effect in a Java project, nothing happens.</p>\n"^^ . "2"^^ . . . . . "ctrl + <del> or <backspace> won't delete a whole word in Neovim"^^ . "2"^^ . . . . . . . "Where does Neovim's Lua List type come from?"^^ . . "<p>You don't need Lua to achieve this, <code>location</code> directives are enough:</p>\n<pre><code>location = / {\n alias ./startpage/;\n try_files index.html =404;\n}\n\nlocation / {\n root ./html/;\n}\n</code></pre>\n<h3>URL → filesystem path:</h3>\n<ul>\n<li>/ → /startpage/index.html</li>\n<li>/foo/ → /html/foo/index.html</li>\n<li>/foo/img.jpg → /html/foo/img.jpg</li>\n<li>/bar/text.txt → /html/bar/text.txt</li>\n</ul>\n"^^ . . . . . . "1"^^ . "0"^^ . . . . . "require"^^ . . . . . . "It has: https://www.lua.org/manual/5.3/manual.html#6.5"^^ . . . . . . "0"^^ . . . . "0"^^ . . "0"^^ . . . "<p>Let's follow the path of <code>func</code> inside this coroutine :</p>\n<pre class="lang-lua prettyprint-override"><code>coroutine.create(function()\n func(player, duration, tickSpeed)\nend)\n</code></pre>\n<p>You pass it into the parent function as <code>self.PrintSomething</code> but it is defined on the module as <code>&lt;moduleName&gt;:PrintSomething</code>. Notice the difference between the period and the colon?</p>\n<p>When you define a function using a colon, this is <a href="https://en.wikipedia.org/wiki/Syntactic_sugar" rel="nofollow noreferrer">syntactic sugar</a> for a function signature that passes in the <code>self</code> object as a hidden first argument. What this means is this :</p>\n<pre class="lang-lua prettyprint-override"><code>function module:PrintSomething(a, b, c) end\n-- is the same as...\nfunction module.PrintSomething(self, a, b, c) end\n</code></pre>\n<p>So, because you defined your <code>PrintSomething</code> function with a colon, there is an expectation you will call the function with a colon, or manually pass in the <code>self</code> object. Since you didn't, it is treating the first argument you <em>did</em> pass in as the <code>self</code> which is why all of your inputs are offset by one.</p>\n<p>In this case, you're lucky, since your <code>PrintSomething</code> function doesn't access <code>self</code> anywhere, it doesn't need to be a member function, you can make it a static one. So just change the function signature to be a period function :</p>\n<pre class="lang-lua prettyprint-override"><code>function SCP867Service.PrintSomething(player, duration, tickSpeed)\n</code></pre>\n"^^ . "1"^^ . "0"^^ . . . . "1"^^ . . "3"^^ . "3"^^ . "1"^^ . "0"^^ . "<p>I am making a tetris clone in love2d (lua) for practice. And what I am trying to do is to make the collins with the walls.</p>\n<p>Note:the tetris pieces are made out of tiles that each one has a relative positions to the piece's position that is stored inside of a table.</p>\n<p>Here's how I implemented the wall collisions</p>\n<pre class="lang-lua prettyprint-override"><code>function tetros.wallLeftCollision(x)\n for i, c in pairs(tetros.shapes[v.shape].angles[v.angle].cubes) do\n local cx= c.x+x\n if cx-1 &lt;= v.window.x then\n return true\n else\n return false\n end\n end\nend\n</code></pre>\n<p>x: is the piece's x position</p>\n<p>&quot;tetros.shapes[v.shape].angles[v.angle].cubes&quot;: is the table that contains the relative positions of the tiles that forms the piece</p>\n<p>&quot;cx= c.x+x&quot;: here I convert the relative position to a normal position</p>\n<p>&quot;cx-1&quot; I just shift the position slightly to the left</p>\n<p>&quot;v.window.x&quot; this is the x position of the space where the pices fall (idk how to call it)</p>\n<p>But when I run the code it apparently choses a random tile and compare it instead of comparing all the tiles.</p>\n<p>what should happen here is the code checks if the position of any tile in the tetris piece is 1 pixel to the right pf the border and the it returns true.</p>\n<p>After that I tried to do a bunch of research to see why it was happening but all I found is that it should work as it is.</p>\n<p>Note:Please consider the fact that I have no programming experience beside Minecraft commands and I am just getting started</p>\n"^^ . . . . . "1"^^ . . . . "0"^^ . "0"^^ . "0"^^ . . "2"^^ . . . "Making a multiple stage selector in Roblox Studio"^^ . . "Is it safe to call lua function again in a c++ funciton called by lua?"^^ . "1"^^ . "0"^^ . "0"^^ . . . "1"^^ . . . . . . . "I'm making it where if the player gain an item by completing a task, the item frame is applied, how is it not working? @Ryan Luu"^^ . . . . . . "0"^^ . . . "0"^^ . "1"^^ . . "<p>I want to simulate a grabber that picks up a cube at point A and moves it to point B. I have the grabber and the cube, but the script does not run.</p>\n<p>This is the code in the script:</p>\n<pre class="lang-lua prettyprint-override"><code>function sysCall_init()\n -- Define handles for the Sawyer robot arm and the cube\n sawyer = sim.getObjectHandle('Sawyer')\n cube = sim.getObjectHandle('Cube')\n\n -- Define positions for point A and point B\n local posA = {x = 1.0, y = 0.875, z = 0.050}\n local posB = {x = 0.5, y = 2, z = 0.050}\n\n -- Move the arm to point A\n moveToPosition(posA)\n\n -- Open gripper and grab cube\n openGripper()\n sim.wait(1) -- Wait for gripper to open\n grabCube()\n\n -- Move the arm to point B\n moveToPosition(posB)\n\n -- Release cube\n releaseCube()\nend\n\nfunction moveToPosition(position)\n -- Calculate joint angles using inverse kinematics\n local jointHandles = {sim.getObjectHandle('joint1'), sim.getObjectHandle('joint2'), sim.getObjectHandle('joint3'), sim.getObjectHandle('joint4'), sim.getObjectHandle('joint5'), sim.getObjectHandle('joint6')}\n local config = sim.getConfigForTipPose(sawyer, jointHandles, 0.1, 10, nil, nil, position)\n\n -- Set joint positions\n for i = 1, 6 do\n sim.setJointPosition(jointHandles[i], config[i])\n end\nend\n\nfunction openGripper()\n -- Open gripper\n sim.setJointTargetPosition(sim.getObjectHandle('sawyerGrabber'), 0.04)\nend\n\nfunction grabCube()\n -- Attach cube to gripper\n sim.setObjectParent(cube, sim.getObjectHandle('sawyerGrabber'), true)\nend\n\nfunction releaseCube()\n -- Detach cube from gripper\n sim.setObjectParent(cube, -1, true)\nend\n</code></pre>\n<p>When I run it I get error message:</p>\n<p><a href="https://i.sstatic.net/uMZVP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/uMZVP.png" alt="1" /></a></p>\n<p>And this is my scene hierarchy:</p>\n<p><a href="https://i.sstatic.net/2yu8X.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2yu8X.png" alt="2" /></a></p>\n<p>Note: I have never used coppeliaSim nor lua before so please explain as clearly as possible. Thank you.</p>\n"^^ . "haproxy"^^ . . . "1"^^ . . "1"^^ . "encode"^^ . . . "Add custom VSCode style snippets to NVChad"^^ . "<p>Maybe I'm missing something obvious but I am trying to set up a kong community server which connects to a postgres cluster that has SSL enabled. I have tried all the kong settings but I keep getting the error &quot;Error: attempt to index local 'ssl' (a nil value)&quot; when I try to run the migrations. Based on what I see the error is because it tries to get the SSL socket which returns nothing: &quot; Failed to create SSL object from socket: u.peer.connection.ssl is nil, context: ngx.timer&quot;</p>\n<p>I have set the following settings:</p>\n<pre><code>database = postgres\npg_host = hostname.domain.com\npg_port = 5432\npg_user = kong \npg_password = &lt;kong password&gt;\npg_database = kong\npg_ssl = on\npg_ssl_cert = certificate.crt\npg_ssl_cert_key = certificate.key\npg_ssl_ca_cert = ca-certificate.ca-bundle\npg_ssl_verify = on\npg_ssl_required = on\npg_ssl_version = tlsv1_3\nlua_ssl_trusted_certificate = system,ca-certificate.ca-bundle\nlua_ssl_verify_depth = 1\n</code></pre>\n<p>I have disabled most pg_ssl settings and tried with only &quot;pg_ssl&quot; on to run it with basics but I get the same error with every combination.</p>\n<p>To verify connectivity to the database I've connected using the psql command:</p>\n<pre><code>PGSSLMODE=verify-full PGSSLROOTCERT=ca-certificate.ca-bundle psql -h host.domain.com -U kong -W -d kong\n\nSSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)\n Type &quot;help&quot; for help.\n\nkong=# \\q\n</code></pre>\n<p>anyone have any ideas or encountered this before?</p>\n<p>Thanks!</p>\n"^^ . . . . . . "1"^^ . . . "client-side"^^ . . "0"^^ . "1"^^ . "1"^^ . "0"^^ . "<p>I'm working on a piece of software that uses Solar2D game engine.</p>\n<p>For Visual Studio Code exists an extension for Solar2D called &quot;Solar2D Editor&quot; but it doesn't provide the possibility to navigate through the Solar2D API.</p>\n<p>My question is - is it possible to somehow integrate the LUA extension with Solar2D libraries? I was trying to find a place these libraries resided and add them to <code>Lua.workspace.library</code> setting in VSCode but with no success so far.</p>\n"^^ . . . . . "0"^^ . "1"^^ . "Is there a way to find the names of the variables without renaming it to what it could have been or asking the original author?"^^ . . . . "1"^^ . "0"^^ . . . "Both `os.execute` and `io.popen` create subprocesses having their own environments, so they do not affect host application environment. So, the task is impossible to achieve using standard Lua functions."^^ . . . . "6"^^ . . . . . . . "ffi"^^ . . . "Source a shell script when loading a modulefile in lua"^^ . . . "0"^^ . "The pattern itself should be valid and correct (`print(('}_'):match('([%a%d}])_')) -- '}'`). How are you using it?"^^ . . "0"^^ . . . . . . . . . . . . . "<p>How can i use Lua FFI for LuaFFIAction() in my dnsdist's configuration file?</p>\n<p>In doc: Invoke a Lua FFI function that accepts a pointer to a dnsdist_ffi_dnsquestion_t object, whose bindings are defined in dnsdist-lua-ffi.hh.</p>\n<p>Do I need include dnsdist-lua-ffi.hh in my C/C++ code and all dependencies for use dnsdist_ffi_dnsquestion_t?</p>\n<p>If I only include dnsdist-lua-ffi.hh, it need all headers into it, and this include a lot of files.</p>\n"^^ . . . "<p>I'm having some trouble using <strong><code>folke/todo-comments.nvim</code></strong>. The highlighting works great and all, but when I use <strong><code>&lt;leader&gt;st</code></strong> (my shortcut for <strong><code>:TodoTelescope</code></strong>), it is searching through all the files I have in any directory. This does happen with other functions like <strong><code>:TodoTrouble</code></strong> as well.</p>\n<p>This is the <strong><code>plugins.lua</code></strong> return for <strong><code>folke/todo-comments.nvim</code></strong>:</p>\n<pre><code>{\n &quot;folke/todo-comments.nvim&quot;,\n cmd = { &quot;TodoTrouble&quot;, &quot;TodoTelescope&quot; },\n event = &quot;LazyFile&quot;,\n dependencies = { &quot;nvim-lua/plenary.nvim&quot; },\n config= function()\n local todo_comments = require(&quot;todo-comments&quot;)\n\n todo_comments.setup()\n end,\n keys = {\n { &quot;]t&quot;, function() require(&quot;todo-comments&quot;).jump_next() end, desc = &quot;Next Todo Comment&quot; },\n { &quot;[t&quot;, function() require(&quot;todo-comments&quot;).jump_prev() end, desc = &quot;Previous Todo Comment&quot; },\n { &quot;&lt;leader&gt;xt&quot;, &quot;&lt;cmd&gt;TodoTrouble&lt;cr&gt;&quot;, desc = &quot;Todo (Trouble)&quot; },\n { &quot;&lt;leader&gt;xT&quot;, &quot;&lt;cmd&gt;TodoTrouble keywords=TODO,FIX,FIXME&lt;cr&gt;&quot;, desc = &quot;Todo/Fix/Fixme (Trouble)&quot; },\n { &quot;&lt;leader&gt;st&quot;, &quot;&lt;cmd&gt;TodoTelescope&lt;cr&gt;&quot;, desc = &quot;Todo&quot; },\n { &quot;&lt;leader&gt;sT&quot;, &quot;&lt;cmd&gt;TodoTelescope keywords=TODO,FIX,FIXME&lt;cr&gt;&quot;, desc = &quot;Todo/Fix/Fixme&quot; },\n },\n},\n</code></pre>\n<p>I've already installed <strong><code>ripgrep</code></strong> and <strong><code>fzf</code></strong>, and I have all the dependencies of the project installed. I'm also using <strong><code>LazyVim</code></strong> as my Neovim distribution and Ubuntu 22.04.4 LTS as my OS.</p>\n"^^ . . "@wurli An MRE would probably help. It doesn't work in my neovim lua files. Are you sure it wasn't wrapped in `vim.cmd [[ ]]` or something? Or maybe you're using a neovim distribution that's doing some magic under the hood?"^^ . . . . "string"^^ . . . . . . . . "0"^^ . . "0"^^ . . . "`it just keeps saying the final like 'end' is a syntax error` - The script you posted is syntactically correct, it can not raise this error."^^ . . "0"^^ . "1"^^ . "0"^^ . "ouya"^^ . "nginx"^^ . "What is the "undetected" symbol in lua"^^ . "Wrong key, Right key script in lua"^^ . . . . "0"^^ . "0"^^ . . "Hi both - it looks like you're completely right, this is just a vimscript thing and _doesn't_ work in Lua as I thought. I was sure I tested this, but apparently not, or perhaps I was within a `vim.cmd [[ ]]` block as suggested and didn't realise at the time. Thanks for the responses and bearing with the clearly very confused question!"^^ . . . "0"^^ . . "2"^^ . . "4"^^ . . "1"^^ . "<p>I am not sure if this is the case but I think the tool might not have been loaded in yet, you could do this to fix it if that's the case</p>\n<pre><code> Player.CharacterAdded:Connect(function(Character)\n local Tool -- Creating a variable but not setting its value yet\n if Character:WaitForChild(&quot;OrangeJuiceTool&quot;):IsA(&quot;Tool&quot;) then -- waiting for the child &quot;OrangeJuiceTool&quot; and also checking if that's a tool\n Tool = Character:WaitForChild(&quot;OrangeJuiceTool&quot;) -- if that's the tool, set the variable to it\n Tool.Activated:Connect(IncrementSips) -- finally connecting the function when the tool is activated\n \n end\nend)\n</code></pre>\n<p>Note that this is only one part of the code, make changes so that it matches your own code</p>\n"^^ . "<p>I am writing some .lua files for loading modules in a HPC system.</p>\n<p>Basically the application I want to make a module is Spack, and it has an autocompletion shell script for sourcing it in linux with:</p>\n<pre><code>source /apps/spack/share/spack/setup-env.sh\n</code></pre>\n<p>I want to run this command in my .lua file when loading the spack module into the system, I can't get it to work by doing the following:</p>\n<pre><code>os.execute('source /apps/spack/share/spack/setup-env.sh')\n</code></pre>\n<p>Note that the module loads fine and I can use spack without any problems, I just want the autocompletion feature to work when loading the module.</p>\n<p>Any help is welcome, thank you!</p>\n"^^ . . "i change to title and deleted it, leaving only the one question I wanted the most.\nsetpeslltraining is a name, can change it to any name.\nI've never learned lua\nI just copied it after seeing someone else load the information like this. This is just code written in the game's init.txt file\nNothing is written other than the content of the code."^^ . "0"^^ . "1"^^ . . "0"^^ . . . . . . . "Set max limit for async fs operations? (EMFILE: too many open files)"^^ . . "<p>If anybody runs into this problem in the future what I did to solve this was to source the file using nvim's <code>vim.cmd</code> functionality. So what I did was:</p>\n<pre class="lang-lua prettyprint-override"><code>local function loadmodule(modulePath, moduleName)\n vim.opt.rtp:append(modulePath)\n\n vim.cmd(&quot;source &quot; .. modulePath .. &quot;/&quot; .. moduleName)\nend\n\nloadmodule(&quot;path/to/module&quot;, &quot;module-name&quot;)\n</code></pre>\n<p>this works for <code>.vim</code> and <code>.lua</code> files.</p>\n"^^ . . "0"^^ . "The terminal apps I'm referring are cmd.exe and powershell.exe"^^ . . . . . "I can't understand the error and how to fix it. Lua version 5.1"^^ . "url-rewriting"^^ . "0"^^ . "1"^^ . . "0"^^ . "1"^^ . . . "1"^^ . "2"^^ . "0"^^ . . . . "The script is local and is under the textlabel that updates it accordingly."^^ . "1"^^ . "plugins"^^ . . . . . "windows"^^ . . . "<p>I am reading <strong>Programming in Lua, 4th edition</strong> with an intention to solve every exercise in that book. The last exercise in Chapter 21 <a href="https://archive.org/details/pil-4th/page/172/mode/2up" rel="nofollow noreferrer">p. 172</a> is the following (emphs are mine):</p>\n<blockquote>\n<p>A variation of the dual representation is to implement objects using proxies (the section called “Tracking table accesses”). <em>Each object is represented by an empty proxy table. An internal table maps proxies to tables that carry the object state. This internal table is not accessible from the outside, but methods use it to translate their <code>self</code> parameters to the real tables where they operate.</em> Implement the <code>Account</code> example using this approach and discuss its pros and cons.</p>\n</blockquote>\n<p>My solution is the following :</p>\n<pre class="lang-lua prettyprint-override"><code>Account = {}\n\nlocal proxyToAccount = {}\n\nfunction Account:new ()\n local proxy = {}\n proxyToAccount[proxy] = { balance = 0 }\n setmetatable(proxy, self)\n self.__index = self\n return proxy\nend\n\nfunction Account:balance ()\n return proxyToAccount[self].balance\nend\n\nfunction Account:withdraw (v)\n proxyToAccount[self].balance = proxyToAccount[self].balance - v\nend\n\nfunction Account:deposit (v)\n proxyToAccount[self].balance = proxyToAccount[self].balance + v\nend\n\nreturn Account\n</code></pre>\n<p>Which is barely different from the example provided by the book itself (several pages above):</p>\n<pre class="lang-lua prettyprint-override"><code>local balance = {}\n\nAccount = {}\n\nfunction Account:withdraw (v)\n balance[self] = balance[self] - v\nend\n\nfunction Account:deposit (v)\n balance[self] = balance[self] + v\nend\n\nfunction Account:balance ()\n return balance[self]\nend\n\nfunction Account:new (o)\n o = o or {} -- create table if user does not provide one\n setmetatable(o, self)\n self.__index = self\n balance[o] = 0 -- initial balance\n return o\nend\n\nreturn Account\n</code></pre>\n<p>I am asking for your opinion if I understand the exercise correctly and if my solution is a correct one. Thank you in advance !</p>\n"^^ . "You are super mega handsome, long life) Thank you for your help!"^^ . . "this could false on a npc"^^ . "rust"^^ . . . . . . . "<h2>Edit</h2>\n<p>This question was very misguided - the feature I'm referring to is from vimscript, not Lua.</p>\n<h2>Original question</h2>\n<p>In Neovim's Lua, in addition to normal table objects, you can create <a href="https://neovim.io/doc/user/usr_41.html#41.8" rel="nofollow noreferrer"><code>List</code></a> objects like so:</p>\n<pre><code>x = [1, 2, 3]\n</code></pre>\n<p>The <a href="https://neovim.io/doc/user/eval.html#List" rel="nofollow noreferrer">documentation</a> for lists is fairly straightforward. However, it doesn't seem like 'standard' Lua supports any such syntax, to wit, my Lua 5.4.6 REPL yields an error:</p>\n<pre class="lang-bash prettyprint-override"><code>&gt; x = [1, 2, 3]\nstdin:1: unexpected symbol near '['\n</code></pre>\n<p><a href="https://neovim.io/doc/user/lua.html#lua-intro" rel="nofollow noreferrer">NB</a>, Neovim ships with Lua 5.1, with LuaJIT additionally available on common platforms.</p>\n<p>Neovim also loads many utility functions by default in addition to the Lua standard library. This seems straightforward enough to me.</p>\n<p>My question then is, if Neovim ships with 'vanilla' Lua/LuaJIT and only adds additional modules/functions, where does this special syntax come from? Or, if there are standard ways of implementing special syntax like this, where can I find the documentation for how to do so?</p>\n"^^ . . . . . . . "<p>So I'm trying to make a Roblox game at 1 am because who doesn't and i ran into a small problem: I have a variable that wont update in my server script even if i can see it being updated in the explorer and leaderstats.</p>\n<p>My cultivation toggle script (local script under the text button):</p>\n<pre><code>local button = script.Parent\nlocal cultivating = game.Players.LocalPlayer.leaderstats.Cultivating\n\nbutton.MouseButton1Click:Connect(function()\n if cultivating.Value == false then\n cultivating.Value = true\n button.Text = &quot;Stop Cultivating&quot;\n else\n cultivating.Value = false\n button.Text = &quot;Start Cultivating&quot;\n end\nend)\n</code></pre>\n<p>My leaderstats script (server script under serverscriptservice):</p>\n<pre><code>game.Players.PlayerAdded:Connect(function(player)\n\n local leaderstats = Instance.new(&quot;Folder&quot;) \n leaderstats.Name = &quot;leaderstats&quot;\n leaderstats.Parent = player\n\n local qi = Instance.new(&quot;IntValue&quot;)\n qi.Name = &quot;Qi&quot;\n qi.Value = 0\n qi.Parent = leaderstats\n \n local cultivating = Instance.new(&quot;BoolValue&quot;)\n cultivating.Name = &quot;Cultivating&quot;\n cultivating.Value = true\n cultivating.Parent = leaderstats\nend)\n</code></pre>\n<p>My cultivation script (server script under serverscriptservice):</p>\n<pre><code>game.Players.PlayerAdded:Connect(function(player)\n local leaderstats = player:WaitForChild(&quot;leaderstats&quot;)\n local qi = leaderstats:WaitForChild(&quot;Qi&quot;)\n local cultivating = leaderstats:WaitForChild(&quot;Cultivating&quot;)\n\n while true do\n if cultivating.Value == true then\n qi.Value += 1\n end\n wait(0.5)\n end\nend)\n</code></pre>\n<p>Basically the variable &quot;cultivating&quot; is getting updated by the local script which works but doesn't get updated inside the cultivation script.</p>\n<p>I was expecting this to give me 1 qi every 0.5 seconds if I'm cultivating.</p>\n<p>I tried using AI to help me (time wasted), tried debugging with a bunch of print statements and got to the conclusion that it is indeed the variable not updating inside the script. I have even tried declaring the variable inside the loop without any success.</p>\n"^^ . . . . . "<p>I am trying to enable a keymap for Lazygit. I have added the following into my tmux.conf:</p>\n<pre><code>set -g @plugin 'kdheepak/lazygit.nvim'\n</code></pre>\n<p>And have added the following to my keymaps.lua:</p>\n<pre><code>-- Keymap for launching Lazygit by hitting space+gg\nvim.keymap.set('n', '&lt;space&gt;gg', ':LazyGit&lt;CR&gt;')\n</code></pre>\n<p>However, I get a pop-up saying LazyGit isn't an available command. If I open a terminal and simply run the Lazygit command, it does open Lazygit.</p>\n<p><a href="https://i.sstatic.net/1eT2fu3L.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/1eT2fu3L.png" alt="enter image description here" /></a></p>\n<p>I know I am missing something, I just don't know what. I am using this guy's pre-built configuration for Tmux, Nvim and so on: <a href="https://github.com/omerxx/dotfiles" rel="nofollow noreferrer">https://github.com/omerxx/dotfiles</a></p>\n<p>I don't want to be spoon-fed necessarily, but if someone could take a peek at the github repository, and tell me what I need to add where. I am very new to Nvim and all of that ecosystem, learning by troubleshooting, but I've been breaking my head over this the past few hours.</p>\n<p>Thank you all.</p>\n"^^ . . . . . . . . . . . . . "@darkfrei, yes it is: "Each object is represented by an empty proxy table." Of course, I could have allowed passing some "initial table" to the `Account:new` (like in the example from the book I showed) but I don't think it matters here."^^ . "Thank you! I'm still a little confused though. If this is vim script, why can I use it as-is in a Lua file? I think I goofed slightly in posting the question - obviously the doc I linked to is for vimscript. However, this syntax _does_ work in Neovim's Lua, so the question still stands"^^ . . . "<p>you can check if a hit part is a part inside of a character by checking if the parent is a character using the <a href="https://create.roblox.com/docs/reference/engine/classes/Players#GetPlayerFromCharacter" rel="nofollow noreferrer"><code>GetPlayerFromCharacter</code></a> method.</p>\n<pre class="lang-lua prettyprint-override"><code>local Players = game:GetService(&quot;Players&quot;);\n\nscript.Parent.Touched:Connect(function(hit)\n local Character = hit.Parent\n local Player = Players:GetPlayerFromCharacter(Character);\n \n if (not Player) then return; end -- exit function, no player touched\n\n local explode = Instance.new(&quot;Explosion&quot;, hit);\n explode.Position = hit.Position;\n hit:BreakJoints();\n Debris:AddItem(hit, 5);\nend);\n</code></pre>\n"^^ . . "utf-8"^^ . . "<p>How can I create symlinks in openresty via post?</p>\n<p>The server has grown massive and need some re-arranging and I do not have console access to fix it, only https, but sysadmin can create a lua script if possible.</p>\n<p>I'm the developer using openresty as a reportportal.</p>\n"^^ . "powershell"^^ . "0"^^ . . "Kong Community migrations error when using postgres with SSL on Rocky Linux 9"^^ . . . "0"^^ . "How to install Monaco editor into a WPF app"^^ . . "0"^^ . . . . . "1"^^ . "linux"^^ . . "If you would like to keep a multiline struct with `zig fmt`, you can put a comma after the last field: `struct { content: []u8, }` will become multiline on save. I'm not sure how to disable format on save in your editor, although zls does have its own config file that can be put in the project root that should work."^^ . . "<p>It is impossible.<br />\nGHub is unable to see if a keyboard key is down or up. Only some keys could be monitored (Shift/Alt/Ctrl), you can also monitor LEDs (NumLock/ScrollLock/CapsLock). On a Logitech keyboard special G-keys (G1, G2, ...) are also monitorable, they generate events similar to events of mouse buttons.</p>\n<p>Use some mouse button instead of <kbd>F</kbd></p>\n"^^ . "1"^^ . "<p>I have a code and I want the function to be on top, not in the loop itself. How do I do that?</p>\n<pre><code>local blocks = workspace.test:GetChildren()\n\nfor indx, obj in pairs(blocks) do\n obj.Touched:connect(function()\n wait(3)\n obj.BrickColor = BrickColor.Random()\n end)\nend\n</code></pre>\n<p>I don't know how to do it...post how to do it right please</p>\n"^^ . . . . "monaco-editor"^^ . "0"^^ . . "<p><img src="https://i.sstatic.net/7oS3uFme.png" alt="enter image description here" /></p>\n<p>I wrote it after seeing that someone else had created code for a different purpose.\nI don't know the principle, But it just works.</p>\n<p>I tried to write for dcss(game) RC\nThe content of the image is a list of orders that are being memorised.\nThe purpose of the code is to enable efficient training of memorized spells\nIt works normally when training 1 spell (now only have 1 memorized spell in total)</p>\n<p>When memorizing multiple spells saved in <code>SetSpellTraining</code>\nStart training it all\nBut, starting to train multiple spells &quot;at the same time&quot; is very inefficient.\n(image situation, memorising a few orders.)</p>\n<pre><code>function ready()\nSetSpellTraining(&quot;Passwall&quot;,&quot;Earth Magic&quot;,&quot;Earth Magic&quot;,&quot;Earth Magic&quot;,1)\nSetSpellTraining(&quot;Mephitic Cloud&quot;,&quot;Conjurations&quot;,&quot;Air Magic&quot;,&quot;Alchemy&quot;,5)\nSetSpellTraining(&quot;Ensorcelled Hibernation&quot;,&quot;Hexes&quot;,&quot;Ice Magic&quot;,&quot;Ice Magic&quot;,1)\nSetSpellTraining(&quot;Corpse Rot&quot;,&quot;Air&quot;,&quot;Necromancy&quot;,&quot;Poison&quot;,5)\n.\n.\n.\n-- I have over 20 SetSpellTraining but I didn't write them here.\nend\n\nlocal school_a_cost = tonumber(you.skill_cost(school_a))\nlocal school_b_cost = tonumber(you.skill_cost(school_b))\nlocal school_c_cost = tonumber(you.skill_cost(school_c))\nlocal school_2_min_cost = tonumber(math.min(school_a_cost,school_b_cost))\nlocal school_3_min_cost = tonumber(math.min(school_a_cost,school_b_cost,school_c_cost))\n\nif spells.memorised(spell_name) then\n if school_a == school_b then\n if spells.fail(spell_name) &gt; fail_chance then\n you.train_skill(school_a, 1)\n else\n you.train_skill(school_a, 0)\n end\n elseif school_a ~= school_b and school_b == school_c then\n if spells.fail(spell_name) &gt; fail_chance then\n if school_a_cost == school_2_min_cost then\n you.train_skill(school_a, 1)\n you.train_skill(school_b, 0)\n else\n you.train_skill(school_a, 0)\n you.train_skill(school_b, 1)\n end\n else\n you.train_skill(school_a, 0)\n you.train_skill(school_b, 0)\n end\n else\n if spells.fail(spell_name) &gt; fail_chance then\n if school_a_cost == school_3_min_cost then\n you.train_skill(school_a, 1)\n you.train_skill(school_b, 0)\n you.train_skill(school_c, 0)\n elseif school_b_cost == school_3_min_cost then\n you.train_skill(school_a, 0)\n you.train_skill(school_b, 1)\n you.train_skill(school_c, 0)\n else\n you.train_skill(school_a, 0)\n you.train_skill(school_b, 0)\n you.train_skill(school_c, 1)\n end\n else\n you.train_skill(school_a, 0)\n you.train_skill(school_b, 0)\n you.train_skill(school_c, 0)\n end\n end\nend\n\nend\n</code></pre>\n<p>Q\nCurrently the code written in the text works, but if there are multiple memorized spells like in the image, they &quot;start training at the same time&quot;. While training one spell, I want to stop training another spell.</p>\n"^^ . "0"^^ . "1"^^ . . . . "0"^^ . . . . . . "0"^^ . "timezone-offset"^^ . . . . "Get network connection status in neovim"^^ . . . . "2"^^ . . . "0"^^ . . "1. If your solution is correct: if it works — then yes. 2. Your solution keeps a table with a single integer field, their keeps the integer field outright, without wrapping it with an additional table. In context of the task is does not matter, but your solution eats more memory which *in theory* might lead to efficiency deficiency in a real project."^^ . . "Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking."^^ . . . . . . . "1"^^ . . "1"^^ . . . "<p>So i wanted to change the text label when a player is switching teams or is in a team that satisfy my code's condition. Also, when a player is interacting with a proximity prompt.</p>\n<p>Problem:<br />\nIt didnt change.. nothing is showing in the console.</p>\n<p>Basically i tried adding some debug statements but again it didnt show up.<br />\nNote: Yes that is the literal names of the team</p>\n<pre><code>local function updateText(message)\n textObject.Text = message\n end\n\nlocal function updateTextOnTeamChange(player)\n local teamService = game:GetService(&quot;Teams&quot;)\n if teamService then\n local playerTeam = teamService:GetPlayerTeam(player)\n if playerTeam then\n local teamName = playerTeam.Name\n if teamName == &quot;Starting Point &lt;3&quot; then \n updateText(&quot;Enter a portal to start~!&quot;)\n elseif teamName == &quot; Playing ~ !!&quot; then \n updateText(&quot;Checkpoint : &quot;)\n elseif teamName == &quot;Finish Line ^w^&quot; then \n updateText(&quot;You finished the tower!&quot;)\n else\n updateText(&quot;An error occurred!&quot;)\n warn(&quot;Unknown player team: &quot; .. teamName)\n end\n else\n updateText(&quot;You are not on any team&quot;)\n end\n else\n warn(&quot;Teams service not found!&quot;)\n updateText(&quot;An error occurred! Please try again later.&quot;)\n end \nend game.Players.PlayerAdded:Connect(function(player)\n print(&quot;Player added:&quot;, player.Name) -- Debugging statement\n player:GetPropertyChangedSignal(&quot;Team&quot;):Connect(function()\n print(&quot;Team changed for player:&quot;, player.Name) -- Debugging statement\n updateTextOnTeamChange(player)\n end)\nend)\n</code></pre>\n<p>this is for the proximity prompt</p>\n<pre><code>local trigger = checkpoint:FindFirstChild(&quot;ProximityPrompt&quot;)\n if trigger then\n trigger.Triggered:Connect(function(player)\n if player == game.Players.LocalPlayer then\n print(&quot;Checkpoint triggered successfully.. Proceeding to update checkpoint &quot; .. checkpoint.Name)\n checkpoint.Transparency = 1\n updateText(&quot;Checkpoint: &quot; .. checkpoint.Name)\n else\n updateText(&quot;Error occurred!&quot;)\n warn(&quot;Objects not found&quot;)\n end\n end)\n end\n</code></pre>\n<p>any feedbacks is greatly appreciated ~!!!</p>\n"^^ . . . "1"^^ . "kong"^^ . . . "todo-comments.nvim: :TodoTelescope is searching for Todo comments in all of my files, not just the ones in the tree"^^ . . . "0"^^ . . . . . "0"^^ . "So, you want to translate (url → filesystem): / → .../startpage/index.html, /foo/ → .../startpage/foo/index.html, but also /foo/ → .../html/foo/index.html. There are obviously conflicting/ambiguous locations. I'd recommend to update the question with directory structure and urls examples, otherwise it's all but impossible to figure out what you are trying to achieve."^^ . . . "1"^^ . "Is that why you are downvoting? Instead could you suggest a change?"^^ . . "LuaU - Need to make this efficient, don't want to spam elseifs"^^ . "How to overload functions string.byte and string.char to support Unicode UTF-8?"^^ . . . "<p>A roundtrip of os.date -&gt; os.time -&gt; os.date in UTC does not seem to get back to the same time:</p>\n<pre><code>print(os.date( &quot;!%a %b %d %H:%M:%S %Y&quot;))\nprint(os.date(&quot;%c&quot; , os.time( os.date(&quot;!*t&quot;, os.time() ) ) ))\n</code></pre>\n<p>Output:</p>\n<blockquote>\n<p>Mon Apr 15 16:08:48 2024 <BR>\nMon Apr 15 17:08:48 2024</p>\n</blockquote>\n<p>What am I missing?</p>\n<p>p.s. the first line is the correct time</p>\n"^^ . . "<p>Your <code>onCollide</code> function runs every time something enters the collision box of the transparent part, but the part of your code that is giving you problems is this:</p>\n<pre class="lang-lua prettyprint-override"><code>isInWater = true -- this runs every time onCollide runs\n</code></pre>\n<p>What this is doing is that <code>isInWater</code> is being set to <code>true</code> every single time <code>onCollide</code> runs, <em>when you should really check for the player before running your for-loop</em>.</p>\n<p>Then, inside of your for-loop, to check if the player is still in the water, you should insert:</p>\n<pre class="lang-lua prettyprint-override"><code>if not isInWater then -- breaks the for loop when not in water\n break\nend\n</code></pre>\n<p>before you decrement health.</p>\n<p>Hope I helped!</p>\n"^^ . . . . . "Dual representation and proxies to achieve privacy in Lua"^^ . . . . "NLua calling non existant function"^^ . "anti-cheat"^^ . . . "You cannot edit the player UI from the server, you must do it client sided"^^ . . . . "2"^^ . "0"^^ . . . . . . "<p>The easiest way that I found is to use <code>brew</code> package manager.</p>\n<ol>\n<li><a href="https://docs.brew.sh/Homebrew-on-Linux" rel="nofollow noreferrer">Install Brew on Linux</a></li>\n<li>Add Brew to <code>$PATH</code>. (It will be suggested at the end of the Brew installation. Just copy-paste)</li>\n<li>Reload terminal to be able to use <code>brew</code> after setting the <code>$PATH</code></li>\n<li>Run <a href="https://formulae.brew.sh/formula/lua-language-server" rel="nofollow noreferrer"><code>brew install lua-language-server</code></a> in terminal</li>\n<li>Run <code>lua-language-server</code> (just to check if it is installed correctly)</li>\n<li>Close <code>lua-luangage-server</code> (Ctrl + C)</li>\n<li>Done</li>\n</ol>\n"^^ . "roblox-studio"^^ . "1"^^ . . . "0"^^ . . . . "1"^^ . "0"^^ . . . "openresty"^^ . "1"^^ . "openresty create symlinks via post"^^ . "you should narrow your goal for a post on stack overflow to 1 question at a time, asking multiple questions will likely get your question closed for "needing more focus", Also to improve you chances of an answer include any frameworks or libraries you are using, I am not seeing any clues to that in your post. so i have no idea what `SetSpellTraining` is doing"^^ . . "1"^^ . . . . "0"^^ . "runtime"^^ . . . "<p>As mentioned above, you can just add comma, but if you still want to disable it:</p>\n<p>According to <a href="https://zigtools.org/zls/editors/vim/nvim-lspconfig/" rel="nofollow noreferrer">https://zigtools.org/zls/editors/vim/nvim-lspconfig/</a> , you can use this global option:</p>\n<pre class="lang-lua prettyprint-override"><code>-- disable format-on-save from `ziglang/zig.vim`\nvim.g.zig_fmt_autosave = 0\n</code></pre>\n<p>To disable &quot;fix all&quot; you can try this, but I didn't tried myself:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.api.nvim_create_autocmd('BufWritePre',{\n pattern = {&quot;*.zig&quot;, &quot;*.zon&quot;},\n callback = function(ev)\n vim.lsp.buf.code_action({\n -- Try to make that *only* array-like table empty\n -- original lines:\n -- context = { only = { &quot;source.fixAll&quot; } },\n -- apply = true,\n context = { only = {} },\n apply = false,\n })\n end\n})\n</code></pre>\n<p>P.S. Also it should be <code>zls</code> instead of <code>Lua</code> for ZLS config of nvim-lspconfig in your code example (<code>Lua</code> is for Lua LS*):</p>\n<pre class="lang-lua prettyprint-override"><code>local lspconfig = require('lspconfig')\nlspconfig.zls.setup {\n -- Server-specific settings. See `:help lspconfig-setup`\n\n -- omit the following line if `zls` is in your PATH\n -- === IMO you can use PATH btw ^ ===\n cmd = { '/path/to/zls_executable' },\n -- There are two ways to set config options:\n -- - edit your `zls.json` that applies to any editor that uses ZLS\n -- - set in-editor config options with the `settings` field below.\n --\n -- Further information on how to configure ZLS:\n -- https://zigtools.org/zls/configure/\n settings = {\n zls = {\n -- Example from link above:\n -- Neovim already provides basic syntax highlighting\n semantic_tokens = &quot;partial&quot;,\n\n -- omit the following line if `zig` is in your PATH\n zig_exe_path = '/path/to/zig_executable'\n }\n }\n}\n</code></pre>\n"^^ . . "0"^^ . . "1"^^ . . . . "1"^^ . "@Ryan_Luu the class names are numbered 1, 2, 3, 4, 5."^^ . "0"^^ . . . "I found another solution to do this. See my answer below. P.S. I didn't know that 'brew' could be installed on Linux because I primarily used it on Mac and made an assumption that it was a Mac-only tool."^^ . . "0"^^ . "'socket.http' module isn't found when using require"^^ . . . "0"^^ . . . "0"^^ . . "<p>I am trying to write a script that executes a mouse movement when the character &quot;f&quot; on the keyboard is pressed but for some reason it doesn't work. Any suggestions?</p>\n<pre><code>function test(event,arg)\n if isKeyPressed(&quot;f&quot;) then\n repeat\n MoveMouseRelative(0,20)\n until not isKeyPressed(&quot;f&quot;)\n end\nend\n</code></pre>\n"^^ . . . . "1"^^ . . "0"^^ . "0"^^ . . "0"^^ . "Your remote event isn't secured. I would recommend a check if the player has the tool and a debounce or an attacker might spam the leaderboard even without having the tool."^^ . "1"^^ . . "Lua has no utf8, it's a custom library. Char is string with one or several letters. Decimal is decimal number, positive integer, that has an index code to specific char in unicode."^^ . "Ok so it sounds like it is your code, can you add the function to the post, so the code that defines `SetSpellTraining`, and is this just a game coded in lua or are you working inside roblox, minecraft, gary's mod, Love2d, or anything like that?"^^ . "0"^^ . . "You can also see if there's a `Disconnect` analogous to `Connect`, so you could disconnect events once they've fired. I'm not sure which is preferred in Roblox--I might check how other well-designed scripts handle this. The other things you might look for (and unfortunately I'm not finding great resources here) are "edge detection" and "debouncing". Edge detection is the term for detecting when an event (e.g. contact with the trigger) starts happening and when it stops. Debouncing is removing short edges, for instance if the character steps off the trigger and immediately back on."^^ . . . "0"^^ . . . . "2"^^ . . . . . . "compiler-optimization"^^ . . . . . "1"^^ . "How to install lua-language-server on linux (Ubuntu)?"^^ . . "1"^^ . . "overloading"^^ . "<p>For example (pseudoc code):</p>\n<pre><code>//c++\nvoid foo() {\n // call lua function bar\n luapcall(bar,...\n}\n\n//binding code\nexport c_foo...\n\n//lua\nfunction bar() return nil\n\nc_foo()\n</code></pre>\n<p>In this case, will lua stack be broken and lead to crash?</p>\n"^^ . "<p>I am running an NGINX server with Lua (via OpenResty).</p>\n<p>I want to implement a very simple thing:</p>\n<ol>\n<li>If the user accesses <code>/</code> serve from the folder <code>startpage</code></li>\n<li>If the user accesses any other path, for example <code>/foo</code>, serve from the folder <code>/html/foo</code></li>\n</ol>\n<p>I tried many things, nothing seems to work. I can not change the root folder by <code>ngx.var.document_root = &quot;/startpage&quot;</code> - I get an error.</p>\n<p>Then I tried this script, but instead of an internal rewrite of the url, I get an redirect to &quot;/startpage&quot;, so the user can see &quot;/startpage&quot; in the browser adress bar, which I do not want.</p>\n<pre><code>-- Check if the script has already been executed - without this check, this script is called recursively\nif rewritten ~= true then\n rewritten = true\n\n -- Root (&quot;/&quot;) was called, set correct startpage\n if ngx.var.uri == &quot;/&quot; then\n ngx.req.set_uri(&quot;/startpage&quot;)\n -- Otherwise, set correct path to the called resource\n else\n ngx.req.set_uri(&quot;/html&quot;..ngx.var.uri)\n end\nend\n</code></pre>\n<p>If anyone can point me to the right direction, I would be very thankful.</p>\n<p><strong>What is the goal exactly?</strong></p>\n<p><strong>If the user calls the root</strong> <code>/</code>:</p>\n<ol>\n<li>If the user is logged in: Serve files from <code>/startpage/user</code></li>\n<li>If the user is logged in: Serve files from <code>/startpage/guest</code></li>\n</ol>\n<p><strong>Else (user calls any other URL):</strong></p>\n<ol>\n<li>Example: User calls <code>/foo</code>: Serve files from <code>/html/foo</code></li>\n<li>Example: User calls <code>/foo/bar/baz</code>: Serve files from <code>/html/foo/bar/baz</code></li>\n</ol>\n<p>The authentication logic is all working, so I know if the user is logged in or not. I just need to set the root folder I serve files from dynamically.</p>\n"^^ . . . . . . . . . . . . "<p>In your case to run correctly it should be like:</p>\n<pre><code>java -classpath target/classes com.khush.distributed.cache.Main\n</code></pre>\n<p>But it's wrong to run like</p>\n<pre><code>java com.khush.distributed.cache.Main\n</code></pre>\n<p>as your package not saved as class path location that is very important, as class loader will try to find class in exactly same dir path, you need to move it to right directory, or just remove package at all, and in this case you can recompile class and then run just by</p>\n<pre><code>java Main\n</code></pre>\n<p>or as you compiled it directly in src/main/java, with package, you can just run it as it is from root (it will be working only in case dev directory, not prod jar of course, because of that, I highly not recommend this approatch)</p>\n<pre><code>java -classpath src/main/java/ com.khush.distributed.cache.Main\n</code></pre>\n<p>In case <code>CRAG666/code_runner.nvim</code> can be</p>\n<pre><code>java = {\n &quot;java -classpath src/main/java/&quot;,\n &quot;$(grep '^package' $dir/$fileName | awk '{print $2}' | sed 's/;//').$fileNameWithoutExt&quot;\n },\n</code></pre>\n<p><em><strong>But I highly recomment to use Maven or Gradle for similar purposes! See below</strong></em></p>\n<hr />\n<p>MAVEN</p>\n<p>In case maven or gradle if you are using them to run java app only one problem - speed , they very slow to run simple main method during development process. They are great package managers, but to simple run, nothing better than simple <code>java -cp class_name</code>, same using by IntelliJ actually. Only think we need to resolve - full app class path of full dependencies, and maven and gradle resolving it very easily.</p>\n<p><em>I will show basic idea on maven, but the same can be used easily for gradle or another managers of course</em></p>\n<p>In case maven, I'm using next command in my <code>CRAG666/code_runner.nvim</code> config (but with caching classpath script, see below)</p>\n<pre><code>return {\n &quot;CRAG666/code_runner.nvim&quot;,\n config = function()\n require('code_runner').setup({\n filetype = {\n java = {\n &quot;java -classpath $(mvn -o -q dependency:build-classpath -Dmdep.outputFile=/dev/stdout -DincludeScope=runtime):target/classes&quot;,\n &quot;$(grep '^package' $dir/$fileName | awk '{print $2}' | sed 's/;//').$fileNameWithoutExt&quot;\n },\n },\n })\n vim.keymap.set('n', '&lt;leader&gt;rr', ':RunCode&lt;CR&gt;', { noremap = true, silent = false, desc = &quot;Run Code&quot; })\n end\n}\n</code></pre>\n<ul>\n<li><p>First line build <code>java -classpath [full class path to run with your class]</code></p>\n</li>\n<li><p>Second build correct full class file package path with main() method like <code>com.something.project.api.ApplicationRun</code> to correctly run it</p>\n</li>\n<li><p>Note that this example for single module project, in case multi maven project, it will not work, as you need properly set [module]/target/classes for all modules (and deps), or correctly script it. I'm usually not often using neovim for big java projects.</p>\n<p><a href="https://i.sstatic.net/rUqTqNOk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rUqTqNOk.png" alt="enter image description here" /></a></p>\n</li>\n</ul>\n<hr />\n<p>SPEED UP &amp; CACHING CLASS PATH</p>\n<p>If you want speed up next runs (as maven by itself not very fast to any operations, but we need run code very offten and not want to wait every time couple seconds more), you can for example add simple script to cache full class path result, and refresh only in case your pom.xml was changed, in this case all runs will be blazingly fast!</p>\n<p>for example in my config I have next to achieve it:</p>\n<pre><code>java = {\n &quot;java -classpath $($HOME/dotfiles/work/java/mvn_cp_cache.sh)&quot;,\n &quot;$(grep '^package' $dir/$fileName | awk '{print $2}' | sed 's/;//').$fileNameWithoutExt&quot;\n},\n</code></pre>\n<p>bash script <code>mvn_cp_cache.sh</code></p>\n<pre><code>#!/usr/bin/env bash\n\nEXEC_DIR=&quot;$1&quot;\nCACHE_FILE_NAME=&quot;.classpath.cache&quot;\nPOM_FILE=&quot;pom.xml&quot;\n\nif [ ! -f &quot;$CACHE_FILE_NAME&quot; ] || [ &quot;$POM_FILE&quot; -nt &quot;$CACHE_FILE_NAME&quot; ]; then\n if [ -f $CACHE_FILE_NAME ]; then\n rm $CACHE_FILE_NAME\n fi\n mvn -q dependency:build-classpath -Dmdep.outputFile=&quot;$CACHE_FILE_NAME&quot; -DincludeScope=runtime\nfi\n\n\ncache_file_dir=&quot;$EXEC_DIR&quot;\nwhile [ &quot;$cache_file_dir&quot; != &quot;$HOME&quot; ]; do\n found_file=$(fd --no-ignore -d 1 -t f -H &quot;$CACHE_FILE_NAME&quot; &quot;$cache_file_dir&quot;)\n if [[ -n $found_file ]]; then\n break\n fi\n cache_file_dir=$(dirname &quot;$cache_file_dir&quot;)\ndone\n\nclasspath=$(cat &quot;$cache_file_dir&quot;/$CACHE_FILE_NAME)\necho &quot;$classpath:$cache_file_dir/target/classes&quot;\n</code></pre>\n<p>don't forget <code>chmod +x mvn_cp_cache.sh</code> and add <code>.classpath.cache</code> to git ignore </p>\n<p>The same idea can be applied to gradle (just class path build command will be <code>$(./gradlew printClasspath -q)</code>).</p>\n<p>Actually you can just extend script to check if presents pom.xml or build.gradle/kt etc and run appropriate command to build classpath to cache</p>\n<p>In result, doesn't matter what java app you are running, simple main or spring boot app etc, run will be all time correct and work in any java app and any java project you want. And it's VERY fast! I'm using it a lot during my workflow.</p>\n<p>For example IntelliJ Idea to run java code using similar idea </p>\n"^^ . "0"^^ . . . . . "1"^^ . . "How to use for loops in Lua / Roblox?"^^ . "1"^^ . . . . . . . "This is not really a programming issue, maybe it is better place your Neovim specific issue at: https://github.com/neovim/neovim/issues"^^ . . . . . . "0"^^ . . . "bytecode"^^ . . . "My issue is the other way round. I don't see the issue in the terminal apps."^^ . . . . . . "2"^^ . . . . "0"^^ . . "-1"^^ . "0"^^ . . . "<p>you can install using Mason.nvim ( if you already using lazy.nvim it's not a problem you can use both at same time not a problem) [sorry for file ordering mixup]</p>\n<pre><code>\n--lazy.nvim\n-- Setup lazy.nvim\nrequire(&quot;lazy&quot;).setup({\n spec = {\n {\n &quot;folke/tokyonight.nvim&quot;,\n lazy = false, -- Load immediately\n priority = 1000, -- Load before other plugins\n config = function()\n require(&quot;tokyonight&quot;).setup({\n style = &quot;storm&quot;, -- Options: &quot;storm&quot;, &quot;moon&quot;, &quot;night&quot;, &quot;day&quot;\n transparent = false,\n terminal_colors = true,\n })\n vim.cmd(&quot;colorscheme tokyonight&quot;)\n end,\n },\n {import = &quot;plugins&quot;}, -- there all plugins are loaded and also mason.nvim\n },\n})\n</code></pre>\n<pre><code>--lsp.lua\n\nreturn {\n {\n &quot;neovim/nvim-lspconfig&quot;,\n config = function()\n require'lspconfig'.lua_ls.setup {}\n end\n }\n} \n</code></pre>\n<pre><code>--my file tree\n\n/home/sharif/.config/nvim\n├── example.lua\n├── init.lua\n├── lazy-lock.json\n└── lua\n ├── config\n │   ├── autocmds.lua\n │   ├── keymaps.lua\n │   ├── lazy.lua\n │   └── options.lua\n └── plugins\n ├── lsp.lua\n ├── mason.nvim.lua\n ├── mini.lua\n └── treesitter.lua\n</code></pre>\n<pre><code>--mason.nvim.lua\n\nreturn {\n 'williamboman/mason.nvim',\n config = function()\n require('mason').setup({\n -- Optional configuration options\n ensure_installed = { &quot;lua-language-server&quot; },-- add more lsp server if you want more language\n automatic_installation = true,\n })\n end\n}\n</code></pre>\n"^^ . "0"^^ . "Lua script for coppeliaSim grabber"^^ . "0"^^ . . "0"^^ . "1"^^ . "<p>I use neovim as my java IDE too.Is not recommend using code runner plugin to run java file or project. My suggestion is to use a packaging tool like Maven or Gradle. If you use Maven, just configure maven-assemble-plugin or maven-shade-plugin in pom.xml then simply run:</p>\n<pre><code>mvn clean package &amp;&amp; java -jar /path/to/*.jar \n</code></pre>\n<p>in terminal. If you use Gradle, run:</p>\n<pre><code>gradle run \n</code></pre>\n<p>in terminal.</p>\n"^^ . . . "0"^^ . . "[2/2] Use `:lua print(vim.env.PATH)` and then `:mess`, and check if `[some_dir]/mason/bin` appears there. Then check if packages actually appear in said mason/bin directory, and if that directory is actually valid on your OS. If that won't help, please give as more info about your environment."^^ . "1"^^ . . . "1"^^ . "Nvim lua cant require lua module with hyphens"^^ . . . . . . "network-programming"^^ . . . . "1"^^ . . "0"^^ . "1"^^ . . "lua-table"^^ . . . . "Check if a part is a part of a character | Roblox"^^ . "<p>i hope this is can help you.</p>\n<pre><code>local override = {\n char = function()\n -- whatever you want here\n print(&quot;Hello&quot;)\n end,\n byte = function()\n -- whatever you want here\n print(&quot;World&quot;)\n end\n}\n\nlocal str = {};\nstr.__index = string;\nstring = setmetatable(override, str);\n\nstring.char() -- Hello\nstring.byte() -- World\nprint(string.lower(&quot;HELLO WORLD!&quot;)) -- Old string functions still work\n</code></pre>\n"^^ . . . "<p><strong>problem</strong>: <code>ctrl + &lt;del&gt;</code> or <code>ctrl + &lt;backspace&gt;</code> doesn't delete a whole word. I know there's another way to do it in Neovim, but I want to change the current behaviour.</p>\n<p>So I tried changing my mappings but ctrl + del doesn't work</p>\n<ul>\n<li>I use powershell on the windows terminal to use neovim.</li>\n<li>config in lua, highlighted lines are the changes I made\n<a href="https://i.sstatic.net/U0rgK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/U0rgK.png" alt="enter image description here" /></a></li>\n</ul>\n<p>here's my current config <a href="https://github.com/phukon/nvim-config/blob/main/lua/core/mappings.lua" rel="nofollow noreferrer">GitHub</a></p>\n"^^ . . . . . . "0"^^ . "0"^^ . . "Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking."^^ . "<p>I found the root cause of the problem. The issue was with tmux.</p>\n<p>For some reason tmux couldn't properly render some colors. By setting the following command in the tmux config, the #04110d color started to display as expected.</p>\n<pre><code>-- ~/.tmux.conf\n\nset-option -ga terminal-overrides &quot;,xterm-256color:Tc&quot;\n</code></pre>\n<p>Also see - <a href="https://stackoverflow.com/questions/60309665/neovim-colorscheme-does-not-look-right-when-using-nvim-inside-tmux">Neovim colorscheme does not look right when using nvim inside tmux</a></p>\n"^^ . . "3"^^ . . . "1"^^ . "<p>In LunarVIM config, what I would like is to create a new <code>ftplugin</code> named <code>log</code> with it's associated syntax.</p>\n<p>I'd like to have the filetype and syntax within a custom folder (<code>~/.lvim</code>) under source control that it loaded by the default <code>config.lua</code>.</p>\n<p>Actually I have:</p>\n<p><code>~/.config/lvim/config.lua</code></p>\n<pre class="lang-lua prettyprint-override"><code>local custom_path = vim.env.HOME .. &quot;/.lvim/?.lua&quot;\npackage.path = package.path .. &quot;;&quot; .. custom_path\nrequire(custom-config)\n</code></pre>\n<p><code>~/.lvim/custom-config.lua</code></p>\n<pre class="lang-lua prettyprint-override"><code>require(xxxx) -- same folder xxxx.lua \nrequire(yyyy) -- same folder yyyy.lua \n</code></pre>\n<p>This is an example of the <code>log</code> file content (it's logs so nothing really fancy):</p>\n<pre><code>[I] [TAG] This is an info level log\n[T] [TAG_2] This is a trace level log\n[E] [TAG] I think you figured this one out!\n</code></pre>\n<p>I have tried to create just a basic syntax file named <code>log.vim</code> like this to easily see that it has been loaded:</p>\n<pre><code>if exists(&quot;b:current_syntax&quot;)\n finish\nendif\n\nechom &quot;Log syntax file loaded&quot;\n\nsyn match line '^.*$'\n\nhighlight line ctermfg=red\n\nlet b:current_syntax = &quot;log&quot;\n</code></pre>\n<p>Right now it does not automatically detect all log files (code will be added towards that with also specific <code>ftplugin) but I manually </code>set filetype=log` when I open such file.</p>\n<p>If I am here, it is that, of course, my <code>log.vim</code> is never loaded (<code>messages</code> never shows my <code>echom</code>).</p>\n<p>I have tried to <code>source ~/.lvim/log.vim</code>, it does output the <code>echom</code> but the syntax does not work.</p>\n<p>I have tried to put this file in multiple folders found during my research on how to add <code>syntax</code> without any success (<code>~/.config/nvim/after/syntax/log.vim</code>, <code>~/.lvim</code> ).</p>\n<p>These are my questions:</p>\n<ol>\n<li>How can I add syntax/ftplugin files in a custom folder and tell LunarVim to automatically load them ?</li>\n<li>Is my syntax file (this is just for &quot;debugging&quot;) valid ?</li>\n</ol>\n"^^ . "Ah hey!! This looks useful: https://create.roblox.com/docs/scripting/debounce. And if you don't want the event to rearm so it only triggers exactly once, remove the `task.wait()` and the line below."^^ . "1"^^ . "1"^^ . "cjk"^^ . "@ESkri You are right, I used the wrong name here. Tho, shouldn't local names be included in compiled files?"^^ . . "0"^^ . . "Heyo, an important piece of information for us is "why doesn't your script work well?"\nDid you test it by noclipping, and your script simply didn't catch it? What part of the script is failing?"^^ . . "0"^^ . "0"^^ . . "<p>I need to write a test that diagnoses double free for a Lua object created using ffi.new.\nAs a result, you need to call collectgarbage() twice, after which a double free situation should occur.</p>\n<p>I wrote this example:</p>\n<pre><code>local ffi = require(&quot;ffi&quot;)\n\nffi.cdef[[\ntypedef struct {\n int x;\n} my_struct;\n]]\n\nlocal obj = ffi.new(&quot;my_struct&quot;, {10})\nobj = ffi.gc(obj, function (o)\n print(123)\nend)\n\nobj = nil\ncollectgarbage(&quot;collect&quot;)\ncollectgarbage(&quot;collect&quot;)\n</code></pre>\n<p>but the destructor of this object is called only 1 time</p>\n"^^ . . . . . . . . . "0"^^ . . "1"^^ . "0"^^ . . . . "0"^^ . "0"^^ . . . . . "Could you elaborate on what you want? I see you proposed an edit to my answer to add a `break` inside the `else`. This is not what you want if you just want to find the word (and the space) anywhere in the string, as your current pattern attempts to do. Does it have to be at the start (`^...`), at the end (`...$`), a full match (`^...$`)?"^^ . "<p>ZLS version is for 0.12.0 (I put in into PATH and lua script and checked if some plugin puts builtin LSP which I dont need).</p>\n<p>In config_gen/config.json:</p>\n<pre><code> {\n &quot;name&quot;: &quot;enable_autofix&quot;,\n &quot;description&quot;: &quot;Whether to automatically fix errors on save. Currently supports adding and removing discards.&quot;,\n &quot;type&quot;: &quot;bool&quot;,\n &quot;default&quot;: false\n },\n</code></pre>\n<p>And it still compresses my struct into a single line:</p>\n<pre><code>//before\nconst Container = struct {\n childs: std.ArrayList(),\n content: []u8\n};\n\n//after saving\nconst Container = struct { childs: std.ArrayList(), content: []u8 };\n</code></pre>\n<p>I tried to configure it in init.lua (I installed kickstart and did almost no changes):</p>\n<pre><code> zls = {\n cmd = { 'C:/zig/lsp/1.12.0/zig-out/bin/zls.exe' },\n settings = {\n Lua = {\n format_on_save = false,\n },\n },\n },\n</code></pre>\n<p>And copypasted in Autoformat section right after lua's formater</p>\n<p>It is better if I fix it not only for nvim, but in ZLS config or whatever</p>\n"^^ . "0"^^ . "1"^^ . . "0"^^ . . "<p>To select n-th symbol of UTF-8 string, use <code>utf8.offset</code> (Lua 5.3+ is required):</p>\n<pre><code>local s = &quot;слово&quot;\nlocal n = 4\nlocal c = s:match(utf8.charpattern, utf8.offset(s,n))\nprint(c) --&gt; в\nif c == &quot;в&quot; then .... end\n</code></pre>\n"^^ . . "roblox"^^ . "simulation"^^ . . . . . . "0"^^ . . . "The error message lists several "no file" entries. You should put your file at one of these locations to make require() find it."^^ . "1"^^ . . "autoplay-media-studio"^^ . . . . . "1"^^ . "0"^^ . "<p>I want to make it so when the proximityprompt is in range of the player, the part with the proxprompt gets a highlight.</p>\n<p>I put a script in the part, the script was this:</p>\n<pre><code>local proximityPrompt = script.Parent\nlocal part = script.Parent.Parent\n\nif proximityPrompt.PromptShown == true then\n Instance.new(Highlight, part)\nend\n</code></pre>\n<p>I'm a new programmer so I couldn't think of another way to do it.</p>\n"^^ . "0"^^ . . . . "0"^^ . ".Touched event is tied to [network ownership](https://create.roblox.com/docs/physics/network-ownership#security-concerns) so it does not matter if you created a collision setting for this. if the client has network ownership over their accessory (which it does) it would fire the event resulting in a disadvantage to some players"^^ . "0"^^ . "<p>You can define a function as a variable, but the thing that makes this tricky is that you are interacting with the original object inside the function.</p>\n<p>So the way to do this is with something called a <a href="https://www.freecodecamp.org/news/higher-order-functions-in-javascript-explained/" rel="nofollow noreferrer">higher-order function</a>. We are going to use a function to create a function. And we will pass the result to the <code>Touched</code> connection.</p>\n<pre class="lang-lua prettyprint-override"><code>local createOnTouchedFunction = function(originalObject)\n return function(otherObject)\n wait(3)\n originalObject.BrickColor = BrickColor.Random()\n end\nend\n\nlocal blocks = workspace.test:GetChildren()\nfor indx, obj in pairs(blocks) do\n obj.Touched:Connect(createOnTouchedFunction(obj))\nend\n</code></pre>\n<p>Alternatively, you could connect the object inside the function :</p>\n<pre class="lang-lua prettyprint-override"><code>local function changeColorOnTouch(obj)\n obj.Touched:Connect(function(otherObject)\n wait(3)\n obj.BrickColor = BrickColor.Random()\n end)\nend\n\nlocal blocks = workspace.test:GetChildren()\nfor indx, obj in pairs(blocks) do\n changeColorOnTouch(obj)\nend\n</code></pre>\n"^^ . "0"^^ . . "1"^^ . . . . . "1"^^ . "0"^^ . . . . . . . . "The editing for the code is a bit wonky for some reason. Probably because of the multitude of 'end's"^^ . . "3"^^ . . . "2"^^ . "It did help me, thank you. Never assumed i could actually break the loop this way."^^ . "<p>I am coding a computer in roblox studio where on the monitor there is a login button and I want it where when a player hit that button a frame from my screengui. Ive been trying different codes but none worked. Mt recent script was a script. (I tried both local and normal script of this code both didnt work.) this script is in the button of the surfacegui.</p>\n<pre><code>local MyButton = script.Parent\nlocal frame = game.StarterGui.ScreenGui.Frame\n\nMyButton.MouseButton1Click:Connect(function()\n frame.Visible = true\nend)\n</code></pre>\n<p>![<a href="https://i.sstatic.net/DHLgwZ4E.png" rel="nofollow noreferrer">the hierarchy of the StarterGui.</a>]\n(<a href="https://i.sstatic.net/TMWlbZBJ.png" rel="nofollow noreferrer">https://i.sstatic.net/TMWlbZBJ.png</a>)</p>\n<p>I tried making the code where when button is pressed it would make frame visible.</p>\n"^^ . "<pre class="lang-lua prettyprint-override"><code>else \nend \n</code></pre>\n<p>The <code>else</code> is the problem. There is no other code before the <code>end</code> at the <code>else</code>. As advice, next time align the code properly and format it to see matching begin-of-statements with their end and you'll find the problems a lot faster. This is the easiest way.</p>\n"^^ . . . . . "1"^^ . . "c#"^^ . "0"^^ . . . "<p>Assuming your Lua source file is UTF-8 encoded, <code>&quot;слово&quot;</code> will be equivalent to <code>&quot;\\209\\129\\208\\187\\208\\190\\208\\178\\208\\190&quot;</code> (you can confirm this via <code>(&quot;слово&quot;):gsub(&quot;.&quot;, function(c) return (&quot;\\\\%d&quot;):format(c:byte()) end)</code>).</p>\n<p>That is, as you observed, the cyrillic characters, not being part of ASCII, will be encoded using multi-byte (in this case specifically two-byte sequences) as UTF-8. This means the first byte is just <code>209</code>. <code>a</code> is the string consisting of just the first byte, so <code>&quot;\\209&quot;</code>. Hence, the answer to your question of</p>\n<blockquote>\n<p>I just want to know which symbol would work for the if statement</p>\n</blockquote>\n<p>is just <code>&quot;\\209&quot;</code>. On its own, this is invalid UTF-8: For it to be valid UTF-8, a second byte in a certain range would need to follow. So if your terminal expects UTF-8 and thus can't decode this, it will display the Unicode replacement character to indicate the invalid encoding. Some terminals may try to be clever about guessing the encoding, displaying other characters instead.</p>\n<p>The other conditions you tried didn't work because:</p>\n<ul>\n<li><code>&quot;?&quot;</code> is just the ASCII question mark, equivalent to <code>&quot;\\63&quot;</code>. Obviously, <code>&quot;\\63&quot;</code> is not the same string as <code>&quot;\\209&quot;</code>, since the byte is different. The question mark isn't special in any way.</li>\n<li><code>&quot;�&quot;</code> is just the Unicode replacement character. This is what terminals often render when you give them an invalid codepoint. It is not the &quot;real codepoint&quot;. Under the hood, it is encoded as <code>&quot;\\239\\191\\189&quot;</code>, which is not byte equal to <code>&quot;\\209&quot;</code>.</li>\n<li><code>&quot;&quot;</code> is just the empty string. Being shorter than the one-byte string <code>&quot;\\209&quot;</code>, it can't be equal.</li>\n<li><code>nil</code> won't compare equal to any string, being of a different type.</li>\n</ul>\n<p>In general, keep in mind that Lua strings are just byte strings, not strings of &quot;codepoints&quot; or &quot;grapheme clusters&quot;. If you substring, you're indexing bytes. If you want to index codepoints instead, <a href="https://www.lua.org/manual/5.4/manual.html#pdf-utf8.codepoint" rel="nofollow noreferrer">use the <code>utf8</code> library</a>, and ensure that your strings are UTF-8 encoded.</p>\n"^^ . "neovim"^^ . "0"^^ . "It's possible to make smooth polyline, just set the max angular difference and find the next nearest `t` to fit this angle (with tolerance)."^^ . . "1"^^ . . "<p>You named both a property and a function <code>position</code>. You can't do that. functions are also properties and as soon as you give the transform instance a position property your overwrote the function that was there. You should simply name them differently. So for example change</p>\n<pre><code>function Transform:position(x, y, z)\n</code></pre>\n<p>to</p>\n<pre><code>function Transform:setPosition(x, y, z)\n</code></pre>\n<p>and change</p>\n<pre><code>transform:position(10, 20, 30)\n</code></pre>\n<p>to</p>\n<pre><code>transform:setPosition(10, 20, 30)\n</code></pre>\n"^^ . . "1"^^ . "0"^^ . . "0"^^ . . "0"^^ . . . . "0"^^ . . . . "<p>The content you referred to isn't Lua code; it's actually a Vim script. You can find at the top of the URL you provided: <a href="https://neovim.io/doc/user/usr_41.html#41.8" rel="nofollow noreferrer">https://neovim.io/doc/user/usr_41.html#41.8</a></p>\n<blockquote>\n<pre><code> VIM USER MANUAL - by Bram Moolenaar\n Write a Vim script\n</code></pre>\n</blockquote>\n"^^ . "<p>In your cultivation toggle script, are you changing the <code>cultivating</code> value on the client and not on the server. That's why your cultivation script which is server-sided is not updating because the <code>cultivating</code> never updates on the server but on the client so the server-side script can't detect it.</p>\n<p>Roblox uses a <a href="https://create.roblox.com/docs/projects/client-server" rel="nofollow noreferrer">client-server model</a> so to communicate on the server it is necessary to use a <a href="https://create.roblox.com/docs/reference/engine/classes/RemoteEvent" rel="nofollow noreferrer"><code>RemoteEvent</code></a> to tell the server that the user is cultivating and then use that information to add <code>qi</code>.</p>\n<blockquote>\n<p>The RemoteEvent object facilitates asynchronous, one-way communication across the client-server boundary without yielding for a response. This communication can be directed from one client to the server, from the server to a specific client, or from the server to all clients.</p>\n<p>— <a href="https://create.roblox.com/docs/reference/engine/classes/RemoteEvent" rel="nofollow noreferrer">https://create.roblox.com/docs/reference/engine/classes/RemoteEvent</a></p>\n</blockquote>\n<p>In this case, you would use the <a href="https://create.roblox.com/docs/scripting/events/remote#client-server" rel="nofollow noreferrer">Client → Server</a> remote event to tell the server that a user is cultivating.</p>\n<p>The changes you should make in your script would include:</p>\n<ul>\n<li>Modifying cultivation toggle script to fire a RemoteEvent to the server when the player starts or stops cultivating</li>\n<li>Remaking the cultivation script entirely to handle the cultivating event and then calculating qi based on that</li>\n</ul>\n"^^ . . . . . "Roblox Animation Loading, Not Loading"^^ . "custom-plugins"^^ . . "1"^^ . "2"^^ . "Simple yet incredibly frustrating lua pattern"^^ . "Yes, manually renaming to what it could have been, or asking the original author"^^ . . . . . . "0"^^ . "0"^^ . "How do you store state in a roblox script? Is it as simple as just declaring a global variable? If so, you could do (top of script) `local hasTriggeredTouchDetector = false`, and then in the TouchDetector event, (slashes are newlines) `if hasTriggeredTouchDetector then / return / else / hasTriggeredTouchDetector = true / end`. That should skip everything but the first invocation."^^ . "1"^^ . . "Have you check this https://docs.konghq.com/gateway/latest/plugin-development/distribution/#via-a-dockerfile-or-docker-run-install-and-load ?"^^ . . . . . "1"^^ . . . "Using Lua FFI in dnsdist"^^ . "<p>I tried use <code>string.match(&quot;Í&quot;,'%s?[\\u{4e00}-\\u{9FFF}]+')</code> which is similar to how we work in JS or others. But it will match one unnecessary character like the above 'Í'.</p>\n<p>The <a href="https://www.lua.org/manual/5.4/manual.html#pdf-utf8.charpattern" rel="nofollow noreferrer">official implementation of matching UTF-8</a> is using eacape <code>\\ddd</code> but <code>\\u{XXX}</code> seems to fail <a href="https://stackoverflow.com/a/27404436/21294350">because</a></p>\n<blockquote>\n<p>Lua's pattern matching facilities work <em>byte by byte</em></p>\n</blockquote>\n<p>Temporarily, I use the unstable workaround similar to <code>utf8.charpattern</code>: <code>string.match(&quot;Í&quot;,'%s?[\\228-\\233][%z\\1-\\191][%z\\1-\\191]')</code> based on <a href="https://en.wikipedia.org/wiki/UTF-8#Encoding" rel="nofollow noreferrer">the utf8 encoding</a> will output <code>nil</code> and works for checking cjk like '我' although it has one wrong range for the 2nd Byte from left.</p>\n<p>Q:</p>\n<p>How to solve this problem with regex?</p>\n"^^ . "1"^^ . "0"^^ . "1"^^ . "libuv"^^ . . "0"^^ . . . "1"^^ . . "0"^^ . . "0"^^ . "1"^^ . . "0"^^ . . . . "1"^^ . . "Probably necause of upvalues (_ENV) can not disappear while optimising."^^ . . . "0"^^ . . . . . . "kubernetes"^^ . "<p>I can’t figure it out, the error is on line 36. How to fix it and why does it occur? What am I doing wrong?</p>\n<blockquote>\n<p>Runtime Error at line: -1: d:\\gameobject.lua:36: attempt to call\nmethod 'position' (a table value)</p>\n</blockquote>\n<pre><code>Vector3f = {}\nVector3f.__index = Vector3f\n\nfunction Vector3f:new(x, y, z)\n local vector = {x = x or 0, y = y or 0, z = z or 0}\n setmetatable(vector, self)\n return vector\nend\n\nTransform = {}\nTransform.__index = Transform\n\nfunction Transform:new(position, rotation, scale)\n local transform = {\n position = position or Vector3f:new(0, 0, 0),\n rotation = rotation or Vector3f:new(0, 0, 0),\n scale = scale or Vector3f:new(0, 0, 0)\n }\n setmetatable(transform, self)\n return transform\nend\n\nfunction Transform:position(x, y, z)\n self.position.x = x or self.position.x\n self.position.y = y or self.position.y\n self.position.z = z or self.position.z\nend\n\nlocal pos = Vector3f:new(1, 2, 3)\nlocal rot = Vector3f:new(4, 5, 6)\nlocal sca = Vector3f:new(7, 8, 9)\n\nlocal transform = Transform:new(pos, rot, sca)\nprint(&quot;X: &quot; .. transform.position.x .. &quot; Y: &quot; .. transform.position.y .. &quot; Z: &quot; .. transform.position.z)\nprint(&quot;X: &quot; .. transform.rotation.x .. &quot; Y: &quot; .. transform.rotation.y .. &quot; Z: &quot; .. transform.rotation.z)\nprint(&quot;X: &quot; .. transform.scale.x .. &quot; Y: &quot; .. transform.scale.y .. &quot; Z: &quot; .. transform.scale.z)\n\ntransform:position(10, 20, 30)\nprint(&quot;X: &quot; .. transform.position.x .. &quot; Y: &quot; .. transform.position.y .. &quot; Z: &quot; .. transform.position.z)\n</code></pre>\n"^^ . . "0"^^ . . . "private"^^ . "zig"^^ . "ftplugin"^^ . . . . "0"^^ . "0"^^ . "0"^^ . . . . . . . "0"^^ . . "0"^^ . "<p>I've written some code that allows a player to take a sip of the item &quot;OrangeJuiceTool&quot; in the StarterPack, and whenever a sip is taken, the Sips value in the script update and add one, however whenever a sip is taken, no values are added. Here is my code:</p>\n<pre><code>local DataStoreService = game:GetService(&quot;DataStoreService&quot;)\nlocal DataStore = DataStoreService:GetDataStore(&quot;TimeStats&quot;)\n\ngame.Players.PlayerAdded:Connect(function(Player)\n local Leaderstats = Instance.new(&quot;Folder&quot;)\n Leaderstats.Name = &quot;leaderstats&quot;\n Leaderstats.Parent = Player\n\n local Sips = Instance.new(&quot;IntValue&quot;)\n Sips.Name = &quot;Sips&quot;\n Sips.Value = 0\n Sips.Parent = Leaderstats\n\n local tool = game.StarterPack:WaitForChild(&quot;OrangeJuiceTool&quot;)\n\n local Data = DataStore:GetAsync(Player.UserId)\n if Data then\n Sips.Value = Data\n end\n\n local function IncrementSips()\n Sips.Value = Sips.Value + 1\n end\n\n tool.Equipped:Connect(IncrementSips)\n\n Player.CharacterAdded:Connect(function(Character)\n local Tool = Character:FindFirstChildOfClass(&quot;Tool&quot;)\n if Tool and Tool.Name == &quot;OrangeJuiceTool&quot; then\n Tool.Activated:Connect(IncrementSips)\n end\n end)\nend)\n\ngame.Players.PlayerRemoving:Connect(function(Player)\n DataStore:SetAsync(Player.UserId, Player.leaderstats.Sips.Value)\nend)\n\n</code></pre>\n<p>I tried to update the code with different functions, didn't work :(</p>\n"^^ . . . "0"^^ . . . "Evaluate string as Lua expression or chunk?"^^ . "<p>I have a list like below in Lua, I send this list to the js side in json format using json.encode() code. But the problem is that the order of this list is changed by json.encode every time. So my list is in an order like 1,2,3 and after json.encode it becomes 2,1,3 or 3,2,1 or 3,1,2. Each time the list is out of order.\nHow can I solve this problem?</p>\n<p>Sample list :</p>\n<pre><code>GAMES = \n{\n [&quot;777_Thimble&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/777thimble_logo.svg&quot;,\n [&quot;1x_multiplier&quot;] = 2.88,\n [&quot;2x_multiplier&quot;] = 1.44,\n [&quot;first_bet&quot;] = 50,\n [&quot;second_bet&quot;] = 100,\n [&quot;third_bet&quot;] = 250,\n [&quot;four_bet&quot;] = 1000,\n [&quot;five_bet&quot;] = 5000,\n [&quot;min_attributable_bet_value&quot;] = 5,\n [&quot;max_attributable_bet_value&quot;] = 10000,\n },\n [&quot;777e_Thimble&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n [&quot;1x_multiplier&quot;] = 2.88,\n [&quot;2x_multiplier&quot;] = 1.44,\n [&quot;first_bet&quot;] = 50,\n [&quot;second_bet&quot;] = 100,\n [&quot;third_bet&quot;] = 250,\n [&quot;four_bet&quot;] = 1000,\n [&quot;five_bet&quot;] = 5000,\n [&quot;min_attributable_bet_value&quot;] = 5,\n [&quot;max_attributable_bet_value&quot;] = 10000,\n },\n [&quot;777_Thimblet&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n [&quot;1x_multiplier&quot;] = 2.88,\n [&quot;2x_multiplier&quot;] = 1.44,\n [&quot;first_bet&quot;] = 50,\n [&quot;second_bet&quot;] = 100,\n [&quot;third_bet&quot;] = 250,\n [&quot;four_bet&quot;] = 1000,\n [&quot;five_bet&quot;] = 5000,\n [&quot;min_attributable_bet_value&quot;] = 5,\n [&quot;max_attributable_bet_value&quot;] = 10000,\n },\n [&quot;777e_Thimbrle&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n [&quot;1x_multiplier&quot;] = 2.88,\n [&quot;2x_multiplier&quot;] = 1.44,\n [&quot;first_bet&quot;] = 50,\n [&quot;second_bet&quot;] = 100,\n [&quot;third_bet&quot;] = 250,\n [&quot;four_bet&quot;] = 1000,\n [&quot;five_bet&quot;] = 5000,\n [&quot;min_attributable_bet_value&quot;] = 5,\n [&quot;max_attributable_bet_value&quot;] = 10000,\n },\n [&quot;777_Thimbgle&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n [&quot;1x_multiplier&quot;] = 2.88,\n [&quot;2x_multiplier&quot;] = 1.44,\n [&quot;first_bet&quot;] = 50,\n [&quot;second_bet&quot;] = 100,\n [&quot;third_bet&quot;] = 250,\n [&quot;four_bet&quot;] = 1000,\n [&quot;five_bet&quot;] = 5000,\n [&quot;min_attributable_bet_value&quot;] = 5,\n [&quot;max_attributable_bet_value&quot;] = 10000,\n },\n [&quot;777e_Thimbfle&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n [&quot;1x_multiplier&quot;] = 2.88,\n [&quot;2x_multiplier&quot;] = 1.44,\n [&quot;first_bet&quot;] = 50,\n [&quot;second_bet&quot;] = 100,\n [&quot;third_bet&quot;] = 250,\n [&quot;four_bet&quot;] = 1000,\n [&quot;five_bet&quot;] = 5000,\n [&quot;min_attributable_bet_value&quot;] = 5,\n [&quot;max_attributable_bet_value&quot;] = 10000,\n },\n [&quot;777_Thimbled&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n [&quot;1x_multiplier&quot;] = 2.88,\n [&quot;2x_multiplier&quot;] = 1.44,\n [&quot;first_bet&quot;] = 50,\n [&quot;second_bet&quot;] = 100,\n [&quot;third_bet&quot;] = 250,\n [&quot;four_bet&quot;] = 1000,\n [&quot;five_bet&quot;] = 5000,\n [&quot;min_attributable_bet_value&quot;] = 5,\n [&quot;max_attributable_bet_value&quot;] = 10000,\n },\n [&quot;777e_Thimble2&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n [&quot;1x_multiplier&quot;] = 2.88,\n [&quot;2x_multiplier&quot;] = 1.44,\n [&quot;first_bet&quot;] = 50,\n [&quot;second_bet&quot;] = 100,\n [&quot;third_bet&quot;] = 250,\n [&quot;four_bet&quot;] = 1000,\n [&quot;five_bet&quot;] = 5000,\n [&quot;min_attributable_bet_value&quot;] = 5,\n [&quot;max_attributable_bet_value&quot;] = 10000,\n },\n [&quot;777e_Thidmble2&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n },\n [&quot;777e_Tdhidmble2&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n },\n [&quot;777e_Thicxdmble2&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n },\n [&quot;777e_Thidmbxle2&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n },\n [&quot;777e_Tchidmble2&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n },\n [&quot;777e_dTchidmble2&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n },\n [&quot;777e_Tdchidmble2&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n },\n [&quot;777e_Tcdhidmble2&quot;] = \n {\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n },\n}\n</code></pre>\n<p>I have made many attempts but without any results\nI am waiting for your support.</p>\n"^^ . "http://lua-users.org/wiki/TimeZone says we need to set isDst = false. It's confusing because it was coming out as false anyway, but it does fix the issue. If you edit the answer and include the -- Eric Feliksik local function get_timezone_offset(ts), I can mark it as answered"^^ . "1"^^ . . . . "declarative"^^ . . "2"^^ . "0"^^ . . . . "<p>Okay, so, I'm just curious on how to make this more efficent. I know it likely has something to do with a table loop like in pairs() or something. I know this is bad code, and I want to find a way to make it not bad.</p>\n<pre><code>if string.find(subject.Name, 0) then\n inVal.Value = 0\nelseif string.find(subject.Name, 1) then\n inVal.Value = 1\nelseif string.find(subject.Name, 2) then\n inVal.Value = 2\nelseif string.find(subject.Name, 3) then\n inVal.Value = 3\nelseif string.find(subject.Name, 4) then\n inVal.Value = 4\nelseif string.find(subject.Name, 5) then\n inVal.Value = 5\nelseif string.find(subject.Name, 6) then\n inVal.Value = 6\nelseif string.find(subject.Name, 7) then\n inVal.Value = 7\nelseif string.find(subject.Name, 8) then\n inVal.Value = 8\nelseif string.find(subject.Name, 9) then\n inVal.Value = 9\nend\n</code></pre>\n"^^ . "3"^^ . . "1"^^ . "2"^^ . . . "0"^^ . . . . . . . . . . . . "<p>I am trying to create a Shop-Keep in minecraft using the ComputerCraft mod. Currently, I have three options passed into my function, but when I try to select one, only the first one correctly breaks the loop. I want to have the player select and option twice to have it go through, so they change their choice if they missclicked. Right now, only the first option updates at all.</p>\n<pre><code>function UTOptions(opt)\n local FR = 0\n local max = 14\n local w,h = term.getSize()\n local check = {}\n while true do\n for i,v in ipairs(opt) do\n if(string.len(v)&gt;max) then\n error(&quot;Option is too long.&quot;)\n end\n if (FR == 0) then\n check[i] = 0\n end\n term.setCursorPos(w-15,i+2)\n if (check[i]== 1) then\n term.setTextColor(colors.red)\n write(&quot;*&quot;)\n term.setTextColor(colors.white)\n write(v)\n else\n write(&quot;*&quot;..v)\n end\n end\n local event, side, mx, my = os.pullEvent(&quot;monitor_touch&quot;)\n if (check[my-2] == 0) then\n check[my-2] = 1\n for i,v in ipairs(check) do\n if (v ~= my-2) then\n check[i] = 0\n end\n end\n elseif (check[my-2]==1) then\n return my-2\n end\n FR = 1\n end\nend\n</code></pre>\n<p>I've tried to change the values in\n<code>local event, side, mx, my = os.pullEvent(&quot;monitor_touch&quot;) if (check[my-2] == 0) then...</code>\nsuch as using my-3 and my-4, but that only changes which option works, and the others still don't update. I have a feeling that the error has something to do with this part:</p>\n<pre><code> for i,v in ipairs(check) do\n if (v ~= my-2) then\n check[i] = 0\n end\n end\n</code></pre>\n<p>I can't find a better way to update all the un-selected options to 0.</p>\n"^^ . "1"^^ . . "0"^^ . . . . "0"^^ . "1"^^ . "java"^^ . . . . "Script randomly stopped working, despite not changing it or updating g hub"^^ . . . . . . . "0"^^ . "1"^^ . "@Assaf Sorry made a mistake with the instructions. Made an edit to the answer. Reload Neovim after you make the changes as well."^^ . . . . "So do answer your question on how to make `.content` update: Wait 0.01 seconds between unminimising the client and grabbing the screenshot (= start a timer). Oh and of course: Hope that 0.01 seconds is enough. It will sometimes fail because that time was not long enough."^^ . . . "<p>LocalScripts run only in certain locations:\n<a href="https://create.roblox.com/docs/projects/data-model#client" rel="nofollow noreferrer">https://create.roblox.com/docs/projects/data-model#client</a></p>\n<p>You can replace the Animate LocalScript with a ServerScript or a ServerScript with RunContext set to Client.</p>\n"^^ . . . . "2"^^ . . . "The first `tool.Equipped:Connect(IncrementSips)` is unnecessary, because that tool will never be equipped by anyone. Only clones of that tool will."^^ . . "<p>When developing your own server, you can simply save the file you're editing, then in the server console, execute the &quot;refresh&quot; command and then &quot;ensure [name of the resource]&quot;. This will update the scripts without having to restart the server and the client !</p>\n"^^ . "Again. the names are gone, without wizardry you can not recover them. Yes code files are in the resource,car,"^^ . "0"^^ . . . "0"^^ . "0"^^ . . . . "0"^^ . "0"^^ . . . . . . "Roblox LocalScript Triggering Code Multiple Times"^^ . . "Now i find this problem when using the following on the .lua script\n`source_sh("bash", "/apps/spack/share/spack/setup-env.sh")`\n\n==> Error: `spack load` requires Spack's shell support.\n To set up shell support, run the command below for your shell.\n For bash/zsh/sh:\n . /apps/spack/share/spack/setup-env.sh"^^ . . . . "1"^^ . "1"^^ . . . "4"^^ . "minecraft"^^ . . "0"^^ . . "1"^^ . . "[Please do not upload images of code/data/errors.](//meta.stackoverflow.com/q/285551)"^^ . . "0"^^ . "powerdns"^^ . . "1"^^ . "nginx-ingress"^^ . "awesome-wm"^^ . . . . . . "0"^^ . "1"^^ . . "Why do you expect a double free to occur here? The first call to `collectgarbage` should free the object. After that, it's freed; GC doesn't care about it anymore. The second call to `collectgarbage` hence does nothing. I'm not sure how you expect to achieve a double free in a garbage-collected language."^^ . . "NGINX / Lua - dynamic root folder / URI rewrite"^^ . . . . "hey there, just tried what you suggested and still the same issue."^^ . . "0"^^ . . . . . . "0"^^ . "0"^^ . . . "0"^^ . "LunarVIM/Neovim create new filtetype and syntax"^^ . "I might end up parsing it twice, but I'm still holding out hope for something a bit more principled."^^ . . "0"^^ . "<p>I'm working with the game GeminiLost from playfirst, they have an assets.pfp file that can be extracted using a <a href="https://aluigi.altervista.org/bms/pfpk.bms" rel="nofollow noreferrer">BMS Script</a></p>\n<p>After extraction it is possible to see lua scripts that were compiled using lua 5.0</p>\n<p>I try to use ChunkBake, luadec, unluac and they all always give the same error, using ChunkSpy it is possible to see that you can identify a large part of the file but at the end it shows an error at the end <a href="https://pst.innomi.net/paste/t64yzafnd4o5nv7nad36uj8x" rel="nofollow noreferrer">Output Log</a></p>\n<p>ChunkSpy:392: bad argument #1 to `len' (string expected, got nil)</p>\n<p>using ChunkBake:</p>\n<pre class="lang-lua prettyprint-override"><code>ChunkBake: A Lua 5 binary chunk assembler\nVersion 0.7.0 (20050512) Copyright (c) 2005 Kein-Hong Man\nThe COPYRIGHT file describes the conditions under which this\nsoftware may be distributed (basically a Lua 5-style license.)\n\n* Run with option -h or --help for usage information\nChunkBake:260: ok.lua:1: Error: unknown character or control character\n</code></pre>\n<p>using luadec:</p>\n<pre><code>luadec.exe: bad code in ok.lua\n</code></pre>\n<p>using unluac:</p>\n<pre><code>Exception in thread &quot;main&quot; java.lang.NullPointerException: Cannot invoke &quot;unluac.decompile.Op.ordinal()&quot; because the return value of &quot;unluac.decompile.Code.op(int)&quot; is null\n at unluac.decompile.ControlFlowHandler.find_branches(ControlFlowHandler.java:344)\n at unluac.decompile.ControlFlowHandler.process(ControlFlowHandler.java:118)\n at unluac.decompile.Decompiler.decompile(Decompiler.java:136)\n at unluac.Main.main(Main.java:98)\n</code></pre>\n<p>I'm confused, do I need to make any changes to all the .lua files in the game or is there an error when unzipping the .pfp file?\n<a href="https://drive.google.com/file/d/1FQ9G0Fr3OHyEf2GWPjAxx4XMs5KZqXeo/view?usp=drive_link" rel="nofollow noreferrer">.lua file examples</a></p>\n"^^ . "<p>I'm doing a prank ransomware program using AutoPlay Media Studio and the only script I did was this:</p>\n<pre class="lang-lua prettyprint-override"><code>Dialog.Message(&quot;A message from ElsaWare...&quot;,&quot;WRONG CODE! Didn't you pay to me?&quot;)\n</code></pre>\n<p>Now, what I'm planning to do is a script that goes like this: In the input box, once you put the correct code, you'll get a message like &quot;That's the right code! Now your videos will be recovered.&quot;. But if you add the incorrect code, you'll get the message that I've written above.</p>\n"^^ . "2"^^ . . . . "<pre><code>--test.lua\nlocal s = io.read()\nfor i=1, utf8.len(s) do\n local cp = utf8.codepoint(s,i)\n print(cp)\n print(utf8.char(cp))\nend\n</code></pre>\n<p>Run in a PowerShell terminal through the Terminal app:</p>\n<pre><code>C:\\&gt;chcp 65001\nActive code page: 65001\n\nC:\\&gt;lua test.lua\nabæ\n97\na\n98\nb\n230\næ\n\nC:\\&gt;\n</code></pre>\n<p>Notice the nonascii 'æ' gets printed and with it's codepoint value of 230</p>\n<p>If I do the same from a regular PowerShell window (i.e. not through the Terminal app):</p>\n<pre><code>C:\\&gt;chcp 65001\nActive code page: 65001\n\nC:\\&gt;lua test.lua\nabæ\n97\na\n98\nb\n0\n\n\nC:\\&gt;\n</code></pre>\n<p>Now the 'æ' is not correctly interpreted.</p>\n<p>I was debugging in VS Code and noticed this during of the sessions. At first I thought it was a problem with how VS Code ran the terminals, but it is apparently a more general difference between the regular PowerShell (and CMD) app and when it's run through the Terminal app. What gives?</p>\n<p>Edit: As per JosefZ's request is here the output of ([console]::InputEncoding, [console]::OutputEncoding, $OutputEncoding) | Select-Object -Property EncodingName, WindowsCodePage, Codepage:</p>\n<pre><code>EncodingName WindowsCodePage CodePage\n------------ --------------- --------\nUnicode (UTF-8) 1200 65001\nOEM United States 1252 437\nUS-ASCII 1252 20127\n</code></pre>\n<p>It's the same for both (PowerShell alone and PowerShell in Terminal)</p>\n<p>I use Lua 5.4</p>\n"^^ . . . "0"^^ . "0"^^ . . . . "1"^^ . . . . . "<p>Using Neovim with <strong>NVChad</strong>.</p>\n<p>I have read the documentation but can't get it to work unless I add my custom snippets to the default <code>friendly-snippets</code> folder.</p>\n<p>According to the NVChad docs:</p>\n<pre><code>-- vscode format i.e json files\nvim.g.vscode_snippets_path = &quot;your snippets path&quot;\n\n-- snipmate format \nvim.g.snipmate_snippets_path = &quot;your snippets path&quot;\n\n-- lua format \nvim.g.lua_snippets_path = vim.fn.stdpath &quot;config&quot; .. &quot;/lua/lua_snippets&quot;\n</code></pre>\n<p>These are the relevant files from my project, but nothing makes a difference.\nI can see that Neovim is picking up the <code>vscode_snippets_path</code> but it's not loading the custom snippets.\nI haven't changed anything else to do with snippets in the configuration.</p>\n<p><a href="https://i.sstatic.net/9HvUp.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9HvUp.png" alt="enter image description here" /></a></p>\n<p>What am I missing?</p>\n"^^ . . . . . . "math"^^ . "How do i change the text in a text label when a player is changing teams and interacting a proximity prompt (LUA)"^^ . "0"^^ . . "vscode-debugger"^^ . . . . . . "1"^^ . "How do you install the plugin in your docker ?"^^ . "I am writing in notepad, Full code is in the text Please wait a moment. My question lacks information.\nI'll write again in the comments"^^ . . . "0"^^ . . "4"^^ . . . . . "What are the types of decimal and char? What do utf8Char and utf8Byte return? Why is there an addtional argument in your example? Lua already has utf8.char and utf8.codes, why not use them?"^^ . . . "0"^^ . . "0"^^ . . "<p>You are only updating the value ONCE, I highly recommend you look into events but for now we will use the propertychangedsignal for this purpose.</p>\n<p>I also believe you are making the grave mistake of using a numbervalue, instead of intvalue: Since the number value <em>cannot be set/incremented to another value</em>. So if you are change that to an intvalue too.</p>\n<p>I also took note that you did made a nice variable called &quot;NumberValue&quot; but didnt used it. Which I believe you should as it makes your code much more cleaner.</p>\n<pre><code>local NumberValue = workspace.Core.Ball.Value \n\nNumberValue:GetPropertyChangedSignal(&quot;Value&quot;):Connect(function()\n if NumberValue &gt;= 100 then\n script.Parent.Text = &quot;Temp:&quot;..NumberValue..&quot;Stable&quot;\n end\n \nend)\n \n</code></pre>\n"^^ . "How can I use lua language json.encode without breaking the order of the list?"^^ . . "1"^^ . "0"^^ . "0"^^ . "1"^^ . . "0"^^ . . . . . "1"^^ . . "0"^^ . . "1"^^ . "1"^^ . . "1"^^ . "0"^^ . "My Roblox frame isn't going to the next frame?"^^ . . . . "`the files are obfuscated` - they look like usual Lua 5.1 bytecode files, without obfuscation"^^ . "<p>So this creates a <code>location</code> context in your <code>nginx.conf</code> (under a <code>server</code> context):</p>\n<pre><code>- path: /app-2\n pathType: Prefix\n backend:\n service:\n name: app-2\n port:\n number: 80\n</code></pre>\n<p>and this also creates a location context with the same name:</p>\n<pre><code>location /app-2 {\n rewrite_by_lua_block {\n ngx.status = 403;\n ngx.exit(ngx.HTTP_FORBIDDEN);\n }\n}\n</code></pre>\n<p>It's likely that this one is defined above the other one so it's overriding it.</p>\n<p>You can check with this:</p>\n<pre><code>kubectl cp &lt;nginx-ingress-controller-pod&gt; -c nginx nginx.conf nginx.conf\ncat nginx.conf\n</code></pre>\n"^^ . . . "<p>I am writing some plugin for neovim in lua. At some point plugin reads some list of files, and this list's size can be &gt;1000. Function that reads file is</p>\n<pre class="lang-lua prettyprint-override"><code>local uv = vim.loop\nfunction utils.read_file(path, callback)\n uv.fs_open(path, &quot;r&quot;, 438, function(err, fd)\n assert(not err, err)\n assert(fd, fd)\n uv.fs_fstat(fd, function(s_err, stat)\n assert(not s_err, s_err)\n assert(stat, stat)\n uv.fs_read(fd, stat.size, 0, function(r_err, data)\n assert(not r_err, r_err)\n uv.fs_close(fd, function(c_err)\n assert(not c_err, c_err)\n callback(data)\n end)\n end)\n end)\n end)\nend\n</code></pre>\n<p>and it is called from loop like</p>\n<pre class="lang-lua prettyprint-override"><code>for _, path in ipairs(paths) do\n utils.read_file(path, some_process_func)\nend\n</code></pre>\n<p>I faced with error</p>\n<pre><code>... EMFILE: too many open files: ...\n</code></pre>\n<p>when size of <code>paths</code> was too big.</p>\n<p>So question is how to deal with this situation? I tried to make kinda semaphore which looks like</p>\n<pre class="lang-lua prettyprint-override"><code>local sema = 10\nfor _, path in ipairs(paths) do\n while sema == 0 do end\n sema = sema - 1\n utils.read_file(path, function()\n sema = sema + 1\n --...\n end)\nend\n</code></pre>\n<p>but it only causes infinite loop and my neoviw stucks forever. My requirements to this part of code is async fs operations, so i don't want to just make it sync and run in other thread. I look for some queue to overflowed async operations will be located in while other operations is working.</p>\n"^^ . "reveal.js"^^ . . "0"^^ . . . "1"^^ . . . . . . . "0"^^ . . "Remove auto format and autofix from ZLS COMPLETELY (with nvim kickstart)"^^ . . . "<p>So I'm trying to use the default Roblox &quot;Animate&quot; client side script on an NPC and when I try it, none of the animations load at all</p>\n<p>When I try to run the game with the code, nothing happens and there is no errors on the output. If you can, I would appreciate help on this</p>\n"^^ . "0"^^ . . . . . "1"^^ . . . . . "2"^^ . "4"^^ . "code-snippets"^^ . . . "this would also count accessories/tool as a hitbox wich would give some players a disadvantage to others. @Ryan"^^ . . "How to add a point to a leaderboard whenever a tool is used via Lua?"^^ . . . . "1"^^ . . . "0"^^ . . . . . "0"^^ . . . . "3"^^ . "0"^^ . . . "1"^^ . . . . . "lunarvim"^^ . . "ide"^^ . . . . . . . . "1"^^ . "1"^^ . . "0"^^ . . . "1"^^ . "1"^^ . "Yo I actually think thats the case, cause the server side keep printing when I touch the ball but the client side never printed. But I wanna ask, even if we know the case how do I fix it."^^ . . "0"^^ . "2"^^ . "1"^^ . . "@Yorick Yes it could be false on NPCs without a Humanoid but since we only want to find the Player this should be fine. Most of the time though NPCs will use Humanoid because they need to walk around or do things only an Humanoid can do (at least without reinventing Humanoids)"^^ . "0"^^ . . . . . . "1"^^ . "0"^^ . . . . "0"^^ . . . . . . "1"^^ . . . . "Roblox default animate script not working on NPC"^^ . . "regex"^^ . "0"^^ . "1"^^ . "1"^^ . . . . . "<h4>If using <a href="https://github.com/kdheepak/lazygit.nvim" rel="nofollow noreferrer">Lazygit</a> plugin:</h4>\n<p>You would put this in your nvim/lua/plugins/lazy.lua file since your package manager is Lazy.</p>\n<pre><code># nvim/lua/plugins/lazy.lua\n\nrequire(&quot;lazy&quot;).setup({\n -- Rest of your requirements...\n {\n &quot;kdheepak/lazygit.nvim&quot;,\n cmd = {\n &quot;LazyGit&quot;,\n &quot;LazyGitConfig&quot;,\n &quot;LazyGitCurrentFile&quot;,\n &quot;LazyGitFilter&quot;,\n &quot;LazyGitFilterCurrentFile&quot;,\n },\n -- optional for floating window border decoration\n dependencies = {\n &quot;nvim-lua/plenary.nvim&quot;,\n },\n -- setting the keybinding for LazyGit with 'keys' is recommended in\n -- order to load the plugin when the command is run for the first time\n keys = {\n { &quot;&lt;leader&gt;lg&quot;, &quot;&lt;cmd&gt;LazyGit&lt;cr&gt;&quot;, desc = &quot;LazyGit&quot; }\n }\n },\n -- Rest of your requirements...\n})\n</code></pre>\n<p>Run <code>:Lazy install</code> at the end.</p>\n<h4>If using Lazygit installed separately on the system:</h4>\n<p>Running <code>:terminal lazygit</code> will open up Lazygit for you.</p>\n<pre><code>vim.keymap.set('n', '&lt;space&gt;gg', ':terminal lazygit&lt;CR&gt;')\n</code></pre>\n<p>Or in my personal config I run it on <a href="https://github.com/akinsho/toggleterm.nvim" rel="nofollow noreferrer">Togglterm</a> in a floating/split terminal.</p>\n<pre><code>local Terminal = require(&quot;toggleterm.terminal&quot;).Terminal\n\n-- Lazygit\nlocal lazygit = Terminal:new({\n cmd = &quot;lazygit&quot;,\n hidden = true,\n direction = &quot;float&quot;,\n close_on_exit = true,\n})\n\nfunction _LAZYGIT_TOGGLE()\n lazygit:toggle()\nend\n\nkeymap(&quot;n&quot;, &quot;&lt;leader&gt;tg&quot;, &quot;&lt;cmd&gt;lua _LAZYGIT_TOGGLE()&lt;CR&gt;&quot;, opts)\n</code></pre>\n"^^ . "How to remove function from "for" in Roblox Studio?"^^ . "Maybe try to use the `io.popen()` function"^^ . . . . . "0"^^ . "Which physics library are you using to determine a hit between the ball and the player?"^^ . . "Maybe above the line `game:GetService("Workspace")["Basement Detector"].Touched:Connect(function(otherPart: BasePart)`, add a `print("Enabled the BasementDetector")` and see if that gets called more than once (and the same number of times as "Triggered" gets printed)."^^ . "3"^^ . "1"^^ . . "0"^^ . "0"^^ . . . . . "0"^^ . "Okey, I have no idea what's going on, haha! I nuked `/mason/bin` and applied your config once again, now it work's just fine for some reason https://pastebin.com/sHk2GPTC I've only change formatting and removed some white spaces from yours init.lua, and now it "just" works https://pastebin.com/VHSwBtus I'm leaving this topic as I wasted so much time on it, but I'm actually curious what the issue is. Please check your setup according to my previous comments and write back. Cheers!"^^ . "You're missing a comma after the last field. See [this](https://github.com/ziglang/zig/issues/3057) for an explanation."^^ . . . . . "decompiling"^^ . . . . "@DmitryMeyer Other folders which then contain html/css/js. For example:\n/startpage/foo/index.html\n/startpage/bar/index.html\n/html/document1/index.html\n/html/document2/index.html\n\nAnd so on."^^ . . "1"^^ . "1"^^ . . "nlua"^^ . . . "Please show us the logs in the [Output Window](https://create.roblox.com/docs/studio/output) or [Developer Console](https://create.roblox.com/docs/studio/developer-console) so we know what's working, what isn't, and any errors or warnings with your code."^^ . . "<p>This has nothing to do with &lt;const&gt;, you can use an old version of Lua (&lt;= 5.1.4) to test the code below:</p>\n<pre><code>function bar()\n if false then\n print(&quot;Hello World!&quot;)\n end\nend\n</code></pre>\n<p>And you will see an optimized result:</p>\n<pre><code>JMP 3 ;jump to return\nGETGLOBAL 0 -1\nLOADK 1 -2\nCALL 0 2 1 \nRETURN 0 1\n</code></pre>\n<p>Very good, right? But an issue is hidden here. As is well known, the logical operators in Lua (<code>and</code>, <code>or</code>) are quite unique. In fact, they share the same logic as some statements such as <code>if-else</code>, and jumping up directly causes such a bug:</p>\n<pre><code>-- version &lt;= 5.1.4: nil\nprint(((nil and nil) or false) and true)\n</code></pre>\n<p>Due to the fact that the left expression (<code>(nil and nil) or false</code>) of the last <code>and</code> is clearly falsy, lua skips evaluating the value of the expression, resulting in some slight deviations in the final result. So lua's solution is to always evaluate falsy expressions.</p>\n<p>You may ask if there is a better solution, and I think there must be, but you also need to know that lua has very few developers.</p>\n"^^ . . . . . "1"^^ . . . . . . "0"^^ . "Do what the Lua command line interpreter does: try it as is first; if it fails, prepend "return " and try again. See https://www.lua.org/source/5.4/lua.c.html#loadline"^^ . "1"^^ . . . "0"^^ . "<p>If you also put a comma in the last line, the formatting will be implemented accordingly:</p>\n<pre class="lang-zig prettyprint-override"><code>const Container = struct {\n childs: std.ArrayList(),\n content: []u8,\n};\n</code></pre>\n<p>This also applies, for example, to parameters in functions, etc.:</p>\n<pre class="lang-zig prettyprint-override"><code>fn foo(\n p1: u8,\n p2: u8,\n p3: u8,\n) void {\n</code></pre>\n"^^ . "luajit"^^ . . . "feel free to edit it and i will be pleased to up vote your comment, no worries"^^ . "0"^^ . "<p>You can check the <a href="https://create.roblox.com/docs/reference/engine/datatypes/RaycastResult" rel="nofollow noreferrer"><code>RaycastResult</code></a>'s ancestor for a <a href="https://create.roblox.com/docs/reference/engine/classes/Humanoid" rel="nofollow noreferrer"><code>Humanoid</code></a> to determine if your <a href="https://create.roblox.com/docs/reference/engine/classes/WorldRoot#Raycast" rel="nofollow noreferrer"><code>Raycast</code></a> has hit a <a href="https://create.roblox.com/docs/reference/engine/classes/Player" rel="nofollow noreferrer"><code>Player</code></a>.</p>\n<p>Since every player's <a href="https://create.roblox.com/docs/reference/engine/classes/Player#Character" rel="nofollow noreferrer"><code>Character</code></a> is a <a href="https://create.roblox.com/docs/reference/engine/classes/Model" rel="nofollow noreferrer"><code>Model</code></a> and has a <code>Humanoid</code> child, if your raycast hits a model with a <code>Humanoid</code> we can safely assume that we've hit the player's character.</p>\n<p>From there you can use <a href="https://create.roblox.com/docs/reference/engine/classes/Players#GetPlayerFromCharacter" rel="nofollow noreferrer"><code>Players:GetPlayerFromCharacter</code></a> to get the <code>Player</code> from its <code>Character</code>.</p>\n<pre class="lang-lua prettyprint-override"><code>if raycastResult and raycastResult.Instance then\n raycastResult.Instance.Color = Color3.new(1, 0, 0)\n\n -- The instance hit will be a child of a character model\n -- If a humanoid is found in the model then it's likely a player's character\n local characterModel = raycastResult.Instance:FindFirstAncestorOfClass(&quot;Model&quot;)\n if characterModel then\n local humanoid = characterModel:FindFirstChild(&quot;Humanoid&quot;)\n if humanoid then\n print(&quot;Detected &quot; .. characterModel.Name)\n end\n end\nend\n</code></pre>\n<p>The above code will check if the <code>Raycast</code> has an ancestor that is a <code>Model</code> and then if that model has a <code>Humanoid</code>. If we do then, in this case, print that we detect the player along with the player's name.</p>\n"^^ . "-1"^^ . "<p>I've been trying to make an Anti-Noclip script, but it doesn't work too well. Could someone help me or tell me what's wrong and how to fix it?</p>\n<p>This is the code I currently have:</p>\n<pre class="lang-lua prettyprint-override"><code>local function CheckNoclip(previous_pos: CFrame, current_pos: CFrame, player: string)\n local raycastResult = workspace:Raycast(current_pos, previous_pos)\n \n local char = workspace:FindFirstChild(player)\n \n if raycastResult then\n print(&quot;Instance:&quot;, raycastResult.Instance)\n print(&quot;Position:&quot;, raycastResult.Position)\n print(&quot;Distance:&quot;, raycastResult.Distance)\n print(&quot;Material:&quot;, raycastResult.Material)\n print(&quot;Normal:&quot;, raycastResult.Normal)\n end\n \n if raycastResult then\n if raycastResult.Instance.CanCollide == true and (not (raycastResult.Instance:IsDescendantOf(char)) ) then\n local Physical_Part = workspace:FindFirstChild(player)\n local RootPart = Physical_Part:WaitForChild(&quot;HumanoidRootPart&quot;)\n \n RootPart.CFrame = CFrame.new(previous_pos)\n warn(&quot;No-Clip Found&quot;)\n end\n print(&quot;---------------------------------&quot;)\n end\nend\n\nlocal players = game.Players\n\nplayers.PlayerAdded:Connect(function(plr: Player)\n local player_name = plr.Name\n plr.CharacterAdded:Wait()\n local RootPart = workspace:FindFirstChild(player_name).HumanoidRootPart\n local prev_position = RootPart.CFrame.Position\n local current_position = prev_position\n \n while true do\n current_position = RootPart.CFrame.Position\n if prev_position ~= current_position then\n CheckNoclip(prev_position, current_position, player_name)\n prev_position = current_position\n end\n wait()\n end\nend)\n</code></pre>\n<p>This keeps happening: <a href="https://youtu.be/5hF6SoNxX08" rel="nofollow noreferrer">https://youtu.be/5hF6SoNxX08</a> (I uploaded it as an unlisted <a href="https://youtu.be/5hF6SoNxX08" rel="nofollow noreferrer">youtube video</a>)</p>\n"^^ . . "You can store any values in the object, but you are using object just as unique key."^^ . . "<p>I'm trying to configure LSP in <a href="https://neovim.io/" rel="nofollow noreferrer">Neovim</a> using <a href="https://github.com/neovim/nvim-lspconfig" rel="nofollow noreferrer">lsp-config</a>. I need to install <code>lua-language-server</code> to make the Lua LSP work, but I don't know how to install <code>lua-language-server</code> on Linux. The <a href="https://luals.github.io/#neovim-install" rel="nofollow noreferrer">official documentation</a> only shows how to install it for macOS and Windows.</p>\n<p>Could you help me install it?</p>\n<p>Ultimately, <code>lua-language-server</code> should be available in the terminal so that <code>lsp-config</code> can use it.</p>\n"^^ . "0"^^ . . . . . "0"^^ . . . . . "HAProxy Fails to Execute Lua Script Correctly and Cannot Detect Backend"^^ . . . . "0"^^ . . . "<p>Here's the way for choosing &quot;B. From latest release&quot; from <a href="https://github.com/LuaLS/lua-language-server/releases" rel="nofollow noreferrer">github</a>.</p>\n<ol>\n<li>Download the <code>.gz</code> file that meets your architecture.</li>\n<li>I'd like to put the files to <code>~/.local/share/lua-lang-server</code>. You can choose other place for them.</li>\n</ol>\n<pre class="lang-bash prettyprint-override"><code>mkdir -p ~/.local/share/lua-lang-server &amp;&amp; \\\ntar --extract --file &lt;YOUR .gz FILE&gt; -av -C ~/.local/share/lua-lang-server\n</code></pre>\n<ol start="3">\n<li>Create a symbolic link in <code>~/.local/bin</code> to the executable.</li>\n</ol>\n<pre class="lang-bash prettyprint-override"><code>ln -s ~/.local/share/lua-lang-server/bin/lua-language-server ~/.local/bin/lua-language-server\n</code></pre>\n<ol start="4">\n<li>Test if it works by executing <code>lua-language-server</code>.</li>\n<li>(Optional) If step 4 fails since bash cannot find the executable <code>lua-language-server</code>, then you have to append <code>~/.local/bin</code> to the environment variable <code>PATH</code>.</li>\n</ol>\n<pre class="lang-bash prettyprint-override"><code>export PATH=$PATH:~/.local/bin\n</code></pre>\n"^^ . . "Get client content from minimized window - Awesome WM"^^ . "[You can't](https://pomax.github.io/bezierinfo/#arclength), there is no solution for the arc length for cubic and higher Bezier curves. So approximations involving either numerical solutions (e.g. constructing a distance based lookup tables and interpolating for intermediary values) or (piecewise) functional approximation are the best you're going to get."^^ . . "<p>I am currently adding lua support to my game written in c# using lua. Before calling a function in lua that can be there but doesn't have to be, it will check if the function exists in the script before it calls it. For example when an animation loops it will call &quot;{CurrentAnimation}_Loop&quot; for handling random stuff that changes before the loop, but not every animation needs to do stuff before the loop, but after checking if its null it still will try and call it which causes an exception to be thrown.</p>\n<pre><code>if (state.Looping)\n{\n curAnimFrame = state.LoopPos;\n LuaFunction func = luaCode.GetFunction(curState + &quot;_Loop&quot;);\n if(func != null)\n func.Call();\n}\n</code></pre>\n<p>This is the code used for looping. When said function exists it works completely fine as expected, but when it doesn't it will throw <code>NLua.Exceptions.LuaScriptException: 'attempt to call a nil value'</code>. Obviously I could just make a function for every animation but that feels way too tedious and I don't want it calling empty functions. Anyone got any ideas on what I can do?</p>\n<p>EDIT:\nComment by Wh1t3rabbit basically fixed it. Now I just have a function that will check if the object exists instead of getting the function from the lua state itself.</p>\n<pre><code>public void CallLuaFunc(string function, params object[] args)\n{\n LuaFunction func = luaCode[function] as LuaFunction;\n if (func != null)\n func.Call(args);\n}\n</code></pre>\n"^^ . "1"^^ . . "0"^^ . "wpf"^^ . "0"^^ . . "windows-terminal"^^ . "<p><code>с</code> is made of 2 bytes whose values are <code>209</code> and <code>129</code> so <code>a = string.sub(&quot;слово&quot;, 1,1)</code> will get the first of those 2 bytes, that means the character you should be checking the of value <code>209</code> and you can do this in lua by putting an escape and then entering the value in a string literal.</p>\n<pre class="lang-lua prettyprint-override"><code>a = string.sub(&quot;слово&quot;, 1,1)\nif a == '\\209' then\n print('Do stuff')\nend\n</code></pre>\n"^^ . . "0"^^ . . "@darkfrei how would I actually ensure that the next time value is on the same curve segment without sampling curvature for parts of the curve that I won't use?"^^ . . . . "0"^^ . . . . . "This is considered as a bad practice since at the next restart of the nginx pod the configuration will be lost. Prefer using configuration snippet\nsource: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#server-snippet"^^ . "0"^^ . . . . . "1"^^ . "thank you, how would i fix this if you dont mind helping?{ im still new to coding"^^ . . "<p>Normally, any collision checking is a loop:</p>\n<p>(here block is a list of tiles, each tile is a table with x and y positions)</p>\n<pre class="lang-lua prettyprint-override"><code>function detectCollision (movingBlock, staticBlock)\n for i, movingTile in ipairs (movingBlock) do\n for j, staticTile in ipairs (staticBlock) do\n if isColliding (movingTile, staticTile) then\n return true -- yes, at least one collision\n end\n end\n end\n return false -- no, there was no collision\nend\n</code></pre>\n<p>For the movement you can just add extra <code>dx</code> and <code>dy</code> to check the collision by this movement:</p>\n<pre class="lang-lua prettyprint-override"><code>function detectCollision (movingBlock, staticBlock, dx, dy)\n for i, movingTile in ipairs (movingBlock) do\n for j, staticTile in ipairs (staticBlock) do\n if isColliding (movingTile, staticTile, dx, dy) then\n return true -- yes, at least one collision\n end\n end\n end\n return false -- no, there was no collision\nend\n</code></pre>\n<p>Example function to compare two tiles after movement to dx, dy:</p>\n<pre class="lang-lua prettyprint-override"><code>function isColliding (movingTile, staticTile, dx, dy)\n if movingTile.x + dx == staticTile.x\n and movingTile.y + dy == staticTile.y then \n return true -- same position of tiles means collision\n else\n return false -- no collision\n end\nend\n</code></pre>\n"^^ . "0"^^ . . . . "In Luasnip. For some reason the `%a` and `%d` work fine, but for the life of me I can't get this to work. This is the whole snippet:\n`s( { trig = "([%a%d%}])_", regTrig = true, snippetType = "autosnippet", name = "autosnippet subscript", dscr = "autosnippet subscript", }, fmta([[<>_{<>}]], { f(function(_, snip) return snip.captures[1] end), i(1) }), utils.mathOnly)`,\n\nSorry. The block codeblock in a comment looked hideous. This is actually better."^^ . . "0"^^ . . . . . "Please [edit] your question to improve your [mcve]. In particular, share (PowerShel) `([console]::InputEncoding, [console]::OutputEncoding, $OutputEncoding) | Select-Object -Property EncodingName, WindowsCodePage, Codepage`"^^ . . . . . "0"^^ . "javascript"^^ . . . "<p>I am attempting to make a pop-up that displays window previews as a tasklist and have almost gotten it, but for a couple of things.</p>\n<p>I first added a tasklist that used a clienticon widget to group classes and added a button trigger to launch the pop-up widget. Here is my tasklist code:</p>\n<pre><code>function theme.at_screen_connect(s)\n \n ...\n \n -- Create an icon only tasklist widget\n s.mytasklist = awful.widget.tasklist {\n screen = s,\n filter = awful.widget.tasklist.filter.currenttags,\n source = function()\n -- Get all clients\n local cls = client.get()\n \n -- Filter by an existing filter function and allowing only one client per class\n local result = {}\n local class_seen = {}\n local class_num = 0\n local class_index = {}\n for _, c in pairs(cls) do\n if awful.widget.tasklist.filter.currenttags(c, s) then\n if not class_seen[c.class] then\n class_seen[c.class] = true\n class_index[c.class] = class_num\n class_num = class_num + 1\n table.insert(result, c)\n end\n end\n end\n return result\n end,\n -- buttons = awful.util.tasklist_buttons,\n --buttons = awful.button({ }, 1, tasklistButton(c)),\n buttons = awful.button({ }, 1, function (c)\n \n local client_num=0\n \n for i, cl in pairs(client.get()) do\n if cl.class == c.class then\n if cl.screen == c.screen then\n client_num = client_num + 1\n end\n end\n end\n \n if client_num &gt; 1 then\n \n if cl_menu then\n if cl_menu_class == c.class then\n cl_menu.visible = false\n cl_menu=nil\n else\n \n cl_menu.visible = false\n cl_menu=nil\n \n cl_menu_class = c.class\n cl_menu=clientClassPopup(c)\n cl_menu.visible=true\n \n end\n \n else\n cl_menu_class = c.class\n cl_menu=clientClassPopup(c)\n cl_menu.visible=true\n end\n \n else\n \n if cl_menu then\n cl_menu.visible = false\n cl_menu = nil\n end\n \n if client.focus == c then\n c.minimized = true\n \n else\n client.focus = c\n awful.tag.viewonly(c:tags()[1])\n c:raise()\n end\n end\n \n end),\n layout = {\n spacing_widget = {\n {\n forced_width = 24,\n forced_height = 1,\n thickness = 1,\n color = '#BBBBBB',\n widget = wibox.widget.separator\n },\n valign = 'center',\n halign = 'center',\n widget = wibox.container.place,\n },\n spacing = 2,\n layout = wibox.layout.fixed.vertical\n },\n -- Notice that there is *NO* wibox.wibox prefix, it is a template,\n -- not a widget instance.\n widget_template = {\n {\n wibox.widget.base.make_widget(),\n forced_width = 1,\n id = 'background_role',\n widget = wibox.container.background,\n },\n {\n {\n id = 'clienticon',\n widget = awful.widget.clienticon,\n },\n margins = 4,\n widget = wibox.container.margin\n },\n nil,\n create_callback = function(self, c, index, objects) --luacheck: no unused args\n self:get_children_by_id('clienticon')[1].client = c\n end,\n layout = wibox.layout.align.horizontal,\n },\n }\n \n ...\n \n -- Create the wibox\n -- s.mywibox_left = awful.wibar({ position = &quot;left&quot;, screen = s, width = dpi(36), bg = gears.color.create_linear_pattern(&quot;linear:0,0:0,5:0,#ff0000:1,#0000ff&quot;), fg = theme.fg_normal })\n s.mywibox_left = awful.wibar({ position = &quot;left&quot;, screen = s, width = dpi(48), bg = theme.bg_normal, fg = theme.fg_normal })\n\n -- Add widgets to the wibox\n s.mywibox_left:setup {\n layout = wibox.layout.align.vertical,\n small_spr,\n s.mytasklist,\n }\n \n ...\n \nend\n</code></pre>\n<p>From the code you can see that clicking on the tasklist class item triggers a function that handles the pop-up menu. Here is the function code:</p>\n<pre><code>function clientClassPopup(c)\n \n client_class_grid = wibox.widget {\n expand = false,\n forced_num_cols = 1,\n spacing = 1,\n vertical_spacing = 1,\n layout = wibox.layout.grid,\n }\n \n client_class_popup = awful.popup({\n screen = c.screen,\n widget = client_class_grid,\n shape = gears.shape.rounded_rect,\n border_width = 1,\n border_color = theme.fg_focus,\n ontop = true,\n visible = false,\n \n })\n \n client_class_popup:connect_signal('mouse::leave', function(self)\n self.visible = false\n end)\n \n class_count = 0\n \n client_index = 0\n \n class_seen = {}\n \n class_index = {}\n \n for i, cl in pairs(client.get()) do\n \n if not class_seen[cl.class] then\n class_seen[cl.class] = true\n class_index[cl.class] = class_count\n class_count = class_count + 1\n end\n \n if cl.class == c.class then\n if cl.screen == c.screen then\n \n size = 256\n \n local surface = cairo.ImageSurface(cairo.Format.RGB24,20,20)\n local cr = cairo.Context(surface)\n \n local s, geo = gears.surface(cl.content), cl:geometry()\n local scale = math.min(size/geo.width, size/geo.height)\n local w, h = geo.width*scale, geo.height*scale\n local dx, dy = (size-w)/2, (size-h)/2\n \n client_tasklist_item = wibox.widget.imagebox()\n \n client_tasklist_item.fit = function(context, width, height) \n return 100, 100\n end\n \n client_tasklist_item.fit = function(self, context, width, height)\n local size = math.min(width, height)\n return size, size\n end\n \n client_tasklist_item.set_client = function(self, cl)\n ret._private.client[1] = cl\n self:emit_signal(&quot;widget::redraw_needed&quot;)\n end\n \n client_tasklist_item.draw = function(self, content, cr, width, height)\n --cr:translate(dx, dy)\n gears.shape.rounded_rect(cr, w, h, 10)\n cr:clip()\n cr:scale(scale, scale)\n cr:set_source_surface(s)\n cr:paint()\n end\n client_tasklist_item.new = function(cl)\n local ret = wibox.widget.base.make_widget(nil, nil, {\n enable_properties = true,\n })\n \n rawset(ret, &quot;fit&quot; , fit )\n rawset(ret, &quot;draw&quot; , draw )\n rawset(ret, &quot;set_client&quot;, set_client)\n ret._private.client = setmetatable({cl}, {__mode=&quot;v&quot;})\n return ret\n end\n \n client_tasklist_item.forced_width = w\n client_tasklist_item.forced_height = h\n \n client_tasklist_item:buttons(my_table.join(\n awful.button({}, 1, function ()\n if client.focus == cl then\n cl.minimized=true\n client_class_popup.visible=false\n else\n client.focus = cl\n cl:raise()\n client_class_popup.visible=false\n end\n end)\n )\n )\n \n bg_client_tasklist_item = wibox.widget{\n client_tasklist_item,\n bg = theme.bg_normal,\n resize = true,\n shape = gears.shape.rounded_rect,\n widget = wibox.container.background\n }\n \n client_class_grid:add(bg_client_tasklist_item)\n \n client_index = client_index + 1\n end\n end\n \n end\n \n return client_class_popup\nend\n</code></pre>\n<p>The function launches a pop-up with a grid layout and then iterates through clients on the screen and adds an imagebox widget painted with a cairo surface of the client window contents and adds button and hover behaviour My issue comes from minimized clients. When a client is minimized the contents aren't drawable and the box is blank.</p>\n<p>I have tried numerous things to fix this including trying multiple different compositors for Awesome WM. I am running Arch Linux if that helps. In particular I am curious if there is something I am missing in creating the tasklist that would allow me to get the client contents even when minimized when utilizing a compositor.</p>\n<p>Any and all help much appreciated and apologies for the hacky code. LUA and cairo are not my expertise.</p>\n<p>Thank you.</p>\n<p>-Robert</p>\n"^^ . . . . "1"^^ . . . "<p>So I am trying to create a plugin for nvim. The plugin gets the path and name of a certain module passed into a loader function. Now this works for modules where the module name does not have a hyphen. But when there is a hyphen i cant require the module.</p>\n<p>My Code looks like this:</p>\n<pre><code>local function loadmodule(modulePath, moduleName)\n vim.opt.rtp:append(modulePath)\n\n package.loaded[moduleName] = nil\n require(moduleName)\nend\n\nloadmodule(&quot;path/to/module&quot;, &quot;module-name&quot;)\n</code></pre>\n<p>When i execute this code on a module without hyphens no errors show up but when the modules name has hyphens in it i get the error:</p>\n<pre><code>E5108: Error executing lua ./lua/script.lua:5: module 'module-name' not found: \n no field package.preload['module-name'] \ncache_loader: module module-name not found \ncache_loader_lib: module module-name not found \n no file './module-name.lua' \n no file '/usr/share/luajit-2.1/module-name.lua' \n no file '/usr/local/share/lua/5.1/module-name.lua' \n no file '/usr/local/share/lua/5.1/module-name/init.lua' \n no file '/usr/share/lua/5.1/module-name.lua' \n no file '/usr/share/lua/5.1/module-name/init.lua' \n no file './module-name.so' \n no file '/usr/local/lib/lua/5.1/module-name.so' \n no file '/usr/lib/lua/5.1/module-name.so' \n no file '/usr/local/lib/lua/5.1/loadall.so' \n no file '/home/user/.config/nvim//lua/lib/lua/5.1/module-name.so' \n</code></pre>\n<p>obviously I am not just plugging <code>module-name</code> in and the module does exist on the runtimepath but nvim doesn't seem to be able to find it.</p>\n<p>I tried plugging in the modules name and it loading the module.\nWhat happened was, nvim loading the module when it doesn't have hyphens and not loading the module when it has hyphens.</p>\n"^^ . . "quarto"^^ . "@Luatic Maybe I have some ambiguity. `%s?[\\u{4e00}-\\u{9FFF}]+` means one space before a block where all are Chinese words (No space or other characters. So I add the `break`). The 2nd pattern seems to fail implement this because it is based on bytes."^^ . "2"^^ . . "<p>The issue that you are facing is that you are connecting listeners to events and never disconnecting them, or debouncing events that fire multiple times. A common problem, especially with the <code>Touched</code> event is that it can fire when anything in the Workspace touches it, and also fire multiple times for the same character model. If your hand and foot both touch a Part, the event will fire for both of those parts.</p>\n<p>Aside from that, a lot of your game logic should happen in a Script, that way, when sounds are played or objects are moved, hidden, or destroyed, they should happen for everyone at the same time.</p>\n<p>The only thing that needs to happen in a LocalScript is where you display messages. So let's set up a simple way for the server to push messages to the UI.</p>\n<p>So follow these steps :</p>\n<ol>\n<li>Create a RemoteEvent in ReplicatedStorage named <code>DisplayMessage</code></li>\n<li>In your LocalScript, delete everything except for this (don't worry, your code is moving to a Script) :</li>\n</ol>\n<pre class="lang-lua prettyprint-override"><code>-- import services\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\n\n-- find the UI elements\nlocal lblMessage = script.Parent.Message\n\n-- find the RemoteEvent telling us that the server has a message for us\nlocal DisplayMessage = ReplicatedStorage.DisplayMessage\n\n-- display the messages when the server sends them to us\nDisplayMessage.OnClientEvent:Connect(function(message : string, color : Color3)\n lblMessage.Text = message\n lblMessage.Color3 = color\nend)\n</code></pre>\n<ol start="3">\n<li>Create a ModuleScript in ReplicatedStorage to handle logic for debouncing when a player touches a part. Name it <code>debounceTouch</code>. We'll use this to prevent a user from triggering a Touch event multiple times when their Character Model touches a part.</li>\n</ol>\n<pre class="lang-lua prettyprint-override"><code>local Players = game:GetService(&quot;Players&quot;)\n\n-- Debounce a function so that it only fires once per player touch event\nlocal function debounceTouch(part : BasePart, onPlayerTouched : (Player)-&gt;(), onPlayerTouchEnded : (Player)-&gt;()?)\n -- keep track of which players are touching the part\n local playersTouching : { [Player] : number } = {}\n \n local touchedConnection = part.Touched:Connect(function(otherPart : BasePart)\n local player = Players:GetPlayerFromCharacter(otherPart.Parent)\n if not player then\n return\n end\n\n if not playersTouching[player] then\n -- a player has begun touching!\n onPlayerTouched(player)\n playersTouching[player] = 1\n else\n playersTouching[player] += 1\n end\n end)\n local touchEndedConnection = part.TouchEnded:Connect(function(otherPart : BasePart)\n local player = Players:GetPlayerFromCharacter(otherPart.Parent)\n if not player then\n return\n end\n -- when a player stops touching, decrement the counter so that we can clear the debounce flag\n if playersTouching[player] then\n playersTouching[player] -= 1\n if (playersTouching[player] &lt;= 0) then\n playersTouching[player] = nil\n\n -- the player has stopped touching, fire the callback if provided\n if onPlayerTouchEnded then\n onPlayerTouchEnded(player)\n end\n end\n end\n end)\n\n -- return an object that functions like an RbxScriptConnection token so that we can disconnect it when it is no longer relevant\n return {\n Connected = (touchedConnection.Connected or touchEndedConnection.Connected),\n Disconnect = function()\n touchedConnection:Disconnect()\n touchEndedConnection:Disconnect()\n end,\n }\nend\n\nreturn debounceTouch\n</code></pre>\n<ol start="4">\n<li>Create a Script in ServerScriptService, and put this into the contents. This will handle your game logic, and send messages to the players.</li>\n</ol>\n<pre class="lang-lua prettyprint-override"><code>-- import services\nlocal ChatService = game:GetService(&quot;Chat&quot;)\nlocal Players = game:GetService(&quot;Players&quot;)\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal Workspace = game:GetService(&quot;Workspace&quot;)\n\n-- import helper functions\nlocal debounceTouch = require(ReplicatedStorage.debounceTouch)\n\n\n-- create a helper function to send the messages to all players\nlocal DisplayMessage = ReplicatedStorage.DisplayMessage\nlocal function displayMessageWithDelay(delay : number, message : string, color : Color3?)\n task.wait(delay)\n DisplayMessage:FireAllClients(message, color)\nend\n\n-- Wait for any player to load into the game\nif #Players.GetPlayers() == 0 then\n Players.PlayerAdded:Wait()\nend\n\n-- define some values\nlocal SAFEZONE_DAMAGE_PER_SECOND = 10\n\n\n-- write down all the messages at the top\nlocal messages = {\n &quot;Back there is the panic room. If there's any trouble, click the big red button and get inside. We're just going to hole up in here until someone comes to help us.&quot;,\n &quot;[static] This is the Robloxian Police Department, Barricaded Suspects Division. We have a warrant for your arrest on counts of [static]...&quot;,\n &quot;Uh oh...&quot;,\n &quot;If you don't come out and surrender now, we will raid the premises!&quot;,\n &quot;Get to the panic room! NOW!!!&quot;,\n &quot;They're raiding the house... we should be safe in here.&quot;,\n &quot;They're in the panic room!&quot;,\n &quot;I don't think we're as safe as I thought. Grab that rifle from the floor and get to the basement, QUICK!&quot;,\n &quot;Okay... this basement was designed to survive a raid, so we should be okay.&quot;,\n &quot;Put your hands up!&quot;,\n &quot;Get down, part of the wall is still up!&quot;,\n &quot;The Robloxian Freedom Fighters are here! Get into their helicopter and escape to headquarters!&quot;,\n}\n\nlocal colors = {\n black = BrickColor.Black().Color,\n red = BrickColor.Red().Color,\n}\n\n-- load some workspace elements\nlocal ButtonClickDetector = Workspace.Button.Part.ClickDetector\nlocal TouchDetector = Workspace.TouchDetector\nlocal PanicDoor = Workspace[&quot;Panic Door&quot;]\nlocal BasementDetector = Workspace[&quot;Basement Detector&quot;]\nlocal BasementWall = Workspace[&quot;Basement Wall&quot;]\nlocal safezone = Workspace[&quot;Wall Parts&quot;].Safezone\nlocal fighters = Workspace[&quot;Freedom Fighters&quot;]\nlocal helicopter = Workspace[&quot;RFF Heli&quot;]\nlocal talkPart = Workspace[&quot;BSD Commander Parker&quot;].Handle\n\n\n\n\n-- start playing the game\ndisplayMessageWithDelay(7, messages[1])\ndisplayMessageWithDelay(7, messages[2], colors.red)\nscript[&quot;Heli Sound&quot;]:Play()\ndisplayMessageWithDelay(5, messages[3], colors.black)\ndisplayMessageWithDelay(2, messages[4], colors.red)\ndisplayMessageWithDelay(3, messages[5])\n\n-- Enable panic room\nClickDetector.MaxActivationDistance = 32\n\nlocal touchedConnection\ntouchedConnection = TouchDetector.Touched:Connect(function(otherPart: BasePart)\n -- make sure that this only fires if a player touches it\n if not Players:GetPlayerFromCharacter(otherPart.Parent) then\n return\n end\n\n -- disconnect the connection so that it doesn't fire again\n touchedConnection:Disconnect()\n\n -- In the panic room\n task.wait(1)\n script[&quot;Explosion&quot;]:Play()\n displayMessageWithDelay(3, messages[6], colors.black)\n script[&quot;Loud Explosion&quot;]:Play()\n displayMessageWithDelay(2, messages[7], colors.red)\n script[&quot;Extra Loud Explosion&quot;]:Play()\n displayMessageWithDelay(2, messages[8], colors.black)\n\n -- set the door on fire\n PanicDoor.Fire.Enabled = true\n PanicDoor.CanCollide = false\n\n \n local basementTouchedConnection\n basementTouchedConnection = BasementDetector.Touched:Connect(function(otherPart: BasePart)\n -- make sure that this only fires if a player touches it\n if not Players:GetPlayerFromCharacter(otherPart.Parent) then\n return\n end\n\n -- disconnect the connection so it only fires once\n basementTouchedConnection:Disconnect()\n \n -- start playing the next set of messages\n displayMessageWithDelay(2, messages[9])\n displayMessageWithDelay(7, messages[10], colors.red)\n\n -- explode the basement walls\n script[&quot;Extra Loud Explosion&quot;]:Play()\n BasementWall.Transparency = 1\n displayMessageWithDelay(2, messages[11], colors.black)\n\n -- create a list of players currently touching the safezone\n local playersInSafezone = {}\n local playerList = Players:GetPlayers()\n for _, player in ipairs(playerList) do\n playersInSafezone[player] = false\n end\n local safezoneTouchConnection = debounceTouch(safezone, function(player)\n -- when they touch the safezone, mark them as safe\n playersInSafezone[player] = true\n end, function(player)\n -- when they stop touching the safezone, mark them as unsafe\n playersInSafezone[player] = false\n end)\n\n task.wait(1)\n for i = 10, 0, -1 do\n task.wait(1)\n script.Gunfire:Play()\n\n -- Check if they are in a safe area\n for player, isSafe in pairs(playersInSafezone) do\n if not isSafe then\n -- Damage player\n player.Character.Humanoid:TakeDamage(SAFEZONE_DAMAGE_PER_SECOND)\n --ReplicatedStorage.DamagePlayer:FireServer(10)\n end\n end\n end\n\n -- clean up the safezone events\n safezoneTouchConnection:Disconnect()\n playersInSafezone = nil\n\n -- Change message\n displayMessageWithDelay(0, messages[12])\n BasementWall.CanCollide = false\n\n -- move the fighters into place\n fighters[&quot;RFF-Beta-31&quot;]:MoveTo(Vector3.new(-100.242, 3.003, 39.393))\n fighters[&quot;RFF-Alpha-0&quot;]:MoveTo(Vector3.new(-103.259, 3.003, 31.674))\n fighters[&quot;RFF-Epsilon-97&quot;]:PivotTo(CFrame.new(-90.501, 9.305, 40.968))\n fighters[&quot;RFF-Sigma-69&quot;]:MoveTo(Vector3.new(-98.693, 3.003, 24.884))\n fighters[&quot;RFF-Gamma-3&quot;]:MoveTo(Vector3.new(-122.102, 3.003, 25.833))\n fighters[&quot;RFF-Foxtrot-11&quot;]:MoveTo(Vector3.new(-96.868, 3.003, 48.219))\n fighters[&quot;RFF-Delta-4&quot;]:MoveTo(Vector3.new(-113.647, 3.003, 32.763))\n helicopter:PivotTo(CFrame.new(-105.629, 3.5, 49.35))\n \n ChatService:Chat(talkPart, &quot;It's an ambush!&quot;)\n print(&quot;Triggered&quot;)\n task.wait(1)\n script[&quot;Machine Gun Fire&quot;]:Play()\n end)\nend)\n</code></pre>\n<ol start="5">\n<li>Finally, move all the sounds that were children of your LocalScript over to the Script. This will ensure that the path to the sounds is preserved.</li>\n</ol>\n<p>You'll notice that I've changed how you are damaging the player, and how the safezone works. This way we can quickly check who is touching the safezone every time without needing to ask the engine to do lookups of parts to players.</p>\n<p>The only other thing I really did was move all of the game messages to a list at the top, this wasn't really necessary, but I thought it would make it easier to see the game logic instead of reading through the messages inside the body of the script. This is my preference, and really isn't necessary for the functioning of your code.</p>\n<p>Hopefully this helps.</p>\n"^^ . "unicode"^^ . . . . . . . . "0"^^ . "0"^^ . . . . "<p>The APK file can be extracted as a zip.</p>\n<p>Using the <a href="https://github.com/0BuRner/corona-archiver" rel="nofollow noreferrer">Corona-archiver</a> you can extract the content of the <code>resource.car</code> file.</p>\n<p>Using <a href="https://github.com/HansWessels/unluac" rel="nofollow noreferrer">unluac</a> you can decompile the <code>*.lu</code> files.</p>\n<p>However, at this point you will notice that all the names of local variables are gone and thus unrecoverably hard to read.</p>\n"^^ . . . "you can show what went wrong with building from scratch, if the target os is linux like, suppose it's fixable"^^ . . "0"^^ . . . . . "0"^^ . . . "0"^^ . . . "Roblox Studio Lua: Detecting with Water reduces Health. How to make it stop when out of water"^^ . . "What is in the `startpage` folder?"^^ . . . . "<p>I would like to use a Lua script with <a href="https://github.com/kubernetes/ingress-nginx/tree/main" rel="nofollow noreferrer">ingress-nginx</a> to block traffic to the specific path. I created the below config, but it doesn't work as expected.</p>\n<pre><code>apiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n name: example-ingress\n annotations:\n nginx.ingress.kubernetes.io/rewrite-target: /$1\n nginx.ingress.kubernetes.io/server-snippet: |\n location /app-2 {\n rewrite_by_lua_block {\n ngx.status = 403;\n ngx.exit(ngx.HTTP_FORBIDDEN);\n }\n }\nspec:\n rules:\n - http:\n paths:\n - path: /app-1\n pathType: Prefix\n backend:\n service:\n name: app-1\n port:\n number: 80\n - path: /app-2\n pathType: Prefix\n backend:\n service:\n name: app-2\n port:\n number: 80\n \n~ curl http://A.B.C.D/app-2\n&lt;html&gt;&lt;body&gt;&lt;h1&gt;It works!&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;\n</code></pre>\n"^^ . . . . "1"^^ . . "Neovim: LSP not attaching to buffer"^^ . "1"^^ . "3"^^ . "Is the simple trick of "try loading as a chunk, if that fails, prepend `return ` and try again" not sufficient?"^^ . "none-ls"^^ . . . "1"^^ . "<p>Well, the output of the print() commands is outside of lua. So it might be different depending on your terminal. I have a case where a program prints a UTF character with 3 bytes ok in Konsole, but the same program prints garbage in GNOME.</p>\n"^^ . . . "With a little more programming experience it will become clear to you that if a `return` is always executed in a loop, the loop body will never run more than once."^^ . . "0"^^ . . . . . "1"^^ . . "i think you misread the answer? a closure can turn a block into an expression, not the other way around. if you want to turn an expression into a block, prepend it with `return `."^^ . . . "1"^^ . . "<p>I'm having trouble getting my script to update the UI with Lua data. I've handled the JavaScript part to the best of my ability as I'm reacquainting myself with frontend development. My friend and I are collaborating on an RZ script—I've handled the frontend UI, and he's tackled the Lua. We're attempting to pass Lua data to the JavaScript for UI updates, but it seems like something's faulty. So i was able to do everything but trying to handle the data for the top 4 players which is not updating i setup console logs and I'm still confused.\n<a href="https://i.sstatic.net/xAMwM.png" rel="nofollow noreferrer">enter image description here</a> <a href="https://i.sstatic.net/f7eBv.png" rel="nofollow noreferrer">enter image description here</a>\nI tried many ways but still not work this is my current js</p>\n<pre><code> function clearText(ids) {\n ids.forEach(function(id) {\n $('#' + id).text('');\n });\n}\n\nwindow.addEventListener('message', function(event) {\n const type = event.data.type;\n const playerData = event.data.PlayerData;\n const zonedata = event.data.zonedata;\n \n\n updateUI(playerData, zonedata);\n});\n\nfunction updateUI(playerData, zonedata) {\n // Get UI elements\n const leaderElement = document.getElementById(&quot;leader&quot;);\n const leaderKillsElement = document.getElementById(&quot;leaderkills&quot;);\n const killStreakNameElement = document.getElementById(&quot;killstreakname&quot;);\n const killStreakNumberElement = document.getElementById(&quot;killstreaknumber&quot;);\n const rewardOnKillElement = document.getElementById(&quot;rewardonkill&quot;);\n const totalKillsElement = document.getElementById(&quot;totalkills&quot;);\n const killsElement = document.getElementById(&quot;kills&quot;);\n const deathsElement = document.getElementById(&quot;deaths&quot;);\n const top1NameElement = document.getElementById(&quot;top1name&quot;);\n const player1KillsElement = document.getElementById(&quot;player1kills&quot;); \n const top2NameElement = document.getElementById(&quot;top2name&quot;);\n const player2KillsElement = document.getElementById(&quot;player2kills&quot;); \n const top3NameElement = document.getElementById(&quot;top3name&quot;);\n const player3KillsElement = document.getElementById(&quot;player3kills&quot;);\n const top4NameElement = document.getElementById(&quot;top4name&quot;);\n const player4KillsElement = document.getElementById(&quot;player4kills&quot;);\n\n // Update UI elements based on received data\n\n\n if (zonedata) {\n \n leaderElement.textContent = zonedata &amp;&amp; typeof zonedata.leader !== 'undefined' &amp;&amp; zonedata.leader !== null ? zonedata.leader : '';\n leaderKillsElement.textContent = zonedata &amp;&amp; typeof zonedata.leaderkills !== 'undefined' ? zonedata.leaderkills : '';\n killStreakNameElement.textContent = zonedata &amp;&amp; typeof zonedata.killStreakName !== 'undefined' ? zonedata.killStreakName : '';\n killStreakNumberElement.textContent = zonedata &amp;&amp; typeof zonedata.killStreakNumber !== 'undefined' ? zonedata.killStreakNumber : '';\n rewardOnKillElement.textContent = '$ ' + (zonedata &amp;&amp; typeof zonedata.rewardOnKill !== 'undefined' ? zonedata.rewardOnKill : '');\n totalKillsElement.textContent = zonedata &amp;&amp; typeof zonedata.totalKillsToWin !== 'undefined' ? zonedata.totalKillsToWin : '';\n \n // Update other UI elements from zonedata as needed\n }\n\n if (playerData) {\n killsElement.textContent = playerData &amp;&amp; typeof playerData.kills !== 'undefined' ? playerData.kills : '';\n deathsElement.textContent = playerData &amp;&amp; typeof playerData.deaths !== 'undefined' ? playerData.deaths : '';\n \n // Update other UI elements from playerData as needed\n }\n\n // Update top players if available\n console.log('Received top players:', zonedata?.topplayers);\n if (zonedata?.topplayers?.length &gt;= 4) {\n for (let i = 0; i &lt; 4; i++) {\n const nameElement = document.getElementById(`top${i}name`);\n const killsElement = document.getElementById(`player${i}kills`);\n if (zonedata.topplayers[i]) {\n nameElement.textContent = zonedata.topplayers[i].name || '';\n killsElement.textContent = zonedata.topplayers[i].kills || '';\n }\n }\n }\n}\n\n$(document).ready(function() {\n window.addEventListener('message', function(event) {\n console.log('Message received:', event.data); // Log the received message\n console.log('Message data:', JSON.stringify(event.data)); // Log the received data as JSON string\n\n if (typeof event.data.zonedata !== 'undefined') {\n console.log('Type of zonedata:', typeof event.data.zonedata); // Log the type of zonedata\n\n // Check if zonedata is a string and parse it\n if (typeof event.data.zonedata === 'string') {\n console.log('zonedata is a string, parsing...');\n try {\n const zonedata = JSON.parse(event.data.zonedata);\n // Now zonedata is an object, you can proceed to use it\n updateUI(event.data.playerData, zonedata);\n } catch (error) {\n console.error('Error parsing zonedata:', error);\n }\n } else {\n \n updateUI(event.data.playerData, event.data.zonedata);\n }\n }\n\n if (event.data.type === 'updateUI') {\n console.log('Updating UI with data:', event.data); // Log the received data\n\n updateUI(event.data.message);\n\n } else if (event.data.type === 'showUI') {\n console.log('Showing UI');\n $(&quot;.container&quot;).fadeIn('fast');\n } else if (event.data.type === 'hideUI') {\n console.log('Hiding UI');\n $(&quot;.container&quot;).fadeOut('fast');\n } else {\n console.log('Unknown message type:', event.data.type);\n }\n });\n</code></pre>\n<p>`</p>\n<p>and here is my server.lua</p>\n<pre><code>function SetupZoneData()\n for k,v in pairs(Config.RedZones) do\n ZoneData[k] = {\n routingbucket = v.routingbucket, \n totalKillsToWin = Config.DeafultKillsToWin,\n Players = {},\n leader = 'None',\n killStreakName = 'None',\n killStreakNumber = 0,\n rewardOnKill = Config.KillRewardMoney,\n topplayers = {}\n }\n end\n\n print(json.encode(ZoneData))\nend\nSetupZoneData()\n\nCitizen.CreateThread(function()\n while true do\n -- Loop through each zone\n for zoneName, zoneData in pairs(ZoneData) do\n if ZoneData[zoneName].Players then\n -- Sort players by kills\n local sortedPlayers = {}\n for playerId, stats in pairs(ZoneData[zoneName].Players) do\n table.insert(sortedPlayers, { playerId = stats.source, kills = stats.kills, deaths = stats.deaths, killstreak = stats.killstreak, zonename = stats.zonename })\n end\n \n table.sort(sortedPlayers, function(a, b)\n return a.kills &gt; b.kills\n end)\n\n -- Update top 4 players in topplayers field\n local topPlayers = {}\n for i = 1, 4 do\n if sortedPlayers[i] then\n local playerId = sortedPlayers[i].playerId\n local playerName = GetPlayerName(playerId)\n local playerKills = sortedPlayers[i].kills\n table.insert(topPlayers, { name = playerName, kills = playerKills })\n end\n end\n \n \n print('Top Players for Zone ' .. zoneName .. ': ' .. json.encode(topPlayers))\n \n -- Find player with the highest kill streak\n local highestKillStreak = 0\n local playerWithHighestStreak = nil\n \n for _, player in ipairs(PlayerData) do\n if player.killstreak &gt; highestKillStreak then\n highestKillStreak = player.killstreak\n playerWithHighestStreak = player.source\n end\n end\n -- Set ZoneData with highest kill streak player\n if playerWithHighestStreak then\n ZoneData[zoneName].killStreakName = GetPlayerName(playerWithHighestStreak)\n ZoneData[zoneName].killStreakNumber = highestKillStreak\n else\n ZoneData[zoneName].killStreakName = 'None'\n ZoneData[zoneName].killStreakNumber = 0\n end\n\n -- Update ZoneData with top players\n ZoneData[zoneName].topplayers = topPlayers\n print(json.encode(topPlayers))\n\n -- Update clients with the latest player and zone data\n for _, data in pairs(PlayerData) do\n TriggerClientEvent('mtf-redzone:Client:RequestZoneSync', data.source, json.encode(ZoneData[zonename].Players[data.source]), json.encode(ZoneData[zoneName]))\n end\n end\n end\n\n -- Sleep for a minute before updating again (adjust as needed)\n Citizen.Wait(1000)\n end\nend)\n\n</code></pre>\n<p>and here is the client.lua</p>\n<pre><code>\nlocal ActiveZones = {}\nlocal InActiveZone = false\nlocal display = false\n\nfunction SetDisplay(bool)\n display = bool\n\n if bool then\n SendNUIMessage({\n type = &quot;showUI&quot;,\n -- PlayerData = PlayerData,\n -- zonedata = zonedata,\n status = bool,\n })\n else\n SendNUIMessage({\n type = &quot;hideUI&quot;,\n status = bool,\n })\n end\nend\n\nfunction UpdateUIThread(zonedata, playerData)\n while InActiveZone do\n Wait(500)\n SendNUIMessage({\n type = &quot;updateUI&quot;,\n PlayerData = playerData,\n zonedata = zonedata,\n })\n end\nend\n\n\n\n-- [ Zone / Blip Creation ] --\n\nCitizen.CreateThread(function()\n for k,v in pairs(Config.RedZones) do\n ActiveZones[k] = lib.zones.sphere({\n coords = v.coords,\n radius = v.zonesize,\n debug = Config.Debug,\n onEnter = function(self)\n TriggerServerEvent('mtf-redzone:Server:EnterZone', v.routingbucket, k)\n InActiveZone = true\n if Config.DisableInventory then exports.ox_inventory:weaponWheel(true) end\n GiveWeaponToPed(PlayerPedId(), v.issueweapon, 99999, false, true)\n SetDisplay(true)\n end,\n\n onExit = function(self)\n TriggerServerEvent('mtf-redzone:Server:LeftZone', v.routingbucket, k)\n RemoveAllPedWeapons(PlayerPedId())\n -- RemoveWeaponFromPed(PlayerPedId(), v.issueweapon)\n InActiveZone = false\n if Config.DisableInventory then exports.ox_inventory:weaponWheel(false) end\n SetDisplay(false)\n end,\n })\n\n if Config.ShowZoneRadius then\n local radius = AddBlipForRadius(v.coords, v.blipradius)\n\n SetBlipSprite(radius, 1)\n SetBlipColour(radius, 1)\n SetBlipAlpha(radius, 65)\n end\n end\nend)\n\nRegisterNetEvent('mtf-redzone:SetCurrentWeapon', function()\n SetCurrentPedWeapon(PlayerPedId(), GetHashKey('weapon_pistol'), true)\nend)\n\nRegisterNetEvent('mtf-redzone:Client:RequestZoneSync', function(playerData, zoneData)\n print('Received zone data:', json.encode(zoneData)) -- Check the received data\n print('Received player data:', json.encode(playerData)) -- Check the received data\n -- Further processing, if needed\n UpdateUIThread(zoneData, playerData) -- Pass the zone data to the UI update function\nend)\n\nRegisterNetEvent('mtf-redzone:client:DeathHandler', function(nearestPoint)\n local player = PlayerPedId()\n DoScreenFadeOut(1000)\n Wait(1000)\n\n SetEntityCoords(PlayerPedId(), nearestPoint.x, nearestPoint.y, nearestPoint.z)\n\n Wait(2500) -- Wait for the player to be teleported\n\n SetEntityMaxHealth(player, 200)\n SetEntityHealth(player, 200)\n ClearPedBloodDamage(player)\n SetPlayerSprint(PlayerId(), true)\n\n -- qb-ambulancejob specific events to revive player\n TriggerEvent('hospital:client:Revive')\n\n DoScreenFadeIn(1000)\n\nend)\n\nAddEventHandler('onResourceStop', function()\n -- for k,v in pairs(Config.RedZones) do\n -- RemoveBlip(k)\n -- lib.zones.remove(k)\n -- end\n\nend)\n</code></pre>\n<p>and here is the html for the top 4 players that i waant updated with the lua data</p>\n<pre><code> &lt;h2&gt;TOP 4&lt;/h2&gt;\n &lt;/div&gt;\n &lt;div class=&quot;red-zone&quot;&gt;\n &lt;div class=&quot;red-card left-card&quot;&gt;\n &lt;span class=&quot;badge&quot;&gt;1\n &lt;/span &gt;\n &lt;p id=&quot;top1name&quot;&gt;Josh&lt;/p&gt;\n &lt;/div&gt;\n &lt;div class=&quot;red-card right-card&quot;&gt;\n &lt;i class=&quot;icon skull-icon&quot;&gt;&lt;/i&gt;\n &lt;span id=&quot;player1kills&quot;&gt;30&lt;/span&gt;\n &lt;/div&gt;\n &lt;/div&gt;\n &lt;div class=&quot;red-zone&quot;&gt;\n &lt;div class=&quot;red-card left-card&quot;&gt;\n &lt;span class=&quot;badge&quot;&gt;2\n &lt;/span&gt;\n &lt;p id=&quot;top2name&quot;&gt;Vinny&lt;/p&gt;\n &lt;/div&gt;\n &lt;div class=&quot;red-card right-card&quot;&gt;\n &lt;i class=&quot;icon skull-icon&quot;&gt;&lt;/i&gt;\n &lt;span id=&quot;player2kills&quot;&gt;10&lt;/span&gt;\n &lt;/div&gt;\n &lt;/div&gt;\n &lt;div class=&quot;red-zone&quot;&gt;\n &lt;div class=&quot;red-card left-card&quot;&gt;\n &lt;span class=&quot;badge&quot;&gt;3\n &lt;/span&gt;\n &lt;p id=&quot;top3name&quot;&gt;llyty&lt;/p&gt;\n &lt;/div&gt;\n &lt;div class=&quot;red-card right-card&quot;&gt;\n &lt;i class=&quot;icon skull-icon&quot;&gt;&lt;/i&gt;\n &lt;span id=&quot;player3kills&quot;&gt;9&lt;/span&gt;\n &lt;/div&gt;\n &lt;/div&gt;\n &lt;div class=&quot;red-zone&quot;&gt;\n &lt;div class=&quot;red-card left-card&quot;&gt;\n &lt;span class=&quot;badge&quot;&gt;4\n &lt;/span&gt;\n &lt;p id=&quot;top4name&quot;&gt;Bob&lt;/p&gt;\n &lt;/div&gt;\n &lt;div class=&quot;red-card right-card&quot;&gt;\n &lt;i class=&quot;icon skull-icon&quot;&gt;&lt;/i&gt;\n &lt;span id=&quot;player4kills&quot;&gt;5&lt;/span&gt;\n &lt;/div&gt;\n &lt;/div&gt;\n &lt;div&gt;\n</code></pre>\n"^^ . "0"^^ . "0"^^ . . . . . "<p>You did not create a proxy as it is described in <code>Tracking table accesses</code> you may want to go back an revisit <a href="https://www.lua.org/pil/13.4.4.html" rel="nofollow noreferrer">that section</a>. you did not produce &quot;A variation of the dual representation&quot; you just reproduced the same code but with <code>balance</code> renamed to <code>proxyToAccount</code> which I feel misses the point of the exercise.</p>\n<p>You are intended to solve the problem using a proxy because it should produce a different result, then you can compare those results.</p>\n<p>Here is an example using a proxy table. There is probably a better way to do this and I may come back and tweak it later.</p>\n<pre class="lang-lua prettyprint-override"><code>local Account = {}\nAccount.__index = Account\nfunction Account:withdraw (v)\n self.balance = self.balance - v\nend\n\nfunction Account:deposit (v)\n self.balance = self.balance + v\nend\n\nfunction Account:new()\n local protected = setmetatable({balance = 0}, Account)\n local proxy = { \n deposit = function(self, v)\n protected:deposit(v)\n end,\n \n withdraw = function(self, v)\n protected:withdraw(v)\n end,\n }\n \n local meta = {\n __index = protected,\n __newindex = function (t,k,v)\n print(&quot;this table is read-only&quot;)\n end,\n }\n\n setmetatable(proxy, meta)\n return proxy\nend\n</code></pre>\n<p>Then you make these calls with both implementations:</p>\n<pre><code>account = Account:new()\naccount:deposit(100)\nprint(account.balance)\n</code></pre>\n<p>what are the differences, how many indexes are done, what is the memory foot print, which is more secure, etc...</p>\n"^^ . . "0"^^ . . "0"^^ . . . "<p>I am trying to make it so that the items that are in the player's backpack appears on the sell Ui, the problem is that I don't know where to start.</p>\n<p>Here is the code shown:</p>\n<pre><code>local player = game.Players.LocalPlayer\nlocal pack = player.Backpack\nlocal itemSell = script.Parent.Item1\nlocal items = pack:GetChildren()\n\nfor i = 1, #items do\n\nend\n</code></pre>\n<p>The blank space is where I got stumped. How can I make it work?</p>\n"^^ . . "1"^^ . . . . "0"^^ . . . . . ""resulting in some slight deviations in the final result" What do you mean by this? What deviations?\nIs the intended print "nil" or "false"?"^^ . "0"^^ . . . "<p>The title says it all. I want to do an operation to apply key values to a dictionary from a dictionary\nHere, I'll explain what I meant.</p>\n<p>I have these long dictionaries initialized in my code.</p>\n<pre><code>local globalDefault = {\n [&quot;LastPlayed&quot;] = &quot;&quot;,\n [&quot;Grades&quot;] = {\n [&quot;Grade&quot;] = 1,\n [&quot;Level&quot;] = 1\n },\n [&quot;Challenge&quot;] = {\n [&quot;History&quot;] = {}\n },\n [&quot;Settings&quot;] = {\n [&quot;ScrollFrameHitbox&quot;] = false\n }\n}\n\nlocal globalData = {\n [&quot;Settings&quot;] = {\n [&quot;ScrollFrameHitbox&quot;] = true\n }\n}\n</code></pre>\n<p>I want to apply all <code>globalData</code>'s key values to <code>globalDefault</code>.\nThis is what <code>globalDefault</code> dictionary should look like after applying them:</p>\n<pre><code>{\n [&quot;LastPlayed&quot;] = &quot;&quot;,\n [&quot;Grades&quot;] = {\n [&quot;Grade&quot;] = 1,\n [&quot;Level&quot;] = 1\n },\n [&quot;Challenge&quot;] = {\n [&quot;History&quot;] = {}\n },\n [&quot;Settings&quot;] = {\n [&quot;ScrollFrameHitbox&quot;] = true\n }\n}\n</code></pre>\n<p>How can I do such a simple operation?</p>\n"^^ . . . . . . . "love2d"^^ . . . "@skisp The buttons need a parent, ideally a [Frame](https://create.roblox.com/docs/reference/engine/classes/Frame) with [UIListLayout](https://create.roblox.com/docs/reference/engine/classes/UIListLayout) so that the buttons are in a list."^^ . "<p>If all you are concerned with is that it is <em>possible</em> to have the value be a block, inspecting <a href="https://www.lua.org/manual/5.3/manual.html#9" rel="nofollow noreferrer">the lua syntax</a> will reveal a block can be converted to an expression by wrapping it in a function definition:\n<code>return (function() print &quot;hello&quot;; print &quot;world&quot;; return 1; end)()</code></p>\n<p>If what you want is to know whether a string should be interpreted in as a block or expression without parsing it first, that is not really possible, since expressions can contain blocks and blocks can contain expressions, and it may require infinite lookahead to determine which is which.</p>\n<p>For example:\n<code>some_really_long_function_name()</code> is a valid chunk, while <code>some_really_long_function_name() + 1</code> is not. however, <code>some_really_long_function_name(2+2)</code> is a valid expression.</p>\n<p>The only theoretical way to achieve what you want without parsing the expression twice would be to write a parser that parses a superset of lua syntax in which an expression is also a valid statement, however such a parser would have to be capable of unbounded token lookahead to disambiguate certain inputs (eg. in the case of a function call with a lot of arguments followed by either a binary operator or a semicolon), so it would not necessarily be any faster than just parsing the string twice.</p>\n"^^ . . "<p>I am attempting to implement a script to execute actions based on the state of my backend nodes. Below is the initial section of my lua script and also haproxy backend config</p>\n<p>Despite these settings, I consistently receive the error message:\n&quot;No backend associated with the transaction.&quot;</p>\n<p>I've tried changing the Lua invocation to the frontend and rearranging several lines, but the issue persists. As I'm relatively new to Lua, I would appreciate any guidance on what I might be missing.</p>\n<p>my lua script :</p>\n<pre><code>\n-- haproxy.lua\n\n-- Track the previous states of nodeA and nodeB\nlocal previous_state_nodeA = &quot;up&quot; -- initial state assumed to be up\nlocal previous_state_nodeB = &quot;backup&quot; -- initial state assumed to be backup\n\ncore.register_action(&quot;server_state_change&quot;, { &quot;http-req&quot;, &quot;tcp-req&quot; }, function(txn)\n -- Verify if the transaction is linked to a backend\n if txn.b ~= nil then\n local be = txn.b\n local server = be:get_server(txn.sf:srv_name())\n local state = server:get_stats()[&quot;status&quot;]\n\n if be.name == &quot;mybackend&quot; then\n if server.name == &quot;nodeA&quot; then\n -- Execute action if state change detected for nodeA\n check_and_trigger_action_nodeA(state)\n elseif server.name == &quot;nodeB&quot; then\n -- Execute action if state change detected for nodeB\n check_and_trigger_action_nodeB(state)\n end\n end\n else\n -- Log an error when no backend is associated with the transaction\n core.log(core.err, &quot;No backend associated with the transaction&quot;)\n end\nend)\n</code></pre>\n<p>Here are the details of my backend configuration:</p>\n<pre><code>\nbackend mybackend\n mode http\n balance roundrobin\n http-request lua.server_state_change\n\n cookie Cookie prefix nocache\n default-server inter 3s fall 3 rise 2\n server nodeA nodea.example.net:80 check\n server nodeB nodeb.example.net:80 check backup\n</code></pre>\n"^^ . . "0"^^ . . . . . . . "1"^^ . . . . "0"^^ . "logic-error"^^ . "0"^^ . "1"^^ . "<p>You can iterate for each key or child in <code>items</code> and then for each one, create a button.</p>\n<p>In the below code, for each item in <code>items</code> we will create a <a href="https://create.roblox.com/docs/reference/engine/classes/TextButton" rel="nofollow noreferrer"><code>TextButton</code></a>. If the user presses the TextButton, then print that the user wants to sell an item.</p>\n<pre class="lang-lua prettyprint-override"><code>local player = game.Players.LocalPlayer\nlocal pack = player.Backpack\nlocal itemSell = script.Parent.Item1\nlocal items = pack:GetChildren()\n\n-- Function to create a button given a tool\nlocal function addItem(item: Tool): ()\n local newButton = Instance.new(&quot;TextButton&quot;)\n newButton.Name = item.Name\n newButton.Text = item.Name\n newButton.MouseButton1Down:Connect(function()\n print(player.Name &quot; wants to sell &quot; .. item.Name) -- Username wants to sell item name\n end)\n newButton.Parent = workspace -- Change this to the frame you want the buttons parented to\nend\n\n-- Loop through each item and create a button for each\nfor _, item: Tool in pairs(items) do\n addItem(item)\nend\n</code></pre>\n<p>Make sure to replace the <code>newButton</code>'s parent with the <a href="https://create.roblox.com/docs/reference/engine/classes/Frame" rel="nofollow noreferrer"><code>Frame</code></a> that you want the buttons to appear in instead of <code>workspace</code> or they won't appear at all.</p>\n<p>If you have any questions on the code or explanation on some parts feel free to comment on what does what.</p>\n"^^ . . "2"^^ . . . "double-free"^^ . "<p>I'm toying with Lua and using <a href="https://www.luac.nl/" rel="nofollow noreferrer">https://www.luac.nl/</a> to see how it translates to bytecode. I wanted to see if a pattern like <code>if boolean_always_true then ... end</code> where the boolean was defined with <code>&lt;const&gt;</code> would get optimized. Same for always false boolean.</p>\n<pre><code>local always_true &lt;const&gt; = true\nlocal always_false &lt;const&gt; = false\n\nfunction foo()\n if always_true then\n print(&quot;Hello World!&quot;)\n end\nend\n\nfunction bar()\n if always_false then\n print(&quot;Hello World!&quot;)\n end\nend\n</code></pre>\n<p>ends up being</p>\n<pre><code>function foo() --line 4 through 8\n1 GETTABUP 0 0 0 ; _ENV &quot;print&quot;\n2 LOADK 1 1 ; &quot;Hello World!&quot;\n3 CALL 0 2 1 ; 1 in 0 out\n4 RETURN0\n\nfunction bar() --line 10 through 14\n1 LOADFALSE 0 \n2 TEST 0 0 \n3 JMP 3 to pc 7\n4 GETTABUP 0 0 0 ; _ENV &quot;print&quot;\n5 LOADK 1 1 ; &quot;Hello World!&quot;\n6 CALL 0 2 1 ; 1 in 0 out\n7 RETURN0 \n</code></pre>\n<p>Why does the <code>always_true</code> case gets optimized and the <code>if</code> disappears but the <code>always_false</code> case doesn't?</p>\n<p>I tried different configurations of the code and looking at the produced bytecode with <a href="https://www.luac.nl/" rel="nofollow noreferrer">https://www.luac.nl/</a>. I was expecting <code>bar</code> to just be <code>RETURN0</code></p>\n"^^ . "0"^^ . . "1"^^ . "0"^^ . . . . . "1"^^ . . . . . "<p>I want to install Monaco editor into a WPF app, I Tried looking the issue up on youtube but nothing came up.</p>\n<p>I've tried installing it like I normally would on Windows Forms App but all it did was come up with a bunch of errors.</p>\n"^^ . . "Apply key values to a dictionary from a dictionary"^^ . . . . "0"^^ . . "1"^^ . "1"^^ . . . . . "Fivem JS not updating UI"^^ . "bezier"^^ . . . . . . . . . . "Everything you've said is spot on. I moved the logic to the server so that the story could progress as anyone performed the appropriate action to progress the story. Very often on StackOverflow, people don't actively consider that aspect so I default to server-side authority for suggestions. You can move the logic back to your LocalScript if individual progression is vital to your game. All of the debounce logic is based on "any" player, but you can compare the player returned from `Players:GetPlayerFromCharacter` against `Players.LocalPlayer` as the key instead. Also, sorry about the bug!"^^ . . "1"^^ . "<p>tl;dr; is there a simple way to evaluate a string as <em>either</em> a Lua chunk <em>or</em> a Lua expression without having to first manually figure out which it is?</p>\n<hr />\n<p>I'm using the Lua C API (i.e. <code>luaL_dostring</code>) to evaluate externally supplied strings for there side effects and I have it almost working. The remaining issue is that <code>luaL_dostring</code> assumes that it's provided with a chunk (which I want to support in <em>some</em> complex cases) that assumption is causing issues in simple cases with expressions that are more complicated than a simple function call:</p>\n<p>Examples:</p>\n<ol>\n<li><code>Fn()</code> works</li>\n<li><code>Fn() and Thing()</code> <strong>FAILS</strong></li>\n<li><code>if Fn() then Thing() end</code> works</li>\n<li><code>Fn1() and Fn2() and Fn3()</code> <strong>FAILS</strong></li>\n<li><code>if Fn1() and Fn2() and Fn3() then ; end</code> works</li>\n<li><code>if Fn1() and Fn2() then Fn3() end</code> works</li>\n<li><code>return Fn1() and Fn2() and Fn3()</code> works</li>\n</ol>\n<p>I could reasonably require the use of #3 in place of #2, but in more complicated but common case of wanting to evaluate a sequence of function calls up to the first that returns false things become more complicated (e.g. #4 becomes one of #5 thought #7) and/or quickly diverge from &quot;it does what it says on the tin&quot; (the expression is evaluated for it's side effects so requiring &quot;returning&quot; something is an unwanted distraction for most users).</p>\n<hr />\n<p>After a bit of playing around, I've been able to find string manglings that allows <strong>each</strong> of those to work, but no one thing that makes <strong>all</strong> of the above work.</p>\n"^^ . "3"^^ . . . "0"^^ . "0"^^ . . . . "0"^^ . . . . . . "0"^^ . "0"^^ . . . . . . . "0"^^ . "1"^^ . . . . "0"^^ . . . . . . . . . . "3"^^ . "0"^^ . "<p>I have managed to do it with this function.</p>\n<pre><code>execute{cmd=&quot;source /apps/spack/share/spack/setup-env.sh&quot;, modeA={&quot;load&quot;}}\n</code></pre>\n<p>Basically it does the source as expected after the module load and it works perfectly.</p>\n<p>Just for the record:</p>\n<p>I was using this command before but only the autocomplete command worked in spack and when I did a spack load I got the error that I needed to do the source to get the environment variables right.</p>\n<pre><code>source_sh(&quot;bash&quot;, &quot;/apps/spack/share/spack/spack/setup-env.sh&quot;)\n</code></pre>\n<p>And the error:</p>\n<pre><code>==&gt; Error: spack load requires Spack's shell support. \nTo set up shell support, run the command below for your shell. \nFor bash/zsh/sh: . /apps/spack/share/spack/\n</code></pre>\n<p>Thanks for all the help provided from everyone :)</p>\n"^^ . . "midi"^^ . . . . . "How can I detect if the raycast hits the player in roblox studio?"^^ . . . . . . "1"^^ . "0"^^ . "Right, Sorry, I forgot to add a recording. I added a youtube link with the issue I'm experiencing. [@Kylaaa](https://stackoverflow.com/users/2860267/kylaaa)"^^ . "Thank you @dkasa. I am still struggling, I edited according to your new instructions using the first method of editing the lazy.lua and there are 2 issues:\n1. I have to to :Lazy load lazygit in order for the keymap to work.\n2. Even when I do that and Lazygit opens, it doesn't recognize the repository I am in while navigating Nvim.\nAppreciate your kind help."^^ . "<p>I normally work on java projects and i recentely shifted to neovim from vscode, i have my lsp setup for java and everything but I cant run my files with just &quot;java file.java&quot; since i am using files from other classes. Is there any code runner type plugin that works perfectly in neovim specifically for java?\nFor eg:</p>\n<pre class="lang-java prettyprint-override"><code>package com.khush.distributed.cache;\n\npublic class Main {\n public static void main(String[] args) {\n Cache cache = new Cache(4);\n cache.put(&quot;1&quot;, &quot;1&quot;);\n cache.put(&quot;2&quot;, &quot;2&quot;);\n cache.put(&quot;3&quot;, &quot;3&quot;);\n cache.put(&quot;4&quot;, &quot;4&quot;);\n cache.printList();\n System.out.println();\n System.out.println();\n \n cache.get(&quot;2&quot;);\n cache.printList();\n \n cache.put(&quot;5&quot;, &quot;5&quot;);\n System.out.println();\n System.out.println();\n cache.printList();\n }\n}\n</code></pre>\n<p>When i try to run this. it can't find the <code>Cache</code> class because obviously it is not compiled (ps: Cache class is in the same package)</p>\n<pre><code>Main.java:5: error: cannot find symbol\n Cache cache = new Cache(4);\n ^\n symbol: class Cache\n location: class Main\nMain.java:5: error: cannot find symbol\n Cache cache = new Cache(4);\n ^\n symbol: class Cache\n location: class Main\n2 errors\n\n[Process exited 1]\n</code></pre>\n<p>how can i fix this? here is my .lua config that i am using for running the code</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;CRAG666/code_runner.nvim&quot;,\n config = function()\n require(&quot;code_runner&quot;).setup({\n filetype = {\n java = {\n &quot;cd $dir &amp;&amp;&quot;,\n &quot;javac $fileName &amp;&amp;&quot;,\n &quot;java $fileNameWithoutExt&quot;,\n },\n python = &quot;python3 -u&quot;,\n typescript = &quot;deno run&quot;,\n rust = {\n &quot;cd $dir &amp;&amp;&quot;,\n &quot;rustc $fileName &amp;&amp;&quot;,\n &quot;$dir/$fileNameWithoutExt&quot;,\n },\n },\n })\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;r&quot;, &quot;:RunCode&lt;CR&gt;&quot;, { noremap = true, silent = false })\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;rf&quot;, &quot;:RunFile&lt;CR&gt;&quot;, { noremap = true, silent = false })\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;rp&quot;, &quot;:RunProject&lt;CR&gt;&quot;, { noremap = true, silent = false })\n end,\n}\n</code></pre>\n<p>apart from this plugin, i did try some other plugins aswell but i am not really that good with setting things up yet,\nAny help with this is appreciated, thank you.</p>\n"^^ . "1"^^ . "How do I set up the hierarchy? right now I have it set up has surface GUI inside the part and a screen GUI in the starter GUI w/ frame I want opened."^^ . . "@Kaj You will need to give permission to use your animations if you are developing a group experience, even if you are the group owner and made the animations."^^ . . . . . . . "<p>It is impossible to invoke a double free for automatically managed memory in LuaJIT (that is, created with <code>ffi.new</code>).<br />\nBut you can do it for manually managed memory:</p>\n<pre><code>local ffi = require&quot;ffi&quot;\nffi.cdef[[\n typedef struct {\n int x;\n } my_struct;\n void* malloc(size_t);\n void free(void*);\n]]\n\nlocal function my_free(o)\n print(123)\n ffi.C.free(o)\nend\n\nlocal obj = ffi.gc(\n ffi.cast(&quot;my_struct*&quot;, ffi.C.malloc(ffi.sizeof(&quot;my_struct&quot;))), \n my_free\n)\nobj.x = 10\n\n-- first free\nmy_free(obj)\n\n-- second free\nobj = nil\ncollectgarbage(&quot;collect&quot;)\ncollectgarbage(&quot;collect&quot;)\n</code></pre>\n<p>P.S.<br />\nBTW, huge blocks of memory are recommended to allocate as manually managed (instead of using <code>ffi.new</code>)</p>\n"^^ . "4"^^ . "0"^^ . . . "0"^^ . "<p>I'd like to build off of the answer in this <a href="https://stackoverflow.com/questions/74138392/define-a-class-of-slides-with-inverse-background-in-revealjs-quarto">question</a>.</p>\n<p>I want to modify the background image of slides that meet a certain criteria. In this case I want to apply new attributes to the title slide and all level 1 header slides. This function successfully targets all level 1 headers, but I'm not sure how to target the title slides as well.</p>\n<p>I know I can do this in the YAML header for the individual Quarto Presentation file, but I'm creating a template for my organization and would like to keep this background modification as simple and easy to maintain as possible, by keeping it in one place.</p>\n<pre><code>function Header(el)\n if el.level == 1 then\n el.attributes[&quot;data-background-image&quot;] = &quot;bg.png&quot;\n el.attributes[&quot;data-background-position&quot;] = &quot;left&quot;\n el.attributes[&quot;data-background-opacity&quot;] = &quot;0.25&quot;\n el.attributes[&quot;data-background-size&quot;] = &quot;33%&quot;\n return el\n end\nend\n</code></pre>\n<p>I've tried this, based on my super limited lua knowledge, but it doesn't work.</p>\n<pre><code>function Header(el)\n if el.level == 1 or el.classes:includes(&quot;title-slide&quot;) then\n el.attributes[&quot;data-background-image&quot;] = &quot;bg.png&quot;\n el.attributes[&quot;data-background-position&quot;] = &quot;left&quot;\n el.attributes[&quot;data-background-opacity&quot;] = &quot;0.25&quot;\n el.attributes[&quot;data-background-size&quot;] = &quot;33%&quot;\n return el\n end\nend\n</code></pre>\n<p>And finally, the minimal example that I'll work with comes from the <a href="https://stackoverflow.com/a/74139223/3790973">answer to the linked question</a>.</p>\n"^^ . . "<p>the problem is in this line:</p>\n<pre class="lang-lua prettyprint-override"><code>OuterCore = Core.Position\n</code></pre>\n<p>this line will set the variable <code>OuterCore</code> to a <code>Vector3</code> value and <code>BrickColor</code> is not a valid member of <code>Vector3</code> resulting into this error: <code>BrickColor cannot be assigned to</code>.</p>\n<p>the way to fix this error is to change that line to the following:</p>\n<pre class="lang-lua prettyprint-override"><code>OuterCore.Position = Core.Position\n</code></pre>\n"^^ . . . "<p>I have custom functions <code>utf8Char (decimal)</code> and <code>utf8Byte(char)</code>.</p>\n<p>How can I overload the functions <code>string.char(...)</code> and <code>string.byte(s, i, j)</code> in Lua?</p>\n<p>Here is an example function what I mean:</p>\n<pre class="lang-lua prettyprint-override"><code>local originalStringCharFunction = string.char\n\n-- new function:\nfunction string.char(...)\n local args = {...}\n local chars = {}\n for i, codepoint in ipairs(args) do\n chars[i] = utf8Char(codepoint, originalStringCharFunction)\n end\n return table.concat(chars)\nend\n</code></pre>\n"^^ . "0"^^ . "<p>The problem is that you gave the wrong parameters the <a href="https://create.roblox.com/docs/reference/engine/classes/WorldRoot#Raycast" rel="nofollow noreferrer"><code>:Raycast()</code></a> method. the function needs an <code>Orgin</code> and <code>Direction</code> not a <code>Start</code> And <code>End</code> you can calculate the Direction between these 2 vectors by doing <code>CurrPos - LastPos</code>.</p>\n<p>note that this could possible false flag because of lag or ping since its serversided.</p>\n<pre><code>local exclude = {}\n\nlocal function CheckNoclip(LastPos: Vector3, CurrPos: Vector3, Player: Player)\n if CurrPos == LastPos then return; end\n\n local Orgin = LastPos;\n local Direction = CurrPos - LastPos;\n local Params = RaycastParams.new();\n Params.FilterDescendantsInstances = exclude;\n Params.FilterType = Enum.RaycastFilterType.Exclude;\n \n local Result = workspace:Raycast(Orgin, Direction, Params);\n\n if not Result then return; end\n if not Result.Instance.CanCollide then return; end\n \n local Character = Player.Character;\n local Root = Character:FindFirstChild(&quot;HumanoidRootPart&quot;);\n\n Root.CFrame = CFrame.new(LastPos);\n warn(&quot;No-Clip Found&quot;);\n print(&quot;---------------------------------&quot;);\nend\n\ngame:GetService(&quot;Players&quot;).PlayerAdded:Connect(function(Player: Player)\n\n Player.CharacterAdded:Connect(function(Character)\n table.insert(exclude, Character);\n \n local Humanoid = Character:WaitForChild(&quot;Humanoid&quot;);\n local Root = Character:WaitForChild(&quot;HumanoidRootPart&quot;);\n \n local CurrPos = Root.Position;\n local LastPos = CurrPos;\n \n task.spawn(function() -- create loop in new thread\n repeat \n LastPos = CurrPos;\n CurrPos = Root.Position;\n \n CheckNoclip(LastPos, CurrPos, Player);\n task.wait();\n until Humanoid.Health &lt;= 0\n end)\n end);\n Player.CharacterRemoving:Connect(function(Character)\n table.remove(exclude, table.find(exclude, Character));\n end);\nend)\n</code></pre>\n"^^ . . . . . "0"^^ . "<p>I've been trying out astroNVim works great but due to enterprise limitations i couldnt get <code>neo-treesitter</code> work for some reason and every time i save a file tree sitter crashes throwing a bunch of alert prompts.</p>\n<p>I would like to disable neo-tree and replace with nvim-tree or alternative. I tried updating couldn't find a resonable solution could be due to lack of admin privileges on certain folders.\nPlease help me mitigate this issue.</p>\n"^^ . . "1"^^ . "How to call the destructor on a Lua object twice to catch double free?"^^ . . "0"^^ . "<p>I am trying to setup neovim and I am getting following error in my <code>NullLsLog</code></p>\n<p><strong>plugin/null-ls.lua</strong></p>\n<pre><code>return {\n &quot;nvimtools/none-ls.nvim&quot;,\n event = { &quot;BufReadPre&quot;, &quot;BufNewFile&quot; },\n dependencies = { &quot;mason.nvim&quot; },\n config = function()\n require(&quot;null-ls&quot;).setup({\n debug = true,\n })\n end,\n opts = function()\n return require &quot;custom.configs.null-ls&quot;\n end,\n}\n</code></pre>\n<p><strong>config/null-ls.lua</strong></p>\n<pre><code>local augroup = vim.api.nvim_create_augroup(&quot;lspformatting&quot;, {})\nlocal null_ls = require(&quot;null-ls&quot;)\n\nlocal opts = {\n sources = {\n null_ls.builtins.formatting.black,\n null_ls.builtins.formatting.stylua,\n -- null_ls.builtins.diagnostics.mypy,\n null_ls.builtins.formatting.terraform_fmt,\n null_ls.builtins.formatting.shellharden,\n null_ls.builtins.formatting.prettier.with({ filetypes = { &quot;json&quot; } }),\n null_ls.builtins.formatting.isort,\n null_ls.builtins.diagnostics.pylint.with({ prefer_local = &quot;.venv/bin&quot;, },\n { extra_args = { &quot;--disable=C0114,C0115,C0116&quot; } }),\n null_ls.builtins.diagnostics.terraform_validate,\n },\n on_attach = function(client, bufnr)\n if client.supports_method(&quot;textdocument/formatting&quot;) then\n vim.api.nvim_clear_autocmds({\n group = augroup,\n buffer = bufnr\n })\n vim.api.nvim_create_autocmd(&quot;bufwritepre&quot;, {\n group = augroup,\n buffer = bufnr,\n callback = function()\n vim.lsp.buf.format({\n buffer = bufnr,\n async = false,\n filter = function(client)\n return client.name == &quot;null-ls&quot;\n end\n })\n end,\n })\n end\n end\n}\nreturn opts\n</code></pre>\n<p>I am installing binaries through mason.</p>\n<p><strong>plugins/mason.lua</strong></p>\n<pre><code>return {\n &quot;williamboman/mason.nvim&quot;,\n opts = {\n ensure_installed = {\n &quot;pyright&quot;,\n &quot;mypy&quot;,\n &quot;pylint&quot;,\n -- &quot;flake8&quot;, -- removed in latest version of nulls ls\n &quot;ruff&quot;,\n &quot;black&quot;,\n &quot;debugpy&quot;,\n &quot;terraform-ls&quot;,\n &quot;lua-language-server&quot;,\n &quot;fixjson&quot;,\n &quot;shellharden&quot;,\n &quot;prettier&quot;,\n &quot;isort&quot;,\n &quot;stylua&quot;\n },\n },\n}\n</code></pre>\n"^^ . . . . . . . . "neovim-plugin"^^ . . . . "0"^^ . . "0"^^ . "0"^^ . . "Cannot read unicode from stdin from regular PS and CMD windows"^^ . . "0"^^ . . . . "I don't really know what is that tho"^^ . "the output/console is blank when it came to the frames"^^ . . . . . . . "1"^^ . . . . "1"^^ . . "3"^^ . "1"^^ . . "<p>I'm making a stage selector that you can go forward and back a stage in my Roblox Game,\nbut it didn't work, here's the code:</p>\n<pre><code>local trasferHandler = {}\n\nlocal TOTAL_STAGES_IN_GAME = 10\n\nfor _, stage in pairs(workspace.Checkpoints:GetChildren()) do\n if tonumber(stage.Name) &gt; TOTAL_STAGES_IN_GAME then\n TOTAL_STAGES_IN_GAME = tonumber(stage.Name)\n end\nend\n\nfunction trasferHandler.up(plr, direction)\n local tpStage = plr.TeleportedStage\n if tpStage.Value &lt; plr.leaderstats.Stage.Value then\n tpStage.Value += 1\n plr.Character.HumanoidRootPart.CFrame = workspace.Checkpoints[plr.TeleportedStage.Value].CFrame + Vector3.new(0,3.25,0)\n elseif tpStage.Value == plr.leaderstats.Stage.Value then\n tpStage.Value = 0\n plr.Character.HumanoidRootPart.CFrame = workspace.Checkpoints[&quot;0&quot;].CFrame + Vector3.new(0,3.25,0)\n end\nend\n\nfunction trasferHandler.up2(plr, direction)\n local tpStage = plr.TeleportedStage\n if tpStage.Value &lt; plr.leaderstats.Stage.Value then\n tpStage.Value += 10\n plr.Character.HumanoidRootPart.CFrame = workspace.Checkpoints[plr.TeleportedStage.Value].CFrame + Vector3.new(0,3.25,0)\n elseif tpStage.Value == plr.leaderstats.Stage.Value then\n tpStage.Value = 0\n plr.Character.HumanoidRootPart.CFrame = workspace.Checkpoints[&quot;0&quot;].CFrame + Vector3.new(0,3.25,0)\n end\nend\n\n\n\nfunction trasferHandler.down2(plr, direction)\n local tpStage = plr.TeleportedStage\n if tpStage.Value &gt; 10 then\n tpStage.Value -= 10\n plr.Character.HumanoidRootPart.CFrame = workspace.Checkpoints[tpStage.Value].CFrame + Vector3.new(0,3.25,0)\n elseif tpStage.Value == 0 then\n tpStage.Value = plr.leaderstats.Stage.Value\n plr.Character.HumanoidRootPart.CFrame = workspace.Checkpoints[plr.leaderstats.Stage.Value].CFrame + Vector3.new(0,3.25,0)\n end\nend\n\nreturn trasferHandler\n\n\n</code></pre>\n<p>i was expecting it to change the stage i was at, and somehow, it also broke the ability for me to go backwards.</p>\n"^^ . . . "game-engine"^^ . . . . . . . . "0"^^ . . "Knit function signature changes when passed as an argument between service and module"^^ . . "I tried to [build from scratch](https://luals.github.io/wiki/build/) (plan C) but it showed me errors and I stopped the installation :("^^ . "computercraft"^^ . . "3"^^ . . . . . "1"^^ . "@Kaia Thanks for the help! The Basement Detector is triggered hundreds of times, meaning this is likely the cause of the problem. How would I go about stopping this effect? I believe touch events are triggered for every frame that the character is in contact with the part in question."^^ . . . "How do I make it so when a player is in a range of a ProximityPrompt the part with the ProxPrompt gets a highlight? And how do I remove it afterwards?"^^ . . . "<p>I have a script which randomly generates underground rooms in a <code>BasePart</code> using the <code>SubtractAsync</code> function. It works perfectly fine, however the <code>CollisionFidelity</code> is inaccurate, leading to me being unable to enter the rooms.</p>\n<p>Here is the code:</p>\n<pre class="lang-lua prettyprint-override"><code>[...]\nfor _,i in workspace:GetPartsInPart(p) do -- Gets parts to be cut into\n local succ, err = pcall(function() -- pcall ignores part if it cannot be cut into (none of the parts I have with models need to be cut into)\n local fi = i:SubtractAsync({b.RemoveFromTerrain}) -- Cuts\n fi.Parent = i.Parent -- Replaces part with cut part\n i:Destroy()\n end)\nend\n[...]\n</code></pre>\n<p>Note that despite being quite slow, if I can get it to work, the performance loss I would suffer from using <code>SubtractAsync</code> would be worth it in my case.</p>\n<p>I have tried the following:</p>\n<ul>\n<li>Setting the <code>CollisionFidelity</code> in the script after the Union was created -&gt; cannot set because no (<code>The current thread cannot write 'CollisionFidelity' (lacking capability Plugin)</code>)</li>\n<li>Setting the <code>CollisionFidelity</code> in Studio on the part I'm cutting into -&gt; BaseParts don't have the <code>CollisionFidelity</code> property</li>\n</ul>\n"^^ . "1"^^ . . . . . . "0"^^ . . . "liskov-substitution-principle"^^ . "0"^^ . "0"^^ . "Integrating VSCode with Solar2d libraries via Lua Language Server extension"^^ . "1"^^ . . . . "<p>I have a love2d project where I am trying to bind midi controllers with rust and mlua rust library,\nI have this file configuration :</p>\n<pre><code>.\n├── conf.lua\n├── data/\n├── fonts/\n├── icon.png\n├── images/\n├── lib\n│ ├── bump/\n│ ├── discordRPC/\n│ ├── gamepadguesser/\n│ └── midi_input_handler\n│ ├── Cargo.lock\n│ ├── Cargo.toml\n│ ├── libmidi_input_handler.so\n│ ├── makefile\n│ ├── src\n│ │ ├── lib.rs\n│ │ └── midi_handler.rs\n│ └── target\n│ ├── CACHEDIR.TAG\n│ └── debug\n│ ├── build\n│ │ ├── alsa-sys-77e1bf3e25c0debe/\n│ │ ├── alsa-sys-b741dd268b3e925f/\n│ │ ├── libc-a02a8f1a1757eae3/\n│ │ ├── libc-c87ef9fe5c4c07ea/\n│ │ ├── mlua-sys-54611b35a16a6525/\n│ │ ├── mlua-sys-620da340fb195242/\n│ │ ├── num-traits-88de8cf05bbdf5ea/\n│ │ ├── num-traits-bc09a7d6340429b8/\n│ │ ├── proc-macro2-590fdbef782f5a29/\n│ │ └── proc-macro2-c2a63acaec6ca8e8/\n│ ├── deps/\n│ ├── examples/.\n│ ├── incremental/\n│ ├── libmidi_input_handler.d\n│ └── libmidi_input_handler.so\n├── main.lua\n├── makefile\n├── makelove.toml\n├── README.md\n├── scripts\n| .\n│ ├── input\n│ │ ├── input_action_state.lua\n│ │ ├── input_button.lua\n│ │ ├── input.lua\n│ │ ├── input_midi.lua\n│ │ ├── input_profile.lua\n│ │ └── input_user.lua\n| .\n| :\n├── sfx/\n└── test.toml\n</code></pre>\n<p>and lib.rs :</p>\n<pre class="lang-rust prettyprint-override"><code>use crate::midi_handler::*;\nuse mlua::prelude::*;\nuse std::thread;\n\n\n//same name as the lib (path include...)\n#[mlua::lua_module] fn libmidi_input_handler(lua: &amp;Lua) -&gt; LuaResult&lt;LuaTable&gt; {lua_init(lua)}\n#[mlua::lua_module] fn target_debug_libmidi_input_handler(lua: &amp;Lua) -&gt; LuaResult&lt;LuaTable&gt; {lua_init(lua)}\n#[mlua::lua_module] fn libmidi_input_handler_libmidi_input_handler(lua: &amp;Lua) -&gt; LuaResult&lt;LuaTable&gt; {lua_init(lua)}\n\n#[mlua::lua_module] fn lib_midi_input_handler_libmidi_input_handler(lua: &amp;Lua) -&gt; LuaResult&lt;LuaTable&gt; {lua_init(lua)}\n\n#[mlua::lua_module]\nfn lua_init(lua: &amp;Lua) -&gt; LuaResult&lt;LuaTable&gt; {\n let exports = lua.create_table()?;\n exports.set(&quot;print_rust&quot;, lua.create_function(lua_print_rust)?)?;\n exports.set(&quot;innit_midi&quot;, lua.create_function(lua_innit_midi)?)?;\n Ok(exports)\n}\n\n//test function\nfn lua_print_rust(_: &amp;Lua, message: String) -&gt; LuaResult&lt;()&gt; {\n println!(&quot;[rust] {message}&quot;);\n Ok(())\n}\n\n//function that I want to use\nfn lua_innit_midi(_: &amp;Lua, _: ()) -&gt; LuaResult&lt;()&gt; {\n thread::spawn(|| {init();});\n\n Ok(())\n}\n\n</code></pre>\n<p>when I do</p>\n<pre class="lang-lua prettyprint-override"><code>local midi = require(&quot;lib.midi_input_handler.libmidi_input_handler&quot;)\n</code></pre>\n<p>In input_user.lua.\nI have this error message :</p>\n<pre><code>./lib/midi_input_handler/libmidi_input_handler.so: undefined symbol: lua_rawgetp\n</code></pre>\n<p>I tried to change my cargo.toml, but it did not change anything (my actual cargo.toml) :</p>\n<pre class="lang-ini prettyprint-override"><code>[lib]\ncrate-type = [&quot;cdylib&quot;]\n\n[dependencies]\nmidi-control = &quot;0.2.2&quot;\nmidir = &quot;0.10.0&quot;\nmlua = { version = &quot;0.9.7&quot;, features = [&quot;lua54&quot;, &quot;module&quot;] }\n\n</code></pre>\n<p>(sorry for that much of code, I don't really know how to give enough element without giving that much)</p>\n"^^ . . "0"^^ . . . . "0"^^ . . . "<p>(if anything, this post has been translated through a translator from Russian into English)</p>\n<p>For my play, I need the object to change smoothly with a delay, of course I decided to use <code>transition.to()</code> and <code>timer.performwithdelay()</code>. Everything worked fine on the first, second and third scenes, but as soon as I decided to finish the &quot;menu&quot;, where a short scene was just shown, <code>timer.performwithdelay()</code> stopped working with a delay (which is why it was made). He just went straight to <code>transition.to ()</code>, without delay.</p>\n<p>At first, I thought that I had not connected or changed something, which is why it does not work. To test this theory, I copied the code from one of the scenes where it worked, and it worked! I decided to just use this code as a kind of &quot;framework&quot;, removed unnecessary functions and objects. And it stopped working!!!</p>\n<p>As I found out empirically, <code>timer.performwithdelay()</code> for some reason skipped the delay and immediately proceeded to execute the function IF it was with &quot;parentheses&quot;, that is, it worked only in this form: <code>timer.performWithDelay( 1000, function )</code></p>\n<p>I do not know why it works like this somewhere, but somewhere like this, if you can help, then I will be very grateful :)</p>\n<p>(And by the way, yes, yes, I know about local functions, but they take up more space than I would like)</p>\n"^^ . . "How to set mapping in AstroNvim?"^^ . . . "coronasdk"^^ . "Thanks, I updated the question and added some more information and exact example of what I try to do. In Summary: I am looking for a way to serve files from different folders on my server, in Lua."^^ . "How are you determining on the client that the ball goes from player 1 to player 2? And on the server?"^^ . . . . "0"^^ . . . . "<p>I'm attempting to determine multiple aspects about a Bézier curve programmatically. I want to be able to find the arc length of the curve, points positioned along the curve with higher density at areas with a higher measure of curvature, and points positioned equidistant from each other. Currently, I store the list of controls in an array and use de Casteljau's recursive algorithm to find points and derivatives. A snippet of my implementation in luau follows:</p>\n<pre class="lang-lua prettyprint-override"><code>function Bezier:Hodograph(t: number): Curve&lt;Bezier&gt; -- A single step in the Casteljau algorithm. Yields a curve 1 degree lower than itself.\n local hodograph = Bezier.new()\n for i = 1, #self.Controls - 1 do\n hodograph.Controls[i] = self.Controls[i]:Lerp(self.Controls[i+1], t)\n end\n return hodograph\nend\n\nfunction Bezier:Casteljau(t: number, derivative: number?): Curve&lt;Bezier&gt; -- Reduces control points and returns a new curve containing the control points.\n derivative = derivative or 0\n \n if #self.Controls &lt;= derivative+1 then\n return self\n end\n \n return self:Hodograph(t):Casteljau(t, derivative)\nend\n\nfunction Bezier:Split(t: number): (Curve&lt;Bezier&gt;, Curve&lt;Bezier&gt;) -- Cuts the curve at point `t` and returns the slices in a tuple, left before right.\n local left = Bezier.new()\n local right = Bezier.new()\n \n local hodograph = self\n for i = 1, #self.Controls do\n left.Controls[i] = hodograph.Controls[1]\n right.Controls[(#self.Controls) - (i-1)] = hodograph.Controls[#hodograph.Controls]\n hodograph = hodograph:Hodograph(t)\n end\n \n return left, right\nend\n\nfunction Bezier:GetPoint(t: number): Vector3\n return self:Casteljau(t).Controls[1]\nend\n\nfunction Bezier:GetTangent(t: number): Vector3 -- Gets the 1st derivative, or rate of change (tangent) of point t.\n local controls: {Vector3} = self:Casteljau(t, 1).Controls\n \n if #controls &lt; 2 then\n return Vector3.zero -- Not enough control points to calculate first derivative (tangent).\n end\n \n return ((controls[2] - controls[1]) * (#self.Controls - 1))\nend\n\nfunction Bezier:GetAcceleration(t: number): Vector3 -- Gets the 2nd derivative, or rate of change in tangent (acceleration) of point t.\n local controls: {Vector3} = self:Casteljau(t, 2).Controls\n \n if #controls &lt; 3 then\n return Vector3.zero -- Not enough control points to calculate second derivative (acceleration).\n end\n \n return ((controls[3] - 2 * controls[2] + controls[1]) * (#self.Controls - 1) * (#self.Controls - 2))\nend\n\nfunction Bezier:GetCurvature(t: number): number\n local secondDerivative = self:Casteljau(t, 2)\n local tangent: Vector3 = secondDerivative:GetTangent(t)\n local acceleration: Vector3 = secondDerivative:GetAcceleration(t)\n \n local cross = tangent:Cross(acceleration)\n \n local speed = tangent.Magnitude^3\n if speed == 0 then\n return 0\n else\n return cross.Magnitude / speed\n end\nend\n</code></pre>\n<p>As you can see, I've already created methods for the first and second derivatives (tangent and acceleration), as well as a method to find curvature. I need some sort of method that can parameterize the arc length of the curve adaptively, emphasizing curves and ensuring that areas with little curvature don't get too much density.</p>\n<p>I've tried iterating through the curve with different time values, changing the size of steps based on curvature, subdividing until distance between points reached a certain epsilon, yet none of my methods are very &quot;scientific.&quot; They all require some sort of value passed into the function or a rough approximation on what do to next. I need a function that's reliable and returns a parameterization of quality in minimal time while only using concrete aspects of the curve itself, no arbitrary weighting or error checking.</p>\n"^^ . "I need assistance with a Numbervalue displaying on a part ,with a Textlabel, with it smoothly going up and down"^^ . "1"^^ . . . . . . "1"^^ . "text-editor"^^ . . . . "1"^^ . "1"^^ . . . . . "Yes it's safe, this happens all the time. Think about all of the STL functions that accept Lua callbacks."^^ . . . "Is your `proxy` just always empty table?"^^ . "trouble decompiling apk"^^ . "@An5Drama oh okay, so basically just validation. Got it. Edited my answer."^^ . "0"^^ . . . . . "[This bug report](https://github.com/NLua/NLua/issues/346) mentions GetFunction always returning a LuaFunction even if the function is not actually defined in Lua. The workaround seems to be using indexing instead of GetFunction `func = luaCode[curState + "_Loop"]` instead of `func = luaCode.GetFunction(curState + "_Loop")`"^^ . . . . . "@RyanLuu i disagree because accessories / tools shouldnt be part of the hitbox ;)"^^ . . "0"^^ . . . "1"^^ . . . . . "0"^^ . "2"^^ . "<p>Order of keys is not guaranteed in objects. For that you should use an array. You can move the key of each item as its <code>id</code>, for example.</p>\n<pre class="lang-lua prettyprint-override"><code>local gamesArray = {\n {\n [&quot;id&quot;] = &quot;777_Thimble&quot;,\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/777thimble_logo.svg&quot;,\n [&quot;1x_multiplier&quot;] = 2.88,\n [&quot;2x_multiplier&quot;] = 1.44,\n [&quot;first_bet&quot;] = 50,\n [&quot;second_bet&quot;] = 100,\n [&quot;third_bet&quot;] = 250,\n [&quot;four_bet&quot;] = 1000,\n [&quot;five_bet&quot;] = 5000,\n [&quot;min_attributable_bet_value&quot;] = 5,\n [&quot;max_attributable_bet_value&quot;] = 10000,\n },\n {\n [&quot;id&quot;] = ,&quot;777e_Thimble&quot;\n [&quot;game_name&quot;] = &quot;777 Thimble&quot;,\n [&quot;game_thumbnail&quot;] = &quot;img/game_bg.svg&quot;,\n [&quot;1x_multiplier&quot;] = 2.88,\n [&quot;2x_multiplier&quot;] = 1.44,\n [&quot;first_bet&quot;] = 50,\n [&quot;second_bet&quot;] = 100,\n [&quot;third_bet&quot;] = 250,\n [&quot;four_bet&quot;] = 1000,\n [&quot;five_bet&quot;] = 5000,\n [&quot;min_attributable_bet_value&quot;] = 5,\n [&quot;max_attributable_bet_value&quot;] = 10000,\n },\n -- more entries ...\n}\n\n\n</code></pre>\n"^^ . "1"^^ . . . . . . . "0"^^ . "list"^^ . . "Ahhh... nvm! I just nuked my `~/.local/share/nvim` path and I got the same issue as yours - https://pastebin.com/aCPtD5kn - and the `/mason/bin` appears on my neovim's PATH env variable. However, `lua-language-server` is missing from `/mason/bin` folder, so there is something wrong with the `servers` table setup."^^ . . . "2"^^ . . "0"^^ . . . . . "Neovim Vim - stylua is not executable (make sure it's installed and on your $PATH)"^^ . "0"^^ . "<p>So through an event I use my SCP867Service:Test onto my Effect's module</p>\n<pre class="lang-lua prettyprint-override"><code>--Service script\nfunction SCP867Service:Test(player)\n Effect.Apply(self.PrintSomething, player, 10, 1, &quot;Test&quot;)\n wait(5)\n Effect.Remove(self.PrintSomething, player, &quot;Test&quot;)\nend\n</code></pre>\n<pre class="lang-lua prettyprint-override"><code>--Module script\nfunction effect.Apply(func, player, duration, tickSpeed, tag)\n \n --Check if the player already has the effect, bad code we don't check nil cases\n local owningPlayer = game.Players:GetPlayerFromCharacter(player.Parent)\n if effectsStorage[owningPlayer] and not Macros.findValue(effectsStorage[owningPlayer], func) then\n --Adding to all tables\n local functionCoroutine = coroutine.create(function()func(player, duration, tickSpeed)end)\n</code></pre>\n<p>In debugging the values look correct, with the player being the humanoid I passed, duration being 10 and tickSpeed being 1. Which then executes a function in the original service script:</p>\n<pre class="lang-lua prettyprint-override"><code>function SCP867Service:PrintSomething(player, duration, tickSpeed)\n for i = 1, duration, 1 do\n print(&quot;Testing count: &quot;, i)\n task.wait(tickSpeed)\n end\nend\n</code></pre>\n<p>However here player = 10, duration =1 and tickSpeed = nil\nWhat causes this?</p>\n<p>I did all debugging I could and found that somewhere between the module script and the function being executed in my coroutine an additional value was required. I added a patch work solution of passing an additional nil before my player to make my code work, but doesn't seem like the proper solution.</p>\n<pre class="lang-lua prettyprint-override"><code>local functionCoroutine = coroutine.create(function() func(nil, player, duration, tickSpeed)end)\n</code></pre>\n"^^ . "<p>Lmod supports sourcing of shell scripts via the source_sh function:</p>\n<p><a href="https://lmod.readthedocs.io/en/latest/260_sh_to_modulefile.html#using-source-sh" rel="nofollow noreferrer">https://lmod.readthedocs.io/en/latest/260_sh_to_modulefile.html#using-source-sh</a></p>\n"^^ . "<p>The function:</p>\n<pre class="lang-lua prettyprint-override"><code>function deepApply (default, new)\n for key, value in pairs (new) do\n if type (value) == &quot;table&quot; then\n if not default[key] then\n default[key] = {}\n print ('created table ['..key..']')\n end\n local def2 = default[key]\n local new2 = new[key]\n deepApply (def2, new2)\n elseif default[key] ~= new[key] then\n print ('updated ['..key..'] from ['..tostring(default[key])..'] to ['..tostring(new[key])..']')\n default[key] = new[key]\n end\n end\nend\n</code></pre>\n<p>Example:</p>\n<pre class="lang-lua prettyprint-override"><code>local globalDefault = {\n [&quot;LastPlayed&quot;] = &quot;&quot;,\n [&quot;Grades&quot;] = {\n [&quot;Grade&quot;] = 1,\n [&quot;Level&quot;] = 1\n },\n [&quot;Challenge&quot;] = {\n [&quot;History&quot;] = {}\n },\n [&quot;Settings&quot;] = {\n [&quot;ScrollFrameHitbox&quot;] = false\n }\n}\n\nlocal globalData = {\n [&quot;Settings&quot;] = {\n [&quot;ScrollFrameHitbox&quot;] = true\n },\n [&quot;NewSettings&quot;] = {\n [&quot;IsFun&quot;] = true\n },\n}\n\ndeepApply (globalDefault, globalData)\n\nserpent = require ('serpent')\n\nprint (serpent.block (globalDefault))\n</code></pre>\n<p>Result:</p>\n<pre class="lang-lua prettyprint-override"><code>created table [NewSettings]\nupdated [IsFun] from [nil] to [true]\nupdated [ScrollFrameHitbox] from [false] to [true]\n{\n Settings = {\n ScrollFrameHitbox = true\n },\n Challenge = {\n History = {}\n },\n NewSettings = {\n IsFun = true\n },\n LastPlayed = &quot;&quot;,\n Grades = {\n Level = 1,\n Grade = 1\n }\n}\n</code></pre>\n"^^ . . . . . "0"^^ . "Oh my bad, yeah you were correct the humanoid root part IS anchored, mb for thinking it wasnt. \nThank you so much i was scratching my head about this for weeks and only recently decided to get back into this"^^ . "Value not updating in script although it is getting update outside of it"^^ . "How to create a lua filter that targets title slides in Quarto revealjs presentations"^^ . . . . "1"^^ . . . "0"^^ . . . . . "I've no idea how this works... But it works so well. I'm going to look into this, thanks!\n\nEdit: After a few minutes of searching, the Lua Handbook and a forum post explained this pretty well. I'll be making sure to use this!"^^ . . . . . "0"^^ . . "0"^^ . "0"^^ . . . "oop"^^ . . . . . . . "it's an option too if it works as that supposed to be"^^ . "isKeyPressed() function is not working for me"^^ . "Am I missing something or there is no actual error in the question?"^^ . "What do you mean by "Change this to the frame you want the buttons parented to", when I tested it won't work and I did change the workspace to the frame."^^ . . . "docker"^^ . "2"^^ . . "0"^^ . . . . . . . "0"^^ . . "1"^^ . . . "1"^^ . . . "This is mostly an X11 question and not AwesomeWM specific. The problem is basically, that X11 comes from a time when memory was really precious and so only the actual screen contents are saved in memory. Try having a floating window above another window. I would expect that `c.content` would also show the content from the floating window. This also means that minimised windows are explicitly told that they are not visible and don't have to draw their content. Thus, there is nothing you can get this content from. Sorry."^^ . . . . . . "0"^^ . . "<p>It turns out, the problem was being on an old version of mason-lspconfig. This was causing the issue:</p>\n<pre><code>require('mason-lspconfig').setup {\n handlers = {\n function(server_name)\n local server = servers[server_name] or {}\n\n server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})\n require('lspconfig')[server_name].setup(server)\n end,\n },\n</code></pre>\n<p>The way to pass in the handlers was different in an older version. Updating it solved the problem.</p>\n"^^ . . . . . . "0"^^ . . . "solar2d"^^ . . . "timer.performwithdelay() works without delay from transition.to ()"^^ . . . . "for-loop"^^ . . . "1"^^ . . . "2"^^ . . . "@wurli the syntax doesn't work in my neovim could you send me what version of neovim you using \n\nthis is mine \n`\nNVIM v0.9.5\nBuild type: Release\nLuaJIT 2.1.1692716794\n\n system vimrc file: "$VIM/sysinit.vim"\n fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"\n\nRun :checkhealth for more info\n`"^^ . "0"^^ . "1"^^ . . . . . "1"^^ . "1"^^ . "0"^^ . "0"^^ . . . . "0"^^ . . . "0"^^ . . . . "<p>if you wanna highlight the parent of the proximity prompt when the proximity prompt becomes visible you could use the <a href="https://create.roblox.com/docs/reference/engine/classes/ProximityPromptService#PromptShown" rel="nofollow noreferrer"><code>PromptShown</code></a> and <a href="https://create.roblox.com/docs/reference/engine/classes/ProximityPromptService#PromptHidden" rel="nofollow noreferrer"><code>PromptHidden</code></a> events inside the <a href="https://create.roblox.com/docs/reference/engine/classes/ProximityPromptService" rel="nofollow noreferrer"><code>ProximityPromptService</code></a> and add / remove the highlight inside this event.</p>\n<p>this should apply to <strong>all</strong> prompts in your game.</p>\n<p>the following script should be placed inside a <a href="https://create.roblox.com/docs/reference/engine/classes/LocalScript" rel="nofollow noreferrer"><code>LocalScript</code></a> inside the <code>StarterPlayerScripts</code> folder.</p>\n<pre><code>local ProximityPromptService = game:GetService(&quot;ProximityPromptService&quot;);\n\nProximityPromptService.PromptShown:Connect(function(Prompt)\n local highlight = Instance.new(&quot;Highlight&quot;, Prompt);\n highlight.Adornee = Prompt.Parent; -- the part to highlight\n highlight.OutlineColor = Color3.fromRGB(255, 0, 0); -- red outline\n highlight.FillColor = Color3.fromRGB(255, 0, 0); -- red fill color\n highlight.FillTransparency = 0.7; -- transparency of the fill color\nend)\n\nProximityPromptService.PromptHidden:Connect(function(Prompt)\n for _, child in pairs(Prompt:GetChildren()) do\n if child:IsA(&quot;Highlight&quot;) then\n child:Destroy(); -- destroys all existing highlights\n end\n end\nend)\n</code></pre>\n"^^ . . . . . . "@Ôrel I don't know how, that's the issue :') Maybe I wasn't clear enough in my question"^^ . "<p>You have 2 main problems here, 1 is the fact that you are listening to a GuiButton on the server and that you are changing StarterGui.</p>\n<p>Instead of having a ServerScript listening to the events, you should use LocalScript, put the SurfaceGui in a ScreenGui and set the SurfaceGui's Adornee to the part.</p>\n<p>From there you can listen to the event from a LocalScript.\nSomething like the below.</p>\n<pre class="lang-lua prettyprint-override"><code>local SurfaceGui = script.Parent.SurfaceGui\nlocal ScreenPart = workspace.Screen\nlocal frame = script.Parent.Frame\n\nSurfaceGui.Adornee = ScreenPart\nSurfaceGui.Button.MouseButton1Click:Connect(function()\n frame.Visible = true\nend)\n</code></pre>\n<p>(where the LocalScript is in the root of the ScreenGui)</p>\n"^^ . "1"^^ . . "3"^^ . "How to use Lua script with ingress-nginx"^^ . . "0"^^ . . "0"^^ . . . . . . . . . "0"^^ . . . . . . "computational-geometry"^^ . "0"^^ . . "1"^^ . . "I've thought of a work around, but am unsure why it isn't working. In the above code, just before the content is grabbed, I unminimize the client, grab the content, and then reminimize the client. When I do this, I expected the content to be grabbable, but it is still blank. How can I force cl.content to update?"^^ . . "0"^^ . "@AlexanderMashin Thanks for your comment. One pure lua solution without using one external lib is preferred."^^ . "apk"^^ . . . . . "0"^^ . . . . . . . . . . . . . "0"^^ . . . . . "0"^^ . "How to load just one item from the data list?"^^ . "0"^^ . "<pre><code>local PathfindingService = game:GetService(&quot;PathfindingService&quot;)\n\n\nlocal Humanoid = script.Parent.Humanoid\nlocal Root = script.Parent.HumanoidRootPart\nlocal goal = script.Parent.Goal -- Change the name of the goal to your Part that you want it to reach.\nlocal prompt = game.Workspace.KickDoor.Door.KickPromptAttachment.ProximityPrompt\n\n\nprompt.Triggered:Connect(function(plr)\n local playerhumanoid = plr.Character:WaitForChild(&quot;Head&quot;)\n local path = PathfindingService:CreatePath()\n path:ComputeAsync(Root.Position, goal.Position)\n local waypoints = path:GetWaypoints()\n for i, waypoint in ipairs(waypoints) do\n Humanoid:MoveTo(waypoint.Position)\n if waypoint.Action == Enum.PathWaypointAction.Jump then\n Humanoid.Jump = true\n end\n local RunService = game:GetService(&quot;RunService&quot;)\n Humanoid.MoveToFinished:Connect(function()\n RunService.Heartbeat:Connect(function()\n Root.CFrame = CFrame.lookAt(\n Root.Position,\n playerhumanoid.Position * Vector3.new(1,0,1)\n + Root.Position * Vector3.new(0,1,0))\n while true do\n local a = script.Parent.Head\n local b = playerhumanoid\n\n local direction = b.position - a.Position\n\n local raycastResult = workspace:Raycast(a.Position,direction)\n\n if raycastResult and raycastResult.Instance then\n\n raycastResult.Instance.Color = Color3.new(1,0,0)\n \n end\n task.wait(1)\n end\n end)\n end)\n end\nend)\n\nHumanoid.Died:Connect(function()\n local ragdoll = game.ReplicatedStorage.Ragdoll\n local clonedModel = ragdoll:Clone()\n clonedModel.Parent = workspace\n clonedModel:MoveTo(Humanoid.Parent.HumanoidRootPart.Position-Vector3.new(0,-5.5,0))\n wait(.1)\n Humanoid.Parent:Destroy()\nend)\n</code></pre>\n<p>How can I detect if the raycast coming from the NPC hits the player? Currently the script Detects parts between the player and the NPC, and changes the color of those detected parts. The desired functionality is that when the player is not behind a part obscuring the NPC's vision, the NPC detects the player.</p>\n"^^ . . "0"^^ . "0"^^ . "3"^^ . "0"^^ . "<p>So I am trying to make a lua script that use &quot;socket.http&quot; but it seems to be missing some dlls or .lua and i'm trying to understand how I would be able to add them into the same folder as my let's call it executor. This is what i get when i try &quot;local socket = require(&quot;socket.http&quot;).</p>\n<p>screenshot:\n<a href="https://i.sstatic.net/ujJ7k.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ujJ7k.png" alt="1" /></a></p>\n<p>I have already downloaded the src for socket.http from <a href="https://github.com/lunarmodules/luasocket" rel="nofollow noreferrer">luasocket repository</a> but i don't know what to do after like\nwhere do i add the files in the folder of my executable, so that I could be able to use socket.http?</p>\n<p>I've tried just adding the src folder to the path where my &quot;executor&quot; is and that didn't work for some reason, i also tried adding a folder called &quot;lua&quot; with only socket.lua and http.lua but that yet again didn't work too.</p>\n"^^ . . . . . . . "0"^^ . . "fivem"^^ . . . . . . . . "0"^^ . "1"^^ . . "1"^^ . "<p>I have been trying to find the code of this game called House of the Lost for a long time. It is for a platform called the Ouya. I believe it was made using corona sdk. Also if you do manage to do it please tell me how. Here is the link to the download site <a href="https://archive.org/details/ouya_com.f5games.hotlouya_1.0.1" rel="nofollow noreferrer">https://archive.org/details/ouya_com.f5games.hotlouya_1.0.1</a> download the android package archive.</p>\n<p>I tried to use corona archiver but when I did it worked but when I looked at the result it was still gibberish. am I doing something wrong or is it impossible?</p>\n"^^ . . "0"^^ . "<p>I'm trying to change the background of the neovim using lua.</p>\n<pre class="lang-lua prettyprint-override"><code>-- init.lua\n\nvim.o.termguicolors = true\n\nvim.api.nvim_set_hl(0, &quot;Normal&quot;, { bg=&quot;#04110d&quot; })\n</code></pre>\n<p>The expected result should be like this (modified directly via Terminal settings)</p>\n<p><a href="https://i.sstatic.net/vbG5GJo7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vbG5GJo7.png" alt="enter image description here" /></a></p>\n<p>But it renders like this</p>\n<p><a href="https://i.sstatic.net/tHlzrZyf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tHlzrZyf.png" alt="enter image description here" /></a></p>\n<p>I use the default Ubuntu Terminal with default configuration.</p>\n<p>I tried to use a &quot;simplier&quot; color and it works</p>\n<p>Instead of this</p>\n<pre><code>vim.api.nvim_set_hl(0, &quot;Normal&quot;, { bg=&quot;#04110d&quot; })\n</code></pre>\n<p>I used this</p>\n<pre><code>vim.api.nvim_set_hl(0, &quot;Normal&quot;, { bg=&quot;#ff0000&quot; })\n</code></pre>\n<p><a href="https://i.sstatic.net/ZLLobkfm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ZLLobkfm.png" alt="enter image description here" /></a></p>\n<p>(sorry for the red image)</p>\n<p>Does anyone know the root cause of the problem and how I can fix that?</p>\n<p>I'd expect the specified color #04110d to work as expected (displaying the dark green background).</p>\n<p>Thanks</p>\n"^^ . . . . . . . . "<p>I have a Kong setup based on Docker, configured in declarative mode (YAML manifest).</p>\n<p>Reference docs: <a href="https://docs.konghq.com/gateway/3.6.x/production/deployment-topologies/db-less-and-declarative-config/#main" rel="nofollow noreferrer">Kong | DB-less and Declarative Configuration</a>.</p>\n<h2>Kong Docker Setup</h2>\n<p>File <code>kong_install.bat</code>:</p>\n<pre><code>@echo off\n\ndocker run -d ^\n--name kong-dbless ^\n--network=kong-net ^\n-v &quot;C:/path/to/config/:/kong/declarative/&quot; ^\n-e &quot;KONG_DATABASE=off&quot; ^\n-e &quot;KONG_DECLARATIVE_CONFIG=/kong/declarative/kong.yml&quot; ^\n-e &quot;KONG_PROXY_ACCESS_LOG=/dev/stdout&quot; ^\n-e &quot;KONG_ADMIN_ACCESS_LOG=/dev/stdout&quot; ^\n-e &quot;KONG_PROXY_ERROR_LOG=/dev/stderr&quot; ^\n-e &quot;KONG_ADMIN_ERROR_LOG=/dev/stderr&quot; ^\n-e &quot;KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl&quot; ^\n-e &quot;KONG_ADMIN_GUI_URL=http://localhost:8002&quot; ^\n-p 8000:8000 ^\n-p 8443:8443 ^\n-p 127.0.0.1:8001:8001 ^\n-p 127.0.0.1:8444:8444 ^\nkong:3.6.1\n\npause\n</code></pre>\n<h2>Kong Declarative Config</h2>\n<p>Here's my <code>kong.yml</code> manifest:</p>\n<pre class="lang-yaml prettyprint-override"><code>_format_version: &quot;3.0&quot;\n_transform: true\n\nservices:\n- name: example_service\n protocol: http\n host: httpbin.org\n port: 80\n routes:\n - name: example_route\n paths:\n - /mock\n strip_path: true\n \nplugins:\n- name: rate-limiting\n route: example_route\n config:\n second: 1\n minute: 10\n policy: local\n</code></pre>\n<h2>Custom Plugin &quot;log-test&quot;</h2>\n<p>I have a simple custom plugin that logs some message in the Kong gateway, during the processing of the request headers.</p>\n<p>File <code>handler.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>local LOG_TEST_Handler = {}\n\nLOG_TEST_Handler.PRIORITY = 1000\nLOG_TEST_Handler.VERSION = &quot;1.0.0&quot;\nLOG_TEST_Handler.NAME = &quot;log-test&quot;\n\nfunction LOG_TEST_Handler:header_filter(config)\n kong.log(&quot;LOG.header_filter: start\\n\\n&quot;)\n \n kong.log(&quot;LOG.header_filter:\\nHello world from log-test custom plugin\\n\\n&quot;)\n \n kong.log(&quot;LOG.header_filter: end\\n\\n&quot;)\nend\n\nreturn LOG_TEST_Handler\n</code></pre>\n<p>File <code>schema.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>local typedefs = require &quot;kong.db.schema.typedefs&quot;\n\nreturn {\n name = &quot;log-test&quot;,\n no_consumer = true, -- This plugin does not require a Consumer to be configured.\n fields = {\n },\n}\n</code></pre>\n<h2>Question</h2>\n<p>Is there a way to configure (<em><strong>possibly in a declarative way</strong></em>, i.e. via YAML manifest) Kong to install custom plugins? I've searched the documentation for hours but couldn't find anything related, except for <code>kong.conf</code> &quot;<a href="https://docs.konghq.com/gateway/3.6.x/reference/configuration/#lua_package_path" rel="nofollow noreferrer">lua_package_path</a>&quot;.</p>\n"^^ . . . . . . . . . . . . "<pre class="lang-lua prettyprint-override"><code> local Core = Instance.new(&quot;Part&quot;,workspace)\n local OuterCore = Instance.new(&quot;Part&quot;,workspace)\n Core.CanCollide = false\n OuterCore.CanCollide = false\n Core.Position = Missile.Position\n OuterCore = Core.Position\n Core.BrickColor = BrickColor.new(&quot;New Yeller&quot;)\n OuterCore.BrickColor = BrickColor.new(&quot;Neon orange&quot;)\n Core.Transparency = 0.3\n OuterCore.Transparency = 0.3 \n</code></pre>\n<p>Literally no property can be assigned to the part except for parent. The error is &quot;(property) cannot be assigned to&quot;.This is inside a module script if that helps. Please help</p>\n"^^ . . . "1"^^ . . "<p>I'm working with Luasnip, and for my latex setup I have some snippets that would make sense to run only if the previous character is a digit, a letter, or a curly brace. The digit and numbers work flawlessly, but for the life of me I can't figure out how to include this closing curly brace. I've escaped it every way I can think of with no success. Here is the pattern I'm working with currently, but if anyone can explain how to include the closing curly brace in that set that would be phenomenal.</p>\n<pre class="lang-lua prettyprint-override"><code>&quot;([%a%d}])_&quot; -- _ should be the trigger character for a subscript in this case.\n</code></pre>\n"^^ . . "<p><code>a = string.sub(&quot;слово&quot;, 1,1)</code>\nслово is a word in russian which needs 2 bytes for every letter and the output for\n<code>print(a)</code>\nis going to something like � depending on where you run it</p>\n<p><code>if a ==&quot;?&quot; then</code></p>\n<p><code>if a ==&quot;�&quot; then</code></p>\n<p><code>if a ==&quot;&quot; then</code>\n<code>if a ==nil then</code></p>\n<p>doesn't work</p>\n<p>I just want to know which symbol would work for the if statement</p>\n"^^ . . . . "1"^^ . . . "<p>Yeah, you can map the key map like this.</p>\n<pre><code>vim.keymap.set(&quot;n&quot;, &quot;&lt;C-BS&gt;&quot;, &quot;dw&quot;, {silent = true, desc = 'delete from cursor to ending word'})\nvim.keymap.set(&quot;n&quot;, &quot;&lt;C-Del&gt;&quot;, &quot;db&quot;, {silent = true, desc = 'delete from cursor to beginning word'})\n</code></pre>\n<p>But note that, in some case, <code>&lt;C-BS&gt;</code> does not work as expect.</p>\n"^^ . . . . . . "regex for the pattern of one optional space before Chinese words in lua"^^ . "I don't think it has to do with _ENV. I also tried `foo` being `if always_true then return 0 end return 1 end` and bar being the same but with `always_false` https://luac.nl/s/e75d1ddecad1497ac7f6975c8f\n\nBoth methods have low-hanging fruits of optimizations, but the false case has the `JMP` and the true case does not"^^ . . . . "0"^^ . . . "@Assaf Adding `lazy = false` into the configuration you added to the *plugins/lazy.lua* file in order to automatically load the plugin and if you want to open the current buffers repo use `:LazyGitCurrentFile` instead of the basic `:LazyGit` command in your config."^^ . "@Luatic I want a full match, which means `^%s?[\\u{4e00}-\\u{9FFF}]+$`. Sorry for the ambiguity."^^ . "lua-patterns"^^ . "0"^^ . "1"^^ . . . "0"^^ . . . . . "0"^^ . . "<p>The issue was with my understanding of the for loop. in this block, the <code>v</code> needed to be <code>i</code> since I wanted to check against the index not the value.</p>\n<p>OLD:</p>\n<pre><code>for i,v in ipairs(check) do\n if (v ~= my-2) then\n check[i] = 0\n end\nend\n</code></pre>\n<p>NEW:</p>\n<pre><code>for i,v in ipairs(check) do\n if (i ~= my-2) then\n check[i] = 0\n end\nend\n</code></pre>\n"^^ . . . . . . . "time"^^ . "0"^^ . . . "0"^^ . . "1"^^ . "0"^^ . . "wireshark"^^ . . . . . "0"^^ . . "didn't work, no output either"^^ . . "So I changed the button's parent but doesn't seem to work, I did everything that is done in that script. This script it located in `StarterGui.Folder.ScreenGui.ImageIabel.ScrollingFrame`. What am I doing wrong? @Ryan Luu"^^ . . . . "2"^^ . . . . . . . "<p>What is most likely is that part of the enemy character is anchored, (probably the HumanoidRootPart) and making sure everything in the enemy is unanchored, and it <em>shoould</em> work.</p>\n"^^ . "@skisp You likely one of the variables you have are incorrect but to answer your initial question you can use a loop to create a button for each item by creating a function which creates a button given an item and then iterating through each item with that function using a for i, v in pairs loop."^^ . "Comparing multiple values in a table makes it that it choses to compare only one randomly"^^ . . "0"^^ . "0"^^ . . . . "0"^^ . . . "How can I install custom plugins in Kong using declarative configuration?"^^ . "0"^^ . "1"^^ . . . . "4"^^ . . . . . "1"^^ . . "<p>Yea so I was just making a sports game, and I basically needs a ball catching/holding system, It works on both sides on the first time but after I thrown it is just glitches out and the ball kept running away from me in client, but on the server side, It says that I am already holding the ball, I will add some notes to my code for better understanding.</p>\n<pre><code>-- This script is made in StarterCharacterScripts --\n\nwhile true do -- a loop looping forever to check if the character is touching anything\n for i,v in ipairs(script.Parent:GetChildren()) do -- Looping through the whole body check all the body parts\n if v:IsA(&quot;Part&quot;) or v:IsA(&quot;MeshPart&quot;) then -- Checking if it is a body part (just to prevent it checking he humanoid so we won't get an error\n v.Touched:Connect(function(hit) -- see if the body part is touching anything\n if hit.Name == &quot;Ball&quot; then -- Checking if it is a ball\n print(&quot;Ball&quot;)\n hit.Parent = script.Parent -- putting the ball inside of the body\n hit.Joint.Part0 = script.Parent.RightHand -- positioning it on the right place\n print(&quot;Holding&quot;)\n end\n end)\n wait()\n end\n end\n wait()\nend\n</code></pre>\n<p>This is the code I am using now, I still have one on the ball before.</p>\n<pre><code>local BALL = require(game.ServerScriptService.ModuleScript) -- requiring the base module\n\nscript.Parent.Touched:Connect(function(hit) -- Checking if the ball is touched by anything\n if hit.Parent:FindFirstChild(&quot;Humanoid&quot;) then -- see if it is a player\n BALL.Pickup(hit, script.Parent) -- Using the function from the module\n end\nend)\n</code></pre>\n<p>Here is the module</p>\n<pre><code>local BALL = {} -- the table\n\nBALL.Pickup = function(hit, ball) -- The function\n ball.Parent = hit.Parent -- setting its parent\n ball.Joint.Part0 = hit.Parent:WaitForChild(&quot;RightHand&quot;) -- positioning again\n print(ball.Joint.Part0) -- just for debugging\nend\n\n\nreturn BALL\n\n</code></pre>\n<p>I hope you guys can help me solve this problem\nbtw the ball aren't running away on roblox player but I just can't grab it</p>\n"^^ . "debugging"^^ . . "<p>I want to make an area in which you lose health, but once out, you don't.\nSo i have created a part, made <code>transparency to 1</code>, and <code>canCollide to false</code>, than put it inside of water. In the code character loses health when enter water, but still lose when out.\nThis is a code i have</p>\n<pre class="lang-lua prettyprint-override"><code>local parent = script.Parent -- the part\nlocal Player = game:GetService('Players')\n\nlocal isInWater = false\nlocal setHealth = 0\n\nlocal function onCollide (hit)\n\n local character = hit.Parent\n local player = Player:GetPlayerFromCharacter(character)\n local humanoid = character:FindFirstChild('Humanoid')\n isInWater = true\n print('in water')\n\n if player and humanoid and isInWater then\n for initalHealth = humanoid.Health, setHealth, -10 do\n humanoid.Health = initalHealth\n task.wait(.2)\n end\n end\nend\n\nparent.Touched:Connect(onCollide)\n\nparent.TouchEnded:Connect(function()\n isInWater = false\n print('left water')\n task.wait(1)\nend)\n</code></pre>\n<p>I made a variable <code>isInWater</code>, which is set to false by default, but once you collide with <code>parent</code> it sets to true, in for loop it's mandatory to work with <code>isInWater</code> being set to true.\nThen came up with yet another function for <code>TouchEnded</code> event to set <code>isInWater</code> to false once you end touching the part.\nNow for loop should <strong>probably</strong> stop.\nThan i thought that <code>for loop</code> won't stop because loop have already begun the job. So what can i do? I'm new to Lua, so any help would be appreciated</p>\n"^^ . "1"^^ . . . . . . "1"^^ . . "3"^^ . "1"^^ . . . . . . "luadec"^^ . . . "visual-studio-code"^^ . "I'm unfamiliar with Roblox scripting, but if `game:GetService("Workspace").TouchDetector.Touched` is activated many times, you connect a new event to `game:GetService("Workspace")["Basement Detector"].Touched` every time. So if TouchDetector gets touched 10x, then you have 10 events that will fire simultaneously on the BasementDetector. Maybe instead of creating the event within another event, you should create the event at the start, and have it do nothing unless a certain condition variable is set?"^^ . . . "1"^^ . "1"^^ . "Why does only one selection work when checking against a table in lua?"^^ . . "0"^^ . . . "its been years since I've touched java, but don't you have to provide a classpath when you run java file?"^^ . . . "0"^^ . "Why neovim can't render a background color?"^^ . "Is there a way to use/a workaround for http requests in a localscript in Roblox?"^^ . "1"^^ . "1"^^ . . . . "2"^^ . . "1"^^ . . . "0"^^ . "0"^^ . "0"^^ . "0"^^ . "1"^^ . . "0"^^ . "0"^^ . . "It doesn't work, unfortunately. I just installed imapfilter on an Ubuntu Server and it should work. We use Zimbra as our mail server."^^ . "<pre class="lang-lua prettyprint-override"><code>string.find(&quot;MOZ-MAIL-1-1&quot;,&quot;MOZ-MAIL-&quot;)\nstring.find(&quot;MOZ-MAIL-1-1&quot;,&quot;OZ-MAIL-&quot;)\n</code></pre>\n<p>Given the above, why do those return false, but the following succeeds?</p>\n<pre class="lang-lua prettyprint-override"><code>string.find(&quot;MOZ-MAIL-1-1&quot;,&quot;Z-MAIL-&quot;)\n</code></pre>\n"^^ . "12"^^ . "1"^^ . "1"^^ . "greatest-common-divisor"^^ . . . . . "1"^^ . . . . . "1"^^ . . . . "0"^^ . . "holding shift to toggle the mouse buttons in lua?"^^ . "0"^^ . . . "0"^^ . . "amazon-s3"^^ . "0"^^ . "3"^^ . "<p>I'm working on building a C++ hook into a game that uses a Lua 5.1 interpreter internally for game functions. Currently, I've identified the common functions that I can use to get the internal lua state (lua_State) however I don't really know where to start on for passing expressions to the interpreter.</p>\n<p>I'm looking for functionality similar to python's <code>exec()</code>, which executes the string provided to it. A possible &quot;entry&quot; point to the interpreter, such as an internal console. I've looked at <code>luaL_dostring</code>, though it does not seem present in the executable of the game.</p>\n"^^ . . "0"^^ . . . "3"^^ . . . "1"^^ . . . . . . "2"^^ . "1"^^ . "scripting"^^ . . . "<p>I'm trying to write a lua filter for Quarto/pandoc that removes all code blocks that do not match the target languages as defined in the yaml header of the document. This is the filter I got so far:</p>\n<pre class="lang-lua prettyprint-override"><code>taget_lang = nil\n\nfunction Meta(m)\n if m.taget_lang then\n taget_lang = pandoc.utils.stringify(m.taget_lang) \n end\n print(&quot;In Meta, taget lang is &quot; .. taget_lang)\n return m\nend\n\nfunction CodeBlock(el)\n print(&quot;In CodeBlock, taget lang is &quot; .. taget_lang)\n if taget_lang then\n if el.attr.classes[1] ~= taget_lang then\n return {}\n end\n return el\n end\nend\n</code></pre>\n<p>And this is an example markdown (or rather Quarto) document:</p>\n<pre><code> ---\n title: Some title\n author: Some author\n date: last-modified\n format:\n ipynb: \n toc: false\n filters: \n - langsplit.lua\n taget_lang: &quot;python&quot;\n ---\n \n Here is some text.\n \n ```{python test-py}\n print(&quot;some python code&quot;)\n ```\n \n ```{r test-r}\n print(&quot;some R code&quot;)\n ```\n</code></pre>\n<p>When I use <code>quarto render test.qmd</code>, I get this print output:</p>\n<pre><code>nil\nnil\nnil\nnil\nIn Meta, taget lang is python\n</code></pre>\n<p>And the rendered document contains all code, telling me that the CodeBlock function has no access to the taget_lang defined inside Meta. But this should work, based on the <a href="https://pandoc.org/lua-filters.html#replacing-placeholders-with-their-metadata-value" rel="nofollow noreferrer">documentation</a>. Any clues?</p>\n<p>(I'm also unhappy with <code>return {}</code>, which returns an empty code block instead of nothing, but that's a separate issue)</p>\n"^^ . "<pre class="lang-lua prettyprint-override"><code>function foo() end\n\nif foo() then end\n</code></pre>\n<p>I saw some code that did this and wondered: What is being evaluated by the if statement when foo() does not return anything.</p>\n<p>Tried it in an interpreter and it evaluates to false, but is that a guarantee? Is it evaluating the last thing returned somewhere else?</p>\n"^^ . "@Nifim ya thats what I want to achieve but how can I make changes in the source code? How would I generate the .rpm file out of it post that"^^ . . "1"^^ . . . . . . "After coercing the visual studio command line to build for x64, I was able to get everything running. As expected, it was something obvious that I simply missed, thank you"^^ . . . "0"^^ . . "0"^^ . . . . . . "0"^^ . . . "1"^^ . "0"^^ . . "0"^^ . . . . "game-development"^^ . . "0"^^ . "user-interface"^^ . . . . . . "I cannot follow. Could some client-side (JS) code solve your problem?"^^ . . . . . . "<p>The following scripts return the same error &quot;Invalid spell slot in GetSpellCooldown&quot;</p>\n<pre class="lang-lua prettyprint-override"><code>/script print(GetSpellCooldown(10335, &quot;spell&quot;))\n</code></pre>\n<p>The id '20216' is the id of 'Holy Strike' in turtle wow:</p>\n<p><a href="https://database.turtle-wow.org/?spell=10335" rel="nofollow noreferrer">https://database.turtle-wow.org/?spell=10335</a></p>\n<p>The above scriptlet works if I use the id for 'Divine Shield':</p>\n<pre class="lang-lua prettyprint-override"><code>/script print(GetSpellCooldown(1020, &quot;spell&quot;))\n</code></pre>\n<p>I must be missing something obvious:</p>\n<p><a href="https://wowwiki-archive.fandom.com/wiki/API_GetSpellCooldown" rel="nofollow noreferrer">https://wowwiki-archive.fandom.com/wiki/API_GetSpellCooldown</a></p>\n"^^ . . "Why do you add `.so` (Linux) file type extension to `package.cpath` on Windows?"^^ . "<p>To get the exact functionality you want, you could use <a href="https://create.roblox.com/docs/reference/engine/classes/RemoteEvent" rel="nofollow noreferrer">RemoteEvents</a> and <a href="https://create.roblox.com/docs/reference/engine/classes/RemoteFunction" rel="nofollow noreferrer">RemoteFunctions</a> to send and reiceve data from the server. Try something like this.</p>\n<ol>\n<li>Create a RemoteFunction in ReplicatedStorage called &quot;Action&quot;</li>\n<li>In a script, use <code>local Response = game.ReplicatedStorage.Action:InvokeServer()</code> to ask the server to send you information</li>\n<li>On the server, use the lines</li>\n</ol>\n<pre class="lang-lua prettyprint-override"><code>game.ReplicatedStorage.Action.OnServerInvoke = function()\n return gearManagement.CheckForViewableInventory(player)\nend\n</code></pre>\n<p>This will get the information on the server and send it to the client.</p>\n"^^ . . "Adaptive Timesteping definitely improved things! A structure that used to take around 2 minutes to fall is now falling in around 10-30 seconds!"^^ . . . . . "0"^^ . . "0"^^ . . . . . . . "0"^^ . . "1"^^ . . . "lua"^^ . . . . . "0"^^ . "0"^^ . "0"^^ . "0"^^ . . "@JBGruber, wow, nice! Happy to help :)"^^ . "0"^^ . . "postgresql"^^ . . . . . . . . . . . . . . . "0"^^ . . . . . "1"^^ . . . "@AsherRoland updated the answer to remove the InstanceInput from the string"^^ . . "I have to disagree. It's very common to make functions local, unless they're part of a table. If someone makes a function global, they're polluting the global namespace."^^ . "Lua - count multiple occurrences in a string"^^ . . . . . . . "0"^^ . "0"^^ . . "0"^^ . . "Does setting collision groups fix anything? I thought it just changed the collision properties of the object, not their physics calculations"^^ . . "Getting over the roblox leaderstats intvalue limit"^^ . . . . "<p>IMAP text search is inclusive, not exact. The specification says (I'm paraphrasing here, not being exact) that the server should include this and and that in the result, without saying that it should exclude anything. This gives servers scope to include borderline cases, or to simplify their code by disregarding non-letters, or, or, or.</p>\n<p>The above implies that can assume that what you want will be in the server's result, but if you need an exact search, you have to check again on the client. The server will give you all the matches you want and maybe a few spurious extras.</p>\n<p>(A common example of this is that if you search for &quot;answers&quot;, the server may include a message that mentions &quot;answer&quot;, because its search engine works on word stems rather than exactly.)</p>\n"^^ . "3"^^ . . . . . . . . "@TheLemon27 i edited my answer, it should be correct now."^^ . . . "3"^^ . . . . . "0"^^ . . "Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer."^^ . "0"^^ . "That doesn't make it a correct statement ;-) You cannot index without an index, end of discussion."^^ . "0"^^ . "0"^^ . "2"^^ . . . . "1"^^ . "0"^^ . . . "<p>I'm trying to script a Roblox game.\nThe aim for now is when I click the &quot;AttractButton&quot; the Object should attract towards player's location and stop 4 studs away. On the other hand, clicking the &quot;RepelButton&quot; should repel the Object a certain distance away. That works fine. the Object collides with another part that's called Orb and stops in its tracks. However, I'm trying to make the Object disappear by the destroy() function but it's just not working no matter how much debugging I do. Can someone help me?</p>\n<p>This script is in the StarterGui:</p>\n<pre><code> local Players = game:GetService(&quot;Players&quot;)\nlocal TweenService = game:GetService(&quot;TweenService&quot;)\nlocal CollectionService = game:GetService(&quot;CollectionService&quot;)\nlocal RunService = game:GetService(&quot;RunService&quot;)\n\nlocal player = Players.LocalPlayer\nlocal mouse = player:GetMouse()\n\nlocal controlGui = player:WaitForChild(&quot;PlayerGui&quot;):WaitForChild(&quot;ControlGui&quot;)\nlocal attractButton = controlGui:WaitForChild(&quot;AttractButton&quot;)\nlocal repelButton = controlGui:WaitForChild(&quot;RepelButton&quot;)\n\nlocal attractMode = false\nlocal repelMode = false\n\nlocal cooldownTime = 2\nlocal lastInteractionTime = {}\nlocal velocity = 10 -- studs per second\n\n-- Function to handle the attract button click\nlocal function onAttractButtonClick()\nattractMode = true\n repelMode = false\n print(&quot;Attract mode enabled&quot;)\n\n-- Visual feedback for button click\n attractButton.BackgroundColor3 = Color3.fromRGB(200, 200, 200) -- Change to a different color\n wait(0.1) -- Wait for a short delay\n attractButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255) -- Revert to original color\nend\n\n-- Function to handle the repel button click\nlocal function onRepelButtonClick()\n attractMode = false\n repelMode = true\n print(&quot;Repel mode enabled&quot;)\n\n -- Visual feedback for button click\n repelButton.BackgroundColor3 = Color3.fromRGB(200, 200, 200) -- Change to a different color\n wait(0.1) -- Wait for a short delay\n repelButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255) -- Revert to original color\nend\n\nattractButton.MouseButton1Click:Connect(onAttractButtonClick)\nrepelButton.MouseButton1Click:Connect(onRepelButtonClick)\n\n-- Function to perform raycast check\nlocal function raycastCheck(startPos, endPos)\n local direction = (endPos - startPos).Unit * (endPos - startPos).Magnitude\n local raycastParams = RaycastParams.new()\n raycastParams.FilterType = Enum.RaycastFilterType.Blacklist\n raycastParams.FilterDescendantsInstances = {player.Character}\n\n local result = workspace:Raycast(startPos, direction, raycastParams)\n return result\nend\n\n-- Function to move object to final position with collision checking\nlocal function moveObject(target, finalPosition)\n local connection\n local function onHeartbeat()\n local currentPosition = target.Position\n local direction = (finalPosition - currentPosition).Unit\n local deltaTime = RunService.Heartbeat:Wait()\n local newPosition = currentPosition + direction * velocity * deltaTime\n local result = raycastCheck(currentPosition, newPosition)\n\n if result then\n target.Position = result.Position - direction * 1 -- Stop just before the obstacle\n connection:Disconnect()\n return\n elseif (currentPosition - finalPosition).Magnitude &lt; 1 then\n target.Position = finalPosition\n connection:Disconnect()\n return\n end\n\n target.Position = newPosition\n end\n\n connection = RunService.Heartbeat:Connect(onHeartbeat)\nend\n\n-- Function to handle mouse button click\nmouse.Button1Down:Connect(function()\n local target = mouse.Target\n if target and target:IsA(&quot;BasePart&quot;) and CollectionService:HasTag(target, &quot;attractable&quot;) then\n local currentTime = tick()\n local lastTime = lastInteractionTime[target]\n\n if lastTime and (currentTime - lastTime) &lt; cooldownTime then\n print(&quot;Cooldown active. Please wait.&quot;)\n return\n end\n\n lastInteractionTime[target] = currentTime\n\n local character = player.Character or player.CharacterAdded:Wait()\n local humanoidRootPart = character:WaitForChild(&quot;HumanoidRootPart&quot;)\n local targetPosition = humanoidRootPart.Position\n\n local offset, finalPosition\n if attractMode then\n offset = (target.Position - targetPosition).Unit * 4\n finalPosition = targetPosition + offset\n elseif repelMode then\n offset = (target.Position - targetPosition).Unit * 20\n finalPosition = target.Position + offset\n end\n\n finalPosition = Vector3.new(finalPosition.X, target.Position.Y, finalPosition.Z) -- Keep Y the same\n\n moveObject(target, finalPosition)\n print(attractMode and &quot;Object attracted&quot; or &quot;Object repelled&quot;)\n end\nend)\n</code></pre>\n<p>This is the code in Object:</p>\n<pre><code>local object = script.Parent -- Assuming the script is directly inside the Object part\nlocal orb = game.Workspace:WaitForChild(&quot;Orb&quot;) -- Assuming the orb is named &quot;Orb&quot; and is a separate part in the Workspace\n\nlocal function onHit(otherPart)\n if otherPart == orb then\n object:Destroy()\n end\nend\n\nobject.Touched:Connect(onHit)\n</code></pre>\n"^^ . . . . "adobe-indesign"^^ . "raylib"^^ . . . "Or [RFC 9051 section 6.4.4](https://datatracker.ietf.org/doc/html/rfc9051#section-6.4.4-15.12)."^^ . "0"^^ . . . . . . . "1"^^ . "<p>You connect your function handling the shot again every time <code>script.Parent.Fall</code> is fired.</p>\n<p>Move <code>script.Parent.Shot.OnServerEvent:Connect()</code> outside of <code>script.Parent.Fall.OnServerEvent:Connect()</code>.</p>\n"^^ . . "0"^^ . . "Love this, at the moment the classes I intend to pass to C aren't using VarHandle, for example I currently just have Point as two doubles in java. \nIs it possible to do something like this without extensively modifying the class?"^^ . "0"^^ . "Have you considered using [Drag Detectors](https://create.roblox.com/docs/ui/drag-detectors) instead? They still achieve your goals and [easily allow you to set axis or movement limits](https://create.roblox.com/docs/ui/drag-detectors#axismovement-limits)."^^ . . . . . . . . . . . . "0"^^ . . . . "You can see it as either. You can get the index resulting in the value, or you can get the value by the index. I'm unsure what the point of your comment was."^^ . "<p>I have JSON manifest in store in s3 and want to access it using vod_upstream_location, but it is always error 502 bad request. It is working fine with local json by alias /etc/nginx/json/</p>\n<p>*noted s3 is not public but I sign it using lua script</p>\n<p>below is my nginx:</p>\n<pre><code>open_file_cache max=1000 inactive=5m;\n open_file_cache_valid 2m;\n open_file_cache_min_uses 1;\n open_file_cache_errors on;\n vod_mode mapped;\n vod_metadata_cache metadata_cache 256m;\n vod_response_cache response_cache 256m;\n\n location /s3/ {\n internal;\n # access_by_lua_file /usr/local/nginx/conf/sign.lua;\n proxy_pass ${PROXY_S3_END_POINT};\n }\n location /json/ {\n internal;\n # access_by_lua_file /usr/local/nginx/conf/sign.lua;\n proxy_pass ${PROXY_S3_JSON_END_POINT};\n }\n\n location /hls/ {\n vod hls;\n access_by_lua_file /usr/local/nginx/conf/sign.lua;\n vod_remote_upstream_location /s3;\n vod_upstream_location /json;\n # alias /etc/nginx/json/;\n gzip on;\n gzip_types application/x-mpegURL;\n\n add_header Access-Control-Allow-Origin &quot;*&quot;;\n }\n</code></pre>\n"^^ . "0"^^ . . "2"^^ . "sysbench"^^ . . "Maybe `object.Name` is `nil`, so `string.sub` raises an error and exits the loop?"^^ . . . . "0"^^ . . . "1"^^ . . . . "<p>I'm trying to recover, before trying to rewrite, a &quot;classic&quot; pandoc custom writer called <code>tba.lua</code>.</p>\n<p>Thus far, I've managed to make it work by adding the prescribed patch in the form</p>\n<pre><code>function Writer (doc, opts)\n PANDOC_DOCUMENT = doc\n PANDOC_WRITER_OPTIONS = opts\n loadfile(PANDOC_SCRIPT_FILE)()\n return pandoc.write_classic(doc, opts)\nend\n</code></pre>\n<p>as stated in the documentation.</p>\n<p>But then, I need to add always a <code>--template</code> option to load the default template, as the writer with the <code>--standalone</code> option complains about</p>\n<pre><code>No template defined in tba.lua\n</code></pre>\n<p>While seeing another example in the documentation, I tried to define the template in the writer by adding</p>\n<pre><code>function Template ()\n local template = pandoc.template\n return template.compile(template.default 'tba.lua')\nend\n</code></pre>\n<p>Pandoc can now find the template <code>default.tba.lua</code> in the <code>--data-dir</code> directory, but now it complains saying</p>\n<pre><code>Error running Lua:\nstring expected, got pandoc Template\n</code></pre>\n<p>I thought that <code>template.compile</code> would return the string and feed it to Pandoc, so I don't know what went wrong.</p>\n"^^ . "0"^^ . . . . . . . . "0"^^ . "<p>I’m trying to use the Torch library in OpenResty, but I’m not having much luck. I’ve attempted to install Torch in the OpenResty Docker container using both Luarocks and manual installation methods, but no matter what I do, I keep getting an error message. Is it even feasible to use Torch with OpenResty? Any advice would be greatly appreciated.</p>\n<p>The way I use it</p>\n<pre><code>location / {\n content_by_lua_block {\n require 'torch'\n }\n}\n</code></pre>\n<p>Error</p>\n<pre><code>2024/05/10 17:10:42 [error] 2578#2578: *1 lua entry thread aborted: runtime error: /usr/local/openresty/luajit/share/lua/5.1/torch/init.lua:13: cannot load '/usr/local/openresty/luajit/lib/lua/5.1/libtorch.so'\nstack traceback:\ncoroutine 0:\n [C]: in function 'require'\n content_by_lua(/etc/nginx/conf.d/default.conf:23):2: in main chunk, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;127.0.0.1&quot;\n127.0.0.1 - - [10/May/2024:17:10:42 +0000] &quot;GET / HTTP/1.1&quot; 500 128571 &quot;-&quot; &quot;curl/7.81.0&quot;\n</code></pre>\n<p>Installation via luarocks</p>\n<pre><code>git clone https://github.com/torch/cwrap.git\ncd cwrap\nluarocks make rocks/cwrap-scm-1.rockspec\nluarocks install --server=https://luarocks.org/dev torch\n</code></pre>\n<p>Manual installation ('./install.sh' is omitted)</p>\n<pre><code>FROM openresty/openresty:jammy\n\nRUN DEBIAN_FRONTEND=noninteractive apt update &amp;&amp; apt install -y git sudo software-properties-common python3-pip\nRUN pip3 install ipython\n\nRUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ubuntuhandbook1/ppa &amp;&amp; \\\n DEBIAN_FRONTEND=noninteractive apt-get update &amp;&amp; \\\n apt-get install -y qt4-dev-tools libqt4-dev libqtcore4 libqtgui4 \n\n\nRUN git clone https://github.com/torch/distro.git ~/torch --recursive\nWORKDIR root/torch\nRUN sed -i 's/python-software-properties/software-properties-common/g' install-deps\nRUN sed -i 's/unzip gnuplot gnuplot-x11 ipython/unzip gnuplot gnuplot-x11/g' ./install-deps\n\nRUN [&quot;/bin/bash&quot;, &quot;install-deps&quot;]\n</code></pre>\n"^^ . "1"^^ . "<p>I am trying to build a simple xmake based app, with the usual lua scripting, but how to write an xmake.lua for this still eludes me. For now I have this:</p>\n<pre class="lang-lua prettyprint-override"><code>add_rules(&quot;mode.debug&quot;, &quot;mode.release&quot;)\nadd_requires(&quot;lua&quot;)\n\ntarget(&quot;Elevated&quot;)\n set_kind(&quot;binary&quot;)\n add_packages(&quot;lua&quot;)\n add_files(&quot;src/*.c&quot;)\n</code></pre>\n<p>and in my <em>/src</em> I have main.c file while .lua scripts are in, let's say <em>/engine</em> dir. Build succeeds with this main.c:</p>\n<pre class="lang-c prettyprint-override"><code>#include &lt;lauxlib.h&gt;\n#include &lt;lua.h&gt;\n#include &lt;lualib.h&gt;\n#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n\nint main(void)\n{\n lua_State *L = luaL_newstate();\n luaL_openlibs(L);\n luaL_dofile(L, &quot;engine/main.lua&quot;);\n return 0;\n}\n</code></pre>\n<p>but I am amiss at how to move .lua scripts dir using xmake.lua. Obviously, I can copy it manually to the same dir where the built executable is, but I'm curious is there anything in xmake to automate this.</p>\n"^^ . . "given how few hits there seem to be when I google for "premake getcwd" I would suggest hard coding the full path in the "libdirs" section to see if it works any better, i.e. libdirs { "/my/full/path/lua/build" } and then links { "lua51" }"^^ . . . . "Why is my key size generated from rsaKeygen() always 19?"^^ . . "I'm not sure how you understand delayed expansion. In lua the value of variables are always up-to-date. Can you show a batch script to demonstrate your purpose?"^^ . "arrays"^^ . . . . . . . . "0"^^ . "0"^^ . . . "0"^^ . . . "0"^^ . "1"^^ . . . . "0"^^ . "0"^^ . "0"^^ . . . "0"^^ . "Aside from the fact that your observation is simply wrong I want to point out that you are confusing the two concepts of scope and access. private, public and protected are access modifiers. in order to mimic access modifiers in Lua you would have to use a combination limited scopes and metatables. local is a scope modifier, it simply defines wether a value is local to the scope it was defined in. this can be far more restrictive than access modifiers."^^ . "1"^^ . . . . . . . "0"^^ . . . "<p>For any number, the Carmichael function returns <code>0</code> no matter what the input <code>n</code> is.</p>\n<pre><code>function gcd(a, b)\n if b == 0 then\n return a\n else\n return (gcd(b,a%b))\n end\nend\n\nfunction carmichael(n)\n coprimes = {}\n for i = 1,n-1 do\n if gcd(i,n) == 1 then\n table.insert(coprimes,i)\n end\n end\n k = 0\n while true do\n for counter = 1,#coprimes do\n coprime = coprimes[counter]\n if (coprime^k)%n ~= 1 then\n break\n else\n return k\n end\n k = k+1\n end\n end\nend\n\ninput = io.read()\n\nprint(carmichael(tonumber(input)))\n</code></pre>\n"^^ . . . "<p>I found an easier way to do this.</p>\n<pre><code>function clamp(obj:Model,cf:CFrame)\n local part = obj.PrimaryPart\n local partSize = part.Size/2\n local plateSize = platePart.Size/2\n \n local localCf = platePart.CFrame:ToObjectSpace(cf)\n \n local _,ry,_ = cf:ToOrientation()\n local Y = math.deg(ry)+180\n \n if math.round(Y/90)%2 == 0 then\n maxX = plateSize.X-partSize.X\n maxZ = plateSize.Z-partSize.Z\n else\n maxX = plateSize.Z-partSize.Z\n maxZ = plateSize.X-partSize.X\n end\n \n local x = math.clamp(localCf.X,-maxX,maxX)\n local z = math.clamp(localCf.Z,-maxZ,maxZ)\n \n local newCf = platePart.CFrame:ToWorldSpace(CFrame.new(x,0.5+partSize.Y,z)) * cf.Rotation\n \n return newCf\nend\n</code></pre>\n<p>In this script, the maximum position along each axis of the plane is based on which axis of the part to be clamped faces the same way as the plate´s.</p>\n<p>If the X axes differentiate by 90°, it means that Z of the part faces the same/opposite way as the X of the plate.\n<a href="https://i.sstatic.net/oTuI7y3A.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oTuI7y3A.png" alt="Example of X and Z axes of plate and part facing different directions" /></a></p>\n"^^ . . "0"^^ . "0"^^ . . "c++"^^ . "3"^^ . . "padding"^^ . . "0"^^ . . . "0"^^ . . "I made this into a Quarto extension: https://github.com/JBGruber/quarto-targetlang Thanks again for the help!"^^ . "0"^^ . . "3"^^ . . . "0"^^ . . . "What still isn't great is that returning `{}` leaves and empty codeblock. I tried `nil`, but then it defaults to the original block. I opened a new question since this is out of the original scope: https://stackoverflow.com/questions/78563491/filter-codeblocks-for-target-language-in-quarto-to-ipynb-conversion"^^ . . . "1"^^ . . "1"^^ . . "This is indeed a bit weird and seems to be a Quarto issue. I don't have a solution."^^ . . . . . . . . . . . "<p>I need to count how many occurrences are contained into a string, but check for multiple chars, the following one (GSM 3.38 extended chars):</p>\n<pre><code>€\n[\n\\\n]\n^\n{\n|\n}\n~\n</code></pre>\n<p>E.g. given string: <code>abc€|€]/{def</code>\nThe number I need is 6</p>\n<p>With a single char I used:</p>\n<pre><code>local _, c = addr:gsub(&quot;€&quot;,&quot;&quot;)\n</code></pre>\n<p>So that c = 2</p>\n<p>And it works perfect. Could someone drive me to implement the count of multiple occurrences in the string?</p>\n"^^ . "0"^^ . . "<p>I am trying to run this code but lua keeps giving me errors. The package exists at the specified location. Here is the code - thanks!:</p>\n<pre><code>package.path = package.path .. ';C:/Users/xyz/AppData/Roaming/luarocks/share/lua/5.4/?.lua;C:/Users/xyz/AppData/Roaming/luarocks/share/lua/5.4/?/init.lua'\npackage.cpath = package.cpath .. ';C:/Users/xyz/AppData/Roaming/luarocks/lib/lua/5.4/?.so'\n\n-- Require the modules using their module names\nlocal npairs = require('nvim-autopairs')\nlocal Rule = require('nvim-autopairs.rule')\nlocal cond = require('nvim-autopairs.conds')\n\n-- Setup nvim-autopairs\nnpairs.setup({})\n\n-- Add custom rules\nnpairs.add_rules({\n Rule(&quot;$&quot;, &quot;$&quot;, &quot;tex&quot;)\n :with_move(cond.after_text(&quot;$&quot;))\n :with_move(cond.before_text(&quot;$&quot;)),\n Rule(&quot;$$&quot;, &quot;$$&quot;, &quot;tex&quot;)\n :with_move(cond.after_text(&quot;$$&quot;))\n :with_move(cond.before_text(&quot;$$&quot;))\n})\n</code></pre>\n"^^ . . . "0"^^ . "torch"^^ . . "0"^^ . "3"^^ . "Sysbench Fails with mysql_stmt_execute Error Despite Successful Manual Query Execution via Mycat()"^^ . . "1"^^ . . "Lua. Why does the for loop close on the first occurrence of if on the second line?"^^ . . . . . . . "0"^^ . . . "imap"^^ . "<p>I'm currently using a workaround script for burst fire using the &quot;p&quot; key of the keyboard because I want to use the left mouse click to shoot in auto/burst mode, for this i call the action with <code>EVENT == &quot;MOUSE_BUTTON_PRESSED and arg == 1</code> and <code>IsMouseButtonPressed(1)</code></p>\n<p>So, i'm wondering if there is an alternative to only call and use the same button (mouse button 1 , LMB) to call and execute the script instead of &quot;p&quot; button. I've read a suggestion to use a &quot;fake button press&quot; variable but i've not been able to make it work.</p>\n<pre class="lang-lua prettyprint-override"><code>EnablePrimaryMouseButtonEvents(true)\n\nfunction OnEvent(event, arg)\n -------------------------------------------------------\n OutputLogMessage(&quot;Event: &quot;..event..&quot; Arg: &quot;..arg..&quot;\\n&quot;)\n -------------------------------------------------------\n \n --- Autoclicker/bind &quot;p&quot; fire ---\n if IsKeyLockOn(&quot;scrolllock&quot;) then\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 then\n repeat\n PressKey(&quot;p&quot;)\n Sleep(1)\n ReleaseKey(&quot;p&quot;)\n Sleep(75)\n PressKey(&quot;p&quot;)\n Sleep(1)\n ReleaseKey(&quot;p&quot;)\n Sleep(75)\n PressKey(&quot;p&quot;)\n Sleep(1)\n ReleaseKey(&quot;p&quot;)\n Sleep(150)\n until not IsMouseButtonPressed(1)\n --------------------------------------\n OutputLogMessage(&quot;Burst fire shoot\\n&quot;)\n --------------------------------------\n end\n else\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 then\n PressKey(&quot;p&quot;)\n elseif event == &quot;MOUSE_BUTTON_RELEASED&quot; and arg == 1 then\n ReleaseKey(&quot;p&quot;)\n ---------------------------------------\n OutputLogMessage(&quot;Normal fire shoot\\n&quot;)\n ---------------------------------------\n end\n end\n</code></pre>\n<p>For some reason this script also uses to freeze and bug all Logitech ghub program after a while when tabbing between desktop and the game. I'm not sure if it is because of the program itself or the script is not optimized/done correctly.</p>\n"^^ . . "Whereas premake prepend configuration for `objdir`, it doesn't for `targetdir` (which is identical for Release/Debug in your case :/)"^^ . "http"^^ . . . . . . "0"^^ . "<p>I'm writing a scripts for a concert in roblox. There is a script in a ServerScriptService, that controls all music and lights. I need a gui reset button, that will start this script from the beginning.</p>\n<p>I have done something like this:</p>\n<pre><code>local button = script.Parent\nlocal ServerScript = game:GetService(&quot;ServerScriptService&quot;)\nlocal ScreenGui = game:GetService(&quot;StarterGui&quot;).ScreenGui\n\n\nlocal function onButtonActivated()\n\n for _, sound in ipairs(workspace.Sounds:GetChildren()) do\n if sound:IsA(&quot;Sound&quot;) and sound.Playing then\n sound.Playing = false\n end\n end\n \n for _, scripts in ipairs(ServerScript.Sounds:GetChildren()) do\n if scripts.Enabled then \n scripts.Enabled = false\n \n end\n end\n \nend\n\n\nbutton.MouseButton1Click:Connect(onButtonActivated)\n\n</code></pre>\n<p>My code really stops the music and lights, but if I call the script again it continues playing from the place it has stopped, not from the beginnig. How to fix that?</p>\n"^^ . "BTW, the second sentence quoted is also a great example of Mark's extremely concise writing style. The sentence doesn't imply that non-ASCII should be treated case sensitively. It is quiet on the subject, because Mark didn't want to formulate a rule. So: the first sentence says 'if(search key is substring) then match else unspecified' and the second says 'if(search key character is ascii) then case-insensitive else unspecified'."^^ . . . . . . . "0"^^ . . "writer"^^ . . "1"^^ . "2"^^ . . . . . "xmake"^^ . . . "1"^^ . . . . "If statement returns nil"^^ . "0"^^ . . . . . "0"^^ . . . "<p>Premise:\nI know the <code>pandoc-eqnos</code> filter exists, but since it doesn't work (it also seems like a semi-abandoned project), I have no choice but to use this method.</p>\n<p>Having said that, the objective of this filter is to extract the <code>equation</code> environments, create a standalone file containing only the equation and, above all, the related label, and to import the image thus created into the resulting .docx file.</p>\n<p>All MWE stuffs:</p>\n<p>.tex file</p>\n<pre><code>\\documentclass{article}\n\\usepackage{amsmath}\n\\usepackage{mathtools}\n\\usepackage{blindtext}\n\\usepackage{tikz}\n\\usepackage{pgfplots}\n\\pgfplotsset{compat=newest}\n\\usepackage{siunitx}\n\\usepackage{graphicx}\n\\usepackage{stix2}\n\\usepackage{microtype}\n\\usepackage{pifont}\n\\title{Sections and Chapters}\n\\author{Overleaf}\n\\date{\\today}\n\n\\begin{document}\n\\maketitle\n\\tableofcontents\n\\section{Introduction}\n\nThis is the first section.\n\n\\begin{equation}\n \\underset{\\mathrm{Einstein}}{E} = mc^2\n\\end{equation}\n\nLorem ipsum dolor sit amet, consectetuer adipiscing elit.\nEtiam lobortis \nfacilisis sem. Nullam nec mi et neque pharetra sollicitudin. Praesent imperdiet\nmi nec ante. Donec ullamcorper, felis non sodales commodo, lectus velit ultrices\naugue, a dignissim nibh lectus placerat pede.\nVivamus nunc nunc, molestie\nut, ultricies vel, semper in, velit.\nUt porttitor.\nPraesent in sapien.\nLorem\nipsum dolor sit amet, consectetuer adipiscing elit. Duis fringilla tristique neque.\nSed interdum libero ut metus.\nPellentesque placerat.\nNam rutrum augue a\nleo. Morbi sed elit sit amet ante lobortis sollicitudin. Praesent blandit blandit\nmauris.\nPraesent lectus tellus, aliquet aliquam, luctus a, egestas a, turpis.\nMauris lacinia lorem sit amet ipsum. Nunc quis urna dictum turpis accumsan\nsemper.\n\n\\end{document}\n</code></pre>\n<p>Lua filter:</p>\n<pre><code>local file = &quot;C:/Logs/test.tex&quot;\n\nfunction all_trim(s)\n return s:match(&quot;^%s*(.-)%s*$&quot;)\nend\n\nfunction file_exists(name)\n local f = io.open(name, &quot;r&quot;)\n if f ~= nil then\n io.close(f)\n return true\n else\n return false\n end\nend\n\nfunction get_line(filename, line_number)\n local i = 0\n for line in io.lines(filename) do\n i = i + 1\n if i == line_number then\n return line\n end\n end\n return nil -- line not found\nend\n\nfunction lines_from(file)\n if not file_exists(file) then\n return {}\n end\n local lines = {}\n for line in io.lines(file) do\n lines[#lines + 1] = line\n end\n return lines\nend\n\n-- tests the functions above\n\nlocal lines = lines_from(file)\n\nlocal section,equation = 0, 0\n\n\nfor k, v in pairs(lines) do\n if string.find(v, &quot;\\\\section&quot;) then\n figure = 0\n section = section + 1\n end\n if string.find(v, &quot;\\\\begin{equation}&quot;) then\n equation = equation + 1\n end\nend\n\n\nfunction Math(el)\n if (el.mathtype == &quot;DisplayMath&quot;) then\n counter = counter + 1\n io.output(&quot;C:/Logs/output.tex&quot;)\n io.write(&quot;\\\\documentclass[preview]{standalone}&quot;, &quot;\\n&quot;)\n local i = 2\n for k, v in pairs(lines) do\n while not string.find(lines[i], &quot;\\\\begin{document}&quot;) do\n io.write(lines[i], &quot;\\n&quot;) -- write preamble\n i = i + 1\n end\n end\n io.write(&quot;\\\\begin{document}&quot;, &quot;\\n&quot;)\n io.write(&quot;\\\\begin{equation}&quot;, &quot;\\n&quot;)\n io.write(el.text, &quot;\\n&quot;)\n io.write(&quot;\\\\label{&quot;..section..&quot;.&quot;..equation..&quot;}&quot;, &quot;\\n&quot;)\n io.write(&quot;\\\\end{equation}&quot;, &quot;\\n&quot;)\n io.write(&quot;\\\\end{document}&quot;, &quot;\\n&quot;)\n io.close()\n os.execute(&quot;cd C:/Logs &amp; pdflatex output.tex &amp; convert -density 288 output.pdf -alpha off output.png&quot;)\n return { pandoc.Para({pandoc.Image({},&quot;C:/Logs/output.png&quot;)})}\n end\nend\n</code></pre>\n<p>The command line:</p>\n<pre><code>pandoc --from latex+raw_tex --filter pandoc-eqnos --lua-filter=filter.lua -s test.tex -o test.docx\n</code></pre>\n<p>And the relative error message:</p>\n<pre><code>Error running filter filter.lua:\nInline, list of Inlines, or string expected, got table\n</code></pre>\n"^^ . . "Could the parts actually be destroyed instead so they can be removed and a delay for them to respawn would replace them, so that maybe it could stagger the possibility of 80 things blowing up at the same time?"^^ . . . . . "0"^^ . . . . . . "eclipse"^^ . . "You can do this using the [Collision Service](https://create.roblox.com/docs/reference/engine/classes/PhysicsService) and creating collision groups. Note that these functions only work on the server side."^^ . . . . . "there are many reasons for not using local functions. many people don't know better, people don't care, it does not matter in many scenarios or you simply need the functions in a global scope. one important reason for many people is that they want to work with functions defined in different files without having to provide and use an interface table for each file. using the global scope instead is convenient and again does not cause problems in most scenarios"^^ . . "If you want your changes to be applied immediately, you can write a class with getters and setters that access the `MemorySegment`."^^ . . . "1"^^ . . "<p>The error message is clear: 10.7.5 is not a valid number. Use strings instead. Moreover, you can replace a chain of ifs with a table, as in the code below.</p>\n<pre><code>t={\n [&quot;Team1&quot;] = &quot;10.1&quot;,\n [&quot;Team2&quot;] = &quot;10.4&quot;,\n [&quot;Team3&quot;] = &quot;10.6&quot;,\n [&quot;Team4&quot;] = &quot;10.7&quot;,\n [&quot;Team5&quot;] = &quot;10.7.5&quot;,\n [&quot;Team6&quot;] = &quot;10.3&quot;,\n [&quot;Team7&quot;] = &quot;10.2&quot;,\n [&quot;Team8&quot;] = &quot;10.5&quot;,\n [&quot;Team9&quot;] = &quot;10.9&quot;,\n [&quot;Team10&quot;] = &quot;11.2&quot;,\n [&quot;Team11&quot;] = &quot;10.8&quot;,\n}\nevent.sid = t[event.user_tag2] or &quot;10.4&quot;\n</code></pre>\n"^^ . . "0"^^ . "<p>I did find a version of this for a string into a table that splits up the letters of the string, but I have a table, that I turn into a string to remove the first part of it, and now I want it back as a table so I can do a for loop through it to get the data inside.</p>\n<p>This is the kind of table I'm talking about – the string currently looks <em>something</em> like this:</p>\n<pre><code>{\n Item1 = InstanceInput {\n Name = &quot;Name&quot;,\n SourceOp = &quot;SourceOp&quot;,\n },\n Item2 = InstanceInput {\n Name = &quot;Name&quot;,\n SourceOp = &quot;SourceOp&quot;,\n }\n}\n</code></pre>\n<p>I'm scripting in Davinci Resolve, and I bet that relates to a small subset of you, but it has an operation to turn something into &quot;userdata&quot; and I tried that, but it returned it as nil.</p>\n<p>I have tried to use the <a href="https://github.com/lunarmodules/Penlight/blob/master/lua/pl/pretty.lua#L116" rel="nofollow noreferrer"><code>pretty.read()</code></a> function. But I cannot use <code>utils</code> due to the way Davinci Resolve handles <code>require</code>.</p>\n"^^ . "0"^^ . . "0"^^ . . . . "2"^^ . . "luau"^^ . "0"^^ . . . . "Yes, I know the alternative way to export TikZ images. What I actually need is execute two pandoc command. one for inserting image `return pandoc.Para({pandoc.Image({},"C:/Logs/output.png")})`, and another immediately following to insert a generic string. How can I do this?"^^ . . "0"^^ . "2"^^ . "Have you tried using collision groups?"^^ . "<p>Ideally, you should not have to type the variable for a modulescript at all. Luau can infer the type of the modulescript automatically if it isn't defined at runtime.</p>\n"^^ . . . . . . "<p>Lua dosen't provide protection level keywords such as public / private / protected. If we want to create a field that only useable in current area, most of the time we use &quot;local&quot; keyword. for example:</p>\n<pre><code>-- field cannot be access in other Lua files\nlocal privateVal = 0\n\n-- field can be read or write outside\npublicVal = 1\n</code></pre>\n<p>However, I hardly see the defination below:</p>\n<pre><code>-- define a named function as local, so that it cannot be use outside\nlocal calc = function(item)\nreturn item.a + item.b\nend\n\n-- use it locally\nresult = calc(myitem)\n</code></pre>\n<p>Why this style hardly use in Lua programming? I think maybe it is difficult to transmit the parameter &quot;self&quot;, or there are some performance loss in function creation prograss.</p>\n<p>Are there any other more critical reasons?</p>\n"^^ . . "garrys-mod"^^ . "Input from user in Luaj"^^ . "3"^^ . "<p>Ivo is correct. Here are some tools for you.</p>\n<p>FYI, you can use luacheck to find the error:</p>\n<pre><code>$ luacheck so-1.lua\nso-1.lua:10:7: variable hundred is never set\nso-1.lua:13:11: unused variable usedist\nso-1.lua:15:11: unused variable usedist\nso-1.lua:20:7: accessing undefined variable usedist\nso-1.lua:21:20: accessing undefined variable usedist\n</code></pre>\n<p>You can also use Penlight strict to find the error:</p>\n<pre><code>$ lua -l pl.strict so-1.lua\nenter speed(m/s):12\nenter distance needed:34\nspecify((m) or(km)):m\nlua: so-1.lua:20: variable 'usedist' is not declared\nstack traceback:\n [C]: in function 'error'\n /home/anonymous/.luarocks/share/lua/5.3/pl/strict.lua:96: in metamethod 'index'\n so-1.lua:20: in main chunk\n [C]: in ?\n</code></pre>\n"^^ . . . "0"^^ . . . . "1"^^ . . "Anyways I ended up doing like you said, filtering the search results on the client side."^^ . "0"^^ . . . "1"^^ . "7"^^ . "-1"^^ . . "How To Post Process Nginx Reverse Proxy Response"^^ . . . . . . "0"^^ . . . "<p>I want to use a neovim plugin that is written in lua (<code>epwalsh/obsidian.nvim</code> for instance).\nBut my whole config is written in vimscript, and I use the vim-plug package manager.\nThe problem is that this plugin requires the call of a lua <code>setup</code> function.\nLua package manager (like <code>lazy.nvim</code>) do it fine, but vim-plug doesn't.</p>\n<p>How can I properly load the plugin from my vimscript config ?</p>\n<p>I tried to execute the file with <code>lua path/to/plugin/init.vim</code>, and to use <code>lua require(&quot;plugin-name&quot;).setup()</code>, but none of these work.</p>\n<p>The plugin I'm trying to load is <code>epwalsh/obsidian.nvim</code>.</p>\n"^^ . . . . "1"^^ . . . . "Pandoc Lua filter to output only image captions with specific paragraph style"^^ . "2"^^ . . . . . . . "1"^^ . "0"^^ . "1"^^ . . . "@RyanLuu Can DragDetectors achieve constant updating, or do players have to drag them constantly? I´m aiming for havingg the object move to wherever the mouse is every frame."^^ . "1"^^ . . "0"^^ . "0"^^ . . . . . "0"^^ . "0"^^ . "3"^^ . . . . . . "0"^^ . . "Lua - "malformed number near""^^ . "haproxy"^^ . . "1"^^ . "0"^^ . . "0"^^ . . "java-ffm"^^ . . . . . "1"^^ . . . . . "1"^^ . . . . "<p>An <a href="https://create.roblox.com/docs/reference/engine/classes/IntValue" rel="nofollow noreferrer"><code>IntValue</code></a> can only store values up to 2<sup>63</sup>-1 or around 9.2 quintillion which is the limit you are reaching. Since you are going over that limit, you are causing an <a href="https://en.wikipedia.org/wiki/Integer_overflow" rel="nofollow noreferrer">integer overflow</a> which restarts your value at zero.</p>\n<blockquote>\n<p>An IntValue stores a single signed 64-bit integer. The highest allowed value is 2^63-1 or around 9.2 quintillion (9.2^18); attempting to store larger numbers will cause integer overflow. The lowest allowed value is -2^63 or about -9.2 quintillion. Practically, however, working with integers larger than 2^53 (9.0^15) will cause loss of precision since Luau uses double-precision floating-point to store numbers.</p>\n<p>— <a href="https://create.roblox.com/docs/reference/engine/classes/IntValue" rel="nofollow noreferrer">https://create.roblox.com/docs/reference/engine/classes/IntValue</a></p>\n</blockquote>\n<p>They are two ways around this, one is to use a library like <a href="https://devforum.roblox.com/t/587199" rel="nofollow noreferrer">BigInteger</a> or <a href="https://rostrap.github.io/Libraries/Math/BigNum/" rel="nofollow noreferrer">BigNum</a> or to store values as a <a href="https://create.roblox.com/docs/reference/engine/libraries/string" rel="nofollow noreferrer"><code>string</code></a> if you are willing to lose precision.</p>\n<h3>Storing Numbers as a String</h3>\n<p>If you are willing to sacrifice precision can store numbers as a string to bypass the 9.2 quintillion limit and then use <a href="https://create.roblox.com/docs/reference/engine/globals/LuaGlobals#tonumber" rel="nofollow noreferrer"><code>tonumber</code></a> to convert that string into an number whenever we want to use an arithmetic operation.</p>\n<p>In the below example, have <code>Money</code> and <code>ExpensiveItemCost</code>. The <code>Money</code> we have is above the IntValue maximum so we use a StringValue. When we are subtracting <code>ExpensiveItemCost</code> from <code>Money</code> we make sure to use <code>tonumber</code> to convert the <code>Money</code> which is a string into a number we can use</p>\n<pre class="lang-lua prettyprint-override"><code>local ExpensiveItemCost = 1e+105\n\n-- Use StringValue instead of IntValue\nlocal Money = Instance.new(“StringValue”, workspace)\n\nMoney.Value = '9e+105' -- Above that maximum IntValue can handle\n\n-- Use tonumber because Money.Value is a string\nMoney.Value = tonumber(Money.Value) - ExpensiveItemCost\n\nprint(Money.Value) -- 8e+105\n</code></pre>\n<p><sub>From <a href="https://devforum.roblox.com/t/1344993" rel="nofollow noreferrer">https://devforum.roblox.com/t/1344993</a></sub></p>\n<h3>Using a Library for Large Numbers</h3>\n<p>There are many libraries you can use to handle large number, because it's best to refer to the library's documentation on how to properly use them.</p>\n<p>For this example, I will be using <a href="https://devforum.roblox.com/t/587199" rel="nofollow noreferrer">BigInteger</a> but you can choose any library you like or that fits you for your Roblox experience.</p>\n<p>This example does the exact same the above does but uses a math library for handling large numbers so we don't lose any precision.</p>\n<pre class="lang-lua prettyprint-override"><code>-- Require the BigInteger module\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal BigInteger = require(ReplicatedStorage.BigInteger) -- Set this to where BigInteger is located\n\n-- Use BigInteger when we're dealing with large numbers\nlocal ExpensiveItemCost = BigInteger.new('1^105')\n\n-- Use StringValue instead of IntValue\nlocal Money = Instance.new(“StringValue”, workspace)\n\nMoney.Value = tostring(BigInteger.new('9^105'))\n\n-- Convert Money.Value string back to BigInteger\nMoney.Value = tostring(BigInteger.new(Money.Value) - ExpensiveItemCost)\n\nprint(Money.Value) -- 8e+105\n</code></pre>\n<hr />\n<p>While both ways work they are cons and pros to each. Using the first option is more easy and simple but costs precision. The second method is more precise but is more complex and requires using a third-party library.</p>\n"^^ . "0"^^ . "1"^^ . . . . . "1"^^ . "well if you look at the documentation of the `IntValue` you can see its stored as a 64bit value. this means the maximum value is 9.2 quintillion and you cant go higher than that using a `IntValue`."^^ . "3"^^ . "thank you.. addition because i cant simply say thank you"^^ . . . . . "0"^^ . "<p><strong>This is my module script:</strong></p>\n<pre><code>local phases = {}\n\nlocal function getRoleAssignments(playersToAssignRoles, roles)\n --Assigns a random player to each role then removes player from list so player can't get two roles.\n --Not every role will be assigned if not enough players\n for role, _ in pairs(roles) do\n local player = nil\n\n if 0 &lt; #playersToAssignRoles then\n player = playersToAssignRoles[math.random(1,#playersToAssignRoles)]\n end\n\n roles[role] = player\n table.remove(playersToAssignRoles,table.find(playersToAssignRoles,player))\n end\n\n return roles\nend\n\n\nfunction phases.loadGame(players, roles)\n local map = getRandomMap()\n print(players) --Prints a full table (just one player because just me testing)\n local roleAssignments = getRoleAssignments(players, roles)\n print(players) --Prints an empty table\nend \n</code></pre>\n<p><strong>This is how I've implemented it in my main script.</strong></p>\n<pre><code>local playersPlaying = Players:GetPlayers()\nroles = Phases.loadGame(playersPlaying, roles)\n</code></pre>\n<p>The <code>players</code> table became empty after calling <code>getRoleAssignments(players, roles)</code> even though I have not referenced it at all. I have only passed it into the function, which should create a local copy as stated in the docs. However, the <code>players</code> table is empty after I called the function shown by the print statement when ran.</p>\n<p>I expect the <code>players</code> table to retain its data.\nI've tried to making sure the identifiers are not the same which did not work.\nI've tired storing the <code>players</code> table in a separate local variable and passing that into the function instead, it did not work.\nNot calling the function does result in the <code>players</code> table retain its data though.</p>\n"^^ . . . . "1"^^ . . . "Right. There are quite a few cases like this around the edges of the RFCs, where Mark (and later Alexey) tried to specify enough to be useful for clients, while leaving enough flexibility to make it easy for server authors."^^ . "<p>As @River said:every time the 'Fall.OnServerEvent' function is triggered,the &quot;Shot.OnServerEvent&quot; will be connect again.So, there are several Shot.OnServerEvent functions being triggered where you can't see them.\nI can provide you with two ways to write:</p>\n<pre><code>script.Parent.Fall.OnServerEvent:Connect(function(plr,guy)\n local shotConnectEvent = script.Parent.Shot.OnServerEvent:Connect(function(plr,target)\n --you code\n shotConnectEvent:disconnect()\n end \nend\n</code></pre>\n<pre><code>script.Parent.Fall.OnServerEvent:Connect(function(plr,guy)\n script.Parent.Shot.OnServerEvent:Once(function(plr,target)\n --you code\n end \nend\n</code></pre>\n<p>Of course, I haven't verified the feasibility of these two writing methods, I hope it can help you.</p>\n"^^ . "I tried shifting my attention here and there and kept trying—I still do—but the rest is also to make clear the purpose of this code, which serves you and others. I hope that clarifies things. I'm not giving up responsibility, only wanting to know if there's a solution for why it keeps occurring. I'm good but not the best at Luau, but in the case that I need to calculate the Absolute Size and Position in UI, I haven't done before. Thanks."^^ . "0"^^ . . "0"^^ . . "luaj"^^ . "2"^^ . "0"^^ . . "2"^^ . "`%[sometext%]` is a correct Lua patten to match `[sometext]` text. How can we repro the issue?"^^ . . . . . "1"^^ . "1"^^ . . "0"^^ . . "1"^^ . "0"^^ . . . . . "Returning `nil` from pandoc lua functions doesn't work as expected as per experience so far. I have used `pandoc.Null()` instead. But keeping [this issue regarding removing `pandoc.Null()`](https://github.com/jgm/pandoc-types/issues/91) in mind, what would be the alternative [here](https://stackoverflow.com/a/78564793/10858321)? Please shed some light, @tarleb sensei."^^ . . . "debugging configuration of dap in nvim for typescipt projects"^^ . . . . "I can and do see people think of it as both."^^ . . . "0"^^ . . "0"^^ . . "string"^^ . "You say the loop terminates after processing a single Town object and a few lines later you say that the for loop goes through all Town objects. The only way for this to work is to have a single Town object. Please clarify.\nprinting the values will help you find out why your conditions are not met."^^ . . . . . . . . "4"^^ . . . . . "nginx"^^ . . . "@RyanLuu no error, just a problem and that problem is that moduleTable.Worker is staying as nil, even after I supposedly set it to player"^^ . . "2"^^ . . . "@shingo Yes, but not in davinci https://onecompiler.com/lua/42d4adv3e"^^ . . "0"^^ . "1"^^ . . . . . "0"^^ . "2"^^ . "2"^^ . "2"^^ . . "1"^^ . . . . "0"^^ . . . . "1"^^ . "Hi,\nThanks with this but this script is causing this error I would be very grateful if you or anyone else could help me solve it.\n\n`CoreGui.Execution.22567:0 attept to index nil with 'Settings'\nCoreGui.Execution.18415:0 attept to index nil with 'Settings'\nCoreGui.Execution.8007:0 attept to index nil with 'Data'`\n\nThe first and second errors were caused by the code:\n`game:GetService(“Players”):FindFirstChild(PlayerName).Settings.Data.Ability.Value`.\nAnd the third error was caused by the code:\n`game:GetService(“Players”):FindFirstChild(PlayerName).Data.Ability.Value`."^^ . . . "0"^^ . "2"^^ . . . "How do I enable syntax highlighting for Lua in Eclipse recent versions (2024-03)?"^^ . "0"^^ . . . . . "<p>I'm currently making a strict type checked script but can't find a way to <a href="https://luau-lang.org/getting-started#annotations" rel="nofollow noreferrer">type annotate</a> a variable that requires a Module Script without using the type <code>any</code> which is bad practice.</p>\n<p><code>DoSomethingScript</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>--!strict\n\nlocal moduleScript: any = require(script.SomethingModule) -- How do I change the any type here?\n\nmoduleScript:DoSomething()\nmoduleScript:NotMethodAndShouldRaiseWarning() -- Using the any type doesn't give warnings for non-existant methods\n</code></pre>\n<p><code>SomethingModule</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>local SomethingModule = {}\n\nfunction SomethingModule.DoSomething()\n print(&quot;Doing something&quot;)\nend\n\nreturn SomethingModule\n</code></pre>\n<p>I tried looking at the <a href="https://create.roblox.com/docs/luau/type-checking" rel="nofollow noreferrer">Roblox Creator Hub documentation</a> and <a href="https://luau-lang.org/getting-started#annotations" rel="nofollow noreferrer">Luau</a> website for how to type annotate a Module Script but can't find anything about it.</p>\n<p>So how would I define the type for a Module Script?</p>\n"^^ . . "0"^^ . . . "plugins"^^ . . . "0"^^ . "InstanceInput is what Davinci uses for making macros. for this use, I do not need it to be a part of the table for each item"^^ . . "<p>When it says &quot;index a nil value&quot;, what it means is that you are trying to get something (an index) from nothing (nil). Lua has two main means of indexing a thing, <code>thing[&quot;index&quot;]</code> and <code>thing.index</code>.</p>\n<p>I highly suspect that you are running into an unused global variable somewhere, which default to <code>nil</code>. It might not be in the code you posted, I can't find any issue with globals directly.</p>\n<p>The only globals you use here are <code>package</code> and <code>require</code>. Maybe your Lua runtime is missing one of those. Try to <code>print(package, require)</code> and see if you see the word nil printed anywhere then you are missing one of those.</p>\n<p>The other option is that <code>npairs</code> or <code>cond</code> is nil. This would be a problem with the <code>nvim-autopairs</code> library.</p>\n<p>Either way you should check for things being nil whenever you get this error.</p>\n"^^ . "<p>The error:</p>\n<blockquote>\n<p><code>ReplicatedStorage.Modules.Drops:35: attempt to index nil with 'Position'</code></p>\n</blockquote>\n<p>The line:</p>\n<pre class="lang-lua prettyprint-override"><code>if (Character.PrimaryPart.Position - Drop.PrimaryPart.Position).Magnitude &lt; 10 and Drop.CanCollect.Value == true then\n</code></pre>\n<p>so this is the problem and since there is 2 positions i do not know with witch one is the issue.</p>\n<p>i tried changing the name of the drop model and doing something with primary part and i tried to find if i made a typo anywhere but not that i can see. <a href="https://i.sstatic.net/6K8ZX6BM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6K8ZX6BM.png" alt="enter image description here" /></a></p>\n"^^ . . . . "In Lua, is it possible to do delayed expansion like you can in batch script?"^^ . . . . "1"^^ . . . "Mark Crispin, the author of those words, was the kind of person who distinguished between "…if the string…" and "…if and only if the string…" Read the quotation exactly, think about what it would mean if it said "… if and only if the string…". Mark left out "and only if" by choice. That distinction is too subtle for most people, which is the reason that the most recent wording uses several sentences and the "swim" example."^^ . "One possible way is to not "return after just one match", but rather use a variable to check whether the loop was broken. If it goes outside the for loop without breaking, then all the coprime numbers satisfy the condition, otherwise go to the next k. However, I am thinking of another problem, namely whether `coprime^k` exceeds the maximum integer in Lua"^^ . . "Evaluating a function that returns nothing"^^ . "Should be fine for smaller numbers, but if `coprime^k` results in a very big number, then it may result in weird behaviors. To see what I mean by "very big", try `unsafe_int = 2^53; print(unsafe_int == unsafe_int+1)` which prints `true`. Anything bigger than the value 9007199254740991 [reference](https://www.codecademy.com/resources/docs/lua/mathematical-library/maxinteger)"^^ . . . . . . "<p>I prepare documents in Markdown to convert via Pandoc to HTML and ICML (InDesign).</p>\n<p>Exporting Images to InDesign proved to be unpractical.</p>\n<p>The goal was to write a lua-filter which only returns the caption of the image while preserving the ParagraphStyleRange &quot;Caption&quot;. The image source itself should not be exported. The effect should be, that in InDesign you will be provided with correctly styled caption (inkluding source reference) but will be able to position and size the image according to the optimal &quot;text-flow&quot;.</p>\n<p>Given a Markdown file with the content</p>\n<pre><code>![Caption [(Image: Source)]{custom-style=&quot;ImageSource&quot;}](image.jpg)\n</code></pre>\n<p>The following lua snippet actually returns only the caption. It also preserves the CharacterStyleRange &quot;ImageSource&quot;, but it does not export the ParagraphStyleRange &quot;Caption&quot;.</p>\n<pre><code>function Image(bild)\n if FORMAT:match 'icml' then -- Only export to icml\n -- Check if caption is empty\n if #bild.caption &gt; 0 then\n return bild.caption\n end\n end\nend\n</code></pre>\n<p>This ist what ends up in the ICML-Export. It seems to me that these correspond to two paragraphs, which I do not understand ...</p>\n<pre class="lang-xml prettyprint-override"><code> &lt;!-- body needs to be non-indented, otherwise code blocks are indented too far --&gt;\n&lt;ParagraphStyleRange AppliedParagraphStyle=&quot;&quot;&gt;\n &lt;CharacterStyleRange AppliedCharacterStyle=&quot;$ID/NormalCharacterStyle&quot;&gt;\n &lt;Content&gt;Caption &lt;/Content&gt;\n &lt;/CharacterStyleRange&gt;\n &lt;CharacterStyleRange AppliedCharacterStyle=&quot;CharacterStyle/ImageSource&quot;&gt;\n &lt;Content&gt;(Image: Source)&lt;/Content&gt;\n &lt;/CharacterStyleRange&gt;\n&lt;/ParagraphStyleRange&gt;\n&lt;Br /&gt;\n&lt;ParagraphStyleRange AppliedParagraphStyle=&quot;&quot;&gt;\n &lt;CharacterStyleRange AppliedCharacterStyle=&quot;$ID/NormalCharacterStyle&quot;&gt;\n &lt;Content&gt;Caption &lt;/Content&gt;\n &lt;/CharacterStyleRange&gt;\n &lt;CharacterStyleRange AppliedCharacterStyle=&quot;CharacterStyle/ImageSource&quot;&gt;\n &lt;Content&gt;(Image: Source)&lt;/Content&gt;\n &lt;/CharacterStyleRange&gt;\n&lt;/ParagraphStyleRange&gt;\n</code></pre>\n<p>I tried to put just the line</p>\n<pre class="lang-lua prettyprint-override"><code>function Image () return {} end\n</code></pre>\n<p>in the filter, which should just delete the Image (as I understood from <a href="https://stackoverflow.com/questions/57393261/how-can-i-strip-figures-and-table-during-a-pandoc-latex-to-word-conversion">How can I strip figures and table during a pandoc LaTeX to Word conversion?</a>). But still in icml-export I get two ParagraphStyleRange the first of which is now empty. I am confused.</p>\n"^^ . . . . . "How to match brackets in imapfilter Subject search?"^^ . . . . . . . . . "<p>Actually, I think that if I reverse the order in which I call the filters, then this information is contained in the table caption:</p>\n<pre><code>pandoc input.md --output=output.tex --from markdown+pipe_tables --to latex --lua-filter=table.lua --filter pandoc-crossref \n</code></pre>\n<p>So I can now run the following table.lua filter, which solves my problem:</p>\n<pre><code>function Table(tbl)\n local simpleTable = pandoc.utils.to_simple_table(tbl)\n local blocks = pandoc.Blocks{}\n\n -- Function to create a LaTeX row\n local function create_latex_row(cells)\n local latex_row = &quot;&quot;\n for i, cell in ipairs(cells) do\n for _, content in ipairs(cell) do\n latex_row = latex_row .. pandoc.write(pandoc.Pandoc({content}), &quot;latex&quot;)\n end\n if i &lt; #cells then\n latex_row = latex_row .. &quot; &amp; &quot;\n end\n end\n return latex_row .. &quot; \\\\\\\\&quot;\n end\n\n -- Determine the number of columns (using header or first row)\n local num_cols = 0\n if simpleTable.header and #simpleTable.header &gt; 0 then\n num_cols = #simpleTable.header\n elseif #simpleTable.rows &gt; 0 then\n num_cols = #simpleTable.rows[1]\n end\n\n -- Assume all columns are left-aligned for simplicity\n local col_alignment = string.rep(&quot;l&quot;, num_cols)\n\n -- Begin table environment\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\begin{table}[tbp]&quot;))\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\centering&quot;))\n\n -- Process caption and label\n if tbl.caption and #tbl.caption.long &gt; 0 then\n local caption_str = pandoc.utils.stringify(tbl.caption.long)\n local caption_text, label = caption_str:match(&quot;^(.*) {#(.-)}$&quot;)\n if caption_text and label then\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\caption{&quot; .. caption_text .. &quot;}&quot;))\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\label{&quot; .. label .. &quot;}&quot;))\n else\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\caption{&quot; .. caption_str .. &quot;}&quot;))\n end\n end\n\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\begin{tabular}{&quot; .. col_alignment .. &quot;}&quot;))\n \n -- Process header\n if simpleTable.header and #simpleTable.header &gt; 0 then\n local header_row = create_latex_row(simpleTable.header)\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, header_row))\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\hline&quot;)) -- Optional: Adds a horizontal line after the header\n end\n\n -- Process rows\n for _, row in ipairs(simpleTable.rows) do\n local latex_row = create_latex_row(row)\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, latex_row))\n end\n\n -- End tabular and table environment\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\end{tabular}&quot;))\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\end{table}&quot;))\n\n return blocks\nend\n</code></pre>\n"^^ . . . . . . . . . . . . . . "Filter CodeBlocks for target language in Quarto to ipynb conversion"^^ . "Refreshing script in roblox"^^ . . . . . . . . "1"^^ . "0"^^ . . "2"^^ . . "Interestingly enough, when giving the full absolute path to the directory, it *does* actually attempt to load the library, but both the `.lib` and the `.dll` are skipped due to being "incompatible".\nSince I just followed the luajit build instructions without too much thought, could it be a bitness problem?\nedit: Just checked, luajit seems to build x86 on windows by default..."^^ . "<p><a href="https://www.lua.org/manual/5.1/manual.html#pdf-string.find" rel="noreferrer"><code>string.find</code></a> uses a pattern by default. <code>-</code> is a special character in a pattern: It is interpreted as &quot;zero or more of the preceding character (class), match lazily&quot;.</p>\n<p>To make Lua interpret <code>-</code> as literal <code>-</code> in a pattern, escape it using <code>%</code>: <code>string.find(&quot;MOZ-MAIL-1-1&quot;,&quot;MOZ%-MAIL%-&quot;)</code> works.</p>\n<p>An alternative - which is especially convenient if your &quot;needle&quot; is a variable - is to pass a starting position, and to tell Lua to interpret the needle as a literal string by passing a fourth parameter <code>plain = true</code>: <code>string.find(&quot;MOZ-MAIL-1-1&quot;,&quot;MOZ-MAIL-&quot;, 1, true)</code> also works.</p>\n<p><code>string.find(&quot;MOZ-MAIL-1-1&quot;,&quot;Z-MAIL-&quot;)</code> succeeds due to a coincidence: It matches <code>MAI</code> in this context: The <code>Z-</code> matches zero <code>Z</code>s, the <code>L-</code> matches zero <code>L</code>s.</p>\n"^^ . . "1"^^ . . . "2"^^ . "How do I create a quarto filter which can update the description of a post listing?"^^ . "1"^^ . . . . . "1"^^ . . . "<p>I'd like to know if it's possible to have a Kong custom plugin with a configuration field which can have one of these two different types: <code>string</code> or <code>array</code>. And in case it's possible, I'd like to know how.</p>\n<p>Example usage (with Kubernetes Ingress Controller):</p>\n<ul>\n<li><p>with a <strong>single string</strong>:</p>\n<pre class="lang-yaml prettyprint-override"><code>apiVersion: configuration.konghq.com/v1\nkind: KongPlugin\nmetadata:\n name: my-plugin-example\n annotations:\n kubernetes.io/ingress.class: kong\nplugin: my-plugin\nconfig:\n different_types: |\n value1\n value2\n value3\n</code></pre>\n</li>\n<li><p>with an <strong>array of strings</strong>:</p>\n<pre class="lang-yaml prettyprint-override"><code>apiVersion: configuration.konghq.com/v1\nkind: KongPlugin\nmetadata:\n name: my-plugin-example\n annotations:\n kubernetes.io/ingress.class: kong\nplugin: my-plugin\nconfig:\n different_types:\n - &quot;value1&quot;\n - &quot;value2&quot;\n - &quot;value3&quot;\n</code></pre>\n</li>\n</ul>\n<hr />\n<p>Here's what I tried (file <code>schema.lua</code>):</p>\n<pre class="lang-lua prettyprint-override"><code>local typedefs = require(&quot;kong.db.schema.typedefs&quot;)\n\nlocal PLUGIN_NAME = &quot;my-plugin&quot;\n\nreturn {\n name = PLUGIN_NAME,\n fields = {\n { consumer = typedefs.no_consumer },\n { protocols = typedefs.protocols_http },\n { config = {\n type = &quot;record&quot;,\n fields = {\n { different_types = {\n description = &quot;This is a config parameter with flexible type&quot;,\n one_of = { \n { type = &quot;string&quot; },\n { type = &quot;array&quot;, elements = { type = &quot;string&quot; },},\n },\n required = false,\n },}\n },\n },},\n },\n}\n</code></pre>\n<p>However, I'm getting error <code>type = &quot;required field missing&quot;</code>:</p>\n<pre class="lang-none prettyprint-override"><code>2024/05/08 15:42:51 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:772: error loading plugin schemas: on plugin 'my-plugin': [off] 2 schema violations (fields.3: {\n fields = {\n [2] = {\n type = &quot;required field missing&quot;\n }\n }\n}; different_types: missing type declaration)\nstack traceback:\n [C]: in function 'assert'\n /usr/local/share/lua/5.1/kong/init.lua:772: in function 'init'\n init_by_lua(nginx-kong.conf:54):3: in main chunk\nnginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:772: error loading plugin schemas: on plugin 'my-plugin': [off] 2 schema violations (fields.3: {\n fields = {\n [2] = {\n type = &quot;required field missing&quot;\n }\n }\n}; different_types: missing type declaration)\nstack traceback:\n [C]: in function 'assert'\n /usr/local/share/lua/5.1/kong/init.lua:772: in function 'init'\n init_by_lua(nginx-kong.conf:54):3: in main chunk\n</code></pre>\n"^^ . . . . . "mouse"^^ . "Specific problems: `d = 1%totientN/e` gives just `1/e`, which isn't what you want: you want an _integer_ that's the inverse of `e` modulo `totientN`. And in `msg^e%n`, you lose precision unless `msg^e` is smaller than `2^53`. And given that your `e` is `2^16+1`, pretty much any value of `msg` (other than 0 or 1) is going to cause `msg^e` to overflow."^^ . "<p>If I understand correctly, then you want to return two blocks instead of one. That's possible by returning a list of blocks, e.g.</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n pandoc.Para {pandoc.Image({}, &quot;image.png&quot;)},\n pandoc.Plain &quot;This follows right after the image.&quot;\n}\n</code></pre>\n"^^ . . . . . "kong"^^ . "0"^^ . . . "you're not "trying to get something (an index)", it is not the index you want to get, you're using the index to get a value. if require were nil you'd get an error for attempting to call a nil value, not for indexing one. : is an indexing operation too btw."^^ . . . "1"^^ . "Lua filter for pandoc (with crossref) that extracts a table's label"^^ . . "<p>I am trying to detect all the Towns in the Street object, inside, that have child wind_.\nBut the loop terminates after processing a single Town object, why?</p>\n<pre><code>for _, object in ipairs(game.Workspace.Street: GetChildren()) do\n if object.Name == &quot;Town&quot; then\n for _, object in ipairs(object.house:children()) do\n if string.sub(object.Name, 1, 5) == &quot;wind_&quot; then\n object.BrickColor = BrickColor.new(&quot;Light blue&quot;)\n end\n end\n end\nend\n</code></pre>\n<p>As expected, the for loop goes through all Town objects.</p>\n"^^ . . . . "0"^^ . . . . . "0"^^ . "I do not agree with your interpretation of the IMAP SEARCH function. See the RFC https://datatracker.ietf.org/doc/html/rfc3501#section-6.4.4 6.4.4. SEARCH Command"^^ . . . . . "cryptography"^^ . "<p>This is not the intended use of <code>ModuleScripts</code>, you can't update variables inside of them and then access that variable from another script as far as I'm aware.</p>\n<p>What you should do is store the <code>Worker</code> inside a <a href="https://create.roblox.com/docs/reference/engine/classes/StringValue" rel="nofollow noreferrer">StringValue</a> if the <code>Worker</code> variable needs to be accessible from both the client side and the server side you can just store the <code>StringValue</code> inside the <code>ReplicatedStorage</code>, this will retain the same value on the server and replicate it to each client.</p>\n"^^ . . . "0"^^ . . "destroy"^^ . "0"^^ . "<p>I need to support CORS between a react js application on http://localhost:3000 and an 'api gateway&quot; proxy server(HAProxy here) on ex: http://localhost:8081.</p>\n<p>I'm able to successfully configure CORS on HAProxy, using the latest cloned lua library at:</p>\n<p><a href="https://github.com/haproxytech/haproxy-lua-cors" rel="nofollow noreferrer">https://github.com/haproxytech/haproxy-lua-cors</a></p>\n<p>by following the configuration in the HAProxy CORS blog post:</p>\n<p><a href="https://www.haproxy.com/blog/enabling-cors-in-haproxy" rel="nofollow noreferrer">https://www.haproxy.com/blog/enabling-cors-in-haproxy</a></p>\n<p>The preflight OPTIONS request appears to be successful.</p>\n<p>I would also like for my HAProxy config file to support JWT validation.</p>\n<p>I followed the configuration to validate JWT's using the HAProxy-provided syntax(without lua) by following the blog post:</p>\n<p><a href="https://www.haproxy.com/blog/verify-oauth-jwt-tokens-with-haproxy" rel="nofollow noreferrer">https://www.haproxy.com/blog/verify-oauth-jwt-tokens-with-haproxy</a></p>\n<p>I'm able to successfully decline the http requests when the JWT validation fails. The client browser(Chrome) - receives a 403 Forbidden response from the JWT validation. The &quot;Access-Control-Allow-Origin&quot; header is not included in that 403 error response, and so the browser displays a CORS origin error:</p>\n<p>Access to fetch at 'http://localhost:8081' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.....</p>\n<p>This is happening after a successful preflight OPTIONS request.</p>\n<p>I tried to set the Access-Control-Allow-Origin header on the response - in a separate server block as directed below:</p>\n<p><a href="https://serverfault.com/questions/1136690/adding-custom-headers-on-error-responses-from-haproxy">https://serverfault.com/questions/1136690/adding-custom-headers-on-error-responses-from-haproxy</a></p>\n<p>The header did not come through however in the response.</p>\n<p>Is there a way to support JWT validation and CORS together - with HAProxy?</p>\n"^^ . "0"^^ . . . . . . . . . "roblox-studio"^^ . "0"^^ . . "physics"^^ . "docx"^^ . . "Setting up a Garry's mod TTT Server with the Moat Setup - Lua Errors"^^ . "You've shared the code that sets the value, but where is the code that prints it out?"^^ . . "oauth"^^ . . "0"^^ . "loops"^^ . "<p>How do I intercept and modify the response HTML from a request running through a reverse proxy and proxy_pass?</p>\n<p>I have a large number of embedded servers that im using Nginx to reverse proxy to through one domain, I would like to be able to remove a certian tag and add css to the response depending on the specific url?</p>\n<p>I know you can use the Lua module, but im not certian how to do that in conjunction with proxy_pass.</p>\n<p>So for the example:</p>\n<pre><code>server {\n listen 80; \n server_name www.website.com;\n\n location /device1 { \n proxy_pass http://1.1.1.1:8080; \n --&gt;also post process to some Lua script or something. \n }\n} \n</code></pre>\n"^^ . "openresty"^^ . . "<p>Once I started searching for Lua code examples I was able to piece together a solution. Here is my Premake script which creates one main project and then one for each sub-project. The main one builds everything.</p>\n<pre><code>workspace &quot;MyApplication&quot;\n basedir &quot;./MyApplication&quot;\n location &quot;./MyApplication/IDE&quot;\n configurations { &quot;Debug&quot;, &quot;Release&quot; }\n\nproject &quot;MyApplication&quot;\n basedir &quot;./MyApplication&quot;\n location &quot;./MyApplication/IDE&quot;\n kind &quot;StaticLib&quot;\n language &quot;C&quot;\n files { &quot;./MyApplication/Includes/**Enum.h&quot; }\n targetname &quot;Plugins&quot;\n targetdir &quot;./MyApplication/Builds&quot;\n objdir &quot;./MyApplication/Builds/obj&quot;\n includedirs { &quot;./MyApplication/Includes&quot; }\n\n filter { &quot;system:android&quot; }\n files { &quot;./MyApplication/Plugins/**.all.c&quot;, &quot;./MyApplication/Plugins/**.and.c&quot; }\n files { &quot;./MyApplication/Includes/**.all.h&quot;, &quot;./MyApplication/Includes/**.and.h&quot; }\n defines { &quot;PLATFORM_AND&quot; }\n\n filter { &quot;system:ios&quot; }\n files { &quot;./MyApplication/Plugins/**.all.c&quot;, &quot;./MyApplication/Plugins/**.ios.c&quot; }\n files { &quot;./MyApplication/Includes/**.all.h&quot;, &quot;./MyApplication/Includes/**.ios.h&quot; }\n defines { &quot;PLATFORM_IOS&quot; }\n\n filter { &quot;system:linux&quot; }\n files { &quot;./MyApplication/Plugins/**.all.c&quot;, &quot;./MyApplication/Plugins/**.lin.c&quot; }\n files { &quot;./MyApplication/Includes/**.all.h&quot;, &quot;./MyApplication/Includes/**.lin.h&quot; }\n defines { &quot;PLATFORM_LIN&quot; }\n\n filter { &quot;system:macosx&quot; }\n files { &quot;./MyApplication/Plugins/**.all.c&quot;, &quot;./MyApplication/Plugins/**.mac.c&quot;, &quot;./MyApplication/Plugins/**.mac.m&quot; }\n files { &quot;./MyApplication/Includes/**.all.h&quot;, &quot;./MyApplication/Includes/**.mac.h&quot; }\n defines { &quot;PLATFORM_MAC&quot; }\n\n filter { &quot;system:windows&quot; }\n files { &quot;./MyApplication/Plugins/**.all.c&quot;, &quot;./MyApplication/Plugins/**.win.c&quot; }\n files { &quot;./MyApplication/Includes/**.all.h&quot;, &quot;./MyApplication/Includes/**.win.h&quot; }\n defines { &quot;PLATFORM_WIN&quot; }\n\n filter { &quot;configurations:Debug&quot; }\n defines { &quot;DEBUG&quot; }\n symbols &quot;On&quot;\n targetdir &quot;./MyApplication/Builds/Debug/bin&quot;\n objdir &quot;./MyApplication/Builds/Debug/bin&quot;\n\n filter { &quot;configurations:Release&quot; }\n defines { &quot;NDEBUG&quot; }\n optimize &quot;On&quot;\n targetdir &quot;./MyApplication/Builds/Release/bin&quot;\n objdir &quot;./MyApplication/Builds/Release/bin&quot;\n\n-- Generate sub-projects\nprintf(&quot;Generating sub-projects&quot;)\ndirectories = os.matchdirs(&quot;./MyApplication/Plugins/*&quot;)\n-- alphabetize everything so it appears in correct order\ntable.sort(directories)\nfor dirCount = 1, #directories do\n local dir = directories[dirCount]\n local dirName = path.getname(dir)\n print (&quot;Generating project for &quot; .. dirName)\n project (dirName)\n kind &quot;StaticLib&quot;\n language &quot;C&quot;\n files { &quot;./MyApplication/Includes/**Enum.h&quot; }\n files { dir .. &quot;/**.all.c&quot;, &quot;./MyApplication/Includes/**.all.h&quot;}\n targetname (dirName)\n targetdir (dir .. &quot;/Builds&quot;)\n objdir (dir .. &quot;/Builds&quot;)\n includedirs { &quot;./MyApplication/Includes&quot; }\n\n filter { &quot;system:macosx&quot; }\n files { dir .. &quot;/**.mac.c&quot;, dir .. &quot;/**.mac.m&quot; }\n files { &quot;./MyApplication/Includes/**.mac.h&quot; }\n defines { &quot;PLATFORM_MAC&quot; }\n\n filter { &quot;system:windows&quot; }\n files { dir .. &quot;/**.win.c&quot; }\n files { &quot;./MyApplication/Includes/**.win.h&quot; }\n defines { &quot;PLATFORM_WIN&quot; }\n\n filter { &quot;configurations:Debug&quot; }\n defines { &quot;DEBUG&quot; }\n symbols &quot;On&quot;\n targetdir (dir .. &quot;/Builds&quot;)\n objdir (dir .. &quot;/Builds&quot;)\nend\n</code></pre>\n"^^ . . "server"^^ . "If `coprime = 1` then `(coprime^k)%n` is 1, so it goes to the `else` part and just `return k`"^^ . . . "<p>I´m not being able to find any lua syntax plugins for Eclipse. The only known one is discontinued (LDT - Lua Development Tools).</p>\n<p>Some people were able to install it using the process described in <a href="https://gitlab.eclipse.org/eclipse/ldt/ldt/-/issues/2#note_1474916" rel="nofollow noreferrer">this</a> page.\nThe problem is DLTK plugin that isn't installed in newer eclipse versions. So some people installed a former version and it worked.\nWhen I tried this Eclipse refused installation saying I already had a newer version installed, probably because I'm using WWD that uses it.</p>\n<p>Anyway I don't need a full IDE for lua as I will be using it only for creating Redis scripts. I just need a proper syntax highlighter.</p>\n<p>Anyone knows an Eclipse plugin that has Lua syntax support besides LDT or how can I install LDT in newer Eclipses ?</p>\n"^^ . "0"^^ . . . "0"^^ . . "2"^^ . "0"^^ . "Have you tried to print the orb variable to make sure it isn't null and if so try to add some print statements in the object to identify what part of the script doesn't get triggered."^^ . "0"^^ . . "How do I destroy a part when it touches another part?"^^ . . "0"^^ . . "2"^^ . . . . . "0"^^ . . . . "-1"^^ . "3"^^ . "I couldn't think of the name at the time, but what I meant to ask was, is it possible to do delayed expansion in Lua like you can do in batch? (i'll edit the question)"^^ . "0"^^ . . . "0"^^ . . . . "<p>You can run a check on the <a href="https://create.roblox.com/docs/reference/engine/classes/BasePart#Touched" rel="nofollow noreferrer"><code>Touched</code></a> event of a <a href="https://create.roblox.com/docs/reference/engine/classes/BasePart" rel="nofollow noreferrer">BasePart</a> and check whether a player has enough clicks and if they do, then set CanCollide off.</p>\n<p>In the below script, find how much clicks the player has in <code>clicksStat</code> and then if that player has enough clicks, which is stored in <code>clicksNeeded</code>, then <code>wallPart</code>'s CanCollide is set to false.</p>\n<pre class="lang-lua prettyprint-override"><code>local Players = game:GetService(&quot;Players&quot;)\n\nlocal player = Players.LocalPlayer\nlocal wallPart = script.Parent -- Make this where your wall is\n\nlocal leaderstats = player and player:FindFirstChild(&quot;leaderstats&quot;)\nlocal clicksStat = leaderstats and leaderstats:FindFirstChild(&quot;Clicks&quot;)\n\nlocal clicksNeeded = 100 -- Clicks needed for CanCollide = false\n\n-- Check every time wallPart is touched if the player has enough clicks\nlocal function onTouched(otherPart)\n if player and clicksStat &gt;= clicksNeeded then\n wallPart.CanCollide = false -- Disable collision if player has enough clicks\n end\nend\n\nwallPart.Touched:Connect(onTouched)\n</code></pre>\n"^^ . "0"^^ . "request"^^ . "How to type annotate a Module Script in Luau?"^^ . "pandoc classic filter's template setting"^^ . . . "0"^^ . "<p>Adding a <code>wait(0.1)</code> after making the <code>LocalPlayer</code> variable fixes it for some reason.\nIt might be because the model still doesn't have the children even if it has waited for the character to load.</p>\n"^^ . "<p>I am making a building system for my game, for which I need to make a clamping function.</p>\n<p>This function should clamp the hit position of the player´s mouse for a part following the mouse to stay within specific bounds (the player´s baseplate) so it doesn´t clip out on any side in any rotation.</p>\n<p>My problem here, is that I don´t know how to execute this. I´ve prepared some variables for myself (such as the part´s and baseplate´s Look- and RightVectors and their negatives) but I don´t exactly know how to use them.</p>\n<p>I am thinking about:</p>\n<ol>\n<li><p>getting the hit position relative to the baseplate</p>\n</li>\n<li><p>clamping that position along x and z so that the max value is (baseplateSize-(partSize/2))</p>\n</li>\n</ol>\n<p>This would work, but only if the part couldn´t rotate, and even so could work on only most sides.</p>\n<p>My current progress:</p>\n<pre><code>function clamp(hit,obj:Model)\n local part = obj.PrimaryPart\n local partSize = part.Size/2\n \n local partFront = part.CFrame.LookVector\n local partBack = -partFront\n local partRight = part.CFrame.RightVector\n local partLeft = -partRight\n \n local plateFront = platePart.CFrame.LookVector\n local plateBack = -plateFront\n local plateRight = platePart.CFrame.RightVector\n local plateLeft = -plateRight\n \n return CFrame.new()\nend\n</code></pre>\n<p>(I really don´t know how to write proper StackOverflow questions, please ask me for more context/information if needed)</p>\n"^^ . "0"^^ . . . . "0"^^ . "0"^^ . . . "0"^^ . "I'm new to Lua and creating meta files for config servers, but does anybody know why my suppressor and barrel doesn't render in game?"^^ . . "@Luatic A point well made. I've tried to clarify."^^ . "6"^^ . "<p>you can use <code>set_rundir</code> to set lua script directory, then use <code>xmake run to run it.</code></p>\n<pre><code>target(&quot;Elevated&quot;)\n set_kind(&quot;binary&quot;)\n add_packages(&quot;lua&quot;)\n add_files(&quot;src/*.c&quot;)\n set_rundir(&quot;scripts&quot;)\n</code></pre>\n<p>then put your lua scripts to <code>scripts</code> directory. <code>scripts/engine/main.lua</code></p>\n<p>run your program.</p>\n<pre><code>xmake run\n</code></pre>\n<p>If you want to distribute your program, you can use <code>add_installfiles</code>, <code>set_installdir</code> to configure all installed lua script files. then run <code>xmake install -o outputdir</code></p>\n"^^ . "Lua attempt to index a nil value vs code"^^ . . . . "The expected output is the Carmichael number of `n`, basically the smallest number of the set of real integers that has the property `a^m = 1 (mod n)` holds for every integer coprime to n [here](https://en.wikipedia.org/wiki/Carmichael_function)"^^ . . . "<p>How to change the cursor thickness on Insert and Replace modes vertically and horizontally, respectively in Vim?<br />\nThe init.lua has</p>\n<pre><code>vim.opt.guicursor='n-v-sm-i-ci-ve:block,i:ver41,r:hor41,a:blinkoff400-blinkon250-Cursor/lCursor'\n</code></pre>\n<p>which fails to set thickness<br />\nPlease sincerely guide to correct path up to solve it</p>\n"^^ . . . "<p>Let's first have a look at how to debug this. Pandoc allows to print the <em>internal</em> document representation with <code>--to=native</code>. That's very useful to see what's going on. When I run <code>pandoc --filter=pandoc-crossref --to=native</code> on your table, this is what I get:</p>\n<pre class="lang-hs prettyprint-override"><code>[ Div \n ( &quot;tbl:table1&quot; , [] , [] )\n [ Table\n ( &quot;&quot; , [] , [] )\n -- ...\n ]\n]\n</code></pre>\n<p>That gives us the hint we need: pandoc-crossref places the table in a <code>Div</code> element and adds the id there! (One could also use the <a href="https://github.com/pandoc-ext/logging" rel="nofollow noreferrer">pandoc/logging</a> helper to do that kind of inspection in a Lua script.)</p>\n<p>To change that, we can use an extra filter (or include it in your other filter):</p>\n<pre class="lang-lua prettyprint-override"><code>function Div (div)\n -- Check if the div contains just a single table\n if #div.content == 1 and div.content[1].t == 'Table' then\n -- move the id to the table, and unwrap the table.\n local tbl = div.content[1]\n tbl.identifier = div.identifier\n return tbl\n end\nend\n</code></pre>\n<p>Running that filter between pandoc-crossref and your other filter should fix the issue.</p>\n"^^ . . "0"^^ . . . . . "<p>This is a scrambled step by step of how I'd do this</p>\n<pre><code>Step 1: Obtain the Kong Code Source\n</code></pre>\n<p>Obtain the source code of the Kong version you are running. You can clone the Kong repository from GitHub:\n<code>git clone https://github.com/Kong/kong.git</code></p>\n<p>Navigate to the directory housing the code source:\n<code>cd kong</code></p>\n<pre><code>Step 2: Find the rockspec File\n</code></pre>\n<p>Locate the <code>rockspec</code> file for the Kong version you are running. Look for <code>kong-0.11.0-0.rockspec</code> file.</p>\n<pre><code>Step 3: Modify the Dependencies\n</code></pre>\n<p>Once you have located the <code>rockspec</code> file, you can modify the dependencies section to override the version of <code>pgmoon</code>. Open the <code>rockspec</code> file in a text editor and locate the <code>dependencies</code> table. Change the version of <code>pgmoon</code> from <code>1.8.0</code> to <code>1.12.0</code>:</p>\n<p><code>dependencies = { -- ... leafo.pgmoon { version = &quot;1.12.0&quot; }, -- ... }</code></p>\n<pre><code>Step 4: Now Rebuild Kong\n</code></pre>\n<p>After modifying the <code>rockspec</code> file, you need to rebuild Kong. You can do this using <code>LuaRocks</code>:\n<code>luarocks make</code></p>\n<p>This will rebuild the Kong package with the overridden dependency version.</p>\n<pre><code>Step 5: Install the Rebuilt Kong\n</code></pre>\n<p>Finally, you can install the rebuilt Kong package. If you are using a package manager like <code>apt</code> or <code>yum</code>, you will need to remove the existing Kong package before installing the new one. After that, you can install the new Kong package using the package manager.\nAlternatively, if you are not using a package manager, you can install Kong manually by copying the rebuilt package to the appropriate directory. For example, if you are using a Linux system, you can copy the package to <code>/usr/local</code>:\n<code>sudo cp kong-*.tar.gz /usr/local/</code></p>\n<p>Then, extract the package and install Kong:\n<code>sudo tar xzf /usr/local/kong-*.tar.gz -C /usr/local/ sudo ln -s /usr/local/kong/bin/kong /usr/local/bin/</code></p>\n"^^ . . . "0"^^ . . . . . "0"^^ . . . . . . . . . "0"^^ . . "0"^^ . "1"^^ . "0"^^ . . . "0"^^ . . . . . . "@Nifim but in the other where I've passed a table, it has been copied instead of passing a pointer. Is there a certain scenario it will pass a pointer?"^^ . . . . . . "<p>Lua seems to generally use 64 bit numbers, way too small for something like RSA. note that 63 bits means <a href="https://www.wolframalpha.com/input?i=log_10%282%5E63%29" rel="nofollow noreferrer">about 19 digits</a>. This means that you need to use <a href="https://github.com/empyreuma/bigint.lua" rel="nofollow noreferrer">a BigInt library</a> or a cryptographic library. If you look at <a href="https://gist.github.com/1lann/6604c8d3d8e5fdad0832" rel="nofollow noreferrer">this RSA lib</a> you see that most of the code is devoted to implementing bigint operations. Beware that it is unlikely that such code is resistant against e.g. side channel attacks.</p>\n<p>When going over 63 bits you will get into weird situations as basically all ops are modulus 2^64 and interpreted as signed 2-complement numbers. This could be cause of the long wait.</p>\n<p>The other possible reason is of course that the <code>isprime</code> function is not efficiently implemented. This can even be slow on native systems for large enough key sizes.</p>\n<p>I'd also try and count up from a specific random value, otherwise your RNG will continuously be asked for new random values to test. Random number generation is relatively slow compared to checking if a <em>possibly even</em> number is prime.</p>\n<p>This is not really something that Lua has been designed for; it makes more sense to call a function within OpenSSL for RSA operations.</p>\n"^^ . . . "2"^^ . "lua-table"^^ . . . "<p>I'm designing a tower defense game on Roblox with Roblox Studio and am currently experiencing issues with the placement system. There is a button on the screen with the text <code>Place Unit</code>, which for testing purposes is connected to a single model (a noob dummy). The code is supposed to make the model follow the player's mouse in real time and fire a RemoteEvent when the mouse is clicked, placing the unit model on the server side where the user clicked. However, when dragging the mouse to move the model around, it jumps in place and sometimes floats at the camera, only to snap back down and start floating again. This behavior even occurs when the mouse is still. If I click the screen while the unit is mid-jump or mid-float, it is placed in the air. Here's my LocalScript code:</p>\n<pre><code>-- Get unit model from ReplicatedStorage\nlocal unit_name = &quot;Noob&quot;\nlocal unit = game:GetService(&quot;ReplicatedStorage&quot;)[&quot;Unit Models&quot;][unit_name]:Clone()\nunit.Parent = game:GetService(&quot;Workspace&quot;)\n\nlocal offset = 5\ncurrent_position = CFrame.new()\n\nscript.Parent.MouseButton1Click:Connect(function()\n local Mouse = game:GetService(&quot;Players&quot;).LocalPlayer:GetMouse()\n\n local lastMousePosition = Mouse.Hit.Position\n\n -- Update position function\n local function updateTowerPosition()\n local ray = Ray.new(Mouse.UnitRay.Origin, Mouse.UnitRay.Direction * 1000)\n local hitPart, hitPosition = game.Workspace:FindPartOnRay(ray, game.Workspace.Terrain, false, true)\n if hitPosition then\n current_position = CFrame.new(hitPosition) * CFrame.new(0, offset, 0)\n unit:SetPrimaryPartCFrame(current_position)\n end\n end\n\n -- Initial tower placement\n updateTowerPosition()\n\n local render_event\n render_event = game:GetService(&quot;RunService&quot;).RenderStepped:Connect(function()\n local currentMousePosition = Mouse.Hit.Position\n if currentMousePosition ~= lastMousePosition then\n updateTowerPosition()\n lastMousePosition = currentMousePosition\n end\n end)\n\n Mouse.Button1Down:Once(function()\n render_event:Disconnect()\n unit:Destroy()\n game.ReplicatedStorage.Place:FireServer(unit_name, current_position)\n end)\nend)\n</code></pre>\n<p>And here is my server script code that handles the <code>Place</code> RemoteEvent:</p>\n<pre><code>-- Server-side unit placement\ngame:GetService(&quot;ReplicatedStorage&quot;).Place.OnServerEvent:Connect(function(player: Player, unit_name: string, pos: CFrame) \n local unit = game:GetService(&quot;ReplicatedStorage&quot;)[&quot;Unit Models&quot;][unit_name]:Clone()\n unit.Parent = game:GetService(&quot;Workspace&quot;)\n unit.PrimaryPart.CFrame = pos\n unit.PrimaryPart.Anchored = true\nend)\n</code></pre>\n<p>I've attempted to force the tower model to not move while the mouse is still, but it continues to hop and (less frequently) float when moved across certain areas of the screen. I don't see what in the code could be causing a jump motion, as I never use <code>Humanoid.Jump</code> or anything similar. The jumps are rapid and repeated. Any help would be appreciated!</p>\n"^^ . "Clamp a part within bounds (Roblox)"^^ . . . "Attempt to index nil with position drops"^^ . . "An alternative to the "manual" table building can be to run `pandoc.write(pandoc.Pandoc{my_table}, 'latex')`, as this will give a LaTeX string that can then be modified. Advantage: works with cells spanning across columns and/or rows. Disadvantage: requires string manipulations."^^ . "logitech-gaming-software"^^ . . "0"^^ . . "I fail to see the difference between an "if" and an "if and only if". A condition is either true or it is not."^^ . . "Could you clarify, please: what exactly should the filter do, what kind of "update" do you want to see for the description, and do you have any code but got stuck? A reproducible example would be extremely helpful, too."^^ . . . . "0"^^ . "Passing Lua expression to interpreter from C++"^^ . . . . . "1"^^ . . . "1"^^ . "<blockquote>\n<p>For some reason this script also uses to freeze and bug all Logitech ghub program after a while when tabbing between desktop and the game.</p>\n</blockquote>\n<p>Try avoiding long sleep by using <code>InterruptableSleep</code> for polling LMB (instead of <code>Sleep</code>) and don't forget to release LMB before switching from the game to desktop.</p>\n<pre><code>local exit\n\nlocal function InterruptableSleep(ms)\n if not exit then\n local tm = GetRunningTime() + ms\n repeat\n Sleep(1)\n exit = not IsMouseButtonPressed(1) \n until exit or GetRunningTime() &gt;= tm\n end\n return exit\nend\n\nEnablePrimaryMouseButtonEvents(true)\n\nfunction OnEvent(event, arg)\n -------------------------------------------------------\n OutputLogMessage(&quot;Event: &quot;..event..&quot; Arg: &quot;..arg..&quot;\\n&quot;)\n -------------------------------------------------------\n \n --- Autoclicker/bind &quot;p&quot; fire ---\n if IsKeyLockOn(&quot;scrolllock&quot;) then\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 then\n exit = false\n repeat\n PressKey(&quot;p&quot;)\n Sleep(1)\n ReleaseKey(&quot;p&quot;)\n if InterruptableSleep(75) then break end\n PressKey(&quot;p&quot;)\n Sleep(1)\n ReleaseKey(&quot;p&quot;)\n if InterruptableSleep(75) then break end\n PressKey(&quot;p&quot;)\n Sleep(1)\n ReleaseKey(&quot;p&quot;)\n if InterruptableSleep(150) then break end\n until false\n --------------------------------------\n OutputLogMessage(&quot;Burst fire shoot\\n&quot;)\n --------------------------------------\n end\n else\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 then\n PressKey(&quot;p&quot;)\n elseif event == &quot;MOUSE_BUTTON_RELEASED&quot; and arg == 1 then\n ReleaseKey(&quot;p&quot;)\n ---------------------------------------\n OutputLogMessage(&quot;Normal fire shoot\\n&quot;)\n ---------------------------------------\n end\n end\n</code></pre>\n<hr />\n<blockquote>\n<p>if there is an alternative to only call and use the same button (mouse button 1 , LMB) to call and execute the script instead of &quot;p&quot; button</p>\n</blockquote>\n<p>It is impossible to both simulate <code>PressMouseButton(1)</code> and monitor <code>IsMouseButtonPressed(1)</code> at the same time. Choose one of the two.</p>\n"^^ . . "Another error: "IsFinished is not a valid member of InventoryPages "Instance" " at `while (not Page:IsFinished()) do`"^^ . . "HumanoidRootPart not a valid member of Character RBLX"^^ . . . . "maybe `:children()` on line 3 should be `:GetChildren()` or did you make a custom function? also you're assigning the variable `object` twice in both loops, so one will overwrite the other."^^ . "<p>Well as it turns out the correct id for 'Holy Strike' is 65. So the correct version of the scriptlet is:</p>\n<pre class="lang-lua prettyprint-override"><code>/script local start_time, duration, enabled = GetSpellCooldown(65, BOOKTYPE_SPELL); print(start_time); print(duration); print(enabled);\n</code></pre>\n"^^ . . "<p>This was a documentation bug: pandoc used to expect a compiled template as the <code>Template</code> parameter, but that was changed for various reasons. The documentation was updated to reflect this <a href="https://github.com/jgm/pandoc/commit/f3ed3b36142afe3d005d57481d7b25c6f2db010a" rel="nofollow noreferrer">5 days ago</a>. It will be online after the next pandoc release.</p>\n<p>Long story short, the below should work:</p>\n<pre class="lang-lua prettyprint-override"><code>Template = pandoc.template.default 'tba.lua'\n</code></pre>\n"^^ . "eclipse-plugin"^^ . "1"^^ . . . . "Also, use a table instead of a chain of ifs."^^ . . "<p>While having many parts explode and get unanchored will always result in lag because of physics calculations, they are ways to improve the physics performance of your experience.</p>\n<p>Technically, you could just have the parts disappear, it takes away from the player's experience. Even with removing other factors like collision calculations it will suffer because of physics.</p>\n<ol>\n<li><p>One way you can improve the performance of physics is to use <a href="https://create.roblox.com/docs/physics/adaptive-timestepping" rel="nofollow noreferrer">Adaptive Timestepping</a> which improves performance of physics by changing the physics frequency of specific physics calculations.</p>\n<blockquote>\n<p>By default, Roblox simulates physics at 240 Hz. Given cycles of approximately 60 frames per second, around 4 worldsteps are advanced per frame. With adaptive timestepping, the physics engine automatically assigns parts to three &quot;solver islands&quot; by varying their simulation timestep, with an emphasis on 60 Hz for best performance. However, parts that are &quot;harder&quot; to solve will use a faster timestep like 240 Hz to ensure physical stability.</p>\n</blockquote>\n<p>It is also important to note that adaptive timestepping isn't always suitable if you want accuracy on your explosions or physics.</p>\n<blockquote>\n<p>Adaptive timestepping can improve physics performance by up to 2.5 times and it is recommended in most cases. However, some experiences should use Fixed mode (240 Hz), including:</p>\n<p>Experiences that require highly accurate simulations and stability, such as racing games, &quot;destruction&quot; simulations, or games featuring complex mechanisms like tanks.</p>\n</blockquote>\n</li>\n<li><p>Another optimization you can perform is to set the <a href="https://create.roblox.com/docs/reference/engine/classes/Workspace#FallenPartsDestroyHeight" rel="nofollow noreferrer"><code>FallenPartsDestroyHeight</code></a> which dictates how low a part can fall being destroyed. This is especially helpful if they are a lot of parts falling off the map because the parts can be removed sooner resulting in less physics calculations and lag generally.</p>\n<blockquote>\n<p>This property determines the height at which the Roblox engine automatically removes falling BaseParts and their ancestor Models from Workspace by parenting them to nil. This is to prevent parts that have fallen off the map from continuing to fall forever.</p>\n</blockquote>\n</li>\n<li><p>You can properly <a href="https://create.roblox.com/docs/tutorials/environmental-art/assemble-an-asset-library#collisionfidelity" rel="nofollow noreferrer">set Physics and Rendering Parameters</a> for models, parts, and meshes in your experience to improve performace. Important properties include <a href="https://create.roblox.com/docs/tutorials/environmental-art/assemble-an-asset-library#cancollide" rel="nofollow noreferrer">CanCollide</a>, <a href="https://create.roblox.com/docs/tutorials/environmental-art/assemble-an-asset-library#cantouch" rel="nofollow noreferrer">CanTouch</a>, and <a href="https://create.roblox.com/docs/tutorials/environmental-art/assemble-an-asset-library#collisionfidelity" rel="nofollow noreferrer">CollisionFidelity</a>. While they are more properties that impact performance, those are the most important regarding physics. If you want to learn more why those properties matter towards physics, click the links for the documentation reason why.</p>\n</li>\n<li><p>For larger maps, it may be more suitable to use <a href="https://create.roblox.com/docs/workspace/streaming" rel="nofollow noreferrer">Instance Streaming</a> to only show parts important to the player and not have them need to render some falling parts from across the map.</p>\n<blockquote>\n<p>In-experience instance streaming allows the Roblox engine to dynamically load and unload 3D content and related instances in regions of the world. This can improve the overall player experience in several ways.</p>\n</blockquote>\n</li>\n</ol>\n<p>Essentially what streaming does is only load parts of the in-game world to the player as opposed to the entire world leading to improved performance due to not needing to render as much. Note that this is typically for bigger maps since it does take time to load a new region and if a player fires a rocket into an unloaded region, it leads to some problems.</p>\n<p>For more stuff about optimization I suggest you read <a href="https://create.roblox.com/docs/projects/performance-optimization" rel="nofollow noreferrer">Performance Optimization</a> and <a href="https://create.roblox.com/docs/projects/performance-optimization/computation#physics" rel="nofollow noreferrer">Physic Computation Optimization</a> which gives a very board overview on how to improve performance in your experience.</p>\n<p>The steps I've listed above are very general but provide you good resources on how to improve physics performance without needing to go deeper into your experience to find the root cause such as using the <a href="https://create.roblox.com/docs/studio/microprofiler" rel="nofollow noreferrer">MicroProfiler</a> to find which physics step causes the most lag and which assembly is causing that lag or using the <a href="https://create.roblox.com/docs/studio/developer-console" rel="nofollow noreferrer">Developer Console</a> to visualize which physics are being computed a lot.</p>\n<p>I hope this explanation helps, if you want any questions or issues with my answer, feel free to comment it out and I'll edit my answer as needed or clarify in comments.</p>\n"^^ . . "roblox"^^ . . . . "1"^^ . "1"^^ . "kong-plugin"^^ . "1"^^ . . "protected"^^ . . "3"^^ . . . . . . "@AsherRoland do you know what InstanceInput is doing and if you care about the changes it is making to the tables being passed to it?"^^ . "0"^^ . "Read through https://stackoverflow.com/questions/47761383/proper-carmichael-function, then apply what that teaches you in a Lua context?"^^ . "It still doesn't work"^^ . . . "0"^^ . . "Roblox Physics Calculation Lag"^^ . "0"^^ . "0"^^ . . . . "5"^^ . "1"^^ . . . . "0"^^ . "1"^^ . "1"^^ . "dont bind an event inside another event. now, everytime `Fall` is triggered it binds `Shot` so if `Fall` is triggered 3 times there will be 3 event listeners for `Shot`."^^ . "neovim"^^ . "0"^^ . "nix"^^ . . . . . . . "1"^^ . . . "0"^^ . "<p>I can propose the following hack where we check whether a Pandoc Div contains such codeblock whose language is not our target lang, if yes, we replace these codeblock with <code>pandoc.Para</code>. And then later, we drop the Div whose first content is <code>pandoc.Para</code>.</p>\n<pre class="lang-lua prettyprint-override"><code>local str = pandoc.utils.stringify\n\nlocal function lang_checker(target_lang)\n -- Check for the code blocks with different language other than `target_lang`\n -- and if it is something other than `target_lang`, then return `pandoc.Para`\n -- instead of CodeBlock. \n return {\n CodeBlock = function(cb)\n if cb.classes:includes('cell-code') and (not cb.classes:includes(target_lang)) then\n return pandoc.Para(&quot;&quot;)\n else \n return cb\n end\n end\n }\nend\n\n\nlocal function remove_div_with_para(target_lang)\n -- Now remove the Div whose first content is pandoc.Para\n return {\n Div = function(el)\n if el.classes:includes('cell') then\n local check_lang = el:walk(lang_checker(target_lang))\n if check_lang.content[1].t == &quot;Para&quot; then\n return pandoc.Null()\n else\n return el\n end\n end\n end\n }\nend\n\n\nfunction Pandoc(doc)\n local target_lang = doc.meta.target_lang and str(doc.meta.target_lang) or nil\n if target_lang then\n return doc:walk(remove_div_with_para(target_lang))\n end\n return doc\nend\n</code></pre>\n"^^ . . . "<p>Hi I have a module script with a variable &quot;Worker&quot; inside of it that starts out as nil, but when I set the player to it(worker = player) it doesn't change. 'Cause when I print it it says nil</p>\n<p>ModuleScript:</p>\n<pre><code>local workModule = {\n [&quot;Worker&quot;] = nil\n}\n\nreturn workModule\n</code></pre>\n<p>Set script:</p>\n<pre><code>local button = script.Parent\nlocal house = workspace.House\nlocal moduleTable = require(workspace.Part.ModuleScript)\nlocal remoteEvent = game.ReplicatedStorage.RemoteEvent\nlocal buttonModule = require(game.ReplicatedStorage.ButtonModule)\nlocal workersGUI = game.ReplicatedStorage.WorkersGUI\n\nbutton.Touched:Connect(function(plr)\n if (plr.Parent:WaitForChild(&quot;Humanoid&quot;)) then\n local player = plr.Parent\n \n moduleTable.Worker = player\n workersGUI:FireAllClients()\n \n buttonModule.SwitchOn(button)\n buttonModule.Player = player\n end\nend)\n\n</code></pre>\n<p>I tried to look at my other code as an example of setting a modulescript variable to the player but it didn't help. I don't know why it works for other modulescripts but not this one</p>\n"^^ . "delay"^^ . "Removing captions in some images using Pandoc markdown to LaTeX conversion while keeping them centered"^^ . . . "0"^^ . "1"^^ . . "0"^^ . . . "1"^^ . "0"^^ . . "1"^^ . "1"^^ . "1"^^ . . "key-generator"^^ . . "0"^^ . . . . "So how exactly world I modify the function so that this problem would no longer occur?"^^ . . "0"^^ . "markdown"^^ . . "1"^^ . "P.S. do you know a way to automatically center both pictures and text inside .docx file?"^^ . . . . . . . . "kubernetes"^^ . . . . "private"^^ . . . . . . . "1"^^ . . . . "<p>I have a large project with dozens of &quot;modules&quot; that are standalone (think plugins). Each module is sitting in its own folder. I want to generate a separate build target for each folder (loop rather than hardcoded), along with a single target that builds everything.</p>\n<p>Since <a href="https://premake.github.io/docs/" rel="nofollow noreferrer">Premake</a> is a Lua program is this possible? Can I just write some sort of loop in Lua with the body of the loop defining the project settings? I can't seem to find any examples or references to get started.</p>\n<p>Simple project structure with root project and one sub-project per sub-folder.</p>\n<pre><code>MyProject\n-Plugin1\n-Plugin2\n-Plugin3\n-Plugin...\n</code></pre>\n"^^ . "0"^^ . . . . . "0"^^ . . . "<p>Lets say I have multiple arrays:</p>\n<pre><code>arr1 = {1,2}\narr2 = {3,4,5}\narr3 = {6,7,8,9}\n</code></pre>\n<p>and I want to use something like this to randomly pick something from one of them:</p>\n<pre><code>local randomPick = 1\n if #array &gt; 1 then\n repeat\n randomPick = RNG:NextInteger(1, #array)\n until randomPick ~= lastPick\n lastPick = randomPick\n end\n</code></pre>\n<p>would it be possible for me to replace the <code>#array</code> in the code with a variable? or is that not possible in Lua? I ask mainly because I know you can do it in batch, so I thought maybe it would be here too.</p>\n<p>Thanks in advance!</p>\n"^^ . . . . "What do you want to do with `k`? What is the expected output of `camichael(n)`?"^^ . . . "0"^^ . . "sequence"^^ . "premake"^^ . . . "3"^^ . . "1"^^ . "makefile"^^ . . . . . . "Thank you very much, it works perfect. This is a good start point to continue with my project"^^ . . . . . "0"^^ . . . . . . "2"^^ . . . "0"^^ . . . . . "Lua non-greedy version of +"^^ . . "1"^^ . . . "0"^^ . . "java"^^ . "I made this into a Quarto extension: https://github.com/JBGruber/quarto-targetlang Thanks again for the help!"^^ . . . "I meant ""ipairs" seems to only work if it starts at 1", or course (facepalm)"^^ . . "0"^^ . "pandoc and LaTeX: importing equation labels"^^ . . . "Why we don't use named local function to create "private function" in Lua?"^^ . "0"^^ . . . . . . . "bigint library, remember?"^^ . . . . . . . "Java FFM, how to link a java object with a C struct?"^^ . . . "<p>In my roblox game, you use a rocket launcher to destroy parts, but when a large amount of parts are being calculated at the same time, it causes immense lag to all physics-based items (including required gameplay items such as a bomb). I've tried using SetNetworkOwner to assign items to the server, but that only made things much worse.</p>\n<p>If there is no direct solution to lowering the lag, is there any way to group physics calculations to separate the core items from the destructible ones?</p>\n<p>Code that causes parts to be flung:</p>\n<pre class="lang-lua prettyprint-override"><code>part:BreakJoints()\npart:ApplyImpulse(((part.Position - explosion.Position).Unit * BLAST_FORCE.Value * part:GetMass()))\n</code></pre>\n"^^ . . "Are you trying to make it so that other players can see what player's character model is stored in the ModuleScript?"^^ . . . "1"^^ . . "0"^^ . . . . "As far as I know, not with FFM. But you could with JNI."^^ . . "<p>Inside of my RSA keygen and encryption/decryption program, the result of decryption is never the same output as the input. I am sure that the <code>gcd(a,b)</code> function and the <code>carmichael(n)</code> functions are working correctly, as is <code>plainToNum(msg)</code>, so the issue must lie in either the <code>rsaEncrypt(e,n,msg)</code>, the <code>rsaDecrypt(d,n,msg)</code>, or the <code>rsaKeygen()</code> functions.\nSource Code:</p>\n<pre><code>function rsaKeygen()\n p = math.random(50000,100000)\n while not isprime(p) do\n p = math.random(1,1000)\n end\n q = math.random(1,1000)\n while not isprime(q) do\n q = math.random(50000,100000)\n end\n local n = p*q\n totientN = carmichael(n)\n e = 2^16+1\n local d = 1%totientN/e\n p,q,totientN = nil,nil,nil\n return e,d,n\nend\n\nfunction encryptRSA(e,n,msg)\n local msg = plainToNum(msg)\n return msg^e%n\nend\n\nfunction decryptRSA(d,n,msg)\n local dec = msg^d%n\n return dec\nend\n</code></pre>\n<p>According to my code, the keys are generated fine (maybe), and the keys work for encryption (they return a reasonable-looking result) and my algorithms are based on the Wikipedia page for RSA (cryptosystem).<br />\nAs a set of test data, the result of plainToNum for the string &quot;testing&quot; is 1.16e+20, the encrypted num is 4566895.0, and the decrypted string is 165.910</p>\n"^^ . . "I suggest to move generic stuff outside of `filter`, i.e ` files { dir .. "/**.all.c", dir .. "/**.all.h"}`"^^ . . . . . . . "jwt"^^ . "2"^^ . "0"^^ . . . "2"^^ . "Do lua sequence values before index 1 use more memory?"^^ . . "After much try and error I came to the conclusion, that a much simpler and above all a working solution to this problem would be the use of "sed" to find and replace image-syntax with the respective custom-styles. sed -n "s/!\\[\\(.*\\)\\](.*)\\({[^}]*}\\)\\?/\\[\\1\\]{custom-style=\\"Caption\\"}/p; t; p" %~nx1 > %~n1-captions.md is what I use and it seems to work just fine. The output then can be used to process with pandoc."^^ . "0"^^ . "0"^^ . . . . . . . . . . "0"^^ . . . . . "0"^^ . . "0"^^ . "0"^^ . . "I ended up coming up with a very hackneyed solution, but yeah I agree that did sound like an XY problem. When I read your response initially, I saw that you mentioned I was grabbing the position of the instead of the value, and that that was the problem, but I knew that part of the code was working. So I tried to explain the question better. All I was looking for was a more compact way of changing target of an if loop each time it runs, with what I was working on as example. Also yes, I'm using roblox. I didn't know how different they were, so I thought labelling it Lua would be enough, sorry."^^ . . . "0"^^ . "0"^^ . . . . . "Returning multiple pandoc action in lua filters"^^ . "encryption"^^ . "0"^^ . "Amazing answer. I thought I could "tag" a sequence by using a "special starting index", but this is clearly not the way to go. I'll have to find another way, which doesn't break standard usage."^^ . . . . . . . . . . . . "math"^^ . "1"^^ . . "```In all search keys that use strings, and unless otherwise specified, a message matches the key if the string is a substring of the associated text. The matching SHOULD be case insensitive for characters within the ASCII range.```"^^ . . . "1"^^ . . . . . . . . . . . "0"^^ . . . . . "Kong Custom Plugin Development: is it possible to have a configuration field with 2 types? How?"^^ . "lua solar2d. player passes through obstacles and incorrect transition to another level"^^ . "The map which the main issue occurs on is the classic "Roblox HQ" map (available on toolbox), leading to upwards of 80 parts being hit at one time. This is with the Rocket Launcher at 8 blast radius. There are visual effects, but we removed them and the issue still persisted. The parts can be hit multiple times, so they aren't able to be removed"^^ . . . . "<p><code>local _, c = addr:gsub(&quot;€&quot;,&quot;&quot;)</code> will give that <code>c = 2</code> but if we create a group <code>[€]</code> it gives <code>c = 6</code> because <code>€</code> is a three bytes wide, Lua sees it as a string of 3 characters each in that group You can also see this by changing <code>€</code> to <code>\\226\\130\\172</code> in both examples.</p>\n<p>to get an accurate count of the characters as you described it you can to do 2 separate <code>gsub</code> with 2 difference patterns one for chars with 3 bytes and one for single bytes:</p>\n<pre class="lang-lua prettyprint-override"><code>local str = &quot;abc€|€]/{def&quot; \nlocal tripleByteCharPattern = &quot;€&quot;\nlocal singleByteCharpattern = &quot;[%[%]/^{|}~]&quot; \nlocal count = select(2, str:gsub(singleByteCharpattern, &quot;&quot;)) \ncount = count + select(2, str:gsub(tripleByteCharPattern, &quot;&quot;))\n \nprint(count)\n</code></pre>\n<hr />\n<p>1 thing to note with this method if there could be other types of multi byte width characters you could end up identifying one of your single byte char INSIDE the multi byte character, the ways around this would usually require identifying the start of the multi byte characters.</p>\n"^^ . . "<p>I am very new to roblox development and was coding a gun script that decreases damage the further away you are, every time you shoot the gun the damage script will play one additional time. if you click anywhere 3 times the damage will be tripled because the script is ran 3 times.</p>\n<p>This script is named &quot;server&quot; and is a normal script</p>\n<pre><code>\nscript.Parent.Fall.OnServerEvent:Connect(function(plr,guy)\n script.Parent.Shot.OnServerEvent:Connect(function(plr,target)\n \n for _, player in pairs((game.Players:GetPlayers())) do\n local character = workspace:WaitForChild(guy)\n local part = target\n local partPosition = part.Position\n if not character then\n continue\n end\n local humanoidRootPart = character:WaitForChild(&quot;HumanoidRootPart&quot;)\n if not humanoidRootPart then\n continue\n end\n local humanoidRootPartPosition = humanoidRootPart.Position\n local distanceBetweenPlayerAndPart = (humanoidRootPartPosition - partPosition).Magnitude\n print(distanceBetweenPlayerAndPart)\n local damage = 100 - 1.5 * distanceBetweenPlayerAndPart\n \n if target:IsDescendantOf(plr.Character) then\n print(&quot;Cant KYS&quot;)\n else\n if target.Parent:FindFirstChild(&quot;Humanoid&quot;) then\n if damage &gt; 0 then\n target.Parent.Humanoid.Health -= damage\n print(target.Parent, &quot;Got shot for&quot;, damage, &quot;Health&quot;)\n \n else\n print(&quot;Too far away to hit, try a gun with longer range&quot;)\n\n end\n \n else\n end\n end\n \n \n \n end\n \n \n end)\n\n \n \nend)\n\n\n</code></pre>\n<p>this is a assosiated local script named &quot;local&quot;</p>\n<pre><code>local mouse = game.Players.LocalPlayer:GetMouse()\nlocal guy = game.Players.LocalPlayer.Name\n\nmouse.Button1Down:Connect(function()\n script.Parent.Shot:FireServer(mouse.Target)\n script.Parent.Fall:FireServer(guy)\n \nend)\n\n\n</code></pre>\n<p>both scripts as well as their remote events are children of a tool which is a child of the starterpack</p>\n<p>From my testing the further away part of the script does not seem to affect the weird damage mechanic.</p>\n<p>When you hit a damageable rig the damage does not reset but keeps increasing</p>\n<p>More maybe helpful info is when you click it displays the distance from where you clicked. If you click once it displays it once, then clicking again makes it twice, clicking again however makes it 4 times, than 7, than 11 than, than 22. and this keeps going.</p>\n<p>Again i have no idea what i am doing and any info would be greatly appreciated</p>\n"^^ . "Openresty + Torch. Is it even possible?"^^ . . . . "lag"^^ . . . "3"^^ . "<p>From my tests (<a href="https://github.com/quarto-dev/quarto-cli/blob/e1026cf2cc1c91febbf4631b38f91ef7848f4f33/src/project/types/website/listing/website-listing-read.ts#L1110C5-L1112C70" rel="nofollow noreferrer">and from code</a>), it appears that the message of a listing post cannot be updated on runtime (when quarto is rendering the HTML).</p>\n<p>A want a lua filter that overrides this functionality and instead generates a custom description will be used by the listing page.</p>\n"^^ . "0"^^ . . . "<p>I'm using pandoc (with the pandoc-crossref filter) to convert markdown documents to LATEX. But I want tables to be outputted as regular (floating) table environments rather than as (non-floating) longtables. I've written a Lua filter to do this, which is successful, except that it fails to extract the information about the table's pandoc-crossref label. I need to extract this information so that I can include this label as part of the LATEX output (and thereby crossreference the table). Here's a minimal example.</p>\n<p>Firstly, here's a minimal markdown document (input.md) containing just a table with the label tbl:table1 (which can be read by pandoc-crossref):</p>\n<pre><code>| First Header | Second Header |\n|:-------------|:--------------|\n| Content Cell | Content Cell |\n| Content Cell | Content Cell |\n\n: Table example {#tbl:table1}\n</code></pre>\n<p>Secondly, here's my minimal Lua-filter (table.lua) that attempts to extract this label (tbl:table1) from this markdown document:</p>\n<pre><code>function Table(elem)\n local id = elem.attr.identifier or ''\n \n if id ~= '' then\n print(&quot;Table label: &quot; .. id)\n else\n print(&quot;Table does not have a label&quot;)\n end\nend\n\nreturn {\n { Table = Table }\n}\n</code></pre>\n<p>Thirdly, when I run pandoc from the command prompt, I expect this Lua filter to print &quot;Table label: tbl:table1&quot; in the command prompt window, but instead it prints &quot;Table does not have a label&quot;. Here's my command line in the command prompt:</p>\n<pre><code>pandoc input.md --output=output.tex --from markdown+pipe_tables --to latex --filter pandoc-crossref --lua-filter=table.lua\n</code></pre>\n<p>Any help greatly appreciated!</p>\n<p>By the way, here is my wider Lua filter that (almost successfully) outputs a table rather than a longtable:</p>\n<pre><code>function Table(tbl)\n local simpleTable = pandoc.utils.to_simple_table(tbl)\n local blocks = pandoc.Blocks{}\n\n -- Function to create a LaTeX row\n local function create_latex_row(cells)\n local latex_row = &quot;&quot;\n for i, cell in ipairs(cells) do\n for _, content in ipairs(cell) do\n latex_row = latex_row .. pandoc.write(pandoc.Pandoc({content}), &quot;latex&quot;)\n end\n if i &lt; #cells then\n latex_row = latex_row .. &quot; &amp; &quot;\n end\n end\n return latex_row .. &quot; \\\\\\\\&quot;\n end\n\n -- Determine the number of columns (using header or first row)\n local num_cols = 0\n if simpleTable.header and #simpleTable.header &gt; 0 then\n num_cols = #simpleTable.header\n elseif #simpleTable.rows &gt; 0 then\n num_cols = #simpleTable.rows[1]\n end\n\n -- Assume all columns are left-aligned for simplicity\n local col_alignment = string.rep(&quot;l&quot;, num_cols)\n\n -- Begin table environment\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\begin{table}[tbp]&quot;))\n\n -- Add caption \n if tbl.caption then\n local caption_text = pandoc.utils.stringify(tbl.caption)\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\caption{&quot; .. caption_text .. &quot;}&quot;))\n end\n\n -- Add label using tbl.attr.identifier\n -- This is the part that doesn't work\n if tbl.attr and tbl.attr.identifier and tbl.attr.identifier ~= &quot;&quot; then\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\label{&quot; .. tbl.attr.identifier .. &quot;}&quot;))\n end\n\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\centering&quot;))\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\begin{tabular}{&quot; .. col_alignment .. &quot;}&quot;))\n \n -- Process header\n if simpleTable.header and #simpleTable.header &gt; 0 then\n local header_row = create_latex_row(simpleTable.header)\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, header_row))\n end\n\n -- Process rows\n for _, row in ipairs(simpleTable.rows) do\n local latex_row = create_latex_row(row)\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, latex_row))\n end\n\n -- End tabular and table environment\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\end{tabular}&quot;))\n blocks:insert(pandoc.RawBlock(&quot;latex&quot;, &quot;\\\\end{table}&quot;))\n\n return blocks\nend\n</code></pre>\n"^^ . . . . "Not sure if it works, but you could try to use a `Figure` element (requires pandoc 3.0 or newer): `return pandoc.Figure({pandoc.Image({}, "image.png"), "Figure caption")` and then use a reference doc to get the figure centered."^^ . . "I tried to use this code, but it gave me the error "Unable to cast to array" at the part that says `local Page = AvatarEditor:GetInventory(Enum.AvatarAssetType.Gear);`"^^ . "1"^^ . . . "<p>I have the following Lua script and it works fine until I add two decimal points. It errors with &quot;malformed number near '10.7.5'&quot;</p>\n<pre><code>if event.user_tag2 == &quot;Team1&quot; then\n event.sid = 10.1\nelseif event.user_tag2 == &quot;Team2&quot; then\n event.sid = 10.4\nelseif event.user_tag2 == &quot;Team3&quot; then\n event.sid = 10.6\nelseif event.user_tag2 == &quot;Team4&quot; then\n event.sid = 10.7\nelseif event.user_tag2 == &quot;Team5&quot; then\n event.sid = 10.7.5\nelseif event.user_tag2 == &quot;Team6&quot; then\n event.sid = 10.3\nelseif event.user_tag2 == &quot;Team7&quot; then\n event.sid = 10.2\nelseif event.user_tag2 == &quot;Team8&quot; then\n event.sid = 10.5\nelseif event.user_tag2 == &quot;Team9&quot; then\n event.sid = 10.9\nelseif event.user_tag2 == &quot;Team10&quot; then\n event.sid = 11.2\nelseif event.user_tag2 == &quot;Team11&quot; then\n event.sid = 10.8\nelse\n event.sid = 10.4\nend\n\nreturn event\n</code></pre>\n<p>Does anyone have any ideas why this is happening?</p>\n<p>Thanks in advance!</p>\n"^^ . . . . "Why does the decryptRSA function return seemingly random output?"^^ . "0"^^ . "<p>I'd like to know how I can &quot;link&quot; a C struct to an object in Java with the FFM library.\nI have a game in Java, and I'd ultimately like to allow users to create Luau scripts to interface with my game through an API. What I'm looking for is a way to send a &quot;Player&quot; object into C (to inevitably reach Lua), such that any changes made to the player through Java are immediately reflected in C (Lua as well), and any changes made in C/Lua are immediately reflected in Java where the core game logic is running.</p>\n<p>I'd like for the player to remain accessible as long as it hasn't been explicitly freed</p>\n<p>I can't really find any info on this topic, one potential solution I've thought of is to map a function for each operation I want to allow in C which calls a Java function and sets the player fields in java then maps it back to C again</p>\n"^^ . "0"^^ . "it means it couldn't find the player and then you indexed it with "Settings" so you have to check if the player exists before continuing"^^ . . . "1"^^ . . . . . "<p>I'm making a roblox game, and am using a localscript to handle some of the ui stuff. I need to use an http request to grab the contents of the local players' inventory (not in-game inventory, but the one with the stuff they can buy from the catalog/marketplace) but you can't use http requests in localscripts, so I'm looking for a workaround. I've also tried putting the code that handles getting the inventory into a separate modulescript. That didn't work, as roblox holds any modulescripts to the restrictions of whatever script they're being run in (at least to my knowledge).\nhere's some code to illustrate where I am atm:\n(here's the modulescript contents:</p>\n<pre><code>local gearManagement = {}\n\nfunction gearManagement.GetGears(player)\n local HttpService = game:GetService(&quot;HttpService&quot;)\n local Table = &quot;https://inventory.roproxy.com/v2/users/&quot;..player.UserId..&quot;/inventory?assetTypes=Gear&amp;limit=100&amp;sortOrder=Asc&quot;\n local GearResponse = HttpService:RequestAsync({\n Url = Table,\n Method = &quot;GET&quot;\n });\n if GearResponse.Success then\n local TableBody = HttpService:JSONDecode(GearResponse.Body)\n for i, v in pairs(TableBody) do\n return v\n end\n end \nend\n\nfunction gearManagement.CheckForViewableInventory(player)\n local HttpService = game:GetService(&quot;HttpService&quot;)\n local CanSeeInventory = &quot;https://inventory.roproxy.com/v1/users/&quot;..player.UserId..&quot;/can-view-inventory&quot;\n local Response = HttpService:RequestAsync({\n Url = CanSeeInventory,\n Method = &quot;GET&quot;\n });\nend\n\nreturn gearManagement\n</code></pre>\n<p>(and here's the localscript)</p>\n<pre><code>local HttpService = game:GetService(&quot;HttpService&quot;)\nlocal players = game:GetService(&quot;Players&quot;)\nlocal player = players.LocalPlayer\nlocal serverStorage = game:GetService(&quot;ServerStorage&quot;)\n-- WHY THE HELL DOES THIS NOT WORK???????????? ITS RIGHT THERE GAME, THE UI FOLDER IS RIGHT THERE, WHY ARENT YOU SEEING IT\n-- ^i have found out how, local scripts can't interact w/ server stuff\nlocal gearCardBase = script.Parent.Parent.Parent.gearCard\nlocal gearManagement = require(script.Parent.gearManagement)\n\nlocal Response = gearManagement.CheckForViewableInventory(player)\n\nif Response.Success then -- If it doesnst work, then idk \n local Body = HttpService:JSONDecode(Response.Body) -- Decoding the table\n if Body.canView == true then\n -- Continue Code\n local Gears = gearManagement.GetGears(player)\n local gearRowNum = 0\n if Gears ~= nil then -- Avoid errors\n for i, v in pairs(Gears) do\n -- print(v.name, v.assetId)\n local newGearCard = gearCardBase:Clone()\n newGearCard.Parent = script.Parent\n newGearCard.Visible = true\n newGearCard.Interactable = true\n \n local gearRowOffset = gearRowNum * 4 + 1\n local trueI = i-gearRowOffset\n \n local xPositioningNum = 121 + 21 -- 2nd num is the space between the two cards\n local finalXPositioningNum = xPositioningNum * trueI\n newGearCard.Position.X = newGearCard.Position.X + finalXPositioningNum\n \n local yPositioningNum = 166 + 21 -- 2nd num is the space between the two cards\n local finalYPositioningNum = yPositioningNum * gearRowNum\n newGearCard.Position.Y = newGearCard.Position.Y + finalYPositioningNum\n \n newGearCard.gearImage.Image = &quot;rbxthumb://type=Asset&amp;w=150&amp;h=150&amp;id=&quot;..v.assetId\n end\n end\n else\n -- might put a warning here\n end\nend\n</code></pre>\n<p>(sorry for my flowery language in the code comments, i was a bit frustrated lol)</p>\n"^^ . . . . "<p>I've read you can start an &quot;array&quot; at any index in Lua, but &quot;ipairs&quot; seems to only work if it starts at 1 [EDIT: was 0].</p>\n<pre><code>&gt; function printIpairs(a)\n&gt;&gt; for i, v in ipairs(a) do\n&gt;&gt; print(i .. '=' .. v)\n&gt;&gt; end\n&gt;&gt; end\n&gt; printIpairs({4,5,6})\n1=4\n2=5\n3=6\n&gt; s = {}\n&gt; s[0] = 4\n&gt; s[1] = 5\n&gt; s[2] = 6\n&gt; printIpairs(s)\n1=5\n2=6\n&gt; t = {}\n&gt; t[4] = 4\n&gt; t[5] = 5\n&gt; t[6] = 6\n&gt; printIpairs(t)\n&gt;\n</code></pre>\n<p>So my question is, do s and t use &quot;3 words&quot; to store the 3 values\ninternally as a sequence, or more(4/6), bc part/whole is stored as a &quot;mapping&quot; instead?\nAnd if they <em>do</em> use only 3 words, how do you find the &quot;starting index&quot; of the &quot;sequence part&quot;, if ipairs won't give it to me?</p>\n"^^ . . . "0"^^ . . "That is doing something, but I forgot an important part of the table string. My Bad! it goes:\n\n```\nItem1 = InstanceInput {Rest of the info}\n```"^^ . . . . "0"^^ . . . "1"^^ . . "@Mike'Pomax'Kamermans the only answer to this question is not a "proper" Carmichael function because it does not make sure that *all* coprimes meet the condition a^m%n=1, only one, resulting in the output of the function always being 0"^^ . . "What's happening is that the clear rule ```if the string is a substring``` is not respected by IMAP servers, or at least by Zimbra, our mail server. ```[foo]``` is **not** a substring of ```foo bar```. ```foo```, however, is. But the IMAP server treats ```[foo]``` like a substring of ```foo bar``` which is plain wrong according to the RFC."^^ . . . . . . "0"^^ . . . "0"^^ . "<p>The docs specify that metadata is process <em>after</em> blocks have been filtered, so <code>target_lang</code> is set only after the <em>CodeBlock</em> elements have been processed.</p>\n<p>There are two ways to deal with this. One method is to filter the main <em>Pandoc</em> element, which gives more control:</p>\n<pre class="lang-lua prettyprint-override"><code>function Pandoc (doc)\n local target_lang = doc.meta.target_lang\n return doc:walk {\n CodeBlock = function (cb)\n if cb.classes[1] ~= target_lang then\n return {} -- delete block\n end\n end\n }\nend\n</code></pre>\n<p>The alternative is to control the execution order of the filters by explicitly returning a sequence of filters, like so:</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n { Meta = Meta},\n { CodeBlock = CodeBlock },\n}\n</code></pre>\n"^^ . . . "Why does this string.find fail?"^^ . "FYI, digressing… someone once asked Mark Crispin about this. Mark answered that he intended to allow flexible matching in RFCs 2060/3501, I've forgotten which RFC was current at the time. If he'd wanted seach text "foo bar" to disallow matching foo\\nbar, his personal writing style would have been to definie "contains" strictly in 2060/3501 6.4.4. But he left the verb undefined."^^ . . "1"^^ . . "0"^^ . . . "<p>Solution: <code>return pandoc.Inlines { pandoc.Image({},&quot;C:/Logs/output.png&quot;) }</code></p>\n<pre><code>function Math(el)\n if (el.mathtype == &quot;DisplayMath&quot;) then\n counter = counter + 1\n io.output(&quot;C:/Logs/output.tex&quot;)\n io.write(&quot;\\\\documentclass[preview]{standalone}&quot;, &quot;\\n&quot;)\n local i = 2\n for k, v in pairs(lines) do\n while not string.find(lines[i], &quot;\\\\begin{document}&quot;) do\n io.write(lines[i], &quot;\\n&quot;) -- write preamble\n i = i + 1\n end\n end\n io.write(&quot;\\\\begin{document}&quot;, &quot;\\n&quot;)\n io.write(&quot;\\\\begin{equation}&quot;, &quot;\\n&quot;)\n io.write(el.text, &quot;\\n&quot;)\n io.write(&quot;\\\\label{&quot;..section..&quot;.&quot;..equation..&quot;}&quot;, &quot;\\n&quot;)\n io.write(&quot;\\\\end{equation}&quot;, &quot;\\n&quot;)\n io.write(&quot;\\\\end{document}&quot;, &quot;\\n&quot;)\n io.close()\n os.execute(&quot;cd C:/Logs &amp; pdflatex output.tex &amp; convert -density 576 output.pdf -alpha off output.png&quot;)\n return pandoc.Inlines { pandoc.Image({},&quot;C:/Logs/output.png&quot;) }\n --)\n end\nend\n</code></pre>\n"^^ . . . "0"^^ . . "<p>I am trying to make a speed calculator that takes speed input and distance needed to cover input and it should return the time needed to cover this distance based on the formula 'speed = distance / time', I also make the user input km if the distance is in kilometers or m if the distance is in meters and I use an If statement to turn the kilometers into meters.</p>\n<pre><code>io.write(&quot;enter speed(m/s):&quot;)\nlocal speed = io.read()\nio.write(&quot;enter distance needed:&quot;)\nlocal distance = io.read()\nio.write(&quot;specify((m) or(km)):&quot;)\nlocal units = io.read()\n\nlocal meters = &quot;m&quot;\nlocal kilometers = &quot;km&quot;\nlocal hundred\n\nif units == meters then \n local usedist = distance\nelseif units == kilometers then \n local usedist = distance * hundred\nelse\n io.write(&quot;you did not enter a valid character, please restart the program by pressing 'enter'&quot;)\n io.read()\nend\nprint(usedist)\nlocal timeneeded = usedist / speed\nlocal timeneededh = timeneeded / 3600\n\nos.execute(&quot;cls&quot;)\n\nio.write(&quot;it will need &quot;..timeneeded..&quot; seconds or &quot;..timeneededh..&quot; hours&quot;)\n\n\nio.write(&quot;\\n&quot;)\nio.write(&quot;press the 'enter' key to continue&quot;)\nio.read()\n</code></pre>\n<p>I was expecting a value of time in seconds but I got this</p>\n<pre><code>enter speed(m/s):5\nenter distance needed:9\nspecify((m) or(km)):km\nC:\\Lua\\lua54.exe: object-time-calc.lua:15: attempt to mul a 'string' with a 'nil'\nstack traceback:\n [C]: in metamethod 'mul'\n object-time-calc.lua:15: in main chunk\n [C]: in ?\n</code></pre>\n"^^ . . . "<p>I'm trying to create a custom meta for a reskinned carbine rifle and to do that, I'm trying to create the necessary custom meta files for the gun and as of right now the gun is able to be spawned and it renders fine, but the only thing it doesn't render is the barrel and the suppressor. Below I have attached the metas.</p>\n<p>weapons.meta</p>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF - 8&quot;?&gt;\n\n&lt;CWeaponInfoBlob&gt;\n &lt;SlotNavigateOrder&gt;\n &lt;Item&gt;\n &lt;WeaponSlots&gt;\n &lt;Item&gt;\n &lt;OrderNumber value=&quot;420&quot;/&gt;\n &lt;Entry&gt;SLOT_WEAPON_TREESHARIFLE&lt;/Entry&gt;\n &lt;/Item&gt;\n &lt;/WeaponSlots&gt;\n &lt;/Item&gt;\n &lt;/SlotNavigateOrder&gt;\n &lt;Infos&gt;\n &lt;Item&gt;\n &lt;Infos&gt;\n &lt;Item type=&quot;CWeaponInfo&quot;&gt;\n &lt;Name&gt;WEAPON_TREESHARIFLE&lt;/Name&gt;\n &lt;Model&gt;w_ar_treesharifle&lt;/Model&gt;\n &lt;Audio&gt;AUDIO_ITEM_CARBINERIFLE&lt;/Audio&gt;\n &lt;Slot&gt;SLOT_WEAPON_TREESHARIFLE&lt;/Slot&gt;\n &lt;DamageType&gt;BULLET&lt;/DamageType&gt;\n &lt;Explosion&gt;\n &lt;Default&gt;DONTCARE&lt;/Default&gt;\n &lt;HitCar&gt;DONTCARE&lt;/HitCar&gt;\n &lt;HitTruck&gt;DONTCARE&lt;/HitTruck&gt;\n &lt;HitBike&gt;DONTCARE&lt;/HitBike&gt;\n &lt;HitBoat&gt;DONTCARE&lt;/HitBoat&gt;\n &lt;HitPlane&gt;DONTCARE&lt;/HitPlane&gt;\n &lt;/Explosion&gt;\n &lt;FireType&gt;INSTANT_HIT&lt;/FireType&gt;\n &lt;WheelSlot&gt;WHEEL_RIFLE&lt;/WheelSlot&gt;\n &lt;Group&gt;GROUP_RIFLE&lt;/Group&gt;\n &lt;AmmoInfo ref=&quot;AMMO_RIFLE&quot;/&gt;\n &lt;AimingInfo ref=&quot;RIFLE_LO_BASE_STRAFE&quot;/&gt;\n &lt;ClipSize value=&quot;60&quot;/&gt;\n &lt;AccuracySpread value=&quot;3.000000&quot;/&gt;\n &lt;AccurateModeAccuracyModifier value=&quot;0.500000&quot;/&gt;\n &lt;RunAndGunAccuracyModifier value=&quot;2.000000&quot;/&gt;\n &lt;RunAndGunAccuracyMaxModifier value=&quot;1.000000&quot;/&gt;\n &lt;RecoilAccuracyMax value=&quot;0.500000&quot;/&gt;\n &lt;RecoilErrorTime value=&quot;3.000000&quot;/&gt;\n &lt;RecoilRecoveryRate value=&quot;1.000000&quot;/&gt;\n &lt;RecoilAccuracyToAllowHeadShotAI value=&quot;1000.000000&quot;/&gt;\n &lt;MinHeadShotDistanceAI value=&quot;1000.000000&quot;/&gt;\n &lt;MaxHeadShotDistanceAI value=&quot;1000.000000&quot;/&gt;\n &lt;HeadShotDamageModifierAI value=&quot;1000.000000&quot;/&gt;\n &lt;RecoilAccuracyToAllowHeadShotPlayer value=&quot;0.175000&quot;/&gt;\n &lt;MinHeadShotDistancePlayer value=&quot;5.000000&quot;/&gt;\n &lt;MaxHeadShotDistancePlayer value=&quot;40.000000&quot;/&gt;\n &lt;HeadShotDamageModifierPlayer value=&quot;18.000000&quot;/&gt;\n &lt;Damage value=&quot;32.000000&quot;/&gt;\n &lt;DamageTime value=&quot;0.000000&quot;/&gt;\n &lt;DamageTimeInVehicle value=&quot;0.000000&quot;/&gt;\n &lt;DamageTimeInVehicleHeadShot value=&quot;0.000000&quot;/&gt;\n &lt;HitLimbsDamageModifier value=&quot;0.500000&quot;/&gt;\n &lt;NetworkHitLimbsDamageModifier value=&quot;0.800000&quot;/&gt;\n &lt;LightlyArmouredDamageModifier value=&quot;0.750000&quot;/&gt;\n &lt;Force value=&quot;75.000000&quot;/&gt;\n &lt;ForceHitPed value=&quot;140.000000&quot;/&gt;\n &lt;ForceHitVehicle value=&quot;1200.000000&quot;/&gt;\n &lt;ForceHitFlyingHeli value=&quot;1250.000000&quot;/&gt;\n &lt;OverrideForces&gt;\n &lt;Item&gt;\n &lt;BoneTag&gt;BONETAG_HEAD&lt;/BoneTag&gt;\n &lt;ForceFront value=&quot;80.000000&quot;/&gt;\n &lt;ForceBack value=&quot;50.000000&quot;/&gt;\n &lt;/Item&gt;\n &lt;Item&gt;\n &lt;BoneTag&gt;BONETAG_NECK&lt;/BoneTag&gt;\n &lt;ForceFront value=&quot;60.000000&quot;/&gt;\n &lt;ForceBack value=&quot;90.000000&quot;/&gt;\n &lt;/Item&gt;\n &lt;Item&gt;\n &lt;BoneTag&gt;BONETAG_L_THIGH&lt;/BoneTag&gt;\n &lt;ForceFront value=&quot;40.000000&quot;/&gt;\n &lt;ForceBack value=&quot;1.000000&quot;/&gt;\n &lt;/Item&gt;\n &lt;Item&gt;\n &lt;BoneTag&gt;BONETAG_R_THIGH&lt;/BoneTag&gt;\n &lt;ForceFront value=&quot;40.000000&quot;/&gt;\n &lt;ForceBack value=&quot;1.000000&quot;/&gt;\n &lt;/Item&gt;\n &lt;Item&gt;\n &lt;BoneTag&gt;BONETAG_L_CALF&lt;/BoneTag&gt;\n &lt;ForceFront value=&quot;70.000000&quot;/&gt;\n &lt;ForceBack value=&quot;80.000000&quot;/&gt;\n &lt;/Item&gt;\n &lt;Item&gt;\n &lt;BoneTag&gt;BONETAG_R_CALF&lt;/BoneTag&gt;\n &lt;ForceFront value=&quot;60.000000&quot;/&gt;\n &lt;ForceBack value=&quot;100.000000&quot;/&gt;\n &lt;/Item&gt;\n &lt;/OverrideForces&gt;\n &lt;ForceMaxStrengthMult value=&quot;1.000000&quot;/&gt;\n &lt;ForceFalloffRangeStart value=&quot;0.000000&quot;/&gt;\n &lt;ForceFalloffRangeEnd value=&quot;50.000000&quot;/&gt;\n &lt;ForceFalloffMin value=&quot;1.000000&quot;/&gt;\n &lt;ProjectileForce value=&quot;0.000000&quot;/&gt;\n &lt;FragImpulse value=&quot;600.000000&quot;/&gt;\n &lt;Penetration value=&quot;0.100000&quot;/&gt;\n &lt;VerticalLaunchAdjustment value=&quot;0.000000&quot;/&gt;\n &lt;DropForwardVelocity value=&quot;0.000000&quot;/&gt;\n &lt;Speed value=&quot;2000.000000&quot;/&gt;\n &lt;BulletsInBatch value=&quot;1&quot;/&gt;\n &lt;BatchSpread value=&quot;0.000000&quot;/&gt;\n &lt;ReloadTimeMP value=&quot;-1.000000&quot;/&gt;\n &lt;ReloadTimeSP value=&quot;-1.000000&quot;/&gt;\n &lt;VehicleReloadTime value=&quot;1.000000&quot;/&gt;\n &lt;AnimReloadRate value=&quot;1.000000&quot;/&gt;\n &lt;BulletsPerAnimLoop value=&quot;1&quot;/&gt;\n &lt;TimeBetweenShots value=&quot;0.135000&quot;/&gt;\n &lt;TimeLeftBetweenShotsWhereShouldFireIsCached value=&quot;-1.000000&quot;/&gt;\n &lt;SpinUpTime value=&quot;0.000000&quot;/&gt;\n &lt;SpinTime value=&quot;0.000000&quot;/&gt;\n &lt;SpinDownTime value=&quot;0.000000&quot;/&gt;\n &lt;AlternateWaitTime value=&quot;-1.000000&quot;/&gt;\n &lt;BulletBendingNearRadius value=&quot;0.000000&quot;/&gt;\n &lt;BulletBendingFarRadius value=&quot;0.750000&quot;/&gt;\n &lt;BulletBendingZoomedRadius value=&quot;0.375000&quot;/&gt;\n &lt;FirstPersonBulletBendingNearRadius value=&quot;0.000000&quot;/&gt;\n &lt;FirstPersonBulletBendingFarRadius value=&quot;0.750000&quot;/&gt;\n &lt;FirstPersonBulletBendingZoomedRadius value=&quot;0.375000&quot;/&gt;\n &lt;Fx&gt;\n &lt;EffectGroup&gt;WEAPON_EFFECT_GROUP_RIFLE_ASSAULT&lt;/EffectGroup&gt;\n &lt;FlashFx&gt;muz_assault_rifle&lt;/FlashFx&gt;\n &lt;FlashFxAlt&gt;muz_alternate_star&lt;/FlashFxAlt&gt;\n &lt;FlashFxFP&gt;muz_assault_rifle_fp&lt;/FlashFxFP&gt;\n &lt;FlashFxAltFP/&gt;\n &lt;MuzzleSmokeFx&gt;muz_smoking_barrel&lt;/MuzzleSmokeFx&gt;\n &lt;MuzzleSmokeFxFP&gt;muz_smoking_barrel_fp&lt;/MuzzleSmokeFxFP&gt;\n &lt;MuzzleSmokeFxMinLevel value=&quot;0.300000&quot;/&gt;\n &lt;MuzzleSmokeFxIncPerShot value=&quot;0.100000&quot;/&gt;\n &lt;MuzzleSmokeFxDecPerSec value=&quot;0.250000&quot;/&gt;\n &lt;ShellFx&gt;eject_auto&lt;/ShellFx&gt;\n &lt;ShellFxFP&gt;eject_auto_fp&lt;/ShellFxFP&gt;\n &lt;TracerFx&gt;bullet_tracer&lt;/TracerFx&gt;\n &lt;PedDamageHash&gt;BulletLarge&lt;/PedDamageHash&gt;\n &lt;TracerFxChanceSP value=&quot;0.150000&quot;/&gt;\n &lt;TracerFxChanceMP value=&quot;0.750000&quot;/&gt;\n &lt;FlashFxChanceSP value=&quot;1.000000&quot;/&gt;\n &lt;FlashFxChanceMP value=&quot;1.000000&quot;/&gt;\n &lt;FlashFxAltChance value=&quot;0.200000&quot;/&gt;\n &lt;FlashFxScale value=&quot;1.000000&quot;/&gt;\n &lt;FlashFxLightEnabled value=&quot;true&quot;/&gt;\n &lt;FlashFxLightCastsShadows value=&quot;false&quot;/&gt;\n &lt;FlashFxLightOffsetDist value=&quot;0.000000&quot;/&gt;\n &lt;FlashFxLightRGBAMin x=&quot;255.000000&quot; y=&quot;93.000000&quot; z=&quot;25.000000&quot;/&gt;\n &lt;FlashFxLightRGBAMax x=&quot;255.000000&quot; y=&quot;100.000000&quot; z=&quot;50.000000&quot;/&gt;\n &lt;FlashFxLightIntensityMinMax x=&quot;1.000000&quot; y=&quot;2.000000&quot;/&gt;\n &lt;FlashFxLightRangeMinMax x=&quot;2.500000&quot; y=&quot;3.500000&quot;/&gt;\n &lt;FlashFxLightFalloffMinMax x=&quot;1024.000000&quot; y=&quot;1536.000000&quot;/&gt;\n &lt;GroundDisturbFxEnabled value=&quot;false&quot;/&gt;\n &lt;GroundDisturbFxDist value=&quot;5.000000&quot;/&gt;\n &lt;GroundDisturbFxNameDefault/&gt;\n &lt;GroundDisturbFxNameSand/&gt;\n &lt;GroundDisturbFxNameDirt/&gt;\n &lt;GroundDisturbFxNameWater/&gt;\n &lt;GroundDisturbFxNameFoliage/&gt;\n &lt;/Fx&gt;\n &lt;InitialRumbleDuration value=&quot;90&quot;/&gt;\n &lt;InitialRumbleIntensity value=&quot;0.700000&quot;/&gt;\n &lt;InitialRumbleIntensityTrigger value=&quot;0.950000&quot;/&gt;\n &lt;RumbleDuration value=&quot;90&quot;/&gt;\n &lt;RumbleIntensity value=&quot;0.100000&quot;/&gt;\n &lt;RumbleIntensityTrigger value=&quot;0.800000&quot;/&gt;\n &lt;RumbleDamageIntensity value=&quot;1.000000&quot;/&gt;\n &lt;InitialRumbleDurationFps value=&quot;150&quot;/&gt;\n &lt;InitialRumbleIntensityFps value=&quot;1.000000&quot;/&gt;\n &lt;RumbleDurationFps value=&quot;95&quot;/&gt;\n &lt;RumbleIntensityFps value=&quot;1.000000&quot;/&gt;\n &lt;NetworkPlayerDamageModifier value=&quot;1.000000&quot;/&gt;\n &lt;NetworkPedDamageModifier value=&quot;1.000000&quot;/&gt;\n &lt;NetworkHeadShotPlayerDamageModifier value=&quot;1.700000&quot;/&gt;\n &lt;LockOnRange value=&quot;65.000000&quot;/&gt;\n &lt;WeaponRange value=&quot;420.000000&quot;/&gt;\n &lt;BulletDirectionOffsetInDegrees value=&quot;0.000000&quot;/&gt;\n &lt;AiSoundRange value=&quot;-1.000000&quot;/&gt;\n &lt;AiPotentialBlastEventRange value=&quot;-1.000000&quot;/&gt;\n &lt;DamageFallOffRangeMin value=&quot;47.500000&quot;/&gt;\n &lt;DamageFallOffRangeMax value=&quot;120.000000&quot;/&gt;\n &lt;DamageFallOffModifier value=&quot;0.300000&quot;/&gt;\n &lt;VehicleWeaponHash/&gt;\n &lt;DefaultCameraHash&gt;DEFAULT_THIRD_PERSON_PED_AIM_CAMERA&lt;/DefaultCameraHash&gt;\n &lt;CoverCameraHash&gt;DEFAULT_THIRD_PERSON_PED_AIM_IN_COVER_CAMERA&lt;/CoverCameraHash&gt;\n &lt;CoverReadyToFireCameraHash/&gt;\n &lt;RunAndGunCameraHash&gt;DEFAULT_THIRD_PERSON_PED_RUN_AND_GUN_CAMERA&lt;/RunAndGunCameraHash&gt;\n &lt;CinematicShootingCameraHash&gt;DEFAULT_THIRD_PERSON_PED_CINEMATIC_SHOOTING_CAMERA&lt;/CinematicShootingCameraHash&gt;\n &lt;AlternativeOrScopedCameraHash/&gt;\n &lt;RunAndGunAlternativeOrScopedCameraHash/&gt;\n &lt;CinematicShootingAlternativeOrScopedCameraHash/&gt;\n &lt;CameraFov value=&quot;35.000000&quot;/&gt;\n &lt;FirstPersonScopeFov value=&quot;20.00000&quot;/&gt;\n &lt;FirstPersonScopeAttachmentFov value=&quot;20.00000&quot;/&gt;\n &lt;FirstPersonRNGOffset x=&quot;0.000000&quot; y=&quot;0.000000&quot; z=&quot;0.000000&quot;/&gt;\n &lt;FirstPersonRNGRotationOffset x=&quot;0.000000&quot; y=&quot;0.000000&quot; z=&quot;0.000000&quot;/&gt;\n &lt;FirstPersonLTOffset x=&quot;0.000000&quot; y=&quot;0.000000&quot; z=&quot;0.000000&quot;/&gt;\n &lt;FirstPersonLTRotationOffset x=&quot;0.000000&quot; y=&quot;0.000000&quot; z=&quot;0.000000&quot;/&gt;\n &lt;FirstPersonScopeOffset x=&quot;0.00000&quot; y=&quot;-0.0200&quot; z=&quot;-0.0230&quot;/&gt;\n &lt;FirstPersonScopeAttachmentOffset x=&quot;0.00000&quot; y=&quot;0.0000&quot; z=&quot;-0.0280&quot;/&gt;\n &lt;FirstPersonScopeRotationOffset x=&quot;-0.70000&quot; y=&quot;0.0000&quot; z=&quot;0.0000&quot;/&gt;\n &lt;FirstPersonScopeAttachmentRotationOffset x=&quot;0.00000&quot; y=&quot;0.0000&quot; z=&quot;0.0000&quot;/&gt;\n &lt;FirstPersonAsThirdPersonIdleOffset x=&quot;-0.07500000&quot; y=&quot;0.000000&quot; z=&quot;-0.05&quot;/&gt;\n &lt;FirstPersonAsThirdPersonRNGOffset x=&quot;-0.025000&quot; y=&quot;0.000000&quot; z=&quot;-0.075000&quot;/&gt;\n &lt;FirstPersonAsThirdPersonLTOffset x=&quot;0.025000&quot; y=&quot;0.000000&quot; z=&quot;-0.0750000&quot;/&gt;\n &lt;FirstPersonAsThirdPersonScopeOffset x=&quot;0.075000&quot; y=&quot;-0.050000&quot; z=&quot;-0.060000&quot;/&gt;\n &lt;FirstPersonAsThirdPersonWeaponBlockedOffset x=&quot;-0.1000000&quot; y=&quot;0.000000&quot; z=&quot;-0.100000&quot;/&gt;\n &lt;FirstPersonDofSubjectMagnificationPowerFactorNear value=&quot;1.025000&quot;/&gt;\n &lt;FirstPersonDofMaxNearInFocusDistance value=&quot;0.000000&quot;/&gt;\n &lt;FirstPersonDofMaxNearInFocusDistanceBlendLevel value=&quot;0.300000&quot;/&gt;\n &lt;ZoomFactorForAccurateMode value=&quot;1.300000&quot;/&gt;\n &lt;RecoilShakeHash&gt;ASSAULT_RIFLE_RECOIL_SHAKE&lt;/RecoilShakeHash&gt;\n &lt;RecoilShakeHashFirstPerson&gt;FPS_ASSAULT_RIFLE_RECOIL_SHAKE&lt;/RecoilShakeHashFirstPerson&gt;\n &lt;AccuracyOffsetShakeHash&gt;DEFAULT_THIRD_PERSON_ACCURACY_OFFSET_SHAKE&lt;/AccuracyOffsetShakeHash&gt;\n &lt;MinTimeBetweenRecoilShakes value=&quot;100&quot;/&gt;\n &lt;RecoilShakeAmplitude value=&quot;0.333000&quot;/&gt;\n &lt;ExplosionShakeAmplitude value=&quot;-1.000000&quot;/&gt;\n &lt;ReticuleHudPosition x=&quot;0.000000&quot; y=&quot;0.000000&quot;/&gt;\n &lt;AimOffsetMin x=&quot;0.250000&quot; y=&quot;0.200000&quot; z=&quot;0.600000&quot;/&gt;\n &lt;AimProbeLengthMin value=&quot;0.430000&quot;/&gt;\n &lt;AimOffsetMax x=&quot;0.165000&quot; y=&quot;-0.180000&quot; z=&quot;0.470000&quot;/&gt;\n &lt;AimProbeLengthMax value=&quot;0.340000&quot;/&gt;\n &lt;AimOffsetMinFPSIdle x=&quot;0.162000&quot; y=&quot;0.225000&quot; z=&quot;0.052000&quot;/&gt;\n &lt;AimOffsetMedFPSIdle x=&quot;0.187000&quot; y=&quot;0.197000&quot; z=&quot;0.321000&quot;/&gt;\n &lt;AimOffsetMaxFPSIdle x=&quot;0.155000&quot; y=&quot;0.038000&quot; z=&quot;0.364000&quot;/&gt;\n &lt;AimOffsetEndPosMinFPSIdle x=&quot;-0.284000&quot; y=&quot;0.612000&quot; z=&quot;-0.205000&quot;/&gt;\n &lt;AimOffsetEndPosMedFPSIdle x=&quot;-0.178000&quot; y=&quot;0.639000&quot; z=&quot;0.616000&quot;/&gt;\n &lt;AimOffsetEndPosMaxFPSIdle x=&quot;-0.21700&quot; y=&quot;-0.096000&quot; z=&quot;0.887000&quot;/&gt;\n &lt;AimOffsetMinFPSLT x=&quot;0.180000&quot; y=&quot;0.231000&quot; z=&quot;0.669000&quot;/&gt;\n &lt;AimOffsetMaxFPSLT x=&quot;0.048000&quot; y=&quot;-0.225000&quot; z=&quot;0.409000&quot;/&gt;\n &lt;AimOffsetMinFPSRNG x=&quot;0.120000&quot; y=&quot;0.275000&quot; z=&quot;0.509000&quot;/&gt;\n &lt;AimOffsetMaxFPSRNG x=&quot;0.138000&quot; y=&quot;-0.212000&quot; z=&quot;0.518000&quot;/&gt;\n &lt;AimOffsetMinFPSScope x=&quot;0.090000&quot; y=&quot;0.078000&quot; z=&quot;0.531000&quot;/&gt;\n &lt;AimOffsetMaxFPSScope x=&quot;0.006000&quot; y=&quot;-0.059000&quot; z=&quot;0.694000&quot;/&gt;\n &lt;TorsoAimOffset x=&quot;-1.000000&quot; y=&quot;0.550000&quot;/&gt;\n &lt;TorsoCrouchedAimOffset x=&quot;0.100000&quot; y=&quot;0.120000&quot;/&gt;\n &lt;LeftHandIkOffset x=&quot;0.015000&quot; y=&quot;0.095000&quot; z=&quot;-0.008000&quot;/&gt;\n &lt;ReticuleMinSizeStanding value=&quot;0.600000&quot;/&gt;\n &lt;ReticuleMinSizeCrouched value=&quot;0.500000&quot;/&gt;\n &lt;ReticuleScale value=&quot;0.300000&quot;/&gt;\n &lt;ReticuleStyleHash&gt;WEAPONTYPE_RIFLE&lt;/ReticuleStyleHash&gt;\n &lt;FirstPersonReticuleStyleHash/&gt;\n &lt;PickupHash&gt;PICKUP_WEAPON_TREESHARIFLE&lt;/PickupHash&gt;\n &lt;MPPickupHash&gt;PICKUP_AMMO_BULLET_MP&lt;/MPPickupHash&gt;\n &lt;HumanNameHash&gt;WEAPON_TREESHARIFLE&lt;/HumanNameHash&gt;\n &lt;MovementModeConditionalIdle&gt;MMI_2Handed&lt;/MovementModeConditionalIdle&gt;\n &lt;StatName&gt;CRBNRIFLE&lt;/StatName&gt;\n &lt;KnockdownCount value=&quot;-1&quot;/&gt;\n &lt;KillshotImpulseScale value=&quot;1.000000&quot;/&gt;\n &lt;NmShotTuningSet&gt;Automatic&lt;/NmShotTuningSet&gt;\n &lt;AttachPoints&gt;\n &lt;Item&gt;\n &lt;AttachBone&gt;WAPSupp&lt;/AttachBone&gt;\n &lt;Components&gt;\n &lt;Item&gt;\n &lt;Default value=&quot;true&quot;/&gt;\n &lt;Name&gt;COMPONENT_TREESHARIFLE_SUPP&lt;/Name&gt;\n &lt;/Item&gt;\n &lt;/Components&gt;\n &lt;/Item&gt;\n &lt;Item&gt;\n &lt;AttachBone&gt;WAPClip&lt;/AttachBone&gt;\n &lt;Components&gt;\n &lt;Item&gt;\n &lt;Default value=&quot;true&quot;/&gt;\n &lt;Name&gt;COMPONENT_TREESHARIFLE_CLIP_01&lt;/Name&gt;\n &lt;/Item&gt;\n &lt;Item&gt;\n &lt;Default value=&quot;true&quot;/&gt;\n &lt;Name&gt;COMPONENT_TREESHARIFLE_CLIP_02&lt;/Name&gt;\n &lt;/Item&gt;\n &lt;/Components&gt;\n &lt;/Item&gt;\n &lt;Item&gt;\n &lt;AttachBone&gt;WAPBarrel&lt;/AttachBone&gt;\n &lt;Components&gt;\n &lt;Item&gt;\n &lt;Name&gt;COMPONENT_AT_TREESHARIFLE_BARREL_01&lt;/Name&gt;\n &lt;Default value=&quot;true&quot; /&gt;\n &lt;/Item&gt;\n &lt;Item&gt;\n &lt;Name&gt;COMPONENT_AT_TREESHARIFLE_BARREL_02&lt;/Name&gt;\n &lt;Default value=&quot;true&quot; /&gt;\n &lt;/Item&gt;\n &lt;/Components&gt;\n &lt;/Item&gt;\n &lt;/AttachPoints&gt;\n &lt;GunFeedBone/&gt;\n &lt;TargetSequenceGroup/&gt;\n &lt;WeaponFlags&gt;CarriedInHand Automatic Gun CanLockonOnFoot CanLockonInVehicle CanFreeAim TwoHanded AnimReload AnimCrouchFire UsableOnFoot UsableInCover AllowEarlyExitFromFireAnimAfterBulletFired NoLeftHandIKWhenBlocked AllowCloseQuarterKills HasLowCoverReloads HasLowCoverSwaps LongWeapon UseFPSAimIK UseFPSSecondaryMotion&lt;/WeaponFlags&gt;\n &lt;TintSpecValues ref=&quot;TINT_DEFAULT&quot;/&gt;\n &lt;FiringPatternAliases ref=&quot;FIRING_PATTERN_RIFLE&quot;/&gt;\n &lt;ReloadUpperBodyFixupExpressionData ref=&quot;default&quot;/&gt;\n &lt;AmmoDiminishingRate value=&quot;3&quot;/&gt;\n &lt;AimingBreathingAdditiveWeight value=&quot;1.000000&quot;/&gt;\n &lt;FiringBreathingAdditiveWeight value=&quot;1.000000&quot;/&gt;\n &lt;StealthAimingBreathingAdditiveWeight value=&quot;1.000000&quot;/&gt;\n &lt;StealthFiringBreathingAdditiveWeight value=&quot;1.000000&quot;/&gt;\n &lt;AimingLeanAdditiveWeight value=&quot;1.000000&quot;/&gt;\n &lt;FiringLeanAdditiveWeight value=&quot;1.000000&quot;/&gt;\n &lt;StealthAimingLeanAdditiveWeight value=&quot;1.000000&quot;/&gt;\n &lt;StealthFiringLeanAdditiveWeight value=&quot;1.000000&quot;/&gt;\n &lt;ExpandPedCapsuleRadius value=&quot;0.000000&quot;/&gt;\n &lt;AudioCollisionHash/&gt;\n &lt;HudDamage value=&quot;32&quot;/&gt;\n &lt;HudSpeed value=&quot;65&quot;/&gt;\n &lt;HudCapacity value=&quot;40&quot;/&gt;\n &lt;HudAccuracy value=&quot;55&quot;/&gt;\n &lt;HudRange value=&quot;45&quot;/&gt;\n &lt;/Item&gt;\n &lt;/Infos&gt;\n &lt;/Item&gt;\n &lt;/Infos&gt;\n &lt;Name&gt;AR&lt;/Name&gt;\n&lt;/CWeaponInfoBlob&gt;\n</code></pre>\n<p>COMPONENT_TREESHARIFLE_SUPP/weaponcomponents.meta</p>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF - 8&quot;?&gt;\n\n&lt;CWeaponComponentInfoBlob&gt;\n &lt;Infos&gt;\n &lt;Item type=&quot;CWeaponComponentSuppressorInfo&quot;&gt;\n &lt;Name&gt;COMPONENT_TREESHARIFLE_SUPP&lt;/Name&gt;\n &lt;Model&gt;treesharifle_supp&lt;/Model&gt;\n &lt;LocName&gt;&quot;SUPPRESSOR&quot;&lt;/LocName&gt;\n &lt;LocDesc&gt;&quot;SUPPRESSOR&quot;&lt;/LocDesc&gt;\n &lt;AttachBone&gt;AAPSupp&lt;/AttachBone&gt;\n &lt;WeaponAttachBone&gt;WAPSupp&lt;/WeaponAttachBone&gt;\n &lt;AccuracyModifier type=&quot;NULL&quot;/&gt;\n &lt;bShownOnWheel value=&quot;true&quot;/&gt;\n &lt;CreateObject value=&quot;true&quot;/&gt;\n &lt;HudDamage value=&quot;-5&quot;/&gt;\n &lt;HudSpeed value=&quot;0&quot;/&gt;\n &lt;HudCapacity value=&quot;0&quot;/&gt;\n &lt;HudAccuracy value=&quot;0&quot;/&gt;\n &lt;HudRange value=&quot;-5&quot;/&gt;\n &lt;MuzzleBone&gt;Gun_SuMuzzle&lt;/MuzzleBone&gt;\n &lt;FlashFx&gt;muz_assault_rifle&lt;/FlashFx&gt;\n &lt;ShouldSilence value=&quot;true&quot; /&gt;\n &lt;/Item&gt;\n &lt;/Infos&gt;\n &lt;InfoBlobName/&gt;\n&lt;/CWeaponComponentInfoBlob&gt;\n</code></pre>\n<pre><code></code></pre>\n"^^ . . . "1"^^ . "<p>When running the <code>rsaKeygen()</code> function, the key it makes is always length <code>19</code>, and increasing the size of the <code>p</code> and <code>q</code> generation ranges causes the program to hang. Code:</p>\n<pre><code>function rsaKeygen()\n p = math.random(50000,100000)\n while not isprime(p) do\n p = math.random(1,1000)\n end\n q = math.random(1,1000)\n while not isprime(q) do\n q = math.random(50000,100000)\n end\n local n = p*q\n totientN = carmichael(n)\n e = 2^16+1\n local d = 1%totientN/e\n p,q,totientN = nil,nil,nil\n return e,d,n\nend\n</code></pre>\n<p>I have tried to increase the ranges for <code>p</code> and <code>q</code>, however that causes the program to hang, and in my <code>pkcs1_v1_5_pad(message,key_size)</code> function, <code>19</code> is not a long enough key to work for any reasonable-sized plaintext. pkcs function:</p>\n<pre><code>function pkcs1_v1_5_pad(message,key_size)\n print(key_size)\n local block_size = key_size/8\n local message_length = #message\n local padding_length = block_size - message_length - 3\n if padding_length &lt; 0 then\n error(&quot;Message is too long for the given key size&quot;)\n end\n local padding = string.rep(&quot;\\x00&quot;,padding_length)\n local padded_message = string.char(0x00)..string.char(0x02)..padding..string.char(0x00)..message\n return padded_message\nend\n</code></pre>\n"^^ . . . . . . . . . . . . . "1"^^ . "0"^^ . "How do I turn Part's CanCollide off for only one player(specific player)?"^^ . . "kaltura"^^ . . . . . "@AsherRoland would you mind updating the question with the full snippet of code just so I can see what you mean?"^^ . . . . . "<blockquote>\n<p>Why this style hardly use in Lua programming?</p>\n</blockquote>\n<p>On Github, searching for <a href="https://github.com/search?q=%2Flocal+%5B%5Cw_%5D%2B%3F+%3D+function%2F+language%3ALua&amp;type=code" rel="nofollow noreferrer"><code>/local [\\w_]+? = function/ language:Lua</code></a> returns 181k files, searching for <a href="https://github.com/search?q=%22local+function%22+language%3ALua&amp;type=code" rel="nofollow noreferrer"><code>&quot;local function&quot; language:Lua</code></a> returns 631k files. I think this style should be quite common.</p>\n"^^ . "1"^^ . "0"^^ . "<p>You are just getting the random item number, but want the value. You're missing the <code>[]</code> operator. Also, read my comment regarding <code>#</code> to know its limitations. In most cases you can use that, of course. (I mostly wrote it so that you know what to expect if you have strange behaviours when different values get null-ed.</p>\n<p>This is what you're probably looking for:</p>\n<pre class="lang-lua prettyprint-override"><code>local math = require &quot;math&quot;\n\narr1 = {1, 2}\narr2 = {3, 4, 5}\narr3 = {6, 7, 8, 9}\n\nfunction randomize(array)\n return array[math.random(1, #array)]\nend\n\nprint(randomize(arr1))\nprint(randomize(arr2))\nprint(randomize(arr3))\n</code></pre>\n<p>There is no <code>NextInteger</code> function or a default RNG library, so you're probably using roblox. In that case, use the <code>random</code> library from roblox instead of LUA's default <code>math</code> in my example. The params are the same: min and max.</p>\n<p>As for the <code>lastPick</code>, you'll need a separate logic for that if you want to make sure the last random number is distinct and dedicated for each table. But to pass by reference as a pseudo-out parameter, you'll need to convert it to a table:</p>\n<pre class="lang-lua prettyprint-override"><code>local math = require &quot;math&quot;\n\nlocal arr1 = {1, 2}\nlocal arr2 = {3, 4, 5}\nlocal arr3 = {6, 7, 8, 9}\n\nlocal lastPickArr1 = {}\nlocal lastPickArr2 = {}\nlocal lastPickArr3 = {}\n\nfunction randomize(array, lastPick)\n local randomPick\n\n repeat\n randomPick = array[math.random(1, #array)]\n until randomPick ~= lastPick[0]\n \n lastPick[0] = randomPick\n \n return randomPick\nend\n\nprint(randomize(arr1, lastPickArr1))\nprint(&quot;last: &quot; .. lastPickArr1[0])\nprint(randomize(arr2, lastPickArr2))\nprint( lastPickArr2[0])\nprint(randomize(arr3, lastPickArr3))\nprint( lastPickArr3[0])\nprint(randomize(arr1, lastPickArr1))\nprint(&quot;last: &quot; .. lastPickArr1[0])\nprint(randomize(arr1, lastPickArr1))\nprint(&quot;last: &quot; .. lastPickArr1[0])\nprint(randomize(arr1, lastPickArr1))\nprint(&quot;last: &quot; .. lastPickArr1[0])\nprint(randomize(arr1, lastPickArr1))\nprint(&quot;last: &quot; .. lastPickArr1[0])\nprint(randomize(arr1, lastPickArr1))\nprint(&quot;last: &quot; .. lastPickArr1[0])\nprint(randomize(arr1, lastPickArr1))\nprint(&quot;last: &quot; .. lastPickArr1[0])\nprint(randomize(arr1, lastPickArr1))\nprint(&quot;last: &quot; .. lastPickArr1[0])\nprint(randomize(arr1, lastPickArr1))\nprint(&quot;last: &quot; .. lastPickArr1[0])\nprint(randomize(arr1, lastPickArr1))\nprint(&quot;last: &quot; .. lastPickArr1[0])\nprint(randomize(arr1, lastPickArr1))\nprint(&quot;last: &quot; .. lastPickArr1[0])\n</code></pre>\n<p>Output:</p>\n<blockquote>\n<p>2</p>\n<p>last: 2</p>\n<p>4</p>\n<p>4</p>\n<p>9</p>\n<p>9</p>\n<p>1</p>\n<p>last: 1</p>\n<p>2</p>\n<p>last: 2</p>\n<p>1</p>\n<p>last: 1</p>\n<p>2</p>\n<p>last: 2</p>\n<p>1</p>\n<p>last: 1</p>\n<p>2</p>\n<p>last: 2</p>\n<p>1</p>\n<p>last: 1</p>\n<p>2</p>\n<p>last: 2</p>\n<p>1</p>\n<p>last: 1</p>\n<p>2</p>\n<p>last: 2</p>\n<p>[Execution complete with exit code 0]</p>\n</blockquote>\n<p>Of course there are better ways to refactor this. I am just showing you a PoC.</p>\n<p>Also try to use local variables and functions as much as possible as opposed to global ones for best performance. You can also add local <em>&quot;pointers&quot;</em> to global functions and use them for some performance gain.</p>\n<p>If you're wondering why I used tables for the <em>local</em> <code>lastPick</code>, it's because primitives are passed by value. So using regular <code>int</code>s would only update their value inside the function, but when it left its scope they'd be <code>nil</code> again. Objects, on the other hand, are passed by reference and you can use that as a trick to get pseudo-out parameter behavior. Of course, as with any reference passing, be aware of its implications and use wisely</p>\n<p><em>(no, I don't mean performance wise, as pass-by-reference should always be faster, but rather, that it modifies the original so any &quot;temporary&quot; change that you use and forget to delete, might cause bugs, so be careful what experiments you do as you might end up debugging for hours for one simple assignment operation or hardcoding you did as a test, but forgot to remove/update)</em></p>\n<p>Also, in order to ensure no repetition (or maybe to force repetition for tests), remember to <a href="https://en.wikipedia.org/wiki/Random_seed" rel="nofollow noreferrer">seed</a> the random once on app initialization, <strong>depending on your use-case</strong>. According ot the docs, roblox applies one if you didn't.</p>\n<p>For the default <code>math</code> lib, you'd use <a href="https://www.tutorialspoint.com/lua/lua_math_library.htm" rel="nofollow noreferrer">math.randomseed(x)</a>, for roblox, you'd use <a href="https://create.roblox.com/docs/reference/engine/datatypes/Random#new" rel="nofollow noreferrer">new</a>.</p>\n<p>For example: <code>local initializedRNG = Random.new(os.clock() * 1000)</code>. Using the <code>os</code> library. Then you can use that initiated RNG. In the case of initiatialized seeds in roblox, they are used when creating a new <code>Random</code> object, meaning, if you use multiple you'd have random seeds (or seeding once will not apply the same seed if you instantiate a new one without a seed). As I said, it depends on your use-case, as the topic of seeding random libraries in general can turn into long discussions by themselves. And as said, that is just about seeding. RNG and PRNG by themselves would be even longer discussions.</p>\n"^^ . . "c"^^ . . "expansion"^^ . . . . . "xmake setup for a simple app with lua scripting"^^ . "Does this answer your question? [How to create a hitbox that lets players through if they have enough money and keeps them out when they don't have enough? - Roblox](https://stackoverflow.com/questions/73765388/how-to-create-a-hitbox-that-lets-players-through-if-they-have-enough-money-and-k)"^^ . . . . . . "I can't change a texture only for the local player"^^ . . "0"^^ . . . . . "Quarto/pandoc filter using meta variable"^^ . . . . "2"^^ . . . "How can I convert a String that is formatted like a table, into a table?"^^ . . . . . . "1"^^ . . "@Shafee Theoretically, replacing `return pandoc.Null()` with `return {}` should work. In fact, `function pandoc.Null() return {} end` is exactly the definition that Quarto has added to ensure compatibility with old scripts."^^ . "<p>I fixed the code by adding a check to see if the loop was broken and modified the check to make sure that <em>all</em> coprimes met the condition using <code>k</code>, and changed the assignment value of <code>k</code> from <code>0</code> to <code>1</code>, so that <code>coprime^k%n</code> does not always evaluate to 1, because all numbers to the power of <code>0</code> result in <code>1</code>. Modified code:</p>\n<pre><code>function carmichael(n)\n coprimes = {}\n for i = 1,n-1 do\n if gcd(i,n) == 1 then\n table.insert(coprimes,i)\n end\n end\n totient = #coprimes\n k = 1\n while k &lt;= totient do\n notcarmichael = false\n for counter = 1,#coprimes do\n coprime = coprimes[counter]\n if (coprime^k)%n ~= 1 then\n notcarmichael = true\n break\n end\n end\n if not notcarmichael then\n return k\n else\n k = k+1\n end\n end\n return totient\nend\n</code></pre>\n"^^ . . "0"^^ . . "0"^^ . "0"^^ . . . "0"^^ . "pkcs"^^ . . . "There you go! :)"^^ . "0"^^ . . . . . . "<p>By default, LocalScripts will not run under workspace (unless in the character), to resolve this problem you can either:</p>\n<ul>\n<li>Move the LocalScript into StarterPlayerScripts</li>\n<li>Convert the LocalScript into a Script and change the RunContext to <code>Client</code></li>\n</ul>\n<p>See: <a href="https://devforum.roblox.com/t/live-script-runcontext/1938784" rel="nofollow noreferrer">https://devforum.roblox.com/t/live-script-runcontext/1938784</a></p>\n"^^ . "0"^^ . "1"^^ . "0"^^ . . "0"^^ . "Warcraft Lua 1.12 (Turtle Wow) GetSpellCooldown doesn't work"^^ . . . . . . "<p>You are looking for the <code>export type</code> keywords.</p>\n<p>The <a href="https://luau-lang.org/typecheck" rel="nofollow noreferrer">Luau documentation</a> has a section for <a href="https://luau-lang.org/typecheck#module-interactions" rel="nofollow noreferrer">'Module Interactions'</a> and you can pair that with the section for <a href="https://luau-lang.org/typecheck#adding-types-for-faux-object-oriented-programs" rel="nofollow noreferrer">'Adding types for faux object oriented programs'</a> which you can use to describe your ModuleScript's returned table.</p>\n<p>For example, in your ModuleScript :</p>\n<pre class="lang-lua prettyprint-override"><code>-- define the shape of the ModuleScript's returned table\nexport type MathUtilImpl = {\n add : (a: number, b: number)-&gt; number,\n subtract : (a: number, b: number) -&gt; number,\n}\nlocal MathUtil : MathUtilImpl = {}\n\nfunction MathUtil.add(a, b)\n return a + b\nend\n\nfunction MathUtil.subtract(a, b)\n return a - b\nend \n\nreturn MathUtil\n</code></pre>\n<p>I'm not using <code>--!strict</code> in the ModuleScript because I didn't want to define everything on the <code>local MathUtil</code> line. But the documentation has suggestions on how to do it.</p>\n<p>Including your ModuleScript will bring the exported types with it. Then, Roblox's linter will give warnings if you are using something incorrectly.</p>\n<p>Then in your Script :</p>\n<pre class="lang-lua prettyprint-override"><code>--!strict\nlocal MathUtil = require(script.ModuleScript)\nprint(MathUtil.add(1, 2)) -- returns 3\nprint(MathUtil.subtract(&quot;foo&quot;, &quot;bar&quot;)) -- gives errors 'Type &quot;string&quot; could not be converted to number'\nprint(MathUtil.multiply(3, 4)) -- gives error 'Key &quot;multiply&quot; not found on table &quot;MathUtil&quot;'\n</code></pre>\n"^^ . "ok so I found out that the problem does not seem to be the dap configuration itsself but that the first file encountered gets processed to quickly. if I just use a timeout somewhere for a few milliseconds debugging works. maybe because otherwise the maps are not processed in time? Any config with the debugger itself that could be the problem?"^^ . "HealthBar in Roblox Studio"^^ . "The _TextMate Language Pack_ provides syntax highlighting for Lua (see [here](https://github.com/eclipse/tm4e/tree/main/org.eclipse.tm4e.language_pack/syntaxes/lua)) which can be installed via _Help > Install New Software..._ working with the update site [`https://download.eclipse.org/tm4e/releases/latest/`](https://download.eclipse.org/tm4e/releases/latest/). Please note that LDT is open source and just needs someone to update it."^^ . . . "1"^^ . "0"^^ . "0"^^ . "0"^^ . . "Why does my Roblox Ui text label sometimes randomly say "100.00M" instead for the correct variable?"^^ . "pandoc"^^ . . "<p>Since both <code>proxy_pass</code> and <code>content_by_lua_block</code> belong to the content phase, they are mutually exclusive:</p>\n<p><a href="https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#content_by_lua_block" rel="nofollow noreferrer">https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#content_by_lua_block</a></p>\n<blockquote>\n<h3>content_by_lua_block</h3>\n<p>[...]</p>\n<p>Do not use this directive and other content handler directives in the same location. For example, this directive and the proxy_pass directive should not be used in the same location.</p>\n</blockquote>\n<p>In order to process the upstream body you have to proxy using Lua cosocket API. There is a library for this job: <a href="https://github.com/ledgetech/lua-resty-http" rel="nofollow noreferrer">lua-resty-http</a>. If the response fits into memory, you can use <a href="https://github.com/ledgetech/lua-resty-http?tab=readme-ov-file#single-shot-request" rel="nofollow noreferrer">Single-shot request</a>, otherwise you have to stream it chunk by chunk — <a href="https://github.com/ledgetech/lua-resty-http?tab=readme-ov-file#streamed-request" rel="nofollow noreferrer">Streamed request</a> — but it makes processing a lot more challenging.</p>\n"^^ . "reverse-engineering"^^ . . . . . "2"^^ . . . . . . . "UI Tween incorrect Positioning, Luau Roblox Studio Ui"^^ . . . . . "1"^^ . "Do you have access to `dostring`, `loadstring` or `load` in your environment? using one of those and prepending the text `return ` to the table string will return the table as a table."^^ . "1"^^ . "0"^^ . "0"^^ . . . . "7"^^ . . . . . "1"^^ . . "1"^^ . "quarto"^^ . . "<blockquote>\n<p>I want mouse button 4 to go from &quot;mouse button 4&quot; to &quot;1.&quot;</p>\n</blockquote>\n<p>This would require removing default action from MB4 (on the big picture of mouse in GHub GUI) and handling of all its press/release events in the code.</p>\n<pre><code>local with_shift\nfunction OnEvent(event, arg)\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 4 then\n with_shift = IsModifierPressed(&quot;lshift&quot;)\n if with_shift then\n PressKey(&quot;1&quot;)\n OutputLogMessage(&quot;Held\\n&quot;)\n else\n PressMouseButton(4)\n OutputLogMessage(&quot;NOT Held\\n&quot;)\n end\n elseif event == &quot;MOUSE_BUTTON_RELEASED&quot; and arg == 4 then\n if with_shift then\n ReleaseKey(&quot;1&quot;)\n else\n ReleaseMouseButton(4)\n end\n end\nend\n</code></pre>\n"^^ . . . . . . . . "<p><code>usedist</code> is local to within the <code>if</code> block where you defined it. Declare it in front of it in order to be able to access it later, like this.</p>\n<pre><code>local usedist\nif units == meters then \n usedist = distance\nelseif units == kilometers then \n usedist = distance * hundred\nelse\n</code></pre>\n"^^ . "0"^^ . "0"^^ . . . "How to load a lua plugin from vimscript (how to call the setup function)"^^ . "0"^^ . . "0"^^ . . . . . "terminal"^^ . . "<p>I'm a completely noob at Lua. I've been playing around with it in g-hub for a Logitech mouse and I figured out how to make it notice if shift is held down while the script is run, but I'm pretty far off from figuring out how to make holding shift change the buttons on the mouse to different values. Lik eI want mouse button 4 to go from &quot;mouse button 4&quot; to &quot;1.&quot; Any help would be greatly appreciated</p>\n<pre><code>function OnEvent(event, arg)\n if IsMouseButtonPressed(2) and IsModifierPressed(&quot;lshift&quot;) then\n PressKey(&quot;2&quot;)\n OutputLogMessage(&quot;Held&quot;)\n end\n if not IsModifierPressed(&quot;lshift&quot;) then\n OutputLogMessage(&quot;NOT Held&quot;)\n end\n end\n</code></pre>\n"^^ . "1"^^ . "0"^^ . . . "Yes okay, understood. So ```a message matches the key if the string is a substring of the associated text``` must be understood as there are possibly other cases where a message matches the key, and those cases are not documented. It means that the RFC is incomplete."^^ . . . . . "How to generate a project for every directory in Premake?"^^ . . "1"^^ . "0"^^ . . . "The best way of achieving this is probably using [AvatarEditorService](https://create.roblox.com/docs/reference/engine/classes/AvatarEditorService#GetInventory)"^^ . . "Try editing your Position and Size variables manually while creating the tween. Maybe the size and position data you are getting from `getAbsolutePositionAndSize(guiObject)` is wrong. I don't see any problem besides that."^^ . . . . . "0"^^ . "I needed `pandoc.utils.stringify(doc.meta.target_lang)` otherwise this worked perfectly!"^^ . . . . . . . . "0"^^ . . "Thanks for the help :) it turns out that it was necessary to make a handler via if)"^^ . "<p>This is a lua filter created by me personally, capable of extracting images synthetically created with TikZ (no already existing imported images), and converting them into a .png file via ImageMagick.</p>\n<p>The image, as you know, can be inserted into the .docx file using the <code>pandoc.Para</code> command. I need to know if, in addition to importing the image, it is possible to write a string just below the newly imported image</p>\n<p>My Minimal Working Example:</p>\n<pre><code>function RawBlock(el)\n if string.find(el.text,&quot;\\\\begin{tikzpicture}&quot;) then\n io.output(&quot;C:/Logs/output.tex&quot;)\n io.write(&quot;\\\\documentclass{standalone}&quot;, &quot;\\n&quot;)\n io.write(&quot;\\\\usepackage{tikz}&quot;, &quot;\\n&quot;)\n io.write(&quot;\\\\usepackage{pgfplots}&quot;, &quot;\\n&quot;)\n io.write(&quot;\\\\pgfplotsset{compat=newest}&quot;, &quot;\\n&quot;)\n io.write(&quot;\\\\usepackage{siunitx}&quot;, &quot;\\n&quot;)\n io.write(&quot;\\\\begin{document}&quot;, &quot;\\n&quot;)\n io.write(el.text, &quot;\\n&quot;)\n io.write(&quot;\\\\end{document}&quot;, &quot;\\n&quot;)\n io.close()\n os.execute(&quot;cd C:/Logs &amp; pdflatex output.tex &amp; convert -density 288 output.pdf -alpha off -resize 35% output.png&quot;)\n print(el.content)\n return pandoc.Para({pandoc.Image({},&quot;C:/Logs/output.png&quot;)})\n end\nend\n</code></pre>\n"^^ . "0"^^ . . . . "-1"^^ . . . "0"^^ . "3"^^ . "0"^^ . "0"^^ . "<p>When a player has a certain amount of something I wanna disable canCollide on a wall(part) but I don't know how to do it only for one player. Right now you click something and it adds to your &quot;Clicks&quot; in leaderstats, and when you have a certain amount of clicks, you get should be able to get access through the wall</p>\n"^^ . "0"^^ . "<p>I am using kong for my api management and the version am using is 0.11.0 (very old) and Postgres version is 10.x.\nWe have an requirement to update the postgres to community edition (15.x) and it needs to be supported immediately.</p>\n<p>I know I need to update the kong, but as if now as an immediate fix I wanted resolve this without updating kong. I know the issue lies in kong-0.11.0-0.rockspec where we have a dependencies named 'pgmoon' version 1.8.0. So basically I need to get this version updated to 1.12.0 as part of this issue <a href="https://github.com/leafo/pgmoon/pull/101" rel="nofollow noreferrer">https://github.com/leafo/pgmoon/pull/101</a>.\nand I cannot change anything in Postgres with this regard.</p>\n<p>So I want to understand how can I override/change the dependecy version in my application since kong is a 3rd party application and I cannot modify the source code.</p>\n"^^ . "<p>I've been trying a lot of ways, it was way worse, it made the pawns disappear and then appear only at the tween complete, so yeah, but now its simpler, so can you help me, I've been reading through dev forums and other peoples issues, but I cant find solutions till now, I'm still trying, help would be appericated.</p>\n<p>Here's my entire code of this part of the issue.</p>\n<pre class="lang-lua prettyprint-override"><code>local SGUI = game.StarterGui\nlocal frame = SGUI.ScreenGui.Background.OutlineFrame.InnerFrame\nlocal theDock = frame.Parent.Parent.PlayerDock\nlocal thePawn = theDock.Player1\nlocal currentBoxOfPawn = thePawn.CurrentBox.Value\nlocal ts = game:GetService(&quot;TweenService&quot;)\n\nlocal isMoving = thePawn.Moving\n\nif isMoving.Value then return end\n\nif currentBoxOfPawn == &quot;000&quot; then\n currentBoxOfPawn = &quot;001&quot;\n\n local oldPos = thePawn.Position\n local oldSize = thePawn.Size\n\n isMoving.Value = true\n thePawn.Visible = false\n\n local newPawn = thePawn:Clone()\n newPawn.Visible = true\n newPawn.Parent = frame.Parent.Parent -- Set to frame.Parent to keep it visible\n\n local function getAbsolutePositionAndSize(guiObject)\n local absPos = guiObject.AbsolutePosition\n local absSize = guiObject.AbsoluteSize\n return UDim2.new(0, absPos.X, 0, absPos.Y), UDim2.new(0, absSize.X, 0, absSize.Y)\n end\n\n local oldAbsPos, oldAbsSize = getAbsolutePositionAndSize(thePawn)\n newPawn.Position = oldAbsPos\n newPawn.Size = oldAbsSize\n\n -- Ensure thePawn is parented to the correct frame\n local newParent = frame:FindFirstChild(currentBoxOfPawn)\n if newParent then\n thePawn.Parent = newParent\n else \n isMoving.Value = false\n return\n end\n\n local newAbsPos, newAbsSize = getAbsolutePositionAndSize(thePawn)\n \n local movement = ts:Create(newPawn, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {\n Position = newAbsPos,\n Size = newAbsSize\n })\n movement:Play()\n\n movement.Completed:Connect(function()\n isMoving.Value = false\n thePawn.Visible = true\n newPawn:Destroy()\n end)\nend\n</code></pre>\n<p>To explain, the Checkered is consistent of boxes for each white or black box, aka a frame, and the frame has a <code>UIGridLayout</code> to allow for multiple pawns at once without collision, and so, that causes a lot of issues when getting the correct position and size as you probably know, that's all. its a little down not in the correct place as the real pawn is in.</p>\n<p>And there's a <a href="https://imgur.com/a/QQyVk92" rel="nofollow noreferrer">video</a> attached to show the problem</p>\n<p><a href="https://imgur.com/a/QQyVk92" rel="nofollow noreferrer">https://imgur.com/a/QQyVk92</a></p>\n<p>Btw, this system is supposed to be used for moving from one box to another and so and so, and I'm planning to add a more smooth way of up then down to the location so I need it to be clear and understandable to allow for change and use so its confusing me a lot.\nThat should clarify the point of this system, it is NOT like chess, its a one by one box game, no need to explain entirely, just I'm trying to make it so there's a event/code to move any chip/pawn from one place to another box without player input.</p>\n<p>Thank you.</p>\n"^^ . . . . . . . . . . . "3"^^ . "1"^^ . "2"^^ . . "<h3>Semantics</h3>\n<blockquote>\n<p>I've read you can start an &quot;array&quot; at any index in Lua</p>\n</blockquote>\n<p>Yes, Lua tables are associative arrays. Almost any key is fine; only not-a-number and <code>nil</code> are not allowed as keys. So <code>{[-1] = 1, [-2] = 2, [-3] = 3}</code> is as valid a Lua table as <code>{[1.5] = 1, [2.5] = 2, [3.5] = 3}</code>. How you &quot;number&quot; your keys is, semantically speaking, just a convention. The Lua convention, which standard library functions work under, is that arrays to be used at lists start with the key 1 and increment in steps of 1.</p>\n<blockquote>\n<p>but &quot;ipairs&quot; seems to only work if it starts at 0.</p>\n</blockquote>\n<p>At 1. But it's easy to write a version of <code>ipairs</code> which starts at 42 (or 0):</p>\n<pre><code>local function inext42(t, i)\n i = i + 1\n local v = t[i]\n if v == nil then return end\n return i, v\nend\nfunction ipairs42(t)\n return inext42, t, 41\nend\nfor i, v in ipairs42({[42] = 1, [43] = 2, [44] = 3}) do\n print(i, v)\nend\n</code></pre>\n<p>(you could even override the built-in <code>ipairs</code>, but that's almost always a bad idea, since it will break third-party code)</p>\n<p>Similarly, you could implement variants for other standard library functions adhering to your indexing conventions, often in terms of the original functions.</p>\n<h3>Memory usage</h3>\n<blockquote>\n<p>So my question is, do s and t use &quot;3 words&quot; to store the 3 values internally as a sequence, or more(4/6), bc part/whole is stored as a &quot;mapping&quot; instead?</p>\n</blockquote>\n<p>This question is, strictly speaking, not a &quot;Lua&quot; question: The Lua programming language is a mere specification, a reference manual. There is a reference implementation, but there is a variety of implementations and hence probably a variety of memory usage patterns, though I would expect some things to be similar. I'll roughly outline how PUC Lua and LuaJIT would use memory for tables, since these are the most popular implementations.</p>\n<p>Yes, PUC Lua, and LuaJIT, separately store a &quot;list&quot; (&quot;sequence&quot;) part and a &quot;hash&quot; (&quot;mapping&quot;) part. This is necessary to make lists fast and memory-efficient.</p>\n<p>(Beware: The &quot;list&quot; part does not need to store a sequence. It may have holes, for example; only at some point, when it gets too sparse and you add a new entry, will PUC Lua move (part of) it to the hash part when &quot;rehashing&quot;. Similarly, part of a sequence may live in the hash part, until it gets &quot;dense&quot; enough for PUC Lua to move it to the &quot;list&quot; part on the next &quot;rehashing&quot;.)</p>\n<p>A table will use many more machine &quot;words&quot; than just 3. Pointers to the list and sequence parts need to be kept. There's a metatable field. The list and sequence part both have capacities that need to be remembered, etc etc; see the sources for details. All in all, an empty table comes to around at least 56 bytes on my machine.</p>\n<p>Now, when you fill the array or hash part, allocations need to happen for these. There will perhaps be some allocator overhead.</p>\n<p>Allocations for the list part happen in powers of two. This is necessary to make appending items fast (amortized constant time). If tables only used minimal size, you might need to do a linear time reallocation every time you add an element.</p>\n<p>This means, for a 3-item table, Lua will use 4 slots. In PUC Lua, each slot will be a type - value pair. This means two &quot;machine words&quot;, so 16 bytes on a 64-bit machine. On LuaJIT, values are stored more compactly in just 8 bytes using a technique called &quot;NaN boxing&quot;.</p>\n<p>Now, if you use <code>[0] = v</code> in your table, that entry lives in the &quot;hash part&quot; in PUC Lua 5.1. This means a hash part has to be allocated to begin with, and at least 2 slots (4 words) will be needed to store the key-value part alone. All other keys however can live in the array part. In your specific example, the array part can have size exactly two. This means 2 slots (4 words) are saved there. So the two solutions might be comparable in terms of memory usage, though hash part overhead will probably put the former at a disadvantage. Measure using <code>collectgarbage</code> to see for yourself (you need to be careful to either turn off garbage collection, creating no other garbage, or to make sure the tables you are creating for benchmarking purposes are not garbage).</p>\n<p>Now, LuaJIT is special here in that it &quot;wastes&quot; a slot for the 0 key, to make using 0 as performant as not using it, and presumably to not have to subtract 1 when indexing. So on LuaJIT, there is only a minuscule difference between starting at 0 and starting at 1; in fact starting at 0 technically leverages one more slot that would otherwise go unused (but unless your table size is a power of two, this is irrelevant).</p>\n<p>Using keys 4-6 means the entire table will land in the hash part on both PUC and JIT. This means at least 4 additional slots for the keys (the hash part will also use a power of two size). This will use the most memory on both PUC and JIT.</p>\n<blockquote>\n<p>And if they do use only 3 words, how do you find the &quot;starting index&quot; of the &quot;sequence part&quot;, if ipairs won't give it to me?</p>\n</blockquote>\n<p>Well, they don't, so the only way to find this index is by iterating over the entire table to find it (or by knowing it by convention, or storing it in another field, or caching it, etc etc).</p>\n<h3>Closing thoughts</h3>\n<ul>\n<li>When in Rome, do as Romans do. Lua indexing conventionally starts at 1. This is endorsed by the standard library. Simply adhere to this convention, unless you have a really good reason not to.</li>\n<li>Not starting at 1 will also usually have negative performance implications, both in terms of memory usage and time spent accessing keys which live in the hash part.</li>\n<li>Do not optimize prematurely. If you want to optimize memory usage, verify your problem (and optimizations) using <code>collectgarbage(&quot;count&quot;)</code> and potentially <code>collectgarbage(&quot;stop&quot;)</code>. Consider moving data structures to a language like C, or using LuaJIT FFI if necessary.</li>\n</ul>\n"^^ . "1"^^ . . . . . . . . "3"^^ . . . . "<p>There is a few things wrong with your script:</p>\n<ul>\n<li>its looks to be a server sided script, GUI should be edited in a client sided script. <a href="https://create.roblox.com/docs/projects/client-server" rel="nofollow noreferrer">read more about this here</a></li>\n<li>you're editing the <a href="https://create.roblox.com/docs/reference/engine/classes/StarterGui" rel="nofollow noreferrer"><code>StarterGui</code></a> instead of <a href="https://create.roblox.com/docs/reference/engine/classes/PlayerGui" rel="nofollow noreferrer"><code>PlayerGui</code></a>. the client just simply clones the version inside the <code>StarterGui</code> to the <code>PlayerGui</code></li>\n<li>i would also be better to use <a href="https://create.roblox.com/docs/reference/engine/classes/Instance#WaitForChild" rel="nofollow noreferrer"><code>WaitForChild</code></a> on the humanoid.</li>\n<li>you updated it to a fixed version of <code>character.Humanoid.Health</code></li>\n</ul>\n<p>What i recommend doing is create a <code>LocalScript</code> inside the <code>game.StarterGui.HealthBar.Health.Bar</code>. inside this script i would put the following code:</p>\n<pre class="lang-lua prettyprint-override"><code>-- // Services \\\\ --\nlocal Players = game:GetService(&quot;Players&quot;);\n\n-- // Variables \\\\ --\nlocal Bar = script.Parent;\nlocal client = Players.LocalPlayer;\n\n-- // Events \\\\ --\nclient.CharacterAdded:Connect(function(Character)\n local Humanoid = Character:WaitForChild(&quot;Humanoid&quot;);\n\n Humanoid.HealthChanged:Connect(function(Health)\n Bar.Text = Health;\n end);\nend);\n</code></pre>\n"^^ . . "What is the error you are getting?"^^ . "rsa"^^ . . "0"^^ . . "<p>It's a simple local script where I clone the local player's character and place it into my viewport frame</p>\n<p>However, when trying to access the member &quot;HumanoidRootPart&quot; (which is usually there in all scenarios), it returns an error saying that it is not a valid member like the title above.</p>\n<p>Said code is below:</p>\n<pre class="lang-lua prettyprint-override"><code>local LocalPlayer = game.Players.LocalPlayer\nlocal Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()\nlocal ViewCharacter = script.Parent\n\nCharacter.Archivable = true\nlocal VCChar = Character:Clone()\nVCChar.Parent = ViewCharacter\nCharacter.Archivable = false\nlocal HumanoidRootPart: Part = VCChar.HumanoidRootPart or VCChar:WaitForChild('HumanoidRootPart') -- error here\nHumanoidRootPart.Anchored = true\nHumanoidRootPart.Position = Vector3.zero\n\nlocal VCCam = Instance.new(&quot;Camera&quot;)\nVCCam.CFrame = CFrame.new(HumanoidRootPart.Position + (HumanoidRootPart.CFrame.LookVector * 3), VCChar.Head.Position)\nVCCam.Parent = ViewCharacter\n\nViewCharacter.CurrentCamera = VCCam\n</code></pre>\n<p>and the Hierarchy is as below:</p>\n<pre><code>StarterGui\n- CharacterView (ScreenGUI)\n-- ViewCharacter (my viewport frame)\n--- LoadChar (my local script with the code above)\n</code></pre>\n<p>I have just tried using</p>\n<pre class="lang-lua prettyprint-override"><code>local HumanoidRootPart = VCChar:WaitForChild('HumanoidRootPart')\n</code></pre>\n<p>but now the error is:</p>\n<pre><code>Infinite yield possible on 'Players.blahblahblah.PlayerGui.CharacterView.ViewCharacter.blahblahblah:WaitForChild(&quot;HumanoidRootPart&quot;)'\n</code></pre>\n<p>(blahblahblah is the local player's name btw)</p>\n<p>genuinely dunno how to fix this, please help</p>\n"^^ . "0"^^ . . "0"^^ . "@TheLemon27 I think you're coming dangerously close to an [XY problem](https://xyproblem.info/). What is it exactly you are trying to achieve? According to the original question, my answer does what you initially asked. Let's break it down to a real use-case of yours. Don't ask what is possible in lua right away, first say what you need, what needs to happen and why. Then we see what is possible using lua or what workarounds there are. This is the proper approach to avoid the *XY problem*. Else you'll find yourself asking the wrong question and getting answers you don't need."^^ . "1"^^ . "<p>If control reaches the end of a function without encountering a <code>return</code> statement, the function implicitly returns <em>nothing</em>. As the syntax for <code>if</code> requires a single <em>expression</em>, the zero-length <em>multires expression</em> of <em>nothing</em> is adjusted to a single <code>nil</code> value.</p>\n<p>In a control structure (<code>if</code>, <code>while</code>, <code>repeat</code>), a condition expression equal to <code>nil</code> tests <em>false</em> (conversely, <code>not nil</code> is <code>true</code>).</p>\n<p>See <a href="https://lua.org/manual/5.4/" rel="nofollow noreferrer">Lua 5.4</a>:</p>\n<ul>\n<li><a href="https://lua.org/manual/5.4/manual.html#2.1" rel="nofollow noreferrer">2.1 – Values and Types</a></li>\n<li><a href="https://lua.org/manual/5.4/manual.html#3.3.4" rel="nofollow noreferrer">3.3.4 – Control Structures</a></li>\n<li><a href="https://lua.org/manual/5.4/manual.html#3.4.11" rel="nofollow noreferrer">3.4.11 – Function Definitions</a></li>\n<li><a href="https://lua.org/manual/5.4/manual.html#3.4.12" rel="nofollow noreferrer">3.4.12 – Lists of expressions, multiple results, and adjustment</a></li>\n</ul>\n"^^ . "1"^^ . . "<p>When the script tries to find out information on the path &quot;game:GetService(“Workspace”).NameValue.Value&quot;.\nit recognizes it, but if this information is used in the path &quot;game.Players.PlayerName.Settings.Data.Ability.Value&quot; then roblox gives the error “PlayerName is not a valid member of Players ‘Players’” can you help me how to fix this error?\nScript:</p>\n<pre><code>local Library = loadstring(game:HttpGet(&quot;https://raw.githubusercontent.com/Robojini/Tuturial_UI_Library/main/UI_Template_1&quot;))()\nlocal Window = Library.CreateLib(&quot;Player infomation&quot;, &quot;RJTheme3&quot;)\n\nlocal PlayerName = game:GetService(&quot;Workspace&quot;).NameValue.Value\n\nlocal Tab = Window:NewTab(&quot;Stand&quot;)\nlocal Section = Tab:NewSection(&quot;&quot;)\n\nlocal stand = game.Players.PlayerName.Settings.Data.Ability.Value\nSection:NewLabel(stand)\n\n------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nlocal Tab = Window:NewTab(&quot;Cash&quot;)\nlocal Section = Tab:NewSection(&quot;&quot;)\n\nlocal cash = game.Players.PlayerName.Settings.Data.Cash.Value\nSection:NewLabel(cash)\n\n------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nlocal Tab = Window:NewTab(&quot;Stand in storage&quot;)\nlocal Section = Tab:NewSection(&quot;&quot;)\n\nlocal StandInStorage1 = game.Players.PlayerName.Data[&quot;Ability Storage&quot;].Ability_Slot1.Value\nlocal StandInStorage2 = game.Players.PlayerName.Data[&quot;Ability Storage&quot;].Ability_Slot2.Value\nlocal StandInStorage3 = game.Players.PlayerName.Data[&quot;Ability Storage&quot;].Ability_Slot3.Value\nlocal StandInStorage4 = game.Players.PlayerName.Data[&quot;Ability Storage&quot;].Ability_Slot4.Value\nlocal StandInStorage5 = game.Players.PlayerName.Data[&quot;Ability Storage&quot;].Ability_Slot5.Value\nlocal StandInStorage6 = game.Players.PlayerName.Data[&quot;Ability Storage&quot;].Ability_Slot6.Value\nSection:NewLabel(StandInStorage1)\nSection:NewLabel(StandInStorage2)\nSection:NewLabel(StandInStorage3)\nSection:NewLabel(StandInStorage4)\nSection:NewLabel(StandInStorage5)\nSection:NewLabel(StandInStorage6)\n\n------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nlocal Tab = Window:NewTab(&quot;Item in storage&quot;)\nlocal Section = Tab:NewSection(&quot;&quot;)\n\nlocal ItemInStorage1 = game.Players.PlayerName.Data[&quot;Item Storage&quot;].Item_Slot1.Value\nlocal ItemInStorage2 = game.Players.PlayerName.Data[&quot;Item Storage&quot;].Item_Slot2.Value\nlocal ItemInStorage3 = game.Players.PlayerName.Data[&quot;Item Storage&quot;].Item_Slot3.Value\nlocal ItemInStorage4 = game.Players.PlayerName.Data[&quot;Item Storage&quot;].Item_Slot4.Value\nlocal ItemInStorage5 = game.Players.PlayerName.Data[&quot;Item Storage&quot;].Item_Slot5.Value\nlocal ItemInStorage6 = game.Players.PlayerName.Data[&quot;Item Storage&quot;].Item_Slot6.Value\nSection:NewLabel(ItemInStorage1)\nSection:NewLabel(ItemInStorage2)\nSection:NewLabel(ItemInStorage3)\nSection:NewLabel(ItemInStorage4)\nSection:NewLabel(ItemInStorage5)\nSection:NewLabel(ItemInStorage6)\n\n------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nlocal Tab = Window:NewTab(&quot;Settings&quot;)\nlocal Section = Tab:NewSection(&quot;&quot;)\n\nlocal Camera_Shake = game.Players.PlayerName.Settings[&quot;Camera Shake&quot;].Value\nlocal CameraShake = game.Players.PlayerName.Settings.CameraShake.Value\nlocal LowGraphics = game.Players.PlayerName.Settings[&quot;Low Graphics&quot;].Value\nlocal Music = game.Players.PlayerName.Settings.Music.Value\nSection:NewLabel(Camera_Shake)\nSection:NewLabel(CameraShake)\nSection:NewLabel(LowGraphics)\nSection:NewLabel(Music)\n\n------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nlocal Tab = Window:NewTab(&quot;Leaderstats&quot;)\nlocal Section = Tab:NewSection(&quot;&quot;)\n\nlocal leaderstats = game.Players.PlayerName.leaderstats[&quot;Total Kill&quot;].Value\nSection:NewLabel(leaderstats)\n</code></pre>\n<p><a href="https://i.sstatic.net/ZEEC8KmS.png" rel="nofollow noreferrer">Here's what StringValue looks like:</a></p>\n<pre><code>\nI tried setting PlayerName like this:\ngame.Players. “PlayerName”.Settings.Data.Ability.Value\ngame.Players.[“PlayerName”].Settings.Data.Ability.Value\ngame.Players[“PlayerName”].Settings.Data.Ability.Value\ngame.Players.PlayerName.Settings.Data.Ability.Value\n\nI wanted the menu to display all the information I wrote in the script.\n</code></pre>\n"^^ . . . . "a number can't have two decimals. I would suggest to use a string instead then. So `event.sid = "10.7.5"` (and of course for all other cases too, to keep it all the same type)"^^ . . "Hi. Please to not add error messages and code as screenshots. This makes it hard to search questions and leads to down-votes/closes-votes."^^ . . . "0"^^ . . . "2"^^ . . . "12"^^ . "Every mouse click makes the damage script play one additional more time"^^ . . . "0"^^ . "0"^^ . . . . . "0"^^ . . . "Good answer, as a small note though, while `WaitForChild` is usually good practice, there's no need to use it inside `CharacterAdded` for the Humanoid. The [docs](https://create.roblox.com/docs/reference/engine/classes/Player#CharacterAdded) say this : "Note that the Humanoid and its default body parts (head, torso, and limbs) will exist when this event fires, but clothing items like Hats, Shirts, and Pants may take a few seconds to be added to the character.""^^ . . . "1"^^ . . . . . . . . "<p>lua solar2d. I have a player and obstacles, I grouped the hitbox and texture to move together, but then the event of collision between the player and the obstacle is not processed, without the group and following textures everything works, as well as when moving to another level, instead of waiting for a click from the player, the game works, although at the start of the 1st level waiting correctly.</p>\n<p>have no other ideas.</p>\n<pre><code>local composer = require(&quot;composer&quot;)\nlocal scene = composer.newScene()\n\nlocal physics = require(&quot;physics&quot;)\nphysics.start()\n\nlocal background = display.newRect(320, 240, 1000, 1000)\nbackground:setFillColor(0.8, 0.8, 0.8, 1)\n\nlocal ground = display.newRect(200, 300, 1000, 40)\nground:setFillColor(1, 1, 1, 1)\nphysics.addBody(ground, &quot;static&quot;)\n\nlocal startScreen = display.newGroup()\n\nlocal startText = display.newText(&quot;Нажмите, чтобы начать!&quot;, 250, 150, &quot;Helvetica&quot;, 25)\nstartText:setFillColor(0.2, 0.2, 0.2, 1)\nstartScreen:insert(startText)\n\nlocal score = 0\nlocal currentScore = display.newText(score, -70, 20, &quot;Helvetica&quot;, 25)\nlocal scoreText = display.newText(&quot;m / 200 m&quot;, 50, 20, &quot;Helvetica&quot;, 25)\n\nscoreText:setFillColor(0.4, 0.4, 0.4, 1)\ncurrentScore:setFillColor(0.4, 0.4, 0.4, 1)\n\nlocal startX = 50\nlocal startY = 250\n\nlocal player = display.newRect(startX, startY, 20, 60)\nplayer:setFillColor(0.4, 0.4, 0.4, 0)\nphysics.addBody(player, &quot;dynamic&quot;)\nplayer.isJumping = false\nplayer.isDucking = false\nplayer.duckingCooldown = false\nplayer.shootingCooldown = false\nplayer.gravityScale = 0\nplayer.isAlive = true\n\nlocal sheetChar = \n{\n width = 300,\n height = 300,\n numFrames = 7\n}\n\nlocal imageSheet = graphics.newImageSheet(&quot;dino_sprite_sheet.png&quot;, sheetChar)\nlocal sequenceData = \n{\n { name = &quot;run&quot;, start = 1, count = 4, time = 600, loopCount = 0, loopDirection = &quot;forward&quot; },\n { name = &quot;death&quot;, start = 5, count = 1, time = 1000, loopCount = 1 },\n { name = &quot;duck&quot;, start = 6, count = 2, time = 600, loopCount = 0, loopDirection = &quot;forward&quot; },\n { name = &quot;jump&quot;, start = 1, count = 1, time = 600, loopCount = 1 }\n}\n\nlocal character = display.newSprite(imageSheet, sequenceData)\ncharacter:scale(0.2, 0.2)\n\nlocal function OnCollision(event)\n if event.phase == &quot;began&quot; and event.other == ground then\n player.isJumping = false\n end\nend\n\nlocal function Crash1(self, event)\n if (event.phase == &quot;began&quot; and (event.other.ID == &quot;obstacle_t1&quot; or \n event.other.ID == &quot;obstacle_t3&quot; or event.other.ID == &quot;obstacle_t4&quot; or\n event.other.ID == &quot;obstacle_t2&quot; and not player.isDucking)) then\n print(&quot;+&quot;)\n player.isAlive = false\n transition.cancel()\n player:setLinearVelocity(0, 0)\n end\nend\n\nplayer.collision = Crash1\n\nplayer:addEventListener(&quot;collision&quot;, player)\nplayer:addEventListener(&quot;collision&quot;, OnCollision)\n\nlocal function Crash2(self, event)\n if event.phase == &quot;began&quot; then\n if event.other.ID == &quot;obstacle_t4&quot; then\n if self.removeSelf then\n self:removeSelf()\n end\n if event.other and event.other.removeSelf then\n event.other:removeSelf()\n end\n elseif event.other.ID == &quot;obstacle_t1&quot; or event.other.ID == &quot;obstacle_t2&quot; or event.other.ID == &quot;obstacle_t3&quot; then\n if self.removeSelf then\n self:removeSelf()\n end\n end\n end\nend\n\nlocal function Jump(event)\n if player.isAlive then\n if event.phase == &quot;began&quot; and not player.isJumping and not player.isDucking then\n player.isJumping = true\n if character.sequence ~= &quot;jump&quot; then\n character:setSequence(&quot;jump&quot;)\n character:play(&quot;jump&quot;)\n end\n transition.to(player, {time=400, y=startY - 100, transition=easing.outQuad, onComplete=function()\n transition.to(player, {time=400, y=startY, transition=easing.inQuad})\n end})\n if character.sequence ~= &quot;run&quot; then\n character:setSequence(&quot;run&quot;)\n character:play(&quot;run&quot;)\n end\n end\n end\nend\n\nlocal function Duck(event)\n if player.isAlive then\n if event.phase == &quot;began&quot; and not player.isJumping and not player.isDucking \n and not player.duckingCooldown then\n player.duckingCooldown = true\n player.isDucking = true\n if character.sequence ~= &quot;duck&quot; then\n character:setSequence(&quot;duck&quot;)\n character:play(&quot;duck&quot;)\n end\n timer.performWithDelay(1200, function() \n player.duckingCooldown = false \n player.isDucking = false\n if not player.isJumping and character.sequence ~= &quot;run&quot; then\n character:setSequence(&quot;run&quot;)\n character:play(&quot;run&quot;)\n end\n end)\n end\n end\nend\n\nlocal function Shoot(event)\n if event.phase == &quot;began&quot; and player.isAlive and not player.isJumping and not player.isDucking and not player.shootingCooldown then\n player.shootingCooldown = true\n local bullet = display.newCircle(player.x + 20, player.y, 5)\n bullet:setFillColor(1, 1, 1, 1)\n physics.addBody(bullet, &quot;dynamic&quot;)\n bullet.gravityScale = 0\n bullet.isBullet = true\n bullet.ID = &quot;bullet&quot;\n bullet.isAlive = true\n bullet.collision = Crash2\n bullet:addEventListener( &quot;collision&quot;, bullet )\n transition.to(bullet, {\n time = 500, \n x = player.x + 100,\n onComplete = function()\n if bullet and bullet.removeSelf then\n bullet:removeSelf()\n end\n end\n })\n timer.performWithDelay(2500, function() player.shootingCooldown = false end)\n end\nend\n\nlocal obstacleSpawnInterval = 3000\nlocal obstacleSpeed = 4000\n\nlocal sheetKakt = \n{\n width = 300,\n height = 300,\n numFrames = 5\n}\n\nlocal imageSheet2 = graphics.newImageSheet(&quot;kaktus_sprite_sheet.png&quot;, sheetKakt)\nlocal sequenceData2 = \n{\n { name = &quot;kakt1&quot;, start = 1, count = 1, time = 1000, loopCount = 1 },\n { name = &quot;kakt2&quot;, start = 2, count = 1, time = 1000, loopCount = 1 },\n { name = &quot;kakt3&quot;, start = 3, count = 1, time = 1000, loopCount = 1 },\n { name = &quot;kakt4&quot;, start = 4, count = 2, time = 400, loopCount = 0, loopDirection = &quot;forward&quot; }\n}\n\nlocal function SpawnObstacle()\n if player.isAlive then\n local obstacleGroup = display.newGroup()\n local obstacle = display.newRect(0, 0, 40, 60)\n local charObstacle\n\n local obstacleType = math.random(1, 4)\n -- Птица\n if obstacleType == 1 then\n obstacle.height, obstacle.width = 20, 60\n obstacle.y = -25\n charObstacle = display.newSprite(imageSheet2, sequenceData2)\n charObstacle:setSequence(&quot;kakt4&quot;)\n charObstacle:scale(0.25, 0.25)\n obstacle.ID = &quot;obstacle_t2&quot;\n -- базовый кактус\n elseif obstacleType == 2 then\n obstacle.height, obstacle.width = 60, 40\n obstacle.y = 0\n charObstacle = display.newSprite(imageSheet2, sequenceData2)\n charObstacle:setSequence(&quot;kakt1&quot;)\n charObstacle:scale(0.25, 0.25)\n obstacle.ID = &quot;obstacle_t1&quot;\n -- Поле кактусов\n elseif obstacleType == 3 then\n obstacle.height, obstacle.width = 40, 75\n obstacle.y = 10\n charObstacle = display.newSprite(imageSheet2, sequenceData2)\n charObstacle:setSequence(&quot;kakt2&quot;)\n charObstacle:scale(0.35, 0.35)\n obstacle.ID = &quot;obstacle_t3&quot;\n -- Длинный кактус\n else\n obstacle.height, obstacle.width = 100, 40\n obstacle.y = -10\n charObstacle = display.newSprite(imageSheet2, sequenceData2)\n charObstacle:setSequence(&quot;kakt3&quot;)\n charObstacle:scale(0.5, 0.5)\n obstacle.ID = &quot;obstacle_t4&quot;\n end\n obstacle:setFillColor(0.3, 0.3, 0.3, 0.8)\n physics.addBody(obstacle, &quot;dynamic&quot;)\n obstacle.gravityScale = 0\n obstacle.isSensor = true\n\n if charObstacle then\n charObstacle:play()\n obstacleGroup:insert(charObstacle)\n end\n\n obstacleGroup:insert(obstacle)\n\n obstacleGroup.x = 600\n obstacleGroup.y = 250\n\n transition.to(obstacleGroup, {time = obstacleSpeed, x = -150, onComplete = function()\n if obstacle and obstacle.removeSelf then\n obstacleGroup:removeSelf()\n end\n end})\n end\nend\n\nlocal jumpButton = display.newRect(-50, 300, 40, 30)\njumpButton:addEventListener(&quot;touch&quot;, Jump)\njumpButton:setFillColor(0, 0, 0, 0.01)\n\nlocal duckButton = display.newRect(20, 300, 40, 30)\nduckButton:addEventListener(&quot;touch&quot;, Duck)\nduckButton:setFillColor(0, 0, 0, 0.01)\n\nlocal shootButton = display.newRect(90, 300, 40, 30)\nshootButton:addEventListener(&quot;touch&quot;, Shoot)\nshootButton:setFillColor(0, 0, 0, 0.01)\n\nlocal sheetChar3 = \n{\n width = 300,\n height = 300,\n numFrames = 3\n}\n\nlocal imageSheet3 = graphics.newImageSheet(&quot;button_sprite_sheet.png&quot;, sheetChar3)\nlocal sequenceData3 = \n{\n { name = &quot;b1&quot;, start = 1, count = 1, time = 1000, loopCount = 1 },\n { name = &quot;b2&quot;, start = 2, count = 1, time = 1000, loopCount = 1 },\n { name = &quot;b3&quot;, start = 3, count = 1, time = 1000, loopCount = 1 }\n}\n\nlocal p = 140\nfor i = 1, 3 do\n local charButton = display.newSprite(imageSheet3, sequenceData3)\n charButton:setSequence(&quot;b&quot; .. i)\n charButton:scale(0.1, 0.1)\n charButton.x = -120 + i * p / 2\n charButton.y = 300\n charButton:play()\nend\n\nlocal function UpdateScore()\n if player.isAlive and score &lt;= 200 then\n score = score + 1\n currentScore.text = score\n end\nend\n\nlocal function startGame(event)\n if event.phase == &quot;ended&quot; then\n display.remove(startScreen)\n UpdateScore()\n character:play(&quot;run&quot;)\n timer.performWithDelay(obstacleSpawnInterval, SpawnObstacle, 0)\n timer.performWithDelay(50, UpdateScore, 0)\n end\nend\n\nstartScreen:addEventListener(&quot;touch&quot;, startGame)\n\nlocal isEnd = false\n\nlocal function Update()\n if not isEnd then\n if score == 200 then\n local textWin = display.newText(&quot;Вы победили!&quot;, 250, 150, &quot;Helvetica&quot;, 25)\n textWin:setFillColor(0.2, 0.2, 0.2, 1)\n transition.cancel()\n timer.performWithDelay(2000, function()\n display.remove(textWin)\n composer.gotoScene(&quot;level2&quot;)\n end)\n end\n\n character.x, character.y = player.x, player.y\n if not player.isAlive then\n if character.sequence ~= &quot;death&quot; then\n character:setSequence(&quot;death&quot;)\n character:play(&quot;death&quot;)\n local textLose = display.newText(&quot;Вы проиграли!&quot;, 250, 150, &quot;Helvetica&quot;, 25)\n textLose:setFillColor(0.2, 0.2, 0.2, 1)\n isEnd = true\n transition.cancel()\n timer.cancel(scoreTimer)\n timer.cancel(obstacleTimer)\n removeListeners()\n end\n elseif player.isDucking then\n if character.sequence ~= &quot;duck&quot; then\n character:setSequence(&quot;duck&quot;)\n character:play(&quot;duck&quot;)\n end\n elseif player.isJumping then\n if character.sequence ~= &quot;jump&quot; then\n character:setSequence(&quot;jump&quot;)\n character:play(&quot;jump&quot;)\n end\n elseif character.sequence ~= &quot;run&quot; then\n character:setSequence(&quot;run&quot;)\n character:play(&quot;run&quot;)\n end\n end\nend\n\nRuntime:addEventListener(&quot;enterFrame&quot;, Update)\n\nreturn scene\n</code></pre>\n"^^ . "0"^^ . "2"^^ . "3"^^ . "1"^^ . . "0"^^ . . "0"^^ . "2"^^ . . . . "<p>Im develop game in Roblox Studio, but my HealthBar not working.\nMy code:</p>\n<pre><code>local text = game.StarterGui.HealthBar.Health.Bar\nprint(&quot;Script started&quot;)\n---------------------------------------------------------\ngame.Players.PlayerAdded:Connect(function(player)\n print(&quot;Player add&quot;)\n player.CharacterAdded:Connect(function(character)\n print(&quot;Character add&quot;)\n local healthText = character.Humanoid.Health\n local function updateHealth(healthText)\n text.Text = healthText\n end\n character.Humanoid:GetPropertyChangedSignal(&quot;Health&quot;):Connect(function()\n updateHealth(healthText)\n end)\n end)\nend)\n---------------------------------------------------------\nprint(&quot;Script ended&quot;)\n\n</code></pre>\n<p>It was supposed to show the health level in numbers, but it doesn't show anything.\nP.S: im speak English so-so.</p>\n"^^ . . . "How to override/update kong-rockspec file to change version of a dependency?"^^ . . . . "0"^^ . "0"^^ . "0"^^ . "0"^^ . . . . "1"^^ . . "1"^^ . . "the point of my comment was to point out false claims in your answer so you can correct/improve it. an indexing operation does not "try to get ... an index" as you claim. it gets a value at the given index. you cannnot "see it as either". you cannot index something without an index so you need an index in the first place."^^ . . "-1"^^ . . "Roblox Studio Lua: Variable changing without being referenced"^^ . . . "0"^^ . "1"^^ . "RSA relies on exact integer arithmetic. Lua's number type is double-precision floating-point, and isn't suitable for implementing RSA. You'll need to use some kind of bigint library for Lua, or switch to a language that makes it easier to do bigint arithmetic. (I think this was already mentioned in the [answer](https://stackoverflow.com/a/78581915/270986) to your earlier question.)"^^ . "Needs more information to formulate a question. If you just want to inspect and modify variables inside the lua system you can do that with some simple functions. If you actually want to run new lua code, you need to generate bytecode for that Lua version and load that."^^ . . "0"^^ . . . . . . . . "1"^^ . . "<p>Your code is supposed to work as-is. In fact, you shouldn't even have to do all of that; even just this is supposed to work:</p>\n<pre class="lang-java prettyprint-override"><code> Globals globals = JsePlatform.standardGlobals();\n LuaValue chunk = globals.load(&quot;a=io.read(); print(a)&quot;);\n chunk.call();\n</code></pre>\n<p>The reason it's not working for you is that there was a bug in LuaJ 3.0.2, fixed by commit <a href="https://github.com/luaj/luaj/commit/14745ba76a109f2acbe10b17a8f323189d463eea" rel="nofollow noreferrer">14745ba76a10 (&quot;Fix call io.read, file:read without params.&quot;)</a>. Unfortunately, no release has been made since that commit. You can either get the fix by building LuaJ from source (but this is nontrivial on modern systems; see <a href="https://github.com/luaj/luaj/pull/113" rel="nofollow noreferrer">pull request #113</a>), or work around the problem by doing <code>io.read('*l')</code> instead of <code>io.read()</code>.</p>\n"^^ . . . . . . . . . "0"^^ . "1"^^ . . "0"^^ . "2"^^ . . . . . . . . "<p>I have to match <code>/home/user/file.lib</code> both in</p>\n<pre><code>bibliography: /home/user/file.lib\n</code></pre>\n<p>as well as</p>\n<pre><code>bibliography: &quot;/home/user/file.lib&quot;\n</code></pre>\n<p>in Lua.</p>\n<p>The best I came up with is:</p>\n<pre><code>&gt; s1 = &quot;bibliography: /home/user/file.lib&quot;\n&gt; s2 = 'bibliography: &quot;/home/user/file.lib&quot;'\n&gt; string.match(s1, 'bibliography: &quot;?(%g+)&quot;?')\n/home/user/file.lib\n&gt; string.match(s2, 'bibliography: &quot;?(%g+)&quot;?')\n/home/user/file.lib&quot;\n</code></pre>\n<p>But the last match contain a trailing <code>&quot;</code>.</p>\n<p>It looks like I need a non-greedy version of the <code>+</code> operator, and it looks like Lua doesn't have it.</p>\n<p>How can I achieve my purpose?</p>\n"^^ . . . . . "Good suggestion, I'll attempt to implement that if at all possible"^^ . . . "public"^^ . "1"^^ . . . "Instead of a pandoc filter, you could use the tikz externalize library to generate png versions of your tikz pictures. Section "52.7 Bitmap Graphics Export" of the tikz user guide has an example. See also https://tex.stackexchange.com/a/350081/36296"^^ . . "neovim-plugin"^^ . . . "1"^^ . . "<h1>Basics</h1>\n<p>Note the <a href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/package-summary.html" rel="nofollow noreferrer"><code>java.lang.foreign</code></a> API documentation is quite good. I recommend reading it fully to get a good grasp on how to use it. Don't just read the linked package documentation; also read the documentation of the various types and their methods. You may want to familiarize yourself with the <a href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/invoke/package-summary.html" rel="nofollow noreferrer"><code>java.lang.invoke</code></a> API as well.</p>\n<p>That said, the <em>Foreign Function &amp; Memory</em> (FFM) API provides the <a href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/StructLayout.html" rel="nofollow noreferrer"><code>StructLayout</code></a> interface for interacting with native structs. Make sure your <code>StructLayout</code> matches the memory layout of the native struct exactly. This includes any padding, as well as using the correct byte alignment and byte order.</p>\n<p>For a simple example, if you have the following C struct:</p>\n<pre class="lang-c prettyprint-override"><code>#include &lt;stdint.h&gt;\n\ntypedef struct Point {\n int32_t x;\n int32_t y;\n} Point;\n</code></pre>\n<p>Then you would want to create a <code>StructLayout</code> like so:</p>\n<pre class="lang-java prettyprint-override"><code>StructLayout pointLayout = MemoryLayout.structLayout(\n ValueLayout.JAVA_INT.withName(&quot;x&quot;),\n ValueLayout.JAVA_INT.withName(&quot;y&quot;),\n).withName(&quot;Point&quot;);\n</code></pre>\n<p>The <a href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/MemoryLayout.html#structLayout(java.lang.foreign.MemoryLayout...)" rel="nofollow noreferrer"><code>MemoryLayout#structLayout(MemoryLayout...)</code></a> takes a series of <a href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/MemoryLayout.html" rel="nofollow noreferrer"><code>MemoryLayout</code></a>. This means you can create an arbitrarily complex struct layout, including nested structs. Note calling <code>withName</code> is not actually necessary, but it can help when debugging problems. It can also make some FFM code more readable, such as when acquiring a <code>VarHandle</code> to a region of memory.</p>\n<p>Once you have the <code>StructLayout</code> you can use a <a href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/SegmentAllocator.html" rel="nofollow noreferrer"><code>SegmentAllocator</code></a> to allocate native memory for the struct from Java. This will give you a <a href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/MemorySegment.html" rel="nofollow noreferrer"><code>MemorySegment</code></a>.</p>\n<pre class="lang-java prettyprint-override"><code>// 'Arena' is a subtype of 'SegmentAllocator'\ntry (Arena arena = Arena.ofConfined()) {\n MemorySegment pointSegment = arena.allocate(pointLayout);\n // use 'pointSegment'...\n\n} // 'arena' is closed, releasing any memory it allocated\n</code></pre>\n<p>You can call the appropriate <code>get</code> and <code>set</code> methods of <code>MemorySegment</code> with the appropriate arguments to get and set the values of the struct's data members. You would pass this <code>MemorySegment</code> to any downcall <a href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/invoke/MethodHandle.html" rel="nofollow noreferrer"><code>MethodHandle</code></a> (created via a <a href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/Linker.html" rel="nofollow noreferrer"><code>Linker</code></a>) that invokes a native function which accepts a <code>Point</code> struct. Similarly, if any such downcall <code>MethodHandle</code> invokes a native function that <em>returns</em> a <code>Point</code> struct then you'll receive a <code>MemorySegment</code>.</p>\n<p>When interacting with native functions, be cognizant of whether or not you're dealing with <em>pointers</em>. That changes how you both create and invoke the downcall <code>MethodHandle</code>. See <a href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/Linker.html#downcallHandle(java.lang.foreign.FunctionDescriptor,java.lang.foreign.Linker.Option...)" rel="nofollow noreferrer"><code>Linker#downcallHandle(FunctionDescriptor,Option...)</code></a> for more information.</p>\n<hr />\n<h1>Wrapper Java Class</h1>\n<p>Directly using a <code>StructLayout</code> and a <code>MemorySegment</code> at all times is not ideal. You can make it more intuitive by creating a wrapper class that wraps the <code>MemorySegment</code> and exposes getters and setters. This will make interacting with the native struct look just like interacting with a regular Java object. You can also use <a href="https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/foreign/MemoryLayout.html#varHandle(java.lang.foreign.MemoryLayout.PathElement...)" rel="nofollow noreferrer"><code>MemoryLayout#varHandle(PathElement...)</code></a> to make implementing the getters and setters easier.</p>\n<pre class="lang-java prettyprint-override"><code>package com.example;\n\nimport static java.lang.foreign.MemoryLayout.PathElement.groupElement;\nimport static java.lang.foreign.MemoryLayout.structLayout;\nimport static java.lang.foreign.ValueLayout.JAVA_INT;\n\nimport java.lang.foreign.MemorySegment;\nimport java.lang.foreign.SegmentAllocator;\nimport java.lang.foreign.StructLayout;\nimport java.lang.invoke.MethodHandles;\nimport java.lang.invoke.VarHandle;\nimport java.util.Objects;\n\npublic final class Point {\n\n private final MemorySegment segment;\n\n // allocates new memory for a new Point struct (0, 0)\n public Point(SegmentAllocator allocator) {\n this(allocator, 0, 0);\n }\n\n // allocates new memory for a new Point struct (x, y)\n public Point(SegmentAllocator allocator, int x, int y) {\n this(allocator.allocate(LAYOUT));\n setX(x);\n setY(y);\n }\n\n // already allocated Point struct (e.g., from native code)\n public Point(MemorySegment segment) {\n if (segment.byteSize() != LAYOUT.byteSize())\n throw new IllegalArgumentException(&quot;segment's byte size does not match layout's&quot;);\n this.segment = segment;\n }\n\n // Allows passing Point to native functions\n public MemorySegment segment() {\n return segment; // may want to return read-only view?\n }\n\n public int getX() {\n return (int) X.get(segment);\n }\n\n public void setX(int x) {\n X.set(segment, x);\n }\n\n public int getY() {\n return (int) Y.get(segment);\n }\n\n public void setY(int y) {\n Y.set(segment, y);\n }\n\n @Override\n public boolean equals(Object obj) {\n return this == obj || (obj instanceof Point other &amp;&amp; segment.equals(other.segment));\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(Point.class, segment);\n }\n\n @Override\n public String toString() {\n return &quot;Point(x=&quot; + getX() + &quot;, y=&quot; + getY() + &quot;)&quot;;\n }\n\n /* *****************************************************************************\n * *\n * FFM State *\n * *\n *******************************************************************************/\n\n public static final StructLayout LAYOUT;\n\n private static final VarHandle X;\n private static final VarHandle Y;\n\n static {\n LAYOUT = structLayout(JAVA_INT.withName(&quot;x&quot;), JAVA_INT.withName(&quot;y&quot;)).withName(&quot;Point&quot;);\n\n var x = LAYOUT.varHandle(groupElement(&quot;x&quot;));\n X = MethodHandles.insertCoordinates(x, 1, 0L); // bind offset argument to 0\n\n var y = LAYOUT.varHandle(groupElement(&quot;y&quot;));\n Y = MethodHandles.insertCoordinates(y, 1, 0L); // bind offset argument to 0\n }\n}\n</code></pre>\n<p>Also see <a href="https://stackoverflow.com/a/78589925/6395627">my answer</a> to <a href="https://stackoverflow.com/q/78587689/6395627">How can I write an array-like datastructure in Java that takes longs as indices using modern unsafe APIs?</a> for ideas on dealing with native arrays.</p>\n<hr />\n<h1>Executable Example</h1>\n<p>Here is an executable example demonstrating the use of FFM with a C struct. Specifically, it demonstrates:</p>\n<ul>\n<li><p>Allocating the struct in <em>native</em> and using it in <em>Java</em>.</p>\n</li>\n<li><p>Allocating the struct in <em>Java</em> and using it in <em>native</em>.</p>\n</li>\n<li><p>Seeing modifications done in <em>Java</em> on the <em>native</em> side.</p>\n</li>\n<li><p>Seeing modifications done in <em>native</em> on the <em>Java</em> side.</p>\n</li>\n<li><p>Invoking native functions that either return or accept the struct.</p>\n</li>\n<li><p>How to handle the return value of a native function in Java when it's a pointer versus when it's not.</p>\n</li>\n</ul>\n<h2>Native Code (C)</h2>\n<p>Here is the native shared library named <code>nativepoint</code>.</p>\n<p><strong>nativepoint.h</strong></p>\n<pre class="lang-c prettyprint-override"><code>#if defined(_MSC_VER)\n // Microsoft \n #define EXPORT __declspec(dllexport)\n #define IMPORT __declspec(dllimport)\n#elif defined(__GNUC__)\n // GCC\n #define EXPORT __attribute__((visibility(&quot;default&quot;)))\n #define IMPORT\n#else\n // do nothing and hope for the best?\n #define EXPORT\n #define IMPORT\n #pragma warning Unknown dynamic link import/export semantics.\n#endif\n// Above taken from https://stackoverflow.com/a/2164853/6395627\n\n#include &lt;stdint.h&gt;\n\ntypedef struct Point {\n int32_t x;\n int32_t y;\n} Point;\n\nEXPORT Point* newPoint(int x, int y);\n\nEXPORT Point newPointByValue(int x, int y);\n\nEXPORT void swapPoint(Point *const point);\n\nEXPORT void printPoint(const Point *const point);\n</code></pre>\n<p><strong>nativepoint.c</strong></p>\n<pre class="lang-c prettyprint-override"><code>#include &quot;nativepoint.h&quot;\n#include &lt;stdlib.h&gt;\n#include &lt;stdio.h&gt;\n\nPoint* newPoint(int32_t x, int32_t y) {\n Point *point = malloc(sizeof *point);\n point-&gt;x = x;\n point-&gt;y = y;\n return point;\n}\n\nPoint newPointByValue(int32_t x, int32_t y) {\n Point point = {x, y};\n return point;\n}\n\nvoid swapPoint(Point *const point) {\n const int32_t x = point-&gt;x;\n point-&gt;x = point-&gt;y;\n point-&gt;y = x;\n}\n\nvoid printPoint(const Point *const point) {\n printf(&quot;[NATIVE]: Point(x=%d, y=%d)\\n&quot;, point-&gt;x, point-&gt;y);\n fflush(stdout); // stay &quot;in sync&quot; with Java logging\n}\n</code></pre>\n<h2>Java Code</h2>\n<p>Here is the Java code. The <code>Point</code> class is a wrapper around the native <code>struct Point</code>. The <code>NativePointLib</code> class is a wrapper around the native <em>functions</em>.</p>\n<p><strong>module-info.java</strong></p>\n<pre class="lang-java prettyprint-override"><code>module com.example {}\n</code></pre>\n<p><strong>Point.java</strong></p>\n<p>Same as from &quot;Wrapper Java Class&quot; section.</p>\n<p><strong>NativePointLib.java</strong></p>\n<pre class="lang-java prettyprint-override"><code>package com.example;\n\nimport java.lang.foreign.Arena;\nimport java.lang.foreign.FunctionDescriptor;\nimport java.lang.foreign.Linker;\nimport java.lang.foreign.MemorySegment;\nimport java.lang.foreign.SegmentAllocator;\nimport java.lang.foreign.SymbolLookup;\nimport java.lang.foreign.ValueLayout;\nimport java.lang.invoke.MethodHandle;\nimport java.nio.file.Path;\nimport java.util.Objects;\n\npublic final class NativePointLib {\n\n private NativePointLib() {}\n\n public static Point newPoint(Arena arena, int x, int y) {\n Objects.requireNonNull(arena, &quot;arena&quot;);\n try {\n /*\n * The 'newPoint' native function returns a *pointer* to a Point struct. In other words, the\n * memory was already allocated off the stack. That's why a SegmentAllocator is not passed to\n * the MethodHandle (unlike 'newPointByValue' below). However, we are still responsible for\n * releasing the memory when appropriate. Generally, this will be done using one of the\n * following approaches:\n *\n * 1. Associating the memory with an Arena via MemorySegment::reinterpret. Then the\n * memory will be released when the Arena is closed.\n *\n * 2. Manually invoking the 'free' native function. This will involve creating a downcall\n * MethodHandle to said native function.\n *\n * 3. Invoking some library-specific native function that releases the memory. Again,\n * this will involve creating a downcall MethodHandle to the native function.\n *\n * The first approach is used in this example.\n */\n var segment = (MemorySegment) NEW_POINT.invokeExact(x, y);\n segment = segment.reinterpret(arena, null); // associate memory with Arena\n return new Point(segment);\n } catch (Throwable t) {\n throw new RuntimeException(&quot;Unable to invoke native 'newPoint'&quot;, t);\n }\n }\n\n public static Point newPointByValue(SegmentAllocator allocator, int x, int y) {\n Objects.requireNonNull(allocator, &quot;allocator&quot;);\n try {\n /*\n * The 'newPointByValue' native function returns a Point struct *by value*. That is why a\n * SegmentAllocator is necessary; Java needs to know how to allocate the memory for the\n * returned value. The struct's memory will be released based on:\n * \n * 1. If the SegmentAllocator is an Arena or backed by an Arena, then when the Arena is\n * closed.\n * \n * 2. If MemorySegment returned by the allocator is in the &quot;automatic scope&quot;, then when\n * it (and all other related objects) are garbage collected.\n * \n * Note if the MemorySegment is in the global scope then it won't ever be released (until the\n * process terminates, of course).\n */\n var segment = (MemorySegment) NEW_POINT_BY_VALUE.invokeExact(allocator, x, y);\n return new Point(segment);\n } catch (Throwable t) {\n throw new RuntimeException(&quot;Unable to invoke native 'newPointByValue'&quot;, t);\n }\n }\n\n public static void swapPoint(Point point) {\n Objects.requireNonNull(point, &quot;point&quot;);\n try {\n SWAP_POINT.invokeExact(point.segment());\n } catch (Throwable t) {\n throw new RuntimeException(&quot;Unable to invoke native 'swapPoint'&quot;, t);\n }\n }\n\n public static void printPoint(Point point) {\n Objects.requireNonNull(point, &quot;point&quot;);\n try {\n PRINT_POINT.invokeExact(point.segment());\n } catch (Throwable t) {\n throw new RuntimeException(&quot;Unable to invoke native 'printPoint'&quot;, t);\n }\n }\n\n /* *****************************************************************************\n * *\n * FFM State *\n * *\n *******************************************************************************/\n\n private static final MethodHandle NEW_POINT;\n private static final MethodHandle NEW_POINT_BY_VALUE;\n private static final MethodHandle SWAP_POINT;\n private static final MethodHandle PRINT_POINT;\n\n static {\n var symbols = loadLibrary();\n var linker = Linker.nativeLinker();\n\n NEW_POINT = linkNewPoint(linker, symbols);\n NEW_POINT_BY_VALUE = linkNewPointByValue(linker, symbols);\n SWAP_POINT = linkSwapPoint(linker, symbols);\n PRINT_POINT = linkPrintPoint(linker, symbols);\n }\n\n private static MethodHandle linkNewPoint(Linker linker, SymbolLookup symbols) {\n var addr = getSymbol(symbols, &quot;newPoint&quot;);\n // By using an ADDRESS layout with a target layout, the created MethodHandle will return a\n // MemorySegment of the correct size. Without the target layout you would have to call\n // 'reinterpret' on the segment.\n var desc = FunctionDescriptor.of(\n ValueLayout.ADDRESS.withTargetLayout(Point.LAYOUT),\n ValueLayout.JAVA_INT,\n ValueLayout.JAVA_INT);\n return linker.downcallHandle(addr, desc);\n }\n\n private static MethodHandle linkNewPointByValue(Linker linker, SymbolLookup symbols) {\n var addr = getSymbol(symbols, &quot;newPointByValue&quot;);\n var desc = FunctionDescriptor.of(Point.LAYOUT, ValueLayout.JAVA_INT, ValueLayout.JAVA_INT);\n // Since the return type is a GroupLayout, the created MethodHandle has an additional\n // argument of type SegmentAllocator. See the 'newPointByValue' method implementation above.\n return linker.downcallHandle(addr, desc);\n }\n\n private static MethodHandle linkSwapPoint(Linker linker, SymbolLookup symbols) {\n var addr = getSymbol(symbols, &quot;swapPoint&quot;);\n // The target layout is not technically necessary here; you could just use ADDRESS\n var desc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS.withTargetLayout(Point.LAYOUT));\n return linker.downcallHandle(addr, desc);\n }\n\n private static MethodHandle linkPrintPoint(Linker linker, SymbolLookup symbols) {\n var addr = getSymbol(symbols, &quot;printPoint&quot;);\n // The target layout is not technically necessary here; you could just use ADDRESS\n var desc = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS.withTargetLayout(Point.LAYOUT));\n return linker.downcallHandle(addr, desc);\n }\n\n // convenience method to give better exception message if symbol could not be found\n private static MemorySegment getSymbol(SymbolLookup symbols, String name) {\n return symbols.find(name).orElseThrow(() -&gt; {\n var msg = &quot;'&quot; + name + &quot;' symbol not found in native library&quot;;\n return new IllegalStateException(msg);\n });\n }\n\n private static SymbolLookup loadLibrary() {\n /*\n * An algorithm that tries to load the library from various configuration options.\n *\n * 1. First, it checks if the 'nativepoint.path' system property has bee set to a non-blank\n * value. If it has, then it loads the library from the specified file, throwing an\n * exception if the load fails.\n *\n * 2. If the system property was not set, then it checks if the 'NATIVEPOINT_PATH'\n * environment variable has been set to a non-blank value. If it has, then it loads the\n * library form the specified file, throwing an exception if the load fails.\n *\n * 3. If neither the system property nor the environment variable have been set, then it\n * tries to load the library by name via an OS-specific mechanism. See the documentation\n * of SymbolLookup::libraryLookup(String,Arena) for more information.\n *\n * 4. If the library could not be loaded by name in step 3, then it attempts to load the\n * library by name via 'System::loadLibrary(String)'. This searches the\n * 'java.library.path' system property.\n *\n * Note the way NativePointLib is designed does not give much control over when the library is\n * unloaded. If you want to be able to unload the library on demand, then you'll need to design\n * your API in such a way that it can accept a user-defined Arena to load the library into.\n */\n var location = System.getProperty(&quot;nativepoint.path&quot;);\n if (location == null || location.isBlank()) {\n location = System.getenv(&quot;NATIVEPOINT_PATH&quot;);\n }\n\n if (location != null &amp;&amp; !location.isBlank()) {\n return SymbolLookup.libraryLookup(Path.of(location), Arena.global());\n }\n\n RuntimeException lookupByNameError;\n try {\n return SymbolLookup.libraryLookup(&quot;nativepoint&quot;, Arena.global());\n } catch (IllegalArgumentException | IllegalCallerException ex) {\n lookupByNameError = ex;\n }\n\n try {\n System.loadLibrary(&quot;nativepoint&quot;);\n } catch (UnsatisfiedLinkError error) {\n error.addSuppressed(lookupByNameError);\n var msg =\n &quot;&quot;&quot;\n Could not load 'nativepoint' native library. Make sure to configure the runtime by:\n 1. Setting the 'nativepoint.path' system property, or\n 2. Setting the 'NATIVEPOINT_PATH' environment variable, or\n 3. Placing the library in an OS-specific location where it can be found, or\n 4. Placing the library on the 'java.library.path' system property.\n &quot;&quot;&quot;;\n throw new IllegalStateException(msg, error);\n }\n return SymbolLookup.loaderLookup();\n }\n}\n</code></pre>\n<p><strong>Main.java</strong></p>\n<pre class="lang-java prettyprint-override"><code>package com.example;\n\nimport java.lang.foreign.Arena;\nimport java.lang.foreign.SegmentAllocator;\n\npublic class Main {\n\n public static void main(String[] args) {\n System.out.println(&quot;===== Point allocated in native via 'newPoint' =====&quot;);\n try (var arena = Arena.ofConfined()) {\n var point = NativePointLib.newPoint(arena, 10, 20);\n logPoint(point);\n demoSwapPoint(arena, point);\n }\n\n System.out.println(&quot;===== Point allocated in native via 'newPointByValue' =====&quot;);\n try (var arena = Arena.ofConfined()) {\n var point = NativePointLib.newPointByValue(arena, 15, 25);\n logPoint(point);\n demoSwapPoint(arena, point);\n }\n\n System.out.println(&quot;===== Point allocated in Java =====&quot;);\n try (var arena = Arena.ofConfined()) {\n var point = new Point(arena, 42, 117);\n logPoint(point);\n demoSwapPoint(arena, point);\n }\n }\n\n static void demoSwapPoint(SegmentAllocator allocator, Point point) {\n NativePointLib.swapPoint(point);\n log(&quot;After 'swapPoint'&quot;);\n logPoint(point);\n\n // now do swap in Java\n int x = point.getX();\n point.setX(point.getY());\n point.setY(x);\n\n log(&quot;After swap via 'setX' / 'setY' in Java&quot;);\n logPoint(point);\n }\n\n static void logPoint(Point point) {\n log(point.toString());\n NativePointLib.printPoint(point);\n System.out.println();\n }\n\n static void log(String msg) {\n System.out.printf(&quot;[JAVA ]: %s%n&quot;, msg);\n }\n}\n</code></pre>\n<h2>Command</h2>\n<p>After compiling both the C library and the Java application:</p>\n<pre class="lang-none prettyprint-override"><code>java -Dnativepoint.path=&lt;libpath&gt; --enable-native-access=com.example -p &lt;modpath&gt; -m com.example/com.example.Main\n</code></pre>\n<p>Replace <code>&lt;libpath&gt;</code> with a path to the built shared library <em>file</em>. Replace <code>&lt;modpath&gt;</code> with a path pointing to your compiled Java application. See the code comment in the <code>NativePointLib::loadLibrary()</code> method for alternatives to setting the <code>nativepoint.path</code> system property.</p>\n<p>Note modules are not necessary. You can remove the <code>module-info</code> descriptor. Just replace <code>com.example</code> with <code>ALL-UNNAMED</code> for <code>--enable-native-access</code>, set the class-path instead of the module-path, and launch with a class name or <code>-jar</code> instead of <code>-m</code>.</p>\n<h2>Output</h2>\n<pre class="lang-none prettyprint-override"><code>===== Point allocated in native via 'newPoint' =====\n[JAVA ]: Point(x=10, y=20)\n[NATIVE]: Point(x=10, y=20)\n\n[JAVA ]: After 'swapPoint'\n[JAVA ]: Point(x=20, y=10)\n[NATIVE]: Point(x=20, y=10)\n\n[JAVA ]: After swap via 'setX' / 'setY' in Java\n[JAVA ]: Point(x=10, y=20)\n[NATIVE]: Point(x=10, y=20)\n\n===== Point allocated in native via 'newPointByValue' =====\n[JAVA ]: Point(x=15, y=25)\n[NATIVE]: Point(x=15, y=25)\n\n[JAVA ]: After 'swapPoint'\n[JAVA ]: Point(x=25, y=15)\n[NATIVE]: Point(x=25, y=15)\n\n[JAVA ]: After swap via 'setX' / 'setY' in Java\n[JAVA ]: Point(x=15, y=25)\n[NATIVE]: Point(x=15, y=25)\n\n===== Point allocated in Java =====\n[JAVA ]: Point(x=42, y=117)\n[NATIVE]: Point(x=42, y=117)\n\n[JAVA ]: After 'swapPoint'\n[JAVA ]: Point(x=117, y=42)\n[NATIVE]: Point(x=117, y=42)\n\n[JAVA ]: After swap via 'setX' / 'setY' in Java\n[JAVA ]: Point(x=42, y=117)\n[NATIVE]: Point(x=42, y=117)\n</code></pre>\n"^^ . "0"^^ . "0"^^ . "1"^^ . . . . . . "1"^^ . . . "<p>I'm writing a game using Raylib with the help of Premake5. I used a template to get started, specifically this one; <a href="https://github.com/raylib-extras/game-premake" rel="nofollow noreferrer">https://github.com/raylib-extras/game-premake</a>.\nI can't seem to figure out how to just link a set <code>.lib</code>. The reason I require this is that LuaJIT is very difficult to embed. With standard lua, I just put the source files into a folder, used the provided <code>premake5.lua</code> and everything builds as expected.</p>\n<p>I used the template library <code>premake5.lua</code>, just edited to <em>try</em> to link to the specific library (LuaJIT also created 5 files, minilua.lib, buildvm.lib, luajit.lib, lua51.lib and lua51.dll, so I wasn't sure which one to use from the onset). This was what I'd tried:</p>\n<pre class="lang-lua prettyprint-override"><code>baseName = path.getbasename(os.getcwd());\n\nproject (baseName)\n kind &quot;StaticLib&quot;\n location &quot;../_build/%{os.target()}&quot;\n targetdir &quot;../_bin/%{os.target()}/%{cfg.buildcfg}&quot;\n\n links { &quot;%{os.getcwd()}/build/%{os.target()}/lua51&quot; } -- also tried luajit\n \n -- and also tried the following:\n libdirs { &quot;%{os.getcwd()}/build/%{os.target()}&quot; }\n links { &quot;lua51&quot; --[[or &quot;luajit&quot;]] }\n</code></pre>\n<p>Though this seems to make the project to be treated as though it has source files. I attempted to circumvent Premake entirely via adding <code>linkoptions { &quot;../../lua/build/%{os.target()}/lua51.lib&quot; }</code> to the game's premake file directly, but the linker would still complain about undefined references to all Lua api functions. Here's an excerpt from the generated makefile;</p>\n<pre><code>ifeq ($(config),debug_x64)\nTARGETDIR = ../../_bin/windows/Debug\nTARGET = $(TARGETDIR)/project_unbound.exe\nOBJDIR = obj/x64/Debug/project_unbound\nDEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_WIN32 -DGRAPHICS_API_OPENGL_43\nALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -g -std=c99\nALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -g -std=c++17\nLIBS += ../../_bin/windows/Debug/raylib.lib ../../_bin/windows/Debug/sqlite3.lib ../../_bin/windows/Debug/flecs.lib -lwinmm -lkernel32 -lopengl32 -lgdi32\nLDDEPS += ../../_bin/windows/Debug/raylib.lib ../../_bin/windows/Debug/sqlite3.lib ../../_bin/windows/Debug/flecs.lib\n\n##### the above mentioned &quot;workaround&quot; causes the path to be added here, instead of above with the rest of the linked libraries\nALL_LDFLAGS += $(LDFLAGS) -L../../_bin/windows/Debug -L/usr/lib64 -m64 ../../lua/build/windows/lua51.dll \n</code></pre>\n<p>Following <a href="https://stackoverflow.com/questions/55039294/directx12-with-premake5-linking-directx12-static-libraries">DirectX12 with Premake5: Linking Directx12 Static Libraries</a>, the linker errors: 'C:/raylib/w64devkit/bin/ld.exe: cannot find -llua51: No such file or directory'\nI feel like I'm missing something obvious.</p>\n"^^ . . "As for using a variable to "reuse" a table, yes, it's possible, just pass it as a parameter."^^ . "<p>The <em><strong>TextMate Language Pack</strong></em> provides <strong>syntax highlighting for Lua</strong> (see <a href="https://github.com/eclipse/tm4e/tree/main/org.eclipse.tm4e.language_pack/syntaxes/lua" rel="nofollow noreferrer">here</a>) and for other languages and formats. It can be installed via <em><strong>Help &gt; Install New Software...</strong></em> working with the update site <a href="https://download.eclipse.org/tm4e/releases/latest/" rel="nofollow noreferrer"><code>https://download.eclipse.org/tm4e/releases/latest/</code></a>.</p>\n<p>Please note that the <a href="https://eclipse.dev/ldt/" rel="nofollow noreferrer">Lua Development Tools (LDT)</a> which provides better support for Lua is currently <a href="https://gitlab.eclipse.org/eclipse/ldt/ldt/-/issues/1" rel="nofollow noreferrer">looking for new contributors/committers</a>. Otherwise it is likely to be archived soon.</p>\n"^^ . "<p>The <code>implicit_figures</code> extension makes pandoc treats an image as a figure if it would otherwise be the only element in a paragraph. HTML comments count as elements, so do something like this to prevent an image from being treated as a figure:</p>\n<pre class="lang-markdown prettyprint-override"><code>![](./image.png){ .center width=200px }&lt;!-- not a figure --&gt;\n</code></pre>\n<p>Also note that the Lua code to check for a class should be updated:</p>\n<pre class="lang-lua prettyprint-override"><code>function Image (elem)\n if elem.classes:includes &quot;center&quot; then\n return {\n pandoc.RawInline('latex', '\\\\hfill\\\\break{\\\\centering'),\n elem,\n pandoc.RawInline('latex', '\\\\par}')\n }\n end\nend\n</code></pre>\n"^^ . . . . "0"^^ . . "-2"^^ . . "<p>I use imapfilter that uses a Lua script as config.\nI am trying to match emails subjects containing [sometext] at any position.</p>\n<p>So I tried:</p>\n<pre><code>results = account1.INBOX:contain_subject('[sometext]')\n</code></pre>\n<p>This performs a search on the server side.\nIt generates the following IMAP command:</p>\n<pre><code>UID SEARCH CHARSET &quot;ISO-8859-15&quot; ALL SUBJECT &quot;[sometext]&quot;\n</code></pre>\n<p>But it matches <code>sometext</code> even without the brackets.</p>\n<p>Same thing happens for:</p>\n<pre><code> results = account1.INBOX:match_subject('%[sometext%]')\n</code></pre>\n<p>This performs a local search so it first downloads all the Subject headers and then it matches them against the regular expression. But, it does not match anything.</p>\n<p>What would be the correct way to match the <code>[sometext]</code> string in my subjects?</p>\n<p><strong>UPDATE</strong></p>\n<p>I gave up on trying to find how to make an exact search on an IMAP server. I tried using other clients than Imapfilter and even telnet directly into the IMAP server to verify the results of a SEARCH command, and they all behaved in the same way, returning wrong results. So the sloppy search issue is on the IMAP server side.</p>\n<p>So what I ended up doing is a two pass operation. First I send the SEARCH, then I filter the search results on the client side to eliminate the wrong ones. Not ideal but I have no more time to waste on this.</p>\n<p>I'll let the question open in case someone finds a solution.</p>\n"^^ . . "<p>I generaly new to Roblox scripting and scripting and general. I am trying to make a clicker game so I made a auto clicker option for players to buy. One is a fast version and one is a regular verison. I scripted the fast version but noticed that sometimes, my ui would say 100.00M (Which is what I had for a place holder in my scene) instead of &quot;17&quot; (Which is the amount of clicks I had) I have data storing and it was working just fine before I added the auto clicker. I asked chatgpt and it gave me a script but that made it just a little better. I also asked my Uncle who is a very good programmer and had pretty good experience with Lua but he also couldn't figue it out.</p>\n"^^ . "<p>How can I get user input for <code>io.read()</code>?</p>\n<p>As I saw on GitHub, in <code>Globals.java</code> there is this code:</p>\n<pre class="lang-java prettyprint-override"><code>public InputStream STDIN = null;\n</code></pre>\n<p>So I tried:</p>\n<pre class="lang-java prettyprint-override"><code>Globals globals = JsePlatform.standardGlobals();\nglobals.STDIN = System.in;\nglobals.load(new JseBaseLib());\nglobals.load(new PackageLib());\nglobals.load(new OsLib());\nLuaValue chunk = globals.load(&quot;a=io.read(); print(a)&quot;);\nchunk.call();\n</code></pre>\n<p>But it did not work.</p>\n"^^ . "0"^^ . "1"^^ . . "1"^^ . . "cors"^^ . . . . . . "<p>So i have been trying to setup a TTT Server running the moat addon uploaded by moat - The upload is however very old, this is the github <a href="https://github.com/colemclaren/ttt" rel="nofollow noreferrer">https://github.com/colemclaren/ttt</a></p>\n<p>I have been trying to get it to work. But just can't seem to get the code to work, these are the current things i have done.</p>\n<ul>\n<li>Installing TTT-Master</li>\n<li>Updating mysqloo to newest version</li>\n<li>installing tmysql4 in garrysmod/lua/bin (Tmysql4 was called in garrysmod/lua/dash/libraries/server/mysql.lua</li>\n<li>configuring top part of addons/moat_addons/lua/system/cfg/sql/sv_config.lua to be configured to my database</li>\n</ul>\n<p>Looking at the console i still have many errors. However it did solve a fair few. I saw it write some tables to the database but there is still a lot missing from the full addon. I don't have a inventory ingame, chat function is broken, Item system is broken and it's spewing lua errors in the ingame console aswell.</p>\n<p>Here is the ones i see from the server console.</p>\n<pre><code>05/28/2024 - 15:58:25: Lua Error: [moat_addons] addons/moat_addons/lua/_dev/init.lua:3: attempt to index global 'yugh' (a nil value) 1. unknown - addons/moat_addons/lua/_dev/init.lua:3 2. include - [C]:-1 3. unknown - addons/moat_addons/lua/system/app/core/init.lua:607 4. include - [C]:-1 5. unknown - addons/moat_addons/lua/autorun/init.lua:4\n05/28/2024 - 15:58:25: Lua Error: [moat_addons] addons/moat_addons/lua/system/cfg/discord/sv_webhooks.lua:45: attempt to index global 'slack' (a nil value) 1. unknown - addons/moat_addons/lua/system/cfg/discord/sv_webhooks.lua:45 2. include - [C]:-1 3. unknown - addons/moat_addons/lua/system/app/core/init.lua:607 4. include - [C]:-1 5. unknown - addons/moat_addons/lua/autorun/init.lua:4\n05/28/2024 - 15:58:25: Lua Error: [moat_addons] addons/moat_addons/lua/system/app/include.lua:13: attempt to index global 'yugh' (a nil value) 1. load - addons/moat_addons/lua/system/app/include.lua:13 2. unknown - addons/moat_addons/lua/system/app/include.lua:34 3. include - [C]:-1 4. unknown - addons/moat_addons/lua/system/app/core/init.lua:607 5. include - [C]:-1 6. unknown - addons/moat_addons/lua/autorun/init.lua:4\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/system/app/ux/core/palette.lua:62: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/system/app/core/datastore.lua:49: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: [moat_addons] addons/moat_addons/lua/system/app/core/datastore.lua:65: attempt to call field 'sql' (a nil value) 1. unknown - addons/moat_addons/lua/system/app/core/datastore.lua:65 2. include - [C]:-1 3. unknown - addons/moat_addons/lua/system/app/core/init.lua:607 4. include - [C]:-1 5. unknown - addons/moat_addons/lua/autorun/init.lua:4\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/assets/weapon_sounds.lua:3396: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/d3a/server/_commands/forcemotd.lua:132: in main chunk [C]: in function 'include' addons/moat_addons/lua/plugins/d3a/server/sv_commands.lua:80: in function 'Load' addons/moat_addons/lua/plugins/d3a/server/sv_commands.lua:90: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/d3a/server/sv_player_checkpass.lua:195: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/mapvote/core/sv_mapvote.lua:85: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/mapvote/prevent/init.lua:62: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/chat/sv_logger.lua:20: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/chat/sv_logger.lua:32: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/deathmsgs/chatmsg/sv_notify.lua:3: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/deathmsgs/chatmsg/sv_notify.lua:7: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/deathmsgs/chatmsg/sv_notify.lua:17: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/hit/sv_ahr.lua:187: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/inv2/init.lua:65: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/inv2/shared/sh_omegas.lua:181: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/inv2/ass/paints/sh_testskin.lua:38: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/inv2/ass/seasonal/easter/sv_moateaster.lua:124: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/scoreboard/levels/sv_level_color.lua:43: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/sessions/sv_servers.lua:18: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/terrortown/hs_sound_sv.lua:3: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/terrortown/hs_sound_sv.lua:13: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/terrortown/sv_buddy_damage.lua:11: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/plugins/moat/modules/weapons/sh_vm.lua:5: in main chunk [C]: in function 'include' addons/moat_addons/lua/system/app/core/init.lua:607: in main chunk [C]: in function 'include' addons/moat_addons/lua/autorun/init.lua:4: in main chunk\n05/28/2024 - 15:58:25: Lua Error: [ERROR] AddCSLuaFile: Couldn't find 'weapons/gmod_tool/shared.lua'\n05/28/2024 - 15:58:25: Lua Error: bad argument #3 to hook.Add (function expected, got nil) stack traceback: addons/moat_addons/lua/entities/peace_sentry/init.lua:83: in main chunk\n05/28/2024 - 15:58:25: Lua Error: Refusing to load ttt_ending_slow_motion because it is missing Type and Base keys!\n\n05/28/2024 - 15:58:27: Lua Error: addons/moat_addons/lua/plugins/moat/modules/sessions/sv_servers.lua:125: attempt to call field 'mysql' (a nil value) stack traceback: [C]: in function 'mysql' addons/moat_addons/lua/plugins/moat/modules/sessions/sv_servers.lua:125: in function &lt;addons/moat_addons/lua/plugins/moat/modules/sessions/sv_servers.lua:121&gt; lua/dlib/modules/hook.lua:904: in function 'Run' addons/moat_addons/lua/system/app/core/datastore.lua:36: in function &lt;addons/moat_addons/lua/system/app/core/datastore.lua:26&gt; [C]: at 0x7185a8d0 lua/dlib/modules/hook.lua:904: in function &lt;lua/dlib/modules/hook.lua:900&gt;\n05/28/2024 - 15:58:27: Lua Error: addons/moat_addons/lua/plugins/moat/modules/inv2/server/sv_tabs_bounties.lua:269: attempt to index a nil value stack traceback: [C]: in function '__index' addons/moat_addons/lua/plugins/moat/modules/inv2/server/sv_tabs_bounties.lua:269: in function &lt;addons/moat_addons/lua/plugins/moat/modules/inv2/server/sv_tabs_bounties.lua:267&gt; [C]: at 0x7185a8d0 lua/dlib/modules/hook.lua:904: in function &lt;lua/dlib/modules/hook.lua:900&gt;\n05/28/2024 - 15:58:27: Lua Error: addons/moat_addons/lua/plugins/moat/modules/inv2/server/sv_tabs_bounties.lua:320: attempt to index a nil value stack traceback: [C]: in function '__index' addons/moat_addons/lua/plugins/moat/modules/inv2/server/sv_tabs_bounties.lua:320: in function &lt;addons/moat_addons/lua/plugins/moat/modules/inv2/server/sv_tabs_bounties.lua:319&gt; [C]: at 0x7185a8d0 lua/dlib/modules/hook.lua:904: in function &lt;lua/dlib/modules/hook.lua:900&gt;\n\n05/28/2024 - 15:58:28: Lua Error: [moat_addons] addons/moat_addons/lua/system/app/yugh/extensions/http.lua:58: attempt to call upvalue 'Struct' (a nil value) 1. unknown - addons/moat_addons/lua/system/app/yugh/extensions/http.lua:58\n</code></pre>\n<p>This one is probably safe to ignore for now - this seems to be because i haven't connected the discord webhooks yet - but can easily be done.</p>\n<pre><code>05/28/2024 - 15:58:25: Lua Error: [moat_addons] addons/moat_addons/lua/system/cfg/discord/sv_webhooks.lua:45: attempt to index global 'slack' (a nil value) 1. unknown - addons/moat_addons/lua/system/cfg/discord/sv_webhooks.lua:45 2. include - [C]:-1 3. unknown - addons/moat_addons/lua/system/app/core/init.lua:607 4. include - [C]:-1 5. unknown - addons/moat_addons/lua/autorun/init.lua:4\n</code></pre>\n<p>So given the fact installation isn't really documented i could only hope that i could get it to work like it was back in the day on moat. But i don't know if this is just horrible outdated.</p>\n<p>I have tried the steps i wrote earlier - I have also tried adding this <a href="https://github.com/SuperiorServers/dash" rel="nofollow noreferrer">https://github.com/SuperiorServers/dash</a> which is the newest version of dash that i could find. It made no changes or maybe gave more errors hard to judge ^^</p>\n<p>I don't know exactly what to do. I don't know if is the dependencies that are outdated or what exactly is the issue for it not working. So i am at a loss - Hopefully one of you can help, i would appreciate it greatly!</p>\n"^^ . "@boombuster2000 because that is how Lua, and most languages pass an object around, for numbers and strings it is trivial to copy but a table could have all sorts of edge cases, like how deep the copy should be."^^ . . "0"^^ . . . "2"^^ . "Why has it passed a pointer?"^^ . "0"^^ . . . "As I said, if you need to focus on an actual solution, rephrase the question with the workflow you need (to quote myself *"first say what you need, what needs to happen and why"*), else, the answer focused on the initial question which was not what you actually wanted (although it did fix your value problem). If what you want is more complex and different though, you'll need to [ask a new question](https://meta.stackexchange.com/q/222735). As you're new to the community, also read [How do I ask a good question](https://stackoverflow.com/help/how-to-ask) as reference."^^ . . . . "1"^^ . "coronasdk"^^ . . "Can HAProxy support JWT validation and CORS together?"^^ . . "0"^^ . "0"^^ . . . . "As advice, if you're using a third party library, framework, workflow or environment, it is better to label it as well. So lua is the language, but the libraries are those of roblox. In your case there was not much difference but the function name did surprise me. If you need help with it more, update the question and we'll see how we can go from there. Else, if you think my answer helped you, [upvote the answer](https://stackoverflow.com/help/someone-answers). Normally also mark as accepted if it fixed your issue, but it was more an XY so it didn't in this case I guess."^^ . . . "1"^^ . "pdf"^^ . "1"^^ . . . . "1"^^ . "0"^^ . . . . "1"^^ . "0"^^ . . . . "Nitpick: Nothing is not quite the same as `nil` - it's the empty vararg, which will turn into `nil` when used as a value. However there are scenarios in which the difference can be seen - for example `print(foo())` would print a blank line rather than `nil`; `assert(foo())` would complain about expecting a value."^^ . . . . "<blockquote>\n<p>Attempt to index nil with position drops</p>\n</blockquote>\n<p>I am not sure how you get from the actual error message to this title.</p>\n<p>The error tells you that in line 35 you'r indexing a nil value with 'Position'.</p>\n<p>This means that you should look for <code>something.Position</code>, <code>something:Position(</code> or <code>something[&quot;Position&quot;]</code> in that line.</p>\n<p>And you'll find that indexing of something which in your case is either <code>Character.PrimaryPart.Position</code> or <code>Drop.PrimaryPart.Position</code>.</p>\n<p>In order to find out which of both is nil, in case it is not obvious from the code you can usually just <code>print(Character.PrimaryPart)</code> and <code>print(Drop.PrimaryPart)</code>.</p>\n<p>If you get a value form somewhere that can be nil you should check if it is nil befor you do anything with it.</p>\n"^^ . . "2"^^ . "Good luck, let me know if it works out and I'll type up a real answer. I just recalled that a common thing people do is destroy the object, then replace it with a visual object without physics that shows the destroyed version of the object and it too would have a shelf life and auto despawn after some time. Throw in some randomization on how long it takes and you got some good staggering."^^ . "1"^^ . . "<p>I am currently unable to find a debbugging configuration for ndap that works for my setup.</p>\n<p>The typescript setup is straight forward. tsc transpiles to the /dist folder and the entry point is the dist/index.js file</p>\n<p>I have read through numerous guides and been trying to find a solution online but nothing worked. I am using nixvim but the setup is just lua. I have been able to set up javascript without any problems so the nodeJs &lt;-&gt; debugger connection works without a problem. However if I try typescript the application just runs through without hitting any breakpoints.\nMy guess is that there is something preventing the source maps from being registered correctly however I do not see any error messages. Also the usual launch.json files to work in vscode without any problems. Here is my current config (one of many I have tried)</p>\n<pre class="lang-lua prettyprint-override"><code>-- ...\n local js_based_languages = {\n &quot;typescript&quot;,\n &quot;javascript&quot;,\n &quot;vue&quot; \n };\n\n dap_vscode_js.setup({\n adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' }\n })\n\n\n -- DEBUG CONFIG\n for _, language in ipairs(js_based_languages) do\n\n dap.configurations[language] = {\n {\n type = &quot;pwa-node&quot;,\n request = &quot;launch&quot;,\n name = &quot;new launch&quot;,\n program = &quot;index.js&quot;,\n cwd = &quot;''${workspaceFolder}/dist&quot;,\n },\n -- ...\n }\n end\n-- ...\n</code></pre>\n<p>I also worked with program being *dist/index.js&quot; and the default cwd being the workspaceFolder. I have experimented with all kinds of values for outFiles or resolveSourceMapLocations. I have explicitly set sourceMaps to true. All with the same outcome.</p>\n"^^ . . "1"^^ . . . . "1"^^ . . . "<p>I am making a game that requires a large amount of values, I have it so there are two values: StringValue and IntValue. The intvalue holds the number of the clicks that the player has and then the main script takes the value from the intvalue shortens it and make it look like &quot;100k&quot; but when I go over 9.2Qi or something like that it will be 0 or it won't go up anymore please help me out here.</p>\n"^^ . . . . . . . . . "0"^^ . . "1"^^ . "1"^^ . . "1"^^ . "Thank you, I'll amend it and mark as solution"^^ . . . "Great, these were exactly the commands I needed. Thank you. I'm still surprised that lua-based xmake does not have this type of project in its examples."^^ . . "0"^^ . . . . . . . . . . "0"^^ . . . . "Carmichael function not incrementing k"^^ . . "0"^^ . . . . "Does kong not build if you make a local rockspec file where you specify the `pgmoon` version as `1.12.0`? in the `kong-0.11.0-0.rockspec` you will find a table called `dependencies` and can change `"pgmoon == 1.8.0"` to `"pgmoon == 1.12.0"`"^^ . "4"^^ . . . . "Module script variable returning as nil"^^ . "mysql"^^ . . . . . "0"^^ . "@Kylaaa thanks for your comment. i didnt know these values were already there. guess i've learned something today too!"^^ . . . "2"^^ . . . . "3"^^ . . "<p>The solution was indeed to use <code>libdirs { &quot;path/to/lib&quot; }</code> and <code>links { &quot;libname&quot; }</code>, though variables in the path were causing issues. setting the path as a fixed string fixed everything.</p>\n"^^ . "0"^^ . . . . . . . . "How to change the cursor thickness on Insert modes in Vim?"^^ . . . . "Check a physical state of a mouse button?"^^ . . "<p>I am trying to change a part's texture just for the local player, but it doesn't work at all.</p>\n<p>I've tried to change it trough a localscript, which I put inside the model in which the part is contained, but nothing happens at all. This is a problem of the localscript, as this same code works in a server script.\nAny help is welcomed</p>\n"^^ . . . ""x is true if and only if y" means that x is true if y, and only in that case. "x is true if y" means that x is true if y, but not necessarily only in that case. People are generally sloppy about the distinction. Compiler authors and a few others take this kind of thing very seriously, though."^^ . "solar2d"^^ . . "<p>If you have access to the <code>load</code> <a href="https://www.lua.org/manual/5.3/manual.html#6.1:%7E:text=load%20(chunk%20%5B%2C%20chunkname%20%5B%2C%20mode%20%5B%2C%20env%5D%5D%5D)" rel="nofollow noreferrer">function</a> you can turn the string into a table (assuming the string will always be valid Lua syntax)</p>\n<pre class="lang-lua prettyprint-override"><code>local importedTable = load(&quot;return &quot; .. tableToImport:gsub(&quot;InstanceInput&quot;, &quot;&quot;))()\n\nprint(importedTable[&quot;Item1&quot;].Name) --&gt; &quot;Name&quot;\n</code></pre>\n<p>How it works is the string passed to load is compiled as a Lua function chunk, which you then can call like any other function which is why you prefix it with <code>return</code> so that when called it returns the Lua table.</p>\n"^^ . . "<p>Roblox does not recommend using their web api inside your game. a great (client sided) solution for this would be using <a href="https://create.roblox.com/docs/reference/engine/classes/AvatarEditorService" rel="nofollow noreferrer">AvatarEditorService</a></p>\n<p>here you can do the following:</p>\n<pre class="lang-lua prettyprint-override"><code>local AvatarEditor = game:GetService(&quot;AvatarEditorService&quot;);\n\nAvatarEditor.PromptAllowInventoryReadAccessCompleted:Connect(function(Result)\n if (Result == Enum.AvatarPromptResult.Success) then\n local Page = AvatarEditor:GetInventory({Enum.AvatarAssetType.Gear});\n\n Items = {};\n while (not Page.IsFinished) do\n local pageItems = Page:GetCurrentPage();\n for _, v in pairs(pageItems) do\n table.insert(Items, v);\n end\n end\n\n -- all gears inside &quot;Items&quot; variable\n else\n -- player denied permission\n end\nend)\n\nAvatarEditor:PromptAllowInventoryReadAccess();\n\n</code></pre>\n"^^ . . . . "0"^^ . . . . . . "0"^^ . . . . . . . . . . "1"^^ . . "Well, keep in mind that `#table` is *not exactly* the element count of that table. For example `print( #{1,nil,2,nil})` will not display 2, nor 4. It will display 1, despite having 2 clear non-null elements in it. That's just to make sure we're all clear on what the code does, before we start using it. As for your request, what are the rules of `lastPick`? For example your arrays are not sharing item values. Are you also asking how to also retain the last returned value of each table? (else `lastPick` makes little sense, unless you're sure you'll use the same table consecutively)"^^ . "1"^^ . . . "0"^^ . . . . . "3"^^ . . "Answer 1 is the only one that seems feasible because of a few main reasons.\n#2 does not work properly with the current system, but wouldn't be much of a help anyways, as many of the maps in the game have invisible barriers to prevent parts from leaving the boundary\n#3 was attempted, but didn't reduce lag\nand #4 is just bad design on our part, because the lobby for the game is 10k studs away from 0,0,0. This means that the game opening menu will not load because it cannot find the Camera1 in workspace (because technically, it doesn't exist)\n\nI will experiment and respond with results"^^ . . . . "latex"^^ . . "0"^^ . . "to use Drop.PrimaryPart you have to actually set the primary part before that else the engine wouldn't know what the primary part is. https://create.roblox.com/docs/reference/engine/classes/Model#PrimaryPart"^^ . . . . . "2"^^ . "5"^^ . "0"^^ . . . "0"^^ . . . . . . . . . . . . . . "1"^^ . . "0"^^ . "2"^^ . . . "2"^^ . "<p>it appears that lua just gives a pointer to the table location instead of giving a copy.\n<a href="https://onecompiler.com/lua/42e9nrkup" rel="nofollow noreferrer">https://onecompiler.com/lua/42e9nrkup</a></p>\n<p>a way to fix this could be by copying the table yourself by doing:</p>\n<pre class="lang-lua prettyprint-override"><code>local copy = table.pack(table.unpack(playersToAssignRoles))\n</code></pre>\n"^^ . "kaltura/nginx-vod-module access to remote to json manifest file in s3"^^ . "0"^^ . . . . . . . . . "1"^^ . "2"^^ . "0"^^ . . . . "0"^^ . "0"^^ . "0"^^ . . "0"^^ . . "fivem"^^ . "1"^^ . "0"^^ . "local hundred is never initialized"^^ . . "0"^^ . "Worked... thanks. Don´t you want to create a answer so I can accept it ?"^^ . . . "0"^^ . . . . . . . . . "0"^^ . . . "0"^^ . "0"^^ . . . . "<p>I am attempting to run a read-only Sysbench benchmark against a Mycat instance (acting as a distributed database middleware), using the command:</p>\n<pre><code>sysbench ./oltp_read_only.lua --mysql-db=zzz-test --mysql-user=xxx --mysql-password=xxx --mysql-host=xxx --mysql-port=8066 --tables=10 --threads=1 --report-interval=10 --time=60 run\n</code></pre>\n<p>when I debug with <code>Mycat</code>, it goes well and got the Result Set successfully. But <code>sysbench</code> went wrong, print error info:</p>\n<blockquote>\n<p>Threads started!<br>\nFATAL: mysql_stmt_execute() returned error 0 () for query 'SELECT c FROM sbtest3 WHERE id BETWEEN ? AND ?'\nFATAL: `thread_run' function failed: ./oltp_common.lua:432: SQL error, errno = 0, state = '00000': **</p>\n</blockquote>\n<p>Curiously, the reported SQL error state ('00000') usually denotes a successful operation in MySQL context, adding to the confusion.\nso I replace MyCat with a real MySql server, and everthing went well and I got the sysbench stats;</p>\n<p>what's wrong ?</p>\n<p>Environment Details:</p>\n<p>Sysbench Version: [1.0.20]<br>\nMycat Version: [1.6.7.6]</p>\n<p>I am seeking assistance to identify the root cause of this anomaly and steps to ensure the Sysbench benchmark operates seamlessly in line with the manual execution outcomes. Any insights, troubleshooting tips, or configuration adjustments that could resolve this issue are welcome.</p>\n<p>thanks</p>\n"^^ . "Problem with not finding the player on the path"^^ . . "0"^^ . . "6"^^ . . . . . . "0"^^ . . . . "The premise of this question is, in general, wrong. It would need to be specified more precisely in which context local variables are "hardly in use"; and even then it would probably still be quite an opinionated question."^^ . . . "Roblox Tower Placement System Causes Towers to Jump and Float"^^ . "0"^^ . . "0"^^ . "0"^^ . "0"^^ . "Linking LuaJIT or other prebuilt static C libraries with Premake5"^^ . . "@TheLemon27 yes mb i made it out of my head so it had some errors, i fixed that now!"^^ . . "lua-patterns"^^ . . . . . . . . "2"^^ . . "0"^^ . "0"^^ . "0"^^ . . . . "0"^^ . . . "0"^^ . "1"^^ . "0"^^ . . "<p>Since <code>%g+</code> matches one or more printable chars and <code>&quot;</code> is also a printable char. So, you need to match any printable characters other than <code>&quot;</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>s1 = &quot;bibliography: /home/user/file.lib&quot;\ns2 = 'bibliography: &quot;/home/user/file.lib&quot;'\nprint(string.match(s1, 'bibliography: &quot;?([^%G&quot;]+)&quot;?'))\n-- /home/user/file.lib\nprint(string.match(s2, 'bibliography: &quot;?([^%G&quot;]+)&quot;?'))\n-- /home/user/file.lib\n</code></pre>\n<p>See the <a href="https://tio.run/##yylN/P@/2FDBVkEpKTMpJzM/vSixIKPSSkE/Iz83Vb@0OLVIPy0zJ1UvJzNJiavYCKhQHVWhEjaV6lwFRZl5JRrFJUAqXS83sSQ5Q6PYUAdDs71GdJyqu1KstqaSvbqmJpeuLjabsZpmRK5p//8DAA" rel="nofollow noreferrer">Lua demo</a>.</p>\n<p>The <code>[^%G&quot;]+</code> pattern matches one or more characters (<code>+</code>) other than non-printable chars (<code>%G</code>) and <code>&quot;</code>.</p>\n"^^ . . . . . "0"^^ . . . . . . . "<p>I'm trying to write a lua filter for Quarto/pandoc that removes all code blocks that do not match the target languages as defined in the yaml header of the document. This is the filter I got <a href="https://stackoverflow.com/a/78563234/5028841">from another answer</a>:</p>\n<pre class="lang-lua prettyprint-override"><code>function Pandoc (doc)\n if doc.meta.target_lang then\n local target_lang = pandoc.utils.stringify(doc.meta.target_lang)\n print(&quot;target lang is &quot; .. target_lang)\n return doc:walk {\n CodeBlock = function (cb)\n if cb.classes[1] ~= target_lang then\n return {}\n end\n end\n }\n end \n return doc\n end\n</code></pre>\n<p>However, this one returns an empty codeblock, which is annoying when rendering to <code>ipynbb</code>:</p>\n<pre><code>{\n &quot;cell_type&quot;: &quot;code&quot;,\n &quot;execution_count&quot;: null,\n &quot;metadata&quot;: {},\n &quot;outputs&quot;: [],\n &quot;source&quot;: [],\n &quot;id&quot;: &quot;c0eaebc8-2af1-42bc-840a-dda2e54fddbb&quot;\n}\n</code></pre>\n<p>This is the original document:</p>\n<pre><code>---\ntitle: Some title\nauthor: Some author\ndate: last-modified\nformat:\n ipynb: \n toc: false\n filters: \n - langsplit.lua\ntarget_lang: &quot;python&quot;\n---\n\nHere is some text.\n\n```{python test-py}\nprint(&quot;some python code&quot;)\n```\n\n```{r test-r}\nprint(&quot;some R code&quot;)\n```\n</code></pre>\n"^^ . . . . . "0"^^ . "1"^^ . . . "1"^^ . "<p>Use sound:Play() and sound:Stop() instead of using sound.Playing.</p>\n<p>sound:Stop() resets the sound to the beginning of the track instead of wherever it currently is.</p>\n<p>You can use :Resume() and :Pause() respectively to start and stop at the current position.</p>\n<p><a href="https://create.roblox.com/docs/reference/engine/classes/Sound#Pause" rel="nofollow noreferrer">Documentation for the Sound class</a></p>\n"^^ . "1"^^ . "Bear in mind that CORS-preflight requests do not carry any credentials. Make sure that JWT validation occurs _+after_ (not before) CORS is handled."^^ . . . . . . . "0"^^ . "0"^^ . . "0"^^ . . . "<p>In your code, you compared the object to an undefined parameter, which will return false. First check if <code>otherpart</code> is a part, then check if it has the same name as the <code>orb</code>, and then destroy <code>object</code>.</p>\n<p>Use a basic system like this:</p>\n<pre><code>--server script\nlocal function onHit(otherpart)\n if otherpart:IsA(&quot;BasePart&quot;) then\n if otherpart.Name==orb.Name then\n object:Destroy()\n \n</code></pre>\n"^^ . "1"^^ . . . . . . "1"^^ . . . . "debugging"^^ . . . . . . . . . . "-1"^^ . . "<p>I'm using Pandoc 3.1.9 to convert a large document to PDF from markdown. The document includes a significant number of figures, and I would like some of them not to have the caption <code>Figure X: text</code> after it. My main problem is that figures stick to the left when they don't have a caption.</p>\n<p>I have tried adding a class to the image:</p>\n<pre><code>![](./image.png){ .center width=200px }\n</code></pre>\n<p>Then using a Lua filter to check for specific classes as in:</p>\n<pre class="lang-lua prettyprint-override"><code>if FORMAT:match 'latex' then\n function Image (elem)\n if elem.className == &quot;center&quot; then\n return {\n pandoc.RawInline('latex', '\\\\hfill\\\\break{\\\\centering'),\n elem,\n pandoc.RawInline('latex', '\\\\par}')\n }\n end\n end\nend\n</code></pre>\n<p>And then applying the filter on the Pandoc call:</p>\n<pre class="lang-bash prettyprint-override"><code>pandoc --lua-filter=center.lua &lt;myfile&gt;.md -o &lt;myfile&gt;.pdf\n</code></pre>\n<p>But this won't work. Other threads have suggested removing the <code>markdown-implicit_figures</code>, but it does it for every image in the document, and I don't want that. Anyone can help?</p>\n"^^ . "<p>in lua if you wanna index with a variable you need to do the following:</p>\n<pre class="lang-lua prettyprint-override"><code>game.Players[PlayerName].Settings.Data.Ability.Value\n</code></pre>\n<p>or</p>\n<pre class="lang-lua prettyprint-override"><code>game:GetService(&quot;Players&quot;):FindFirstChild(PlayerName).Settings.Data.Ability.Value\n</code></pre>\n"^^ . . . . . . "1"^^ . "1"^^ . . . . . "0"^^ . . . . . . . "2"^^ . . . . . . "0"^^ . . . "How to access Lua global object from another script?"^^ . . . . "Love 2d - match 3, I get a stack overflow"^^ . "0"^^ . "cygwin"^^ . "0"^^ . "3"^^ . . . . "`[^\\\\scalebox]` is a negated character class. You're telling Lua to match "one or more characters which are not in the set {\\, s, c, a, l, e, b, o, x}"."^^ . . "6"^^ . . . . . . "3"^^ . . "wezterm"^^ . "thank u lol, what a stupid midunderstanding."^^ . . . . . "scrapy"^^ . . "<p>I'm working through the CS50 intro to game dev course and I'm having a syntax error I've been beating my head against.</p>\n<p>I'm trying to write a function using the knife timer library that will be called every update to check the current alpha to see if it is at it max or min value and if so tween it to the opposite to create a pulsing effect. However I'm getting a syntax error that I can't solve. I've looked at the examples from the lecture, the repo provided for the project, and the knife timer library readme and been unable to find how my syntax varies from any of them.</p>\n<p>Function below</p>\n<pre><code>function Tile:shimmer()\n if self.alpha == SHINYHIGHESTALPHA then\n Timer.tween(1, {\n [self] = {self.alpha = SHINYLOWESTALPHA}\n })\n elseif self.alpha == SHINYLOWESTALPHA then\n Timer.tween(1, {\n [self] = {self.alpha = SHINYHIGHESTALPHA}\n })\n end\nend\n</code></pre>\n<p>and the error I get, line 41 is <code>[self] = {self.alpha = SHINYLOWESTALPHA}</code></p>\n<pre><code>Error\n\nSyntax error: src/Tile.lua:41: '}' expected near '='\n\n\n\nTraceback\n\n[love &quot;callbacks.lua&quot;]:228: in function 'handler'\n[C]: at 0x7ffeef872fa0\n[C]: in function 'require'\nsrc/Dependencies.lua:35: in main chunk\n[C]: in function 'require'\nmain.lua:34: in main chunk\n[C]: in function 'require'\n[C]: in function 'xpcall'\n[C]: in function 'xpcall'\n\n</code></pre>\n"^^ . "Where are you getting your variables from? It's unclear what your variables are and their types. Please edit your question to show what each variable is."^^ . "0"^^ . . . "1"^^ . . . "<p>My <code>local players</code> table uses the PlayerServerId as Index.</p>\n<p>When i now want to access the player data at Index 1 (My PlayerServerId) i get <code>nil</code> as a result.</p>\n<p>But when i now iterate through the players table and print out the index for the iterations, I get the Index 1 (like how i expect)</p>\n<p><strong>Debug Code:</strong></p>\n<pre><code>print(&quot;PlayerServerId: &quot;.. GetPlayerServerId(PlayerId())) -- --&gt; Output: &quot;PlayerServerId: 1&quot;\n\nprint(players[1]) -- --&gt; Output &quot;nil&quot;\n\nfor i, player in pairs(players) do\n print(&quot;Index: &quot; .. i) -- --&gt; Output: &quot;Index: 1&quot;\nend\n</code></pre>\n<p><strong>Output:</strong>\n<img src="https://i.sstatic.net/0jcc6GCY.png" alt="image of output" /></p>\n<p>How is this possible? What am i doing wrong or what do I oversee?</p>\n<p>I tried to debug every single step to make sure the data i want to access is available.</p>\n"^^ . . . "Neovim: <leader>pv key mapping not working for :Ex command in init.lua"^^ . . . . "0"^^ . "0"^^ . . . "1"^^ . "pattern-matching"^^ . . . . "chat"^^ . . "<p>It is possible to make a part that is welded to the player's HumanoidRootPart. You can do this by instancing a weld object to the player's torso. Here is an example:</p>\n<pre><code> player.CharacterAdded:connect(function(char)\n \n local torso = char:WaitForChild(&quot;HumanoidRootPart&quot;) --You can change this to another body part\n \n local newPart = Instance.new(&quot;Part&quot;, char)\n newPart.Massless = true --You will likely want to set at least these properties\n newPart.CanCollide = false\n newPart.Anchored = false\n \n local weld = Instance.new(&quot;Weld&quot;, torso) --Could also use a Motor6D, or likewise\n weld.C0 = CFrame.new() --Both C0 and C1 are, by default, set to a blank CFrame\n weld.C1 = CFrame.new()\n weld.Part0 = torso\n weld.Part1 = newPart\n \n end)\nend)\n</code></pre>\n<p>Source: <a href="https://devforum.roblox.com/t/how-do-i-attach-a-part-onto-a-players-torso/1085376" rel="nofollow noreferrer">Here</a></p>\n"^^ . . . "1"^^ . . . . . "<p>You set a <em>Normal mode mapping</em>, as in <a href="https://vimhelp.org/map.txt.html#key-mapping" rel="nofollow noreferrer"><code>:help key-mapping</code></a>. This is accessible directly from Normal mode by pressing the sequence of keys <code> pv</code> (that's <kbd>Space</kbd><kbd>P</kbd><kbd>V</kbd>).<br />\nYou must not prefix a colon.</p>\n<p>You're confusing mappings with <em>user-defined commands</em>, explained in <a href="https://vimhelp.org/map.txt.html#user-commands" rel="nofollow noreferrer"><code>:help user-commands</code></a>.\nBy the way, user-defined commands have to start with a capital letter to avoid confusion with the build-in Ex commands. Even if you were defining a command, it would need to be either <code>:Pv</code> or <code>:PV</code>.</p>\n<p>My recommendation would be to familiarize yourself with your editor's features by means of the built-in documentation like <a href="https://vimhelp.org/usr_toc.txt.html#user-manual" rel="nofollow noreferrer"><code>:help user-manual</code></a> before trying to follow online resources. You need to understand the basics before you can tweak them. Just my two cents, though.</p>\n"^^ . . . "0"^^ . "common-lisp"^^ . . . . . "1"^^ . . . . . . . . . . . . "This is so I can weld the part to the Torso and give the part the AssemblyLinearVelocity, so it can fling the player. I doubt it will work though, any ideas?"^^ . "<pre><code>Backpack.__index = Backpack\n</code></pre>\n<p>simply stores the table Backpack in itself at index <code>__index</code></p>\n<p>This on its own does nothing useful.</p>\n<p>As already mentioned</p>\n<pre><code>function Backpack.new()\n local obj = {}\n obj.__index = self\n return obj\nend\n</code></pre>\n<p>is also not very helpful as <code>self</code> is <code>nil</code> and assigning <code>nil</code> to <code>obj.__index</code> does not do anything in this context.</p>\n<p>First of all we replace <code>function Backpack.new()</code> with <code>function Backpack.new(self)</code> or short <code>function Backpack:new()</code> so <code>self</code> refers to <code>Backpack</code> if we call it with <code>Backpack.new(Backpack)</code> or short <code>Backpack:new()</code></p>\n<p>Then <code>obj</code> the new instance of our class <code>Backpack</code> we are about to create needs access to <code>Backpack</code></p>\n<p>This is done using a metatable.</p>\n<pre><code>function Backpack.new()\n local obj = {}\n setmetatable(obj, self) -- this is new\n obj.__index = self\n return obj\nend\n</code></pre>\n<p>Now <code>obj</code>'s metatable is new and as metamethod <code>__index</code> refers to <code>Backpack</code> Lua will always default to indexing <code>Backpack</code> whenever that index does not exist in <code>obj</code>.</p>\n<p>Otherwise you would have to implement each method and property in every instance of your class.</p>\n<p>From the manual:</p>\n<blockquote>\n<p>__index: The indexing access operation table[key]. This event happens when table is not a table or when key is not present in table. The\nmetavalue is looked up in the metatable of table.</p>\n</blockquote>\n"^^ . . . . "1"^^ . . . . . "<p>I have similar issue. Try to build Solar2d yourself with steps in this link <a href="https://forums.solar2d.com/t/how-i-made-solar2d-works-on-linux/356469" rel="nofollow noreferrer">https://forums.solar2d.com/t/how-i-made-solar2d-works-on-linux/356469</a>. In my case it solved the problem.</p>\n"^^ . "1"^^ . . . . . . "<p>Here is the code:</p>\n<pre><code>script.Parent.Activation.OnServerEvent:Connect(function()\n local part = Instance.new(&quot;Part&quot;)\n part.Size = Vector3.new(1,1,1)\n part.Transparency = 0\n part.CanCollide = false\n \n hitboxActivated = true\n script.Parent.Handle.Touched:Connect(function(hit)\n --NPC\n if hit.Parent:FindFirstChild(&quot;Torso&quot;) and hitboxActivated == true then\n local torsoPart = hit.Parent:FindFirstChild(&quot;Torso&quot;)\n hitSFX.Parent = torsoPart\n hitSFX.Volume = 2\n screamSFX.Parent = torsoPart\n hitSFX:Play()\n screamSFX:Play()\n torsoPart.AssemblyLinearVelocity = script.Parent.Handle.CFrame.LookVector * 1500\n hitboxActivated = false\n end\n --PLAYER\n if hit.Parent:FindFirstChild(&quot;Torso&quot;) and hitboxActivated == true then\n local torsoPart = hit.Parent:FindFirstChild(&quot;HumanoidRootPart&quot;)\n hitSFX.Parent = torsoPart\n hitSFX.Volume = 2\n screamSFX.Parent = torsoPart\n hitSFX:Play()\n screamSFX:Play()\n \n part.Position = torsoPart.Position\n part.AssemblyLinearVelocity = script.Parent.Handle.CFrame.LookVector * 100\n part.Parent = torsoPart\n \n local weld = Instance.new(&quot;WeldConstraint&quot;)\n weld.Part0 = part\n weld.Part1 = torsoPart\n \n hitboxActivated = false\n end\n end)\n wait(3)\n hitboxActivated = false\nend)\n</code></pre>\n<p>Whenever I test the tool in game, it doesn't apply the force onto the hit player. It just does</p>\n<pre><code>AssemblyLinearVelocity = 0,0,-0\n</code></pre>\n<p>I have tried multiple ways to try and fix, but still no luck. Does anybody know how to fix this problem?</p>\n<p>PS: It only works on NPCs, not players.</p>\n"^^ . "0"^^ . . "1"^^ . "0"^^ . . "How to wait for the model to load in Roblox? (lua)"^^ . "@LTyrone Why did you reject Andrew Yim's edit only to make the exact same change yourself in your own edit?"^^ . "<p>I am using the CC:Tweaked Minecraft Mod to attempt to automate crafting of stuff I need a lot of for other mods, and it uses lua. With the particular way the Turtles (robots) work, they need the component items inserted in certain slots in their inventory, set up like the normal crafting grid. To do this I've set up multiple chests around it and wrote a function to tell it what chest it needs to get the item for each slot from. From what I can tell, that part of the function works properly.</p>\n<p>But when I run the program and input the directions of the chest, it then gets stuck on the while loop that's meant to make it wait for the item it needs if it isn't already in the chest, despite the item being there. On observation, the turtle doesn't even attempt to collect the item, it just jumps straight to the else line of that while loop in perpetuity without doing anything else.</p>\n<p>The full code is here. I know it's probably poorly written since I wrote it while half asleep in 2 hours, but I'm more worried about it functioning than form since it's just a personal use thing.</p>\n<pre><code>\n\nOn=1\n\nItem1=false\n\nItem2=false\n\nItem3=false\n\nItem4=false\n\nItem5=false\n\nItem6=false\n\nItem7=false\n\nItem8=false\n\nItem9=false\n\nSlot1=turtle.getItemCount(1)\n\nSlot2=turtle.getItemCount(2)\n\nSlot3=turtle.getItemCount(3)\n\nSlot4=turtle.getItemCount(4)\n\nSlot5=turtle.getItemCount(5)\n\nSlot6=turtle.getItemCount(6)\n\nSlot7=turtle.getItemCount(7)\n\nSlot8=turtle.getItemCount(8)\n\nSlot9=turtle.getItemCount(9)\n\nMaterialLocation1= &quot;front&quot;\n\nMaterialLocation2= &quot;front&quot;\n\nMaterialLocation3= &quot;front&quot;\n\nMaterialLocation4= &quot;front&quot;\n\nMaterialLocation5= &quot;front&quot;\n\nMaterialLocation6= &quot;front&quot;\n\nMaterialLocation7= &quot;front&quot;\n\nMaterialLocation8= &quot;front&quot;\n\nMaterialLocation9= &quot;front&quot;\n\n\n\nfunction getMaterialLocation(SelectedSlot)\n\n \n Complete=false\n\n \n\n while Complete == false do\n\n print(&quot;Please type the chest to use for slot &quot;, SelectedSlot, &quot; Front Left Right Back Up Down If the slot is empty type 'empty'.&quot;)\n\n Location=read()\n\n Location=string.lower(Location)\n\n\n\n if Location == &quot;front&quot; then\n\n if selectedSlot == 1 then\n\n MaterialLocation1=&quot;front&quot;\n\n elseif selectedSlot == 2 then\n\n MaterialLocation2=&quot;front&quot; \n\n elseif selectedSlot == 3 then\n\n MaterialLocation3=&quot;front&quot;\n\n elseif selectedSlot == 4 then\n\n MaterialLocation4=&quot;front&quot;\n\n elseif selectedSlot == 5 then\n\n MaterialLocation5=&quot;front&quot;\n\n elseif selectedSlot == 6 then\n\n MaterialLocation6=&quot;front&quot;\n\n elseif selectedSlot == 7 then\n\n MaterialLocation7=&quot;front&quot;\n\n elseif selectedSlot == 8 then\n\n MaterialLocation8=&quot;front&quot;\n\n elseif selectedSlot == 9 then\n\n MaterialLocation9=&quot;front&quot;\n\n end\n\n \n\n print(&quot;Slot &quot;, SelectedSlot, &quot; is &quot;, Location)\n\n Complete=true\n\n \n\n elseif Location == &quot;left&quot; then\n\n if selectedSlot == 1 then\n\n MaterialLocation1=&quot;left&quot;\n\n elseif selectedSlot == 2 then\n\n MaterialLocation2=&quot;left&quot; \n\n elseif selectedSlot == 3 then\n\n MaterialLocation3=&quot;left&quot;\n\n elseif selectedSlot == 4 then\n\n MaterialLocation4=&quot;left&quot;\n\n elseif selectedSlot == 5 then\n\n MaterialLocation5=&quot;left&quot;\n\n elseif selectedSlot == 6 then\n\n MaterialLocation6=&quot;left&quot;\n\n elseif selectedSlot == 7 then\n\n MaterialLocation7=&quot;left&quot;\n\n elseif selectedSlot == 8 then\n\n MaterialLocation8=&quot;left&quot;\n\n elseif selectedSlot == 9 then\n\n MaterialLocation9=&quot;left&quot;\n\n end\n\n \n\n print(&quot;Slot &quot;, SelectedSlot, &quot; is &quot;, Location)\n\n Complete=true\n\n \n\n elseif Location == &quot;right&quot; then\n\n if selectedSlot == 1 then\n\n MaterialLocation1=&quot;right&quot;\n\n elseif selectedSlot == 2 then\n\n MaterialLocation2=&quot;right&quot; \n\n elseif selectedSlot == 3 then\n\n MaterialLocation3=&quot;right&quot;\n\n elseif selectedSlot == 4 then\n\n MaterialLocation4=&quot;right&quot;\n\n elseif selectedSlot == 5 then\n\n MaterialLocation5=&quot;right&quot;\n\n elseif selectedSlot == 6 then\n\n MaterialLocation6=&quot;right&quot;\n\n elseif selectedSlot == 7 then\n\n MaterialLocation7=&quot;right&quot;\n\n elseif selectedSlot == 8 then\n\n MaterialLocation8=&quot;right&quot;\n\n elseif selectedSlot == 9 then\n\n MaterialLocation9=&quot;right&quot;\n\n end\n\n \n\n print(&quot;Slot &quot;, SelectedSlot, &quot; is &quot;, Location)\n\n Complete=true\n\n \n\n elseif Location == &quot;back&quot; then\n\n if selectedSlot == 1 then\n\n MaterialLocation1=&quot;back&quot;\n\n elseif selectedSlot == 2 then\n\n MaterialLocation2=&quot;back&quot; \n\n elseif selectedSlot == 3 then\n\n MaterialLocation3=&quot;back&quot;\n\n elseif selectedSlot == 4 then\n\n MaterialLocation4=&quot;back&quot;\n\n elseif selectedSlot == 5 then\n\n MaterialLocation5=&quot;back&quot;\n\n elseif selectedSlot == 6 then\n\n MaterialLocation6=&quot;back&quot;\n\n elseif selectedSlot == 7 then\n\n MaterialLocation7=&quot;back&quot;\n\n elseif selectedSlot == 8 then\n\n MaterialLocation8=&quot;back&quot;\n\n elseif selectedSlot == 9 then\n\n MaterialLocation9=&quot;back&quot;\n\n end\n\n \n\n print(&quot;Slot &quot;, SelectedSlot, &quot; is &quot;, Location)\n\n Complete=true\n\n \n\n elseif Location == &quot;up&quot; then\n\n if selectedSlot == 1 then\n\n MaterialLocation1=&quot;up&quot;\n\n elseif selectedSlot == 2 then\n\n MaterialLocation2=&quot;up&quot; \n\n elseif selectedSlot == 3 then\n\n MaterialLocation3=&quot;up&quot;\n\n elseif selectedSlot == 4 then\n\n MaterialLocation4=&quot;up&quot;\n\n elseif selectedSlot == 5 then\n\n MaterialLocation5=&quot;up&quot;\n\n elseif selectedSlot == 6 then\n\n MaterialLocation6=&quot;up&quot;\n\n elseif selectedSlot == 7 then\n\n MaterialLocation7=&quot;up&quot;\n\n elseif selectedSlot == 8 then\n\n MaterialLocation8=&quot;up&quot;\n\n elseif selectedSlot == 9 then\n\n MaterialLocation9=&quot;up&quot;\n\n end\n\n \n\n print(&quot;Slot &quot;, SelectedSlot, &quot; is &quot;, Location)\n\n Complete=true\n\n \n\n elseif Location == &quot;down&quot; then\n\n if selectedSlot == 1 then\n\n MaterialLocation1=&quot;down&quot;\n\n elseif selectedSlot == 2 then\n\n MaterialLocation2=&quot;down&quot; \n\n elseif selectedSlot == 3 then\n\n MaterialLocation3=&quot;down&quot;\n\n elseif selectedSlot == 4 then\n\n MaterialLocation4=&quot;down&quot;\n\n elseif selectedSlot == 5 then\n\n MaterialLocation5=&quot;down&quot;\n\n elseif selectedSlot == 6 then\n\n MaterialLocation6=&quot;down&quot;\n\n elseif selectedSlot == 7 then\n\n MaterialLocation7=&quot;down&quot;\n\n elseif selectedSlot == 8 then\n\n MaterialLocation8=&quot;down&quot;\n\n elseif selectedSlot == 9 then\n\n MaterialLocation9=&quot;down&quot;\n\n end\n\n \n\n print(&quot;Slot &quot;, SelectedSlot, &quot; is &quot;, Location)\n\n Complete=true\n\n \n\n elseif Location == &quot;empty&quot; then\n\n print(SelectedSlot, &quot; is empty.&quot;)\n\n Complete=true\n\n \n\n else\n\n print(&quot;Try again, Fuckboy.&quot;)\n\n end\n\n end\n\nend\n\n\n\nfunction pullFront()\n\n turtle.suck(1)\n\nend\n\n\n\nfunction pullLeft()\n\n turtle.turnLeft()\n\n turtle.suck(1)\n\n turtle.turnRight()\n\nend\n\n\n\nfunction pullRight()\n\n turtle.turnRight()\n\n turtle.suck(1)\n\n turtle.turnLeft()\n\nend\n\n\n\nfunction pullBack()\n\n turtle.turnLeft()\n\n turtle.turnLeft()\n\n turtle.suck(1)\n\n turtle.turnLeft()\n\n turtle.turnLeft()\n\nend\n\n\n\nfunction pullUp()\n\n turtle.suckUp(1)\n\nend\n\n\n\nfunction pullDown()\n\n turtle.suckDown(1)\n\nend\n\n \n\nfunction drop()\n\n turtle.drop()\n\nend\n\n\n\nfunction craft()\n\n turtle.craft()\n\n item1=false\n\n item2=false\n\n item3=false\n\n item4=false\n\n item5=false\n\n item6=false\n\n item7=false\n\n item8=false\n\n item9=false\n\n drop()\n\n print(Done)\n\n\n\nend\n\n\n\nfunction getDirection(SelectedSlot)\n\n if SelectedSlot == 1 then\n\n if MaterialLocation1 == &quot;front&quot; then\n\n pullFront()\n\n elseif MaterialLocation1 == &quot;left&quot; then\n\n pullLeft()\n\n elseif MaterialLocation1 == &quot;right&quot; then\n\n pullRight()\n\n elseif MaterialLocation1 == &quot;back&quot; then\n\n pullBack()\n\n elseif MaterialLocation1 == &quot;up&quot; then\n\n pullUp()\n\n elseif MaterialLocation1 == &quot;down&quot; then\n\n pullDown()\n\n else\n\n Item1=true \n\n end \n\n\n\n elseif SelectedSlot == 2 then\n\n if MaterialLocation2 == &quot;front&quot; then\n\n pullFront()\n\n elseif MaterialLocation2 == &quot;left&quot; then\n\n pullLeft()\n\n elseif MaterialLocation2 == &quot;right&quot; then\n\n pullRight()\n\n elseif MaterialLocation2 == &quot;back&quot; then\n\n pullBack()\n\n elseif MaterialLocation2 == &quot;up&quot; then\n\n pullUp()\n\n elseif MaterialLocation2 == &quot;down&quot; then\n\n pullDown()\n\n else\n\n Item2=true \n\n end\n\n\n\n elseif SelectedSlot == 3 then\n\n if MaterialLocation3 == &quot;front&quot; then\n\n pullFront()\n\n elseif MaterialLocation3 == &quot;left&quot; then\n\n pullLeft()\n\n elseif MaterialLocation3 == &quot;right&quot; then\n\n pullRight()\n\n elseif MaterialLocation3 == &quot;back&quot; then\n\n pullBack()\n\n elseif MaterialLocation3 == &quot;up&quot; then\n\n pullUp()\n\n elseif MaterialLocation3 == &quot;down&quot; then\n\n pullDown()\n\n else\n\n Item3=true \n\n end\n\n \n\n elseif SelectedSlot == 4 then\n\n if MaterialLocation4 == &quot;front&quot; then\n\n pullFront()\n\n elseif MaterialLocation4 == &quot;left&quot; then\n\n pullLeft()\n\n elseif MaterialLocation4 == &quot;right&quot; then\n\n pullRight()\n\n elseif MaterialLocation4 == &quot;back&quot; then\n\n pullBack()\n\n elseif MaterialLocation5 == &quot;up&quot; then\n\n pullUp()\n\n elseif MaterialLocation6 == &quot;down&quot; then\n\n pullDown()\n\n else\n\n Item4=true \n\n end\n\n \n\n elseif SelectedSlot == 5 then\n\n if MaterialLocation5 == &quot;front&quot; then\n\n pullFront()\n\n elseif MaterialLocation5 == &quot;left&quot; then\n\n pullLeft()\n\n elseif MaterialLocation5 == &quot;right&quot; then\n\n pullRight()\n\n elseif MaterialLocation5 == &quot;back&quot; then\n\n pullBack()\n\n elseif MaterialLocation5 == &quot;up&quot; then\n\n pullUp()\n\n elseif MaterialLocation5 == &quot;down&quot; then\n\n pullDown()\n\n else\n\n Item5=true \n\n end\n\n \n\n elseif SelectedSlot == 6 then\n\n if MaterialLocation6 == &quot;front&quot; then\n\n pullFront()\n\n elseif MaterialLocation6 == &quot;left&quot; then\n\n pullLeft()\n\n elseif MaterialLocation6 == &quot;right&quot; then\n\n pullRight()\n\n elseif MaterialLocation6 == &quot;back&quot; then\n\n pullBack()\n\n elseif MaterialLocation6 == &quot;up&quot; then\n\n pullUp()\n\n elseif MaterialLocation6 == &quot;down&quot; then\n\n pullDown()\n\n else\n\n Item6=true \n\n end\n\n \n\n elseif SelectedSlot == 7 then\n\n if MaterialLocation7 == &quot;front&quot; then\n\n pullFront()\n\n elseif MaterialLocation7 == &quot;left&quot; then\n\n pullLeft()\n\n elseif MaterialLocation7 == &quot;right&quot; then\n\n pullRight()\n\n elseif MaterialLocation7 == &quot;back&quot; then\n\n pullBack()\n\n elseif MaterialLocation7 == &quot;up&quot; then\n\n pullUp()\n\n elseif MaterialLocation7 == &quot;down&quot; then\n\n pullDown()\n\n else\n\n Item7=true \n\n end\n\n \n\n elseif SelectedSlot == 8 then\n\n if MaterialLocation8 == &quot;front&quot; then\n\n pullFront()\n\n elseif MaterialLocation8 == &quot;left&quot; then\n\n pullLeft()\n\n elseif MaterialLocation8 == &quot;right&quot; then\n\n pullRight()\n\n elseif MaterialLocation8 == &quot;back&quot; then\n\n pullBack()\n\n elseif MaterialLocation8 == &quot;up&quot; then\n\n pullUp()\n\n elseif MaterialLocation8 == &quot;down&quot; then\n\n pullDown()\n\n else\n\n Item8=true\n\n end\n\n \n\n elseif SelectedSlot == 9 then\n\n if MaterialLocation9 == &quot;front&quot; then\n\n pullFront()\n\n elseif MaterialLocation9 == &quot;left&quot; then\n\n pullLeft()\n\n elseif MaterialLocation9 == &quot;right&quot; then\n\n pullRight()\n\n elseif MaterialLocation9 == &quot;back&quot; then\n\n pullBack()\n\n elseif MaterialLocation9 == &quot;up&quot; then\n\n pullUp()\n\n elseif MaterialLocation9 == &quot;down&quot; then\n\n pullDown()\n\n else\n\n Item9=true\n\n end\n\n end\n\nend\n\n\n\nfunction gatherMats()\n\n print (&quot;Crafting...&quot;)\n\n \n\n select(1)\n\n while item1 == false do\n\n getDirection(1)\n\n Slot1=turtle.getItemCount(1)\n\n if Slot1 == 1 then\n\n Item1=true\n\n else\n\n print(&quot;Waiting for input in slot 1&quot;)\n\n end\n\n end\n\n \n\n select(2)\n\n while Item2 == false do\n\n getDirection(2)\n\n Slot2=turtle.getItemCount(2)\n\n if Slot2 == 1 then\n\n Item2=true\n\n else\n\n print(&quot;Waiting for input in slot 2&quot;)\n\n end\n\n end\n\n \n\n select(3)\n\n while Item3 == false do\n\n getDirection(3)\n\n Slot3=turtle.getItemCount(3)\n\n if Slot3 == 1 then\n\n Item3=true\n\n else\n\n print(&quot;Waiting for input in slot 3&quot;)\n\n end\n\n end\n\n\n\n select(5)\n\n while Item4 == false do\n\n getDirection(4)\n\n Slot4=turtle.getItemCount(4)\n\n if Slot4 == 1 then\n\n Item4=true\n\n else\n\n print(&quot;Waiting for input in slot 4&quot;)\n\n end\n\n end\n\n \n\n select(6)\n\n while Item5 == false do\n\n getDirection(2)\n\n Slot5=turtle.getItemCount(5)\n\n if Slot5 == 1 then\n\n Item5=true\n\n else\n\n print(&quot;Waiting for input in slot 5&quot;)\n\n end\n\n end\n\n \n\n select(7)\n\n while Item6 == false do\n\n getDirection(6)\n\n Slot6=turtle.getItemCount(6)\n\n if Slot6 == 1 then\n\n Item1=true\n\n else\n\n print(&quot;Waiting for input in slot 6&quot;)\n\n end \n\n end\n\n \n\n select(9)\n\n while Item7 == false do\n\n getDirection(7)\n\n Slot6=turtle.getItemCount(7)\n\n if Slot7 == 1 then\n\n Item1=true\n\n else\n\n print(&quot;Waiting for input in slot 7&quot;)\n\n end\n\n end\n\n \n\n select(10)\n\n while Item8 == false do\n\n getDirection(8)\n\n Slot8=turtle.getItemCount(8)\n\n if Slot8 == 1 then\n\n Item8=true\n\n else\n\n print(&quot;Waiting for input in slot 8&quot;)\n\n end\n\n end\n\n \n\n select(11)\n\n while Item9 == false do\n\n getDirection(9)\n\n Slot9=turtle.getItemCount(9)\n\n if Slot9 == 1 then\n\n Item9=true\n\n else\n\n print(&quot;Waiting for input in slot 9&quot;)\n\n end\n\n end\n\nend\n\n\n\nfunction main()\n\n Working=true\n\n getMaterialLocation(1)\n\n getMaterialLocation(2)\n\n getMaterialLocation(3)\n\n getMaterialLocation(4)\n\n getMaterialLocation(5)\n\n getMaterialLocation(6)\n\n getMaterialLocation(7)\n\n getMaterialLocation(8)\n\n getMaterialLocation(9)\n\n\n\n while Working == true do\n\n gatherMats()\n\n craft()\n\n end\n\nend\n\n\n\nmain()\n\n</code></pre>\n<p>The point it seems to get stuck on is here</p>\n<pre><code>\nfunction gatherMats()\n\n print (&quot;Crafting...&quot;)\n\n \n\n select(1)\n\n while item1 == false do\n\n getDirection(1)\n\n Slot1=turtle.getItemCount(1)\n\n if Slot1 == 1 then\n\n Item1=true\n\n else\n\n print(&quot;Waiting for input in slot 1&quot;)\n\n end\n\n end\n\n\n</code></pre>\n<p>It just seems to skip the getDirection() function entirely so it never attempts to get the item to break the while loop, just endlessly printing the &quot;waiting on input&quot; message.\nFrom what I see, even if the MaterialLocation variables were getting set incorrectly, it would still break out of the while loop because the else argument of the material location changes the condition variable for that loop.</p>\n"^^ . "<p>In JavaScript, there's</p>\n<pre class="lang-js prettyprint-override"><code>const a, b = await Promise.all([task1(), task2()])\n</code></pre>\n<p>In Python, there's</p>\n<pre class="lang-py prettyprint-override"><code>a, b = await asyncio.gather(task1(), task2())\n</code></pre>\n<p>Is there Lua's equivalent of the above?</p>\n<pre class="lang-lua prettyprint-override"><code>local task1 = coroutine.create(...)\nlocal task2 = coroutine.create(...)\nlocal a, b = coroutine.resume_all(task1, task2) -- No such method\n\n-- All the coroutines have run to completion or errored.\nassert(coroutine.status(task1) == 'dead')\nassert(coroutine.status(task2) == 'dead')\n</code></pre>\n"^^ . . . "@RelaxGaming, if you can't figure out metamethods, you can always use IntValues and their [Changed](https://create.roblox.com/docs/reference/engine/classes/IntValue#Changed) signal."^^ . "0"^^ . . . . . . "game-development"^^ . . . . . "1"^^ . "@shingo yes it works... this is why I wonder why people use it..."^^ . . . . . . . . "Note: putting a `<h1>` inside a `<p>` is invalid HTML."^^ . . . . . . . . . "0"^^ . . . "mplayer"^^ . "Which .dll file do i choose for setting up luajit?"^^ . . "1"^^ . "sorting"^^ . "0"^^ . "0"^^ . "0"^^ . . . "Importing file, recursive function and infinite loop in Lua"^^ . . "1"^^ . "don't you think it would be nice if you'd format your post properly? you must have realized that it's looking aweful and yet you decided to leave it as is."^^ . "0"^^ . . . . "coroutine"^^ . . . . . . . "2"^^ . "<p>How to wait for the model to load? I have a very simple code but 2 out of 3 times when I lunch the game I get an error <code>Players.Alex.PlayerGui.AllSeeingEye:120: attempt to index nil with 'Position'</code>. 1 time out of 3 it works.</p>\n<pre class="lang-lua prettyprint-override"><code>local EyeModel = workspace:WaitForChild(&quot;EyeBox&quot;):WaitForChild(&quot;EyeBoxModel&quot;)\nlocal EyePosition = EyeModel.PrimaryPart.Position\n</code></pre>\n<p>I tried adding WaitForChild for the folder (EyeBox) and Model (EyeBoxModel). But not helping. Using a while loop sounds like a bad idea...</p>\n"^^ . . . "lua"^^ . . . . . "0"^^ . . "Ah! That will do it. If the on/off trick doesn't work... upgrading probably does. Thanks!"^^ . "<p>You will want to install two extensions; the <a href="https://marketplace.visualstudio.com/items?itemName=pixelbyte-studios.pixelbyte-love2d" rel="nofollow noreferrer">love2d support</a> extension and the <a href="https://marketplace.visualstudio.com/items?itemName=sumneko.lua" rel="nofollow noreferrer">lua</a> extension so you have the language server which provides syntax highlighting and error checking. Do read their installation instructions.</p>\n<p>This is not enough to complete the setup. To get rid of the undefined 'love' global error, you will want to, in an opened project, do the following:</p>\n<ul>\n<li>open the Visual Studio Code command palette (under the &quot;View&quot; menu)</li>\n<li>Search for &quot;lua addon manager&quot; and open it</li>\n<li>In the lua addon manager you will want to look for LOVE (should be at the top) and enable it.</li>\n</ul>\n<p>This will resolve the undefined global error for this project. If you start a new project, you will need to repeat these steps.</p>\n<p>Worth noting is that there are several versions of Lua that the language server supports; from Lua 5.1 to 5.4 and also LuaJIT. Love2d by default uses LuaJIT for performance reasons. LuaJIT is limited to the Lua 5.1 feature set, so something like the <code>\\\\</code> operator which does an integer division is not supported. When starting a new project it is worth it to check that the Lua extension is configured for LuaJIT so the extension will warn you when you are using unsupported features, which should already be the case if you activated LOVE support as per the above instructions. You can do this by:</p>\n<ul>\n<li>Opening the extensions in the left menu</li>\n<li>Clicking on the gear next to the installed &quot;lua&quot; extension and then clicking &quot;settings&quot;</li>\n<li>In the search box at the top search for &quot;lua runtime version&quot; and make sure &quot;LuaJIT&quot; is selected in the select box.</li>\n</ul>\n<p>Finally most documentation will tell you that you can run your Love2d project from Visual Studio Code using the ALT+L keyboard shortcut. This is likely to conflict with other extensions though. If it doesn't work, you should change the key binding to something like ALT+SHIFT+L. You can do this by taking the following steps:</p>\n<ul>\n<li>Open the visual studio code keyboard shortcuts (under File -&gt; Preferences)</li>\n<li>In the search box at the top, search for &quot;love2d&quot;</li>\n<li>The keyboard shortcut you will want to change is the one named &quot;Run Love2D on the workspace folder&quot;.</li>\n</ul>\n"^^ . . "0"^^ . . . "<p>I cannot figure out how to make <strong>ENT:Touch</strong> only detect when touching a <strong>specific entity</strong> instead of detecting anything and <em>everything</em> touching it. It probably has something to do with the <em>argument</em> but nothing I've tried has worked</p>\n<p>current code (useless)</p>\n<pre><code>function ENT:Touch(entity) \n EmitSound( Sound (&quot;buttons/lightswitch2.wav&quot; ), self:GetPos(), 1, CHAN_AUTO, 1, 75, 0, 100)\n self:Remove()\n end\n</code></pre>\n<p>I've tried making the argument the entity name, Using getclass in an if statement (to see if I can do if getclass comes back as the entity run the code) but neither of these or any variations of them have worked.</p>\n"^^ . . . . "0"^^ . "1"^^ . "2"^^ . . . "<p>I'm making a 'purchase/shop' screen for a Roblox game, but I'm having trouble opening it from a localscript in a part.\n<br />\nI'm not sure exactly what the problem is, I'm fairly beginner to Roblox development.\nI used a similar script for closing the GUI (which worked well) but when prompted it will not open or make any sound. <a href="https://i.sstatic.net/LsLh7Qdr.png" rel="nofollow noreferrer">Screenshot of explorer</a></p>\n<p>Here's the code I've written (also displayed in the screenshot if I've typo'd it):</p>\n<pre><code>-- localScript\nlocal clicky = game.Workspace\nlocal GUI = game.Players.FindFirstChild(&quot;menuGUI&quot;)\nlocal bloopSound = game:GetService(&quot;SoundService&quot;).UIbloop\n\nfunction openfromprompt()\n\n GUI.Visible = true\n bloopSound:Play()\nend\n\nclicky.ClickDetector.MouseClick:Connect(openfromprompt)\n</code></pre>\n<p>And the error message as follows:\n(line 11 is the Mouseclick:connect line)</p>\n<p><em>Exception hit:\nLocalScript:11 attempt to index nil with 'ClickDetector'</em></p>\n"^^ . "3"^^ . . . "0"^^ . "@X078 You can shorten every identifier."^^ . . "<p>I'm trying to use include along with the token</p>\n<p>premake5:</p>\n<pre><code>include &quot;%{wks.location}/BuildSystemDependencies/UNIX/MacOS/Dependencies.lua&quot;\n</code></pre>\n<p>file tree:</p>\n<pre><code>├── BuildSystemDependencies\n├── LICENSE\n├── README.md\n├── build\n├── premake5.lua\n</code></pre>\n<p>my <strong>premake5</strong>, which is next to the folder\n<strong>BuildSystemDependencies</strong></p>\n<p>contains a <strong>workspace</strong> for defining the wks.location token</p>\n<pre><code>workspace &quot;Radiant&quot;\n configurations { &quot;Debug&quot;, &quot;Release&quot; }\n architecture &quot;x64&quot;\n startproject &quot;Sanxbox&quot;\n\n language &quot;C++&quot;\n cppdialect &quot;C++17&quot;\n targetdir &quot;build/Bin/%{cfg.buildcfg}&quot;\n objdir &quot;build/Intermediates/%{cfg.buildcfg}&quot;\n\n externalanglebrackets &quot;On&quot;\n externalwarnings &quot;Off&quot;\n warnings &quot;Off&quot;\n\n\ngroup &quot;ThirdParty&quot;\ninclude &quot;ThirdParty/&quot;\ngroup &quot;&quot;\n\n-- Platform-specific includes\nif os.target() == &quot;windows&quot; then\n include &quot;Radiant/BuildSystem/Windows&quot;\nelseif os.target() == &quot;macosx&quot; then\n include &quot;Radiant/BuildSystem/UNIX/MacOS&quot;\nend\n</code></pre>\n<p>But I get an error</p>\n<p><em>Error: unable to open %{wks.location}/BuildSystemDependencies/Dependencies.lua: No such file or directory</em></p>\n<p>What's the reason my wks.location is not detected?</p>\n"^^ . . "1"^^ . . . "3"^^ . "0"^^ . . . "0"^^ . "3"^^ . . . "-1"^^ . "Problems with coding censor extension for VLC Media Player using Lua"^^ . . "1"^^ . . "0"^^ . . . . "0"^^ . "file"^^ . . . . . "4"^^ . . . . . "<p><code>i</code> is probably the string <code>&quot;1&quot;</code>.</p>\n<p><code>1 ~= &quot;1&quot;</code> due to things of different types never being equal in Lua. So <code>t[1]</code> can be <code>nil</code>, while <code>t[&quot;1&quot;]</code> can be something else.</p>\n<p>When you iterate with <code>pairs</code>, you also iterate over string keys. <code>print(&quot;Index: &quot; .. i)</code> will then print <code>Index: 1</code> if <code>i</code> is the string <code>&quot;1&quot;</code>. It would also print the same if <code>i</code> was the number <code>1</code>.</p>\n<p>Effectively, your <code>print</code> debugging is flawed, because it performs number to string coercion. To properly debug, you need something that tells you the type as well, for example by quoting strings.</p>\n<p>I would recommend using something like <a href="https://github.com/kikito/inspect.lua" rel="noreferrer"><code>inspect.lua</code></a> or writing your own equivalent. For now, printing <code>type(i)</code> as well should tell you everything you need to know.</p>\n"^^ . . "1"^^ . . "0"^^ . . . "Does the metadata key contains any dot (.)? This headers are considered invalid from Nginx and will be ignored. In which nginx phase is the code executed?\n\nTry sending the request to https://grpcbin.test.k6.io/ and inspect the response to make sure the metadata is sent to the server."^^ . "0"^^ . . "0"^^ . . . "I am new to api, so may i know how u can find those parameter to pass into the api?"^^ . . "stream"^^ . . "The problem is discussed here: https://gitlab.com/wireshark/wireshark/-/issues/18589"^^ . . . . "Lua Love2D, CS50's Introduction to Game Development, knife library Timer.tween syntax"^^ . . "<p>The lua language server (<code>lls</code>) doesn't require love by default so,\nadd this at every first line of any lua file that uses the love table.</p>\n<p>also with the love support extension you can use alt+l in order to run the project your in.</p>\n<pre><code>local love = require(&quot;love&quot;)\n</code></pre>\n"^^ . "undefined global lov2d not working in vs code"^^ . "<p>The issue, not really an issue, is something I am interested to learn. It is how to minimize my code so it literally becomes the smallest format it can possibly.</p>\n<p>My best work (In Lua by the way) on this is as shows:</p>\n<pre class="lang-lua prettyprint-override"><code>local p = {&quot;celeb&quot;,&quot;celery&quot;,&quot;carnita&quot;,&quot;bobby&quot;,&quot;logno&quot;,&quot;1x1x1&quot;,&quot;invalidcharacter&quot;} local u = coroutine.create( function() for i,v in ipairs(p) do print(&quot;uscan&quot;, i) coroutine.yield() end end) for i=1,#p do coroutine.resume(u) end\n</code></pre>\n<p>I need to find out if I can shorten function coroutine to be assigned to string &quot;c&quot; and if I can take player list &quot;p&quot; to shorten it somehow, and since this is going to be implemented into Roblox Studio, aka Roblox as a whole, it also needs support for LuaU, documentation <a href="https://luau-lang.org/" rel="nofollow noreferrer">here</a>. What I <em><strong>do not</strong></em> want to do however is encoding/hexidecimal, like the 0xA09B or whatever, it's because, like binairy, is ineffecient, and hard to decode. I only need a function to simplify other functions, like coroutine to &quot;c&quot; and similar keywords shortened.</p>\n<p>I have tried things like</p>\n<pre class="lang-lua prettyprint-override"><code>local e = end\n</code></pre>\n<p>but as you expect, this didn't work since the keyword ends the running code. so, I can't thing of anything else to solve this issue however.</p>\n"^^ . "This question is similar to: [Is there a way to call an asynchronous function from a synchronous function in njs?](https://stackoverflow.com/questions/78722188/is-there-a-way-to-call-an-asynchronous-function-from-a-synchronous-function-in-n). If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem."^^ . . "2"^^ . . "Nominatim 4.4.0 motorway_link not imported despite editing import.lua files"^^ . . . "0"^^ . . . . . . . "4"^^ . . . . . . . . . "Why does roblox studio walk wrong through the table"^^ . . . "0"^^ . "Low performance when receiving large amounts of data from tarantool"^^ . . "<p>For some reason, my code doesn't work in any way. Does someone has an answer why UserInputService doesn't work for me?</p>\n<pre><code>local player = game.Players.LocalPlayer\nlocal character = player.CharacterAdded:Wait()\nlocal humanoid = character:WaitForChild(&quot;Humanoid&quot;)\nlocal debounce = false\n\nUIS = game:GetService(&quot;UserInputService&quot;)\n\nUIS.InputBegan:Connect(function(input, typing)\n print(&quot;input&quot;)\n if typing then return end\n \n if input.UserInputType == Enum.UserInputType.MouseButton1 then\n \n print(player, &quot; pressed lmb&quot;)\n \n end\n \nend)\n</code></pre>\n<p>I already tried multiple variants of my code, none of which work. For some reason, sometimes, key thingy works, and I can do something by pressing E or Q if I bind it using script.\nI also tried changing devices, and currently writing this from my Laptop (I mainly do everything on PC.)</p>\n"^^ . . . . "0"^^ . . "0"^^ . . . . "0"^^ . . . . "1"^^ . "Nitpick: There aren't separate "array" and "dictionary" types in Lua. It's all tables; `pairs` doesn't guarantee any order."^^ . "2"^^ . . "Yes, by default the lua language server does (no longer?) load love2d by default, it needs to be added. The process changed a bit recently with the introduction of an addon manager: https://luals.github.io/wiki/definition-files/"^^ . . . "0"^^ . . . "2"^^ . "import"^^ . "Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer."^^ . . "How is this related to Python or FastAPI?"^^ . "Maybe [this Q&A](https://stackoverflow.com/questions/54669211/logitech-scripting-combining-keystroke-and-mouse-click), or [this one](https://stackoverflow.com/questions/24578998/game-lua-scripting-using-couroutine-or-polling) would be helpful."^^ . . "0"^^ . . "0"^^ . . . . . . "sockets"^^ . . "2"^^ . . . "lua-userdata"^^ . . . "0"^^ . . "1"^^ . . . "0"^^ . "0"^^ . "0"^^ . "3"^^ . "<p>The Gui is not located inside the player itself. it is actually inside <a href="https://create.roblox.com/docs/reference/engine/classes/PlayerGui" rel="nofollow noreferrer"><code>Player.PlayerGui</code></a>. but other than that if this is the LocalScript inside the Gui you could just do <code>script.Parent</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>-- // Variables\nlocal Clicky = workspace:FindFirstChild(&quot;Upgrades&quot;);\nlocal Gui = script.Parent;\nlocal Bloop = game:GetService(&quot;SoundService&quot;).UIbloop;\n\nClicky.ClickDetector.MouseClick:Connect(function()\n Gui.Visible = true;\n Bloop:Play();\nend)\n</code></pre>\n"^^ . . . . "1"^^ . . . "0"^^ . . . "0"^^ . . "0"^^ . "0"^^ . "0"^^ . "0"^^ . . . "1"^^ . . . . "0"^^ . "<p>I am new to HS and I just try to implement a simple function to make my active window left half, here is my code, I'm confused as to why I have to press cmd+left three times to make this work?</p>\n<pre class="lang-lua prettyprint-override"><code>hs.hotkey.bind({ &quot;cmd&quot; }, &quot;left&quot;, function()\n local win = hs.window.focusedWindow()\n local f = win:frame()\n local screen = win:screen()\n local max = screen:frame()\n f.x = max.x\n f.y = max.y\n f.w = max.w / 2\n f.h = max.h\n win:setFrame(f, 0)\nend)\n</code></pre>\n<p>and here is what happened to my computer when i try this hotkey</p>\n<p><img src="https://i.sstatic.net/9PVb2dKN.gif" alt="Scene Reproduction" /></p>\n"^^ . "1"^^ . . . . "Tokens are mostly handled for *"properties"*, there are several places where there are not handled (`filter` and as you discover `include`)."^^ . "0"^^ . "Varnish cache is probably the best tool for this, but I think you need Varnish Enterprise. Maybe this will help https://samanbaboli.medium.com/modify-html-pages-on-the-fly-using-nginx-2e7a2d069086"^^ . "0"^^ . "as I said I'm no Roblox expert, but you shouldn't try to educate me about simple boolean logic. I even explained to you why it is always true. how can you argue that? `player.UserId == 3193848005 or 2601513514` is always true as `2601513514` is always true. false or true is true, true or true is true, true or false is true. did you even read the manual? it explicitly explains the case you're mentioning."^^ . . "1"^^ . "How to apply "AsemblyLinearVelocity" from scripts onto "hit.Parent""^^ . "0"^^ . "logitech"^^ . . . . "<p>I've been having this problem in weeks. I made a custom plugin for Kong, written in Lua, that supposed to forward any request that Kong received to a custom auth service. Here is Handler.lua.</p>\n<pre><code>-- Handler.lua\n\nlocal http = require &quot;resty.http&quot;\nlocal utils = require &quot;kong.tools.utils&quot;\nlocal cjson = require(&quot;cjson&quot;)\n\nlocal MessageForwarder = {\n VERSION = &quot;1.0&quot;,\n PRIORITY = 1000,\n}\n\nlocal function forward_message(conf, request_method, request_path, request_headers, request_body)\n -- Make HTTP Request\n local httpc = http.new()\n local res, err = httpc:request_uri(conf.forward_host .. request_path, {\n method = request_method,\n headers = request_headers,\n body = request_body,\n ssl_verify = false\n })\n\n -- Checking response\n if not res then\n kong.log.err(&quot;Failed to forward request: &quot;, err)\n return kong.response.exit(500)\n end\n\n if res.status ~= 200 then\n kong.log.err(&quot;Responded with status: &quot;,res.status)\n return kong.response.exit(500)\n end\n\n return true -- all is well\nend\n\nlocal function forward_message_new(conf, request_method, request_path, request_headers, request_body)\n local server = assert(socket.bind(&quot;*&quot;, 0))\nend\n\nfunction MessageForwarder:access(conf)\n local request_path = kong.request.get_raw_path()\n local request_method = kong.request.get_method()\n local request_headers = kong.request.get_headers()\n\n local raw_request_body\n if raw_request_method ~= &quot;GET&quot; then\n raw_request_body = kong.request.get_raw_body()\n end\n\n local request_body = cjson.decode(raw_request_body)\n\n local auth_path = conf.auth_token_b2b_endpoint\n\n local bool = forward_message(conf, request_method, request_path, request_headers, request_body)\n\n return true\nend\n\n\nreturn MessageForwarder\n</code></pre>\n<p>The result is always consistent. Consistent errors. The Spring Boot REST API that receives the request forwarded from that plugin returns this error to the Spring Boot log:</p>\n<pre><code>WARN 20440 --- [nio-8010-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Ignoring exception, response committed already: org.springframework.http.converter.HttpMessageNotReadableException: I/O error while reading input message\nWARN 20440 --- [nio-8010-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: I/O error while reading input message]\n</code></pre>\n<p>I'm not sure if the problem is in my Spring Boot API since I've tested it with requests from other sources (Postman, Insomnia, other Spring Boot app, Ajax) and everything works fine, just not from my custom Kong plugin with Lua. I wonder if there are some set of rules in using resty.http that I didn't follow.</p>\n<p>Any suggestion would be highly appreciated.</p>\n<p><em>As an additional information</em>, I adapted this tutorial from Kong blog to fit my requirements: <a href="https://konghq.com/blog/engineering/custom-authentication-and-authorization-framework-with-kong" rel="nofollow noreferrer">https://konghq.com/blog/engineering/custom-authentication-and-authorization-framework-with-kong</a></p>\n"^^ . "mp4"^^ . . . . . "<p>I am relatively new to Lua, and I am encountering a problem when I try to compile my code in VLC.\nPlease try the code that I have attached and get back to me. I have tried everything that I can think of but so far I cant get past this problem. I am sorry for the messy code!</p>\n<p>This is the error that it gives:</p>\n<pre><code>lua info: Activated Addon!\nlua info: Preparing Subtitles\nlua info: Subtitle file opened successfully\nlua info: Keyword found at 52.943 seconds.\nlua info: Keyword found at 7337.018 seconds.\nlua info: Successfully processed subtitles for exclusion times.\nlua info: Printing exclusion times...\nlua info: Exclusion Time 1: Start = 51.943, End = 53.943\nlua info: Exclusion Time 2: Start = 7336.018, End = 7338.018\nlua error: Could not activate extension!\n</code></pre>\n<p>Code:</p>\n<pre><code>-- Define descriptor function for the VLC addon\nfunction descriptor()\n return {\n title = &quot;Censor Extension&quot;,\n version = &quot;1.0&quot;,\n author = &quot;Deacon Griffiths&quot;,\n capabilities = {}\n }\nend\n\n\n\n-- Global table to store exclusion times\nexclusion_times = {}\n\n\nold_time = 0\n\n-- For storing initial volume\nprev_vol = vlc.volume.get()\n\n\n\n\n\n-- Function to convert time from HH:MM:SS,ms to seconds\nfunction timeToSeconds(time_str)\n local hours, minutes, seconds, milliseconds = time_str:match(&quot;(%d+):(%d+):(%d+),(%d+)&quot;)\n return tonumber(hours) * 3600 + tonumber(minutes) * 60 + tonumber(seconds) + tonumber(milliseconds) / 1000\nend\n\n\n\n-- Function to process subtitle file and populate exclusion_times\nfunction prepareSubtitles()\n vlc.msg.info(&quot;Preparing Subtitles&quot;)\n\n local subtitle_file_path = &quot;C:\\\\Program Files (x86)\\\\VideoLAN\\\\VLC\\\\lua\\\\extensions\\\\Subtitles.srt&quot;\n local subtitle_file = io.open(subtitle_file_path, &quot;r&quot;)\n\n if not subtitle_file then\n vlc.msg.error(&quot;Failed to open subtitle file at &quot; .. subtitle_file_path)\n return\n end\n\n vlc.msg.info(&quot;Subtitle file opened successfully&quot;)\n\n local current_time = 0\n local in_block = false\n\n for line in subtitle_file:lines() do\n -- Detect the time block\n local start_time_str, end_time_str = line:match(&quot;(%d+:%d+:%d+,%d+)%s*--&gt;%s*(%d+:%d+:%d+,%d+)&quot;)\n if start_time_str and end_time_str then\n current_time = timeToSeconds(start_time_str)\n in_block = true\n elseif in_block and line ~= &quot;&quot; then\n -- Check for the keyword in subtitle text\n if string.find(line:lower(), &quot;keyword&quot;) then\n -- Ensure start_time does not go negative\n local start_exclusion = math.max(current_time - 1, 0)\n local end_exclusion = current_time + 1\n table.insert(exclusion_times, {start_time = start_exclusion, end_time = end_exclusion})\n vlc.msg.info(&quot;Keyword found at &quot; .. current_time .. &quot; seconds.&quot;)\n end\n elseif line == &quot;&quot; then\n -- End of a subtitle block\n in_block = false\n end\n end\n\n subtitle_file:close()\n vlc.msg.info(&quot;Successfully processed subtitles for exclusion times.&quot;)\nend\n\n\n\n\n\n\n\n\n-- Function to check if current time is within exclusion times\nfunction isInExclusionTimes(current_time)\n for _, range in ipairs(exclusion_times) do\n if current_time &gt;= range.start_time and current_time &lt;= range.end_time then\n return true\n end\n end\n return false\nend\n\n\n\n\n\n\n\n-- Function to get the current playback time in seconds\nfunction getCurrentTime()\n local media_player = vlc.object.input()\n local current_time = vlc.var.get(media_player, &quot;time&quot;)\n\n if current_time then\n return current_time / 1000\n else\n return 0\n end\nend\n\n\n\n\n\n\n\n-- Function to adjust volume based on current playback time\nfunction adjustVolume()\n local media_player = vlc.object.input()\n local current_time = getCurrentTime()\n\n if isInExclusionTimes(current_time) then\n vlc.volume.set(0)\n prev_vol = vlc.volume.get()\n vlc.msg.info(&quot;Volume muted at time: &quot; .. current_time)\n else\n vlc.volume.set(prev_vol)\n vlc.msg.info(&quot;Volume set to 256 at time: &quot; .. current_time)\n end\nend\n\n\n\n\n\n\n\n\nfunction poll_time()\n vlc.msg.info(&quot;Poll time&quot;)\n local cur_time = getCurrentTime()\n vlc.msg.info(&quot;Got current_time&quot;)\n if time ~= old_time then\n adjustVolume()\n old_time = time\n end\n vlc.timer(100, poll_time)\nend\n\n\n\n\n\n\n-- Function called when the addon is activated\nfunction activate()\n vlc.msg.info(&quot;Activated Addon!&quot;)\n prepareSubtitles()\n\n -- Print exclusion_times for verification\n vlc.msg.info(&quot;Printing exclusion times...&quot;)\n for i, entry in ipairs(exclusion_times) do\n vlc.msg.info(&quot;Exclusion Time &quot; .. i .. &quot;: Start = &quot; .. entry.start_time .. &quot;, End = &quot; .. entry.end_time)\n end\n\n -- Subscribe to time change event\n local media_player = vlc.object.input()\n vlc.msg.info(&quot;Created local variable media_player&quot;)\n if media_player then\n vlc.msg.info(&quot;Inside If statement&quot;)\n adjustVolume()\n vlc.msg.info(&quot;Timer added for time change event.&quot;)\n poll_time()\n else\n vlc.msg.info(&quot;Failed to get media player object.&quot;)\n end\nend\n</code></pre>\n<p>The code starts by accessing a subtitle file named <code>Subtitle.srt</code> that contains the now playing movies subtitles. It then checks the subtitle file for bad language (Which is a hard coded one word for now) and stores the times of occurances in a global table variable named <code>exclusion_times</code>, which stores the time one second before the occurance, and one second after the occurance.</p>\n<p>That is what <em>is</em> working. Now this is where the problem comes in:</p>\n<p>When it has processed the subtitles, it is <em><strong>supposed</strong></em> to check for a time change every 10 milliseconds, and when the time changes, it runs a function which is supposed to check if the <code>current_time</code> is within any of the exclusion times. If so, it mutes audio. When it is outside of any of those times, it unmutes the audio to the original volume. It is not working.\nPlease help!</p>\n"^^ . . "Thank you, also, I haven't done lua in a while, yk, but I'm getting back into it. Are there other identifiers you can shorten?"^^ . . . . "0"^^ . "LuaXML_lib is located at `C:\\Program Files (x86)\\Lua\\5.1\\clibs\\LuaXML_lib.dll`"^^ . . "neovim error: when using vim.fs.root(): attempt to call field 'root' (a nil value)"^^ . "<p>I am making a game right now in roblox, and need to make gamepass store, however when my loop goes through it (its a table in table), it goes out of order\nExample code with the tables in table</p>\n<pre><code>a = {\n [&quot;5robux&quot;] = {\n value = 10,\n name = &quot;21&quot;\n },\n [&quot;10robux&quot;] = {\n value = 13,\n name = &quot;31&quot;\n },\n [&quot;15robux&quot;] = {\n value = 20,\n name = &quot;41&quot;\n },\n [&quot;20robux&quot;] = {\n value = 25,\n name = &quot;64&quot;\n },\n [&quot;61robux&quot;] = {\n value = 25,\n name = &quot;64&quot;\n },\n [&quot;50robux&quot;] = {\n value = 3,\n name = &quot;64&quot;\n }\n\n\n}\nfor i, v in pairs(a) do\n print(i, v)\nend\n</code></pre>\n<p>Output:</p>\n<pre><code>5robux ▶ {...} - Server - Script:30\n50robux ▶ {...} - Server - Script:30\n61robux ▶ {...} - Server - Script:30\n20robux ▶ {...} - Server - Script:30\n15robux ▶ {...} - Server - Script:30\n10robux ▶ {...} - Server - Script:30\n</code></pre>\n<p>As you see, it firstly goes to the first element, then to the last and so on</p>\n<p>Also tried removing the brackets [], got another output which is still incorrect\nOutput:</p>\n<pre><code>robux15 ▶ {...} - Server - Script:30\nrobux5 ▶ {...} - Server - Script:30\nrobux50 ▶ {...} - Server - Script:30\nrobux61 ▶ {...} - Server - Script:30\nrobux10 ▶ {...} - Server - Script:30\nrobux20 ▶ {...} \n</code></pre>\n<p>How can i fix it, and whats wrong?</p>\n<p>Tried changing the loop, but still wrong output</p>\n"^^ . . . . "0"^^ . . "1"^^ . . . . "0"^^ . "1"^^ . "<p>Originally closed here <a href="https://github.com/wez/wezterm/issues/284" rel="nofollow noreferrer">https://github.com/wez/wezterm/issues/284</a></p>\n<p>I could not get any of the solutions in the thread or the docs to work correctly in conjunction with</p>\n<pre class="lang-lua prettyprint-override"><code>config.window_decorations = &quot;NONE&quot;\n</code></pre>\n"^^ . . . . "using self. inside table constructors is fine as long as your syntax is ok."^^ . . . "thanks for your answer. Actually, the descriptions are different - I just replaced them in my question by '<snip>' to hide the actual values. So I think your second suggestion is most appropriate for me, and does explain what is going on, i.e. the code is executing twice. But I'm afraid I don't understand your solution. Could you please suggest what the solution would look like as code?"^^ . "<p>I'm trying to retrieve and parse some simple JSON from a url. This is what works so far for me (although I'm not sure if ofLoadURL is what I should be using - there seem to be many ways to retrieve content from a url):</p>\n<pre><code>ofelia f;\nresp = ofLoadURL(&quot;https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY&amp;date=2024-06-06&quot;);\ntext = resp.data:getText();\nprint(text);\nreturn(anything);\n</code></pre>\n<p>I can output it as text but cannot understand how to parse it from buffer or the string to JSON. I've been using this as an example (<a href="https://stackoverflow.com/questions/4800605/iterating-through-objects-in-jsoncpp">Iterating through objects in JsonCpp</a>) so just to get one entry from the JSON should it be something like this? - not sure how to change it to work in Ofelia:</p>\n<pre><code>Json::Value root;\nJson::Reader parser;\n\n// Parse the json (using the text in the code above)\nparser.parse( text, root );\n\n// Get the url\nprint(root[&quot;url&quot;]);\n</code></pre>\n"^^ . . . . . . "0"^^ . . "4"^^ . "0"^^ . "c++"^^ . . . "Perhaps I should explain that my scripts work fine (as is) when in the Wireshark global plugins folder. The problem only occurs when I use the personal plugins folder (in AppData on Windows). The global folder is awkward to use because of permission restrictions."^^ . "lua require works in CMD but not in VSCode debugger"^^ . . . . . . . . "0"^^ . . . "0"^^ . "1"^^ . "1"^^ . . . . . . "replace"^^ . . "0"^^ . . "cs50"^^ . . . "1"^^ . . . "2"^^ . "0"^^ . "using tokens when including files"^^ . . "0"^^ . "0"^^ . . . "<blockquote>\n<p>So if I understand this correctly, Lua data types of string, numbers are values, while functions and tables are references.</p>\n</blockquote>\n<p>Since your question is ultimately about implementation details (e.g. memory usage): It is a bit more nuanced than this.</p>\n<p>Lua values are effectively a &quot;tagged union&quot;: There's the type tag, and then there is a value, usually one machine word. For types that don't fit into a single machine word, this value will be a reference, and these types will thus be &quot;reference&quot; types.</p>\n<p><code>nil</code>, booleans, and numbers in Lua are &quot;primitive&quot; types: They are cheap to copy (they use up just a single machine word or less, maybe two machine words together with the type tag, if your Lua implementation does not use <a href="https://piotrduperas.com/posts/nan-boxing/" rel="noreferrer">NaN boxing</a>), so they are copied on every assignment. The value is just the boolean or floating-point number value. <em>Not</em> copying them (referencing them) would be more expensive than copying them.</p>\n<p>Strings <em>behave</em> like a &quot;value&quot; type: They are immutable, so there's no difference between copying and referencing them. But they are implemented as reference types for performance reasons nonetheless. If you assign a string to a variable, the string isn't being &quot;copied&quot; - only the reference (a pointer with a type tag) is being copied.</p>\n<p>This means that when you do <code>local x = ...</code>, you are only using a constant amount of extra memory: The extra memory needed to store one Lua value, which will be around one or two machine words. There is no copy of tables, strings, userdata, threads or functions happening here: All types that aren't trivially copyable are implemented as reference types, mutable or not.</p>\n<blockquote>\n<p>So this should theoretically improve speed by a bit since we're assigning it to a local variable</p>\n</blockquote>\n<p>Indeed it usually does, since it saves you a hash lookup in the global table, but I would recommend against premature optimization nonetheless, especially considering &quot;smart&quot; implementations like LuaJIT.</p>\n<blockquote>\n<p>but I wonder if doing so will consume significantly more memory</p>\n</blockquote>\n<p>Usually not significantly, but you might want to be aware of the following ramifications:</p>\n<ul>\n<li>You need a slot to store this <code>local</code>. (This is only a small constant memory usage and effectively negligible though.)</li>\n<li>If this <code>local</code> is used in functions, it becomes a heap-allocated <em>upvalue</em>. (Again only a small constant usage, no matter how large the value you're referencing or copying is.)</li>\n<li>All functions that use this <code>local</code> will need an &quot;upvalue slot&quot; to reference the upvalue.</li>\n</ul>\n<p>So this is ultimately a time-space tradeoff: If you don't localize, functions have to hit the global table (technically their environment table, which defaults to the global table) to get at global variables. If you localize, you're marrying the function to the values <em>at the time you localize</em>, at a small memory cost (because the function now effectively needs to store a pointer to the upvalue).</p>\n<p>Note also that localizing interferes with monkey-patching: Suppose you do <code>Config = {frobnicate = true}</code>, then load a file which localizes <code>local Config = {}</code>, then another file which redefines <code>Config = {frobnicate = false}</code>. The second file will still work with the outdated definition.</p>\n"^^ . . . "Without digging too deep, I believe that this algorithm works with separate lines rather than complete text, and that is why lines with '$$' only trigger both conditions *starts with '$$'* and *ends with '$$'*."^^ . . "0"^^ . "4"^^ . "The condition is also not always true. It's only true if Users ID is matching."^^ . . . . . "2"^^ . . "nvim.cmp"^^ . "Thanks for your constructive criticism and actually being the first to reply to this. Let me be more specific, I need help because I dont think I have yet the skill to 1) make my code less messy 2)fix why I get a stack overflow 20% of the time. I made it work but now I need a little push from someone else to improve it."^^ . . . . . . . . "I assume that you will eventually feed this to a PCRE engine? If so, apply [EAFP](https://stackoverflow.com/q/11360858) and use [`pcall(...)`](https://stackoverflow.com/q/63528999)."^^ . "Lua conditional evaluation of new language operators"^^ . "0"^^ . . "attempt to concatenate string with nil | Roblox Code, How to fix?"^^ . . "How to modify existing and new string index in Redis?"^^ . . . . "0"^^ . . . . "Perhaps better suited to https://codereview.stackexchange.com"^^ . . . "What is causing LuaLS to give this bogus cast-local-type warning?"^^ . "0"^^ . "<p>I have a file structured like this: we can call it input.tex</p>\n<pre><code>\\begin{document}\n\\import{./}{Capitolo1.tex}\n\\import{./}{Capitolo2.tex}\n\\end{document}\n</code></pre>\n<p>Using this function I can perform a serger operation, replacing the \\import command with the content of the desired file (Chapter 1, Chapter 2)</p>\n<pre><code>function file_exists(name)\n local f = io.open(name, &quot;r&quot;)\n if f ~= nil then\n io.close(f)\n return true\n else\n return false\n end\nend\n\nfunction rows_from(file)\n if not file_exists(file) then\n return {}\n end\n local rows = {}\n for line in io.lines(file) do\n rows[#rows + 1] = line\n end\n return rows\nend\n\nfunction search_for_import(tex)\n local tbl = {}\n for j = 1, #rows_from(tex) do\n if string.sub(rows[j],1,7) == &quot;\\\\import&quot; then\n table.insert(tbl,{\n [1] = j, --line\n [2] = string.sub(rows[j],13,-2), --file name\n })\n print(string.sub(rows[j],13,-2))\n search_for_import(string.sub(rows[j],13,-2))\n end\n end\n if #tbl &gt; 0 then\n temp = tex..&quot;.mirror&quot; --create mirror file\n io.output(temp)\n local line\n row = rows_from(tex)\n for i = 1, #row do\n line = row[i]\n for key, value in pairs(tbl) do\n \n if i == value[1] then\n print(value[2])\n line = row[i+1]\n for j = 1, #rows_from(value[2]) do\n io.write(rows_from(value[2])[j], &quot;\\n&quot;)\n end\n end\n end\n io.write(line, &quot;\\n&quot;)\n end\n io.close()\n end\n os.execute(&quot;move &quot;..temp..&quot; &quot;..tex) --final result\nend\n</code></pre>\n<p>This function works fine. But what if the imported file itself had an \\import command? My attempt is to use the recursive function</p>\n<pre><code>for j = 1, #rows_from(tex) do\n if string.sub(rows[j],1,7) == &quot;\\\\import&quot; then\n table.insert(tbl,{\n [1] = j,\n [2] = string.sub(rows[j],13,-2),\n })\n print(string.sub(rows[j],13,-2))\n search_for_import(string.sub(rows[j],13,-2)) --this\n end\nend\n</code></pre>\n<p>But this end with an infinite loop.</p>\n<p>Ant ideas?</p>\n"^^ . "1"^^ . . "0"^^ . "1"^^ . "excel"^^ . . . "hammerspoon"^^ . . . . . . . . . . "Not to be dismissive, but this kind of question is surprisingly common. The answer is _it isn't worth your time_. Use a library. Requirements forbidding that are inane; anything you are running lua on already has libmp4 on it. Just link and use."^^ . . . "1"^^ . . . . "`print( ("sometext\\\\scalebox{0.74}"):gsub("\\\\scalebox","") )\n`"^^ . . . "Prevent duplication entry based on amount"^^ . . "dll"^^ . . "3"^^ . . "1"^^ . . . . "0"^^ . . . . . . . "0"^^ . "Thank you that certainly works. That command to manipulate the HTML is what I hoped the Pandoc filter would do."^^ . "0"^^ . "Ah sorry. I had noticed that typo in game but forgot to fix it in the pastebin I pulled it into the game from. I have fixed that typo before asking this question. Apologies."^^ . . . . . "1"^^ . . . "<p>so i downloaded love2d and its in program files and added it to the environment variables and opened vs code and downloaded the extension of love2d support and i did everything like the video on youtube right and its still now working, it says undefined global love so if anyone can please help me and i found that someone said that you can drag the main.lua file in the love2d app and it should work but it doesnt work for me also so please help and thank you.\n<img src="https://i.sstatic.net/0kSY13vC.png" alt="enter image description here" />\n<img src="https://i.sstatic.net/p4Pph9fg.png" alt="enter image description here" />\n<img src="https://i.sstatic.net/Apmqc08J.png" alt="enter image description here" />\n<img src="https://i.sstatic.net/MBuHVRhp.png" alt="enter image description here" />\n<img src="https://i.sstatic.net/pBDNs83f.png" alt="enter image description here" /></p>\n<p>i tried everything other extensions and nothing works, i even downloaded it on my ither leptop and same problem and i my friend also has the same exact problem</p>\n"^^ . . . . . . . . "json"^^ . "0"^^ . . "profanity"^^ . . "0"^^ . . . "I cannot make sense of your post. Your heading says "leaves", your body says "joins" . I'm no roblox expert. I would assume that player stats are being managed by the server, not the client. also your condition is always true. you need to write `if player.UserId == 123 or player.UserId == 456' other wise you're oring with a number which is alway true, making your condition always true regardless the userid.\nI would also assume that the server treats the host as any other player so joining your own server should trigger the same events for the host."^^ . "0"^^ . "0"^^ . "Please show your Lua filter (at least the relevant parts)"^^ . . "0"^^ . "0"^^ . . . "@Luatic yes, I need `$$` to be at start/end of a line. `$$` is a LaTeX tag to display math equations, just like, for example, <code> </code> in XML."^^ . "0"^^ . . . "0"^^ . . "0"^^ . "0"^^ . . . . "0"^^ . . . "tarantool"^^ . "luau"^^ . . "3"^^ . . . . . . . . "1"^^ . "0"^^ . "<p>I am recently try using scrapy splash to scrape data from a website that loads more data when scrolls to bottom. <code>website: https://www.openrice.com/zh/hongkong/restaurants/district/%E5%B0%96%E6%B2%99%E5%92%80</code></p>\n<p>so I first try to perform scrolling in <strong>console</strong> of dev tools using JavaScript:</p>\n<pre><code>for (let i = 0; i &lt; 5; i++) {\n setTimeout(() =&gt; window.scrollTo(0, (document.body.scrollHeight-1500)), i * 2000);\n}\n</code></pre>\n<p>(I set the y-coord to (document.body.scrollHeight-1500) because it cannot load when it is at the very end, so it needs to be a bit upper)</p>\n<p>The js code works perfectly when do this in the dev tool on browser, so i put this in scrapy splash:\nand here's my code:</p>\n<pre><code>import scrapy\nfrom Task2.items import RestaurantItem\nfrom scrapy_splash import SplashRequest\n\nlua_script = &quot;&quot;&quot;\nfunction main(splash, args)\n splash:go(args.url)\n splash:wait(5.0)\n local scroll = splash:jsfunc([[\n function scrollWithDelay() {\n for (let i = 0; i &lt; 5; i++) {\n setTimeout(() =&gt; window.scrollTo(0, (document.body.scrollHeight-1500)), i * 2000);\n }\n }\n ]])\n scroll()\n splash:wait(5.0)\n return {html = splash:html()}\nend\n&quot;&quot;&quot;\n\nclass OpenriceTstSpider(scrapy.Spider):\n name = &quot;openrice_tst&quot;\n allowed_domains = [&quot;www.openrice.com&quot;]\n\n def start_requests(self):\n url = &quot;https://www.openrice.com/zh/hongkong/restaurants/district/%E5%B0%96%E6%B2%99%E5%92%80&quot;\n yield SplashRequest(url, callback=self.parse, endpoint='execute', \n args={'wait': 2, 'lua_source': lua_script, 'viewport': '1920x1080',\n url: &quot;https://www.openrice.com/zh/hongkong/restaurants/district/%E5%B0%96%E6%B2%99%E5%92%80&quot;})\n\n def parse(self, response):\n ...\n</code></pre>\n<p>I am only getting the first 20 search result from the website, which could be loaded when i keep scrolling down, it was there before using any js.</p>\n<p>So i want to know if I missed any detail or i write anything wrong on my code? I can get some result but it is <strong>not</strong> from the js, the js works perfectly on my browser, so the problem is either the scrapy-splash is not working, or my lua script is wrong, i keep searching for 2 days and still cannot find a solution, i will give you a big thanks if u can help me!</p>\n<p>Also is it possible that I can force it to show all result without scrolling? Thank you so much for everyone that would like to help me...</p>\n"^^ . "1"^^ . . "0"^^ . . . "garrys-mod"^^ . . . . . "I usually put it in `StarterPlayer.StarterCharacterScripts`, but did you try putting `UIS,InputBegan` and the following code until its end in the end? The code is written in a Local Script, which is why I in the first place used `game.Players.LocalPlayer`"^^ . . . . "0"^^ . . . . . "5"^^ . "0"^^ . "<p>Thanks to @<a href="https://stackoverflow.com/users/21305238/insync">InSync</a> for the suggestion :) this gave me an insight on a possible solution.</p>\n<p>One can simply use a regex engine and <strong>pcall</strong> (~try-catch) the pattern creation block.</p>\n<p>Example using <a href="https://luarocks.org/modules/rrt/lrexlib-pcre" rel="nofollow noreferrer"><code>lrexlib-pcre</code></a> library:</p>\n<pre class="lang-lua prettyprint-override"><code>local rex = require(&quot;rex_pcre&quot;)\n\nlocal function is_valid_regex(pattern)\n return pcall(rex.new, pattern)\nend\n\n-- Test\nprint(is_valid_regex(&quot;.*&quot;)) -- true\nprint(is_valid_regex(&quot;[a-z]+&quot;)) -- true\nprint(is_valid_regex(&quot;([0-9]&quot;)) -- false (unbalanced parentheses)\nprint(is_valid_regex(&quot;*invalid&quot;)) -- false (invalid usage of *)\n</code></pre>\n"^^ . . . . . . . . "0"^^ . "1"^^ . "0"^^ . . . . . "<p>I need help with <code>CheckType</code>. How can I make it check: <code>Enum</code>. (<code>Enum</code> is a <code>userdata</code>, but it doesn't work; <code>Enum</code> is in Luau.) (This is me asking for help in the Language: Luau (Roblox))</p>\n<p>When I test <code>Enum</code>, it gives me a string because it turns into the string: &quot;Enums&quot;</p>\n<p>Doing <code>type(Enum)</code> -- Output: <code>userdata</code>.</p>\n<p>I want my own code to be as accurate as possible to the original <code>type</code> function.</p>\n<p>I also need help with a better <code>newproxy</code>, it just doesn't feel the same way as the original Lua 5.1 one.</p>\n<pre><code>local proxy = {}\n\nnewproxy = newproxy or function(bool)\n if bool then\n setmetatable(proxy, {\n __index = {}\n })\n end\n return proxy\nend\n\nfunction CheckType(a)\n local s, e = pcall(function()\n return a.Archivable and (string.match(tostring(a), &quot;^(.-):&quot;) == nil)\n end)\n\n local _nil = ((a == nil) and &quot;nil&quot;)\n local Instance = ((s and e ~= nil) and &quot;Instance&quot;)\n local userdata = ((a == newproxy(true)) and &quot;userdata&quot;) \n local coffee = (string.match(tostring(a), &quot;^(.-):&quot;))\n local boolean = (((a == true) and &quot;boolean&quot; or (a == false) and &quot;boolean&quot;)) \n local number = (((tonumber(a) ~= nil and tostring(a) ~= nil) and &quot;number&quot;))\n local string = ((((not tostring(a) == _nil) and (not tonumber(a)))) and &quot;string&quot;)\n local unknown = &quot;Unknown&quot;\n\n return Instance or userdata or coffee or boolean or number or string or unknown\nend\n\nprint(CheckType(Enum)) -- Output: userdata (But it Outputs: string)\n</code></pre>\n"^^ . . . . . . . . . "<p>Im trying to put the following 2 scripts together so that they can run at the same exact time.</p>\n<pre><code>function OnEvent(event, arg)\n if EnableRCS ~= false then\n if IsMouseButtonPressed(3) then -- Only check for right mouse button press\n repeat\n if IsMouseButtonPressed(1) then\n repeat\n MoveMouseRelative(0, RecoilControlStrength)\n Sleep(DelayRate)\n until not IsMouseButtonPressed(1)\n end\n until not IsMouseButtonPressed(3)\n end\n end\nend\n</code></pre>\n<p>and</p>\n<pre><code>if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 8 then\n PressKeySequenceA()\n end\n</code></pre>\n<p>I've tried combining the script like this:</p>\n<pre><code>function OnEvent(event, arg)\n if EnableRCS ~= false then\n \n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 8 then\n PressKeySequenceA()\n end\n\n \n if IsMouseButtonPressed(3) then\n repeat\n if IsMouseButtonPressed(1) then\n repeat\n MoveMouseRelative(0, RecoilControlStrength)\n Sleep(DelayRate)\n until not IsMouseButtonPressed(1)\n end\n until not IsMouseButtonPressed(3)\n end\n end\nend\n</code></pre>\n<p>But it doesn't result in the scripts being executed simultaneously</p>\n<p>Right now the scripts execute one by one but I want them to execute at the same time.</p>\n"^^ . . . . . . . . . "<p>I'm trying to integrate Lua 503 into a C++ game engine using Sol v3.2.1 as a wrapper. Everything is included properly in the project and builds fine until i try using Sol, then i start getting linker errors.</p>\n<pre><code>#include &quot;Engine.h&quot;\n\n#include &lt;sol.hpp&gt;\n\nvoid TestLua()\n{\n sol::state lua; // &lt;-- This is causing linker errors\n}\n\nint main(int argv, char* argc[])\n{\n TestLua();\n\n return 0;\n}\n</code></pre>\n<p><a href="https://i.sstatic.net/BHm3nioz.png" rel="nofollow noreferrer">Solution Explorer file structure</a></p>\n<p>I'm unfamiliar with integrating scripting, i'm just following along with a course so i am unsure of what to do. Any help is greatly appreciated.</p>\n"^^ . "0"^^ . . "0"^^ . . "OMG thank you so much! Since the biggest problem i have is to find all url to different restarant, i can now access to the url using \n`data = response.json()\ndata["paginationResult"]["results"]["shortenUrl"]`\nwith the url i think i can scrape the data using my scrapy code again! this really helps me a lot tysm! also i got a small question, how do u find this api?"^^ . . . . . "0"^^ . . . "I can't seem to understand a single thing. So it basically means that I can't simply access the variable change it, and detect when it changes."^^ . . "Minecraft CC Tweaked Mod: Why does it appears that the turtle is skipping lines of code?"^^ . . . "Lua not being able to load a script"^^ . . . . . "1"^^ . . . . "0"^^ . . "1"^^ . . "<p>Main question for me is can I make it so that it can access the local players character from a variable given in a module script? I can't seem to access the character of it, even though it still IS the local player and prints out local players name.\nif we guess that:\nmodule script:</p>\n<pre><code>local info = {\n\nlocalplayer = game.Players.LocalPlayer,\n\n}\nreturn info\n</code></pre>\n<p>how do I access the character? (the script making the hitbox isn't a local script.)</p>\n"^^ . . . "luasocket"^^ . "Can nginx's njs (or Lua?) be used to replace a header with that header's SHA-512?"^^ . "2"^^ . "http2"^^ . . "<p>I get the error from the title in my Roblox(Lua) code. Here's the code:</p>\n<pre class="lang-lua prettyprint-override"><code>local inventoryEvent = game.ReplicatedStorage.Remotes.InventoryEvent\n\ngame.Players.PlayerAdded:Connect(function(player)\n -- Ensure the player's inventory exists\n local inventory = player:FindFirstChild(&quot;Inventory&quot;)\n if not inventory then\n inventory = Instance.new(&quot;Folder&quot;)\n inventory.Name = &quot;Inventory&quot;\n inventory.Parent = player\n end\n\n -- Ensure InventoryGui and its components exist\n local inventoryGui = player.PlayerGui:WaitForChild(&quot;InventoryGui&quot;)\n local inventoryFrame = inventoryGui:WaitForChild(&quot;InventoryFrame&quot;)\n local itemsFrame = inventoryFrame:WaitForChild(&quot;ItemsFrame&quot;)\n\n -- Connect inventory child added event\n inventory.ChildAdded:Connect(function(Item)\n print(&quot;Item added to inventory: &quot; .. Item.Name) -- Debugging statement\n inventoryEvent:FireClient(player, Item.Name, true) -- Pass the item's name as a string and true as Value\n end)\nend)\n\ninventoryEvent.OnServerEvent:Connect(function(player, ItemName, Value, button)\n -- Validate arguments\n if not (player and ItemName and Value and button) then\n warn(&quot;Missing argument in inventoryEvent.OnServerEvent&quot;)\n return\n end\n\n -- Debugging output\n print(&quot;Received request to process item:&quot;, ItemName)\n\n if Value == false then\n local selectedItem = player.Inventory:FindFirstChild(ItemName)\n if not selectedItem then\n print(&quot;Items in inventory:&quot;)\n for _, item in ipairs(player.Inventory:GetChildren()) do\n print(item.Name)\n end\n warn(&quot;Selected item not found in inventory: &quot; .. ItemName)\n return\n end\n\n local backpack = player.Backpack:GetChildren()\n local characterItems = player.Character:GetChildren()\n\n if #backpack == 0 and not player.Character:FindFirstChildWhichIsA(&quot;Tool&quot;) then\n button.Text = &quot;Unequip&quot;\n button.BackgroundColor3 = Color3.new(1, 0, 0)\n selectedItem:Clone().Parent = player.Backpack\n else\n for _, v in ipairs(backpack) do\n button.Text = &quot;Equip&quot;\n button.BackgroundColor3 = Color3.new(0, 1, 0)\n v:Destroy()\n end\n for _, v in ipairs(characterItems) do\n if v:IsA(&quot;Tool&quot;) then\n button.Text = &quot;Equip&quot;\n button.BackgroundColor3 = Color3.new(0, 1, 0)\n v:Destroy()\n end\n end\n end\n end\nend)\n\n</code></pre>\n<p>And the real error: <code>Missing argument in inventoryEvent.OnServerEvent - Server - InventoryScript:27</code></p>\n<p>Can anyone help?</p>\n<p>I tried asking chat gpt, copilot and every possible lua guide to fix it!</p>\n"^^ . "0"^^ . . "<p>I have stumbled upon a strange behavior of <code>table.sort()</code>, in which the comparing function is invoked by passing the same array element in both parameters.</p>\n<p>Consider the code below. I want to sort the array from highest to lowest value of the property <code>v</code> and, in case they are equal (and since <code>table.sort()</code> algorithm is not stable as of <a href="https://www.lua.org/manual/5.3/manual.html#pdf-table.sort" rel="nofollow noreferrer">the docs</a>), I want to sort them by the original indices of the elements.</p>\n<pre class="lang-lua prettyprint-override"><code>-- The array to sort\nlocal arr = {\n {id=&quot;A&quot;, v = 1},\n {id=&quot;B&quot;, v = 1},\n {id=&quot;C&quot;, v = 0},\n {id=&quot;D&quot;, v = 1},\n {id=&quot;E&quot;, v = 1}\n}\n\n-- A map containing the original index of the elements in the array: element =&gt; originalIndex\nlocal original_indices = {}\nfor index, elem in ipairs(arr) do\n original_indices[elem] = index\nend\n\n-- Sort the array\ntable.sort(arr, \n function(a, b) \n assert(a ~= b, &quot;Comparing the same element in the array!&quot;)\n \n -- Compare the value\n if a.v &gt; b.v then\n return true\n elseif a.v &lt; b.v then\n return false\n end\n \n -- Values are equal. Compare original indices, which should always\n -- decide the final order.\n local ia = original_indices[a]\n local ib = original_indices[b]\n \n if ia &lt; ib then\n return true\n elseif ia &gt; ib then\n return false\n end\n \n error(&quot;BUG! Comparing the same element in the array!&quot;) \n end\n)\n\n</code></pre>\n<p>The expected result should be:</p>\n<pre class="lang-lua prettyprint-override"><code>{ \n {id=&quot;A&quot;, v = 1},\n {id=&quot;B&quot;, v = 1},\n {id=&quot;D&quot;, v = 1},\n {id=&quot;E&quot;, v = 1},\n {id=&quot;C&quot;, v = 0}\n}\n</code></pre>\n<p>But, instead, I get an error because Lua is invoking the sorting function by passing the same element in both parameters, which should not.</p>\n<p>Am I missing something? How can I get the expected result?</p>\n<p>You can play around with the code <a href="https://onecompiler.com/lua/42jwnh2j2" rel="nofollow noreferrer">here</a>.</p>\n"^^ . "<p>You could use <code>sed</code> on the <code>inputfile.html</code> between the two <code>pandoc</code> commands.</p>\n<pre class="lang-bash prettyprint-override"><code>#!/bin/bash\n\npandoc -f rtf -t html -o inputfile.html inputfile.rtf\n\ncat inputfile.html | sed 's/&lt;p&gt;&lt;strong&gt;\\(.*\\)&lt;\\/strong&gt;&lt;\\/p&gt;/&lt;h1&gt;\\1&lt;\\/h1&gt;/g' &gt; inputfile-fixed.html &amp;&amp; rm inputfile.html\n\npandoc -t chunkedhtml --split-level=1 -o RN_File inputfile-fixed.html\n</code></pre>\n<p>Save as: <code>fix_heading.sh</code><br>\nChange mode executable: <code>chmod +x fix_heading.sh</code><br>\nUsage: <code>./fix_heading.sh</code></p>\n<hr />\n<p>I used <code>cat</code> as a precaution. If you want to directly edit the file, inline, replace the <code>cat</code> line with:</p>\n<pre><code>sed -i 's/&lt;p&gt;&lt;strong&gt;\\(.*\\)&lt;\\/strong&gt;&lt;\\/p&gt;/&lt;h1&gt;\\1&lt;\\/h1&gt;/g' inputfile.html\n</code></pre>\n<p>That will eliminate need of the intermediate file.</p>\n"^^ . . . "4"^^ . "<p>I been using this script for LGS ( Logitech gaming software) and it was working well all the time. but then I have to replaced my old mouse g502 to G502x which only support by G HUB.</p>\n<p>now when I run this script on G HUB, it doesn't work anymore, in console when i left click nothing happen and show in console but when I right click I'm getting this message event = MOUSE_BUTTON_PRESSED, arg = 2 and i believe it should show up arg= 1 when i left click.</p>\n<p>I've added an image to show the trouble that I get when I run the script using the Logitech mouse g502x on g HUB.</p>\n<p>I've also add another function on the top of the script &quot;function math.pow(x,y) return x^y end&quot; because I had similar error before like this one <a href="https://stackoverflow.com/questions/67126798/attempt-to-call-nil-value">Attempt to call nil value</a>, when run on g hub</p>\n<p>am fairly new to Lua and don't really know the mechanics. so I really ask for you help, thank you guys</p>\n<p><a href="https://i.sstatic.net/fkFZj6ta.jpg" rel="nofollow noreferrer">enter image description here</a></p>\n<pre><code>--------------------------------------------------------------------------\n--------------------------------------------------------------------------\n---- key bind ----\nlocal scarl_key = nil\nlocal ump9_key = nil\nlocal hold_breath_key = &quot;lshift&quot;\nlocal m416_key = 11\nlocal set_off_key = 10\nlocal akm_key = nil\nlocal m16a4_key = nil\nlocal uzi_key = nil\n\n---- control_key ----\n\nlocal control_key = &quot;lctrl&quot; \n\n---- can use &quot;lalt&quot;, &quot;ralt&quot;, &quot;alt&quot; &quot;lshift&quot;, &quot;rshift&quot;, &quot;shift&quot; &quot;lctrl&quot;, &quot;rctrl&quot;, &quot;ctrl&quot;\n\nlocal ignore_key = &quot;lalt&quot; --- ignore key\n\n--- fastloot setting---\n--- Press controlkey and and ignore_key and click Left mouse button ---\n--- &quot;lctrl&quot; + &quot;lalt&quot; + mousebutton\n\nlocal control_key = &quot;lctrl&quot; \nlocal fastloot = false ---if you don't need it, you can close it by true to false.\nlocal move = 40 ----1920*1080\n\n---- only can use &quot;numlock&quot;, &quot;capslock&quot;, &quot;scrolllock&quot;\n\nlocal full_mode_key = &quot;numlock&quot; ---numlock lamp on,recoil is full_mode.&quot;numlock&quot; \nlocal mode_switch_key = &quot;capslock&quot; \nlocal lighton_key = &quot;scrolllock&quot; ---start script,scrolllock l\n--- Your Sensitivity in Game amp will be on.close script ,scrolllock lamp will be off.\n\n\nlocal vertical_sensitivity = 1 --- default is 0.7\nlocal target_sensitivity = 38 --- default is 50.0\nlocal scope_sensitivity = 38 --- default is 50.0\nlocal scope4x_sensitivity = 38 --- default is 50.0\n\n-- you can close these by true to false\n\nlocal hold_breath_mode = false\nlocal full_mode = false\n\n---- Obfs setting\n-- local obfs_mode = false\nlocal obfs_mode = false\nlocal interval_ratio = 0.75\nlocal random_seed = 1\n\nlocal auto_reloading = false\n\n--------------------------------------------------------------------------\n---------------- Recoil Table ------------------------------\n---------------- You can fix the value here ------------------------------\n--------------------------------------------------------------------------\n--- recoil times\n--- if the Recoil compensation is Large or small,You can modify the value of all_recoil_Times or recoil_table{times}\nlocal all_recoil_times = 1\n\nlocal recoil_table = {}\n\nrecoil_table[&quot;akm&quot;] = {\n basic={56,41,42,46,48, 58,58.5,62,64,67, 68,71,70,74.4,77, 74},\n basictimes = 1.04,\n full={56,41,42,46,48, 58,58.5,64,68,68, 70,71,70,74.4,77, 74},\n fulltimes = 1.04*0.75,\n quadruple={56,41,42,46,48, 58,58.5,64,68,68, 70,71,70,74.4,77, 74},\n quadrupletimes = 4*1.04,\n fullof4x={56,41,42,46,48, 58,58.5,64,68,68, 70,71,70,74.4,77, 74},\n fullof4xtimes = 4*1.04*0.75,\n speed = 100,\n maxbullets = 40,\n holdbreathtimes = 1.25,\n fullholdbreathtimes = 1.25, \n}\n\nrecoil_table[&quot;m416&quot;] = {\n basic={44,44,45,46,49,50,51,51,55,55,55,58,61,61,63,63,64,64,64,62,63,62,63,62,63,62,62,62,62,62},\n basictimes = 1.27,\n full={44,44,45,46,49,50,51,51,55,55,55,58,61,61,63,63,64,64,64,62,63,62,63,62,63,62,62,62,62,62},\n fulltimes = 1.08*0.75, \n quadruple={44,44,45,46,49,50,51,51,55,55,55,58,61,61,63,63,64,64,64,62,63,62,63,62,63,62,62,62,62,62},\n quadrupletimes = 3*1.08*0.9,\n fullof4x={44,44,45,46,49,50,51,51,55,55,55,58,61,61,63,63,64,64,64,62,63,62,63,62,63,62,62,62,62,62},\n fullof4xtimes =3*1.01*0.55,\n speed = 86,\n maxbullets = 40,\n holdbreathtimes = 1.25,\n fullholdbreathtimes = 1.25, \n}\n\nrecoil_table[&quot;scarl&quot;] = {\n basic={41,33,33,36,41, 40,46,47,45.6,46.5, 47.5,48.5,49.2,52.2,53.1, 53}, \n basictimes = 1.50,\n full={41,30,33,36,41, 40,46,47,45.6,46.5, 47.5,46.5,49.2,52.2,53.1, 53},\n fulltimes = 1.08*0.75, \n quadruple={41,30,33,36,41, 40,46,47,45.6,46.5, 47.5,46.5,49.2,52.2,53.1, 53},\n quadrupletimes = 4*1.08*0.9,\n fullof4x={41,30,33,36,41, 40,46,47,45.6,46.5, 47.5,46.5,49.2,52.2,53.1, 53},\n fullof4xtimes = 3*1.00*0.55,\n speed = 94,\n maxbullets = 40,\n holdbreathtimes = 1.25,\n fullholdbreathtimes = 1.25, \n}\n\nrecoil_table[&quot;ump9&quot;] = {\n basic={30,31,32,34,37, 35,35,36,42,38, 39,42,42,41,41, 41,41,42,42,42, 43,40,41,43,40, 40,40,41,42},\n basictimes = 1,\n full={30,31,32,34,37, 35,35,36,42,38, 39,42,42,41,41, 41,41,42,44,42, 43,40,41,44,40, 40,41,42,43},\n fulltimes = 0.75*0.9,\n quadruple={30,31,32,34,37, 35,35,36,42,38, 39,42,42,41,41, 41,41,42,44,42, 43,40,41,44,40, 40,41,42,43},\n quadrupletimes = 4*1*0.97,\n fullof4x={30,31,32,34,37, 35,35,36,42,38, 39,42,42,41,41, 41,41,42,44,42, 43,40,41,44,40, 40,41,42,43},\n fullof4xtimes = 4*0.75,\n speed = 92,\n maxbullets = 40,\n holdbreathtimes = 1.25,\n fullholdbreathtimes = 1.25, \n}\n\nrecoil_table[&quot;uzi&quot;] = { \n basic={8.5,8.5,9,9,9,10.5,10.5,10.5,12,13,13,14.5,15.5,16,17.5,18.5,19,19.5,19,19.5,19,19,19.5,20},\n basictimes = 2,\n full={4.8,4.8,5,5,5,6,6,6,6.2,6.8,6.8,7.6,7.6,7.9,8.2,8.2,8.2,8.7,8.7,9,9.5,9.5,9.6,9.6},\n fulltimes = 2,\n quadruple={8.5,8.5,9,9,9,10.5,10.5,10.5,12,13,13,14.5,15.5,16,17.5,18.5,19,19.5,19,19.5,19,19,19.5,20},\n quadrupletimes = 2,\n fullof4x={4.8,4.8,5,5,5,6,6,6,6.2,6.8,6.8,7.6,7.6,7.9,8.2,8.2,8.2,8.7,8.7,9,9.5,9.5,9.6,9.6},\n fullof4xtimes = 2,\n speed = 48,\n maxbullets = 35,\n holdbreathtimes = 1.25,\n fullholdbreathtimes = 1.25, \n}\n\nrecoil_table[&quot;m16a4&quot;] = {\n basic={42.3,31.2,32.4,42.3,50.4, 54.1,62.1,60,62.5,65.5, 63,62.1,64.4,64.4,65.25,63.9},\n basictimes = 1.23,\n full={42.3,31.2,32.4,42.3,50.4,54.1,62.1,60,62.5,65.5,63,62.1,64.4,64.4,65.25,63.9},\n fulltimes = 1.23*0.77,\n quadruple={42.3,31.2,32.4,42.3,50.4,54.1,62.1,60,62.5,65.5,63,62.1,64.4,64.4,65.25,63.9},\n quadrupletimes = 1.23*4,\n fullof4x={42.3,31.2,32.4,42.3,50.4,54.1,62.1,60,62.5,65.5,63,62.1,64.4,64.4,65.25,63.9},\n fullof4xtimes = 4*1.23*0.75,\n speed = 80,\n maxbullets = 40,\n clickspeed = 40,\n holdbreathtimes = 1.25,\n fullholdbreathtimes = 1.25, \n}\n\nrecoil_table[&quot;none&quot;] = {\n basic={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n basictimes = 1,\n full={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n fulltimes = 1,\n quadruple={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n quadrupletimes = 1,\n fullof4x={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\n fullof4xtimes = 1,\n speed = 30,\n maxbullets = 40,\n clickspeed = 40,\n holdbreathtimes = 1.25,\n fullholdbreathtimes = 1.25, \n}\n\n--------------------------------------------------------------------------\n---------------- Function ------------------------------\n--------------------------------------------------------------------------\n\n\n\nfunction convert_sens(unconvertedSens) \n return 0.002 * math.pow(10, unconvertedSens / 50)\nend\n\nfunction calc_sens_scale(sensitivity)\n return convert_sens(sensitivity)/convert_sens(50)\nend\n\nlocal target_scale = calc_sens_scale(target_sensitivity)\nlocal scope_scale = calc_sens_scale(scope_sensitivity)\nlocal scope4x_scale = calc_sens_scale(scope4x_sensitivity)\n\nfunction recoil_mode()\n if not IsKeyLockOn(mode_switch_key) then\n if IsKeyLockOn(full_mode_key) and full_mode then\n return &quot;full&quot;;\n else\n return &quot;basic&quot;;\n end\n end \n \n if IsKeyLockOn(mode_switch_key) then\n if IsKeyLockOn(full_mode_key) and full_mode then\n return &quot;fullof4x&quot;\n else\n return &quot;quadruple&quot;\n end \n end \nend\n \nfunction recoil_value(_weapon,_duration)\n local _mode = recoil_mode()\n local step = (math.floor(_duration/recoil_table[_weapon][&quot;speed&quot;])) + 1\n if step &gt; #recoil_table[_weapon][_mode] then\n step = #recoil_table[_weapon][_mode]\n end\n\n local weapon_recoil = recoil_table[_weapon][_mode][step]\n local weapon_speed = recoil_table[_weapon][&quot;speed&quot;]\n local weapon_clickspeed = recoil_table[_weapon][&quot;clickspeed&quot;]\n local weapon_maxbullets = recoil_table[_weapon][&quot;maxbullets&quot;]\n local weapon_basictimes = recoil_table[_weapon][&quot;basictimes&quot;]\n local weapon_fulltimes = recoil_table[_weapon][&quot;fulltimes&quot;]\n local weapon_quadrupletimes = recoil_table[_weapon][&quot;quadrupletimes&quot;]\n local weapon_fullof4xtimes = recoil_table[_weapon][&quot;fullof4xtimes&quot;]\n local weapon_holdbreathtimes = recoil_table[_weapon][&quot;holdbreathtimes&quot;]\n local weapon_fullofholdbreathtimes = recoil_table[_weapon][&quot;fullholdbreathtimes&quot;]\n local weapon_intervals = weapon_speed \n local weapon_clicktime = weapon_clickspeed\n local weapon_bullets = weapon_maxbullets \n\n if obfs_mode then\n local coefficient = interval_ratio * ( 1 + random_seed * math.random())\n weapon_intervals = math.floor(coefficient * weapon_speed) \n end\n -- OutputLogMessage(&quot;weapon_intervals = %s\\n&quot;, weapon_intervals)\n\n recoil_recovery = weapon_recoil\n recoil_times = all_recoil_times * 0.7 / vertical_sensitivity \n\n if recoil_mode() == &quot;basic&quot; and not IsModifierPressed(hold_breath_key) then\n recoil_recovery = recoil_recovery * recoil_times * weapon_basictimes\n end\n if recoil_mode() == &quot;basic&quot; and hold_breath_mode and IsModifierPressed(hold_breath_key) then\n recoil_recovery = recoil_recovery * weapon_holdbreathtimes * recoil_times * weapon_basictimes\n end\n\n if recoil_mode() == &quot;full&quot; and not IsModifierPressed(hold_breath_key) then\n recoil_recovery = recoil_recovery * recoil_times * weapon_fulltimes\n end\n if recoil_mode() == &quot;full&quot; and hold_breath_mode and IsModifierPressed(hold_breath_key) then\n recoil_recovery = recoil_recovery * weapon_fullofholdbreathtimes * recoil_times * weapon_fulltimes\n end\n\n if recoil_mode() == &quot;quadruple&quot; then\n recoil_recovery = recoil_recovery * recoil_times * weapon_quadrupletimes\n end\n \n if recoil_mode() == &quot;fullof4x&quot; then\n recoil_recovery = recoil_recovery * recoil_times * weapon_fullof4xtimes\n end\n\n -- issues/3\n if IsMouseButtonPressed(2) then\n recoil_recovery = recoil_recovery / target_scale\n elseif recoil_mode() == &quot;basic&quot; then\n recoil_recovery = recoil_recovery / scope_scale \n elseif recoil_mode() == &quot;full&quot; then\n recoil_recovery = recoil_recovery / scope_scale\n elseif recoil_mode() == &quot;quadruple&quot; then\n recoil_recovery = recoil_recovery / scope4x_scale\n elseif recoil_mode() == &quot;fullof4x&quot; then\n recoil_recovery = recoil_recovery / scope4x_scale\n end\n\n return weapon_intervals,recoil_recovery,weapon_clicktime,weapon_bullets\nend\n\nfunction light_off()\n if IsKeyLockOn(lighton_key) then\n PressAndReleaseKey(control_key)\n PressAndReleaseKey(lighton_key)\n end \nend\nfunction light_on()\n if not IsKeyLockOn(lighton_key) then\n PressAndReleaseKey(control_key)\n PressAndReleaseKey(lighton_key)\n end\nend\n\n--------------------------------------------------------------------------\n---------------- OnEvent ------------------------------\n--------------------------------------------------------------------------\n\n\nfunction OnEvent(event, arg)\n OutputLogMessage(&quot;event = %s, arg = %d\\n&quot;, event, arg)\n if (event == &quot;PROFILE_ACTIVATED&quot;) then\n EnablePrimaryMouseButtonEvents(true)\n Fire = false\n current_weapon = &quot;none&quot;\n shoot_duration = 0.0\n if IsKeyLockOn(lighton_key) then\n PressAndReleaseKey(lighton_key)\n elseif IsKeyLockOn(full_mode_key) then\n PressAndReleaseKey(full_mode_key)\n elseif IsKeyLockOn(mode_switch_key) then\n PressAndReleaseKey(mode_switch_key)\n end\n elseif event == &quot;PROFILE_DEACTIVATED&quot; then\n ReleaseMouseButton(1)\n end\n\n if (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == set_off_key) \n or (event == &quot;G_PRESSED&quot; and arg == set_off_gkey) then\n current_weapon = &quot;none&quot; light_off()\n elseif (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == akm_key)\n or (event == &quot;G_PRESSED&quot; and arg == akm_gkey) then\n current_weapon = &quot;akm&quot; light_on()\n elseif (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == m16a4_key)\n or (event == &quot;G_PRESSED&quot; and arg == m16a4_gkey) then\n current_weapon = &quot;m16a4&quot; light_on()\n elseif (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == m416_key)\n or (event == &quot;G_PRESSED&quot; and arg == m416_gkey) then\n current_weapon = &quot;m416&quot; light_on()\n elseif (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == ump9_key)\n or (event == &quot;G_PRESSED&quot; and arg == ump9_gkey) then\n current_weapon = &quot;ump9&quot; light_on()\n elseif (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == uzi_key)\n or (event == &quot;G_PRESSED&quot; and arg == uzi_gkey) then\n current_weapon = &quot;uzi&quot; light_on()\n elseif (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == scarl_key)\n or (event == &quot;G_PRESSED&quot; and arg == scarl_gkey) then\n current_weapon = &quot;scarl&quot; light_on()\n elseif (event == &quot;M_RELEASED&quot; and arg == 3 and Fire) then\n local intervals,recovery,clicktime,bullets = recoil_value(current_weapon,shoot_duration)\n if shoot_duration % clicktime == 0 then\n PressAndReleaseMouseButton(1)\n end \n MoveMouseRelative(0, recovery / 10)\n Sleep(intervals/10)\n shoot_duration = shoot_duration + (intervals/10)\n if auto_reloading then\n if shoot_duration &gt; (intervals * bullets) + 100 then\n ReleaseMouseButton(1)\n PressAndReleaseKey(&quot;r&quot;)\n Sleep(200)\n Fire = false\n end\n end\n if not Fire then\n ReleaseMouseButton(1)\n elseif Fire then\n SetMKeyState(3)\n end\n\n elseif (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1) then\n -- button 1 : Shoot\n if ((current_weapon == &quot;none&quot;) or IsModifierPressed(ignore_key)) then\n PressMouseButton(1)\n repeat\n Sleep(30)\n until not IsMouseButtonPressed(1)\n elseif(current_weapon == &quot;m16a4&quot;) then\n Fire = true\n SetMKeyState(3)\n else\n repeat\n local intervals,recovery,clicktime,bullets = recoil_value(current_weapon,shoot_duration)\n MoveMouseRelative(0, recovery /10 )\n Sleep(intervals/10)\n shoot_duration = shoot_duration + (intervals/10)\n if auto_reloading then\n if shoot_duration &gt; (intervals * bullets) + 100 then\n ReleaseMouseButton(1)\n PressAndReleaseKey(&quot;r&quot;)\n Sleep(200)\n end\n end\n until not IsMouseButtonPressed(1)\n end\n elseif (event == &quot;MOUSE_BUTTON_RELEASED&quot; and arg == 1) then\n Fire = false\n shoot_duration = 0.0\n end\n\n while (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 1 and IsModifierPressed(control_key) and IsModifierPressed(ignore_key) and fastloot) do\n ReleaseMouseButton(1)\n PressMouseButton(1)\n for i = 0, 14 do\n MoveMouseRelative(move, 0)\n Sleep(2)\n end\n ReleaseMouseButton(1)\n for i = 0, 14 do\n MoveMouseRelative(-move, 0)\n Sleep(2)\n end\n Sleep(10) \n end\n\nend\n</code></pre>\n<p>i tried run the script with old version of g hub, still doesn't work.\ni tried delete the top newest function, it came back to the previous pow error &quot;Attempt to call nil value&quot;</p>\n"^^ . "0"^^ . "screen"^^ . . . . . . . "0"^^ . "0"^^ . . . . . . . . "1"^^ . . . . . . . . "1"^^ . "wxgrid"^^ . . . . "0"^^ . "1"^^ . "<p>I'm trying to get LazyVim/NeoVim setup and I need to build with luajit, but I wasn't able to do the instructions:</p>\n<blockquote>\n<p>Copy <code>luajit.exe</code> and <code>lua51.dll</code> (built in the <code>src</code> directory) to a\nnewly created directory (any location is ok). Add <code>lua</code> and <code>lua\\jit</code>\ndirectories below it and copy all Lua files from the <code>src\\jit</code>\ndirectory of the distribution to the latter directory.</p>\n<p>There are no hardcoded absolute path names — all modules are loaded\nrelative to the directory where <code>luajit.exe</code> is installed (see\n<code>src/luaconf.h</code>).</p>\n</blockquote>\n<p>What i did was first install luajit from the git link and pasted into powershell, then installed cygwin and installed gcc-core and make, then made cygwin\\bin go into my path for make to then work.</p>\n<p>I tried to look online for this issue but I didn't seem to find any solution.</p>\n<p>then i just looked up .dll, and found <code>cyglua51.dll</code> &amp; <code>libluajit-5.1.dll.a</code> within the luajit folder</p>\n<p><a href="https://i.sstatic.net/JpssM5b2.png" rel="nofollow noreferrer">enter image description here</a></p>\n<p>Which one do i use? or do i need something that is exactly as <code>lua51.dll</code> instead without &quot;cyg&quot;?</p>\n<p>I am not a coder/computer expert at all, I'm only really able to find quick fixes on google and can find some problems with a bit of patient, but complex problems are out of my reach.</p>\n"^^ . . . . . . . . "0"^^ . . "1"^^ . . . . "1"^^ . . . "<p>Removed the keys from the table (instead of 5robux just the table), and it worked!\nExample:</p>\n<pre><code>a = {\n {\n key = &quot;5robux&quot;,\n value = 10,\n name = &quot;21&quot;\n },\n {\n key = &quot;10robux&quot;,\n value = 13,\n name = &quot;31&quot;\n },\n {\n key = &quot;15robux&quot;,\n value = 20,\n name = &quot;41&quot;\n },\n}\n</code></pre>\n<p>Thanks to gsck</p>\n"^^ . . . "0"^^ . "0"^^ . "<ol>\n<li>Self is not defined in functions that are structured with periods, you're supposed to use <a href="https://create.roblox.com/docs/luau/metatables" rel="nofollow noreferrer">setmetable</a> to define a backpack with its own table</li>\n<li>You use __index for <a href="https://devforum.roblox.com/t/roblox-oop-object-oriented-programming/1639499/1" rel="nofollow noreferrer">OOP (Object Oriented Programming)</a>, read up on that to refine your code</li>\n</ol>\n"^^ . "0"^^ . "<p>Being fairly new to the wonderful language of lua, I still don't fully\nunderstand how all the bits and pieces fit together in the lua eco-system.</p>\n<p>If editing the following perfectly valid code:</p>\n<pre class="lang-lua prettyprint-override"><code>require &quot;luarocks.loader&quot;\nlocal serpent = require &quot;serpent&quot;\n\nlocal deser = {} -- This line produces the linter warning.\n-- local deser -- If skipping the table, it goes away.\nlocal data = { foo = &quot;bar&quot; }\n\nlocal ser = serpent.dump(data)\n_, deser = serpent.load(ser)\nfor k, v in pairs(deser) do\n print(k, v)\nend\n</code></pre>\n<p>The following linter warning occur on line 9:</p>\n<blockquote>\n<p>[Lua Diagnostics.] This variable is defined as type <code>table</code>. Cannot convert its type to <code>string|unknown</code>.</p>\n<ul>\n<li><code>string</code> cannot match <code>table</code></li>\n<li>Type <code>string</code> cannot match <code>table</code></li>\n</ul>\n</blockquote>\n<p>As visible from the comment on line 5, it is easy to silence the warning. Still, it would be interesting to better understand where it is coming from.</p>\n<p>The function signature for <a href="https://github.com/pkulchenko/serpent/blob/ed98a21/src/serpent.lua#L134" rel="nofollow noreferrer">serpent.load()</a> has no type information. So my guess is that the language-server makes stuff up, by making incorrect assumptions. Is that a fair description of what is happening?</p>\n<p>The language-server is in my case v3.9.3 of <a href="https://github.com/LuaLS/lua-language-server/" rel="nofollow noreferrer">LuaLS</a>. It does document e.g. what <a href="https://luals.github.io/wiki/diagnostics/#cast-local-type" rel="nofollow noreferrer">cast-local-type</a> means, but I fail at finding how it comes to the conclusion that the lint should be applicable. Is it doing so by itself, or relying on a linter tool or library which could be used independently of the language-server?</p>\n<p>How can one best deal with this kind of issues in the lua world? Introducing ambiguity, by separating declaration and assignment, was my work-around this time? Would the only better approach be the costly one of to trying to contribute type-hinting to all rocks one use?</p>\n<p>For fully unknown API:s, like in <a href="https://stackoverflow.com/q/77429985/type-hints-for-lua">q77429985</a>, a suggestion is to create <a href="https://luals.github.io/wiki/definition-files/" rel="nofollow noreferrer">Definition Files</a>. It appears those would conflict with the actual implementation, making that a problematic path to take when the real code is available for LuaLS?</p>\n"^^ . "recursion"^^ . "0"^^ . . . . . . . "0"^^ . "<p>I am storing strings and numbers in Redis.</p>\n<p>I use basic key value stores to keep track of the current color value.</p>\n<pre><code>DATA:color:ID1 = red\nDATA:color:ID2 = red\nDATA:color:ID3 = red\nDATA:color:ID4 = blue\n</code></pre>\n<p>I use SETs to allow for quick lookup of colors and corresponding IDs.</p>\n<pre><code>INDEX:color:red = {ID1, ID2, ID3}\nINDEX:color:blue = {ID4}\n</code></pre>\n<p>How should I go about updating these values? If ID1 becomes blue, we will need to run the following commands:</p>\n<pre><code>SADD INDEX:color:blue ID1\nSREM INDEX:color:red ID1\nSET DATA:color:ID1 blue\n</code></pre>\n<p>The issue though is I do not know which SET ID1 is inside at the time of updating the value to blue. I can achieve this using a lua script, but this violates the rules about generating dynamic keys. The lua script would look like:</p>\n<pre><code>-- ARGV[1] is the index key\n-- ARGV[2] is the ID\n-- ARGV[3] is the new value\n\nlocal k = redis.call('GET', KEYS[1])\nredis.call('SREM', ARGV[1] .. &quot;:&quot; .. k, ARGV[2])\nredis.call('SADD', ARGV[1] .. &quot;:&quot; .. ARGV[3], ARGV[2])\nredis.call('SET', KEYS[1], ARGV[3])\n</code></pre>\n<p>Example usage would look like:</p>\n<pre><code>EVALSHA &lt;SHA&gt; 1 DATA:color:ID1 INDEX:color ID1 blue\n</code></pre>\n<p>If I were storing numbers, this is trivial as I can use sorted sets.</p>\n<p>Is there a way to achieve this without violating the guidelines?</p>\n"^^ . . . . "0"^^ . "string"^^ . "tags"^^ . "0"^^ . "<p>I'm assuming you've seen <a href="https://stackoverflow.com/questions/1426954/split-string-in-lua">other posts</a> that tell you to use <code>[^sep]</code> to split a string by the <code>sep</code> character. These work, but only for one character long separators.</p>\n<p>So for your pattern, <code>[^\\\\scalebox]+</code>, we will split on ALL the characters <code>\\</code>,<code>s</code>,<code>c</code>,<code>a</code>,<code>l</code>,<code>e</code>,<code>b</code>,<code>o</code>, or <code>x</code>. Which results in the list of strings that you're getting: &quot;m&quot;, &quot;t&quot;, &quot;t&quot;, &quot;{0.74}&quot;.</p>\n<p>Since you want to split on text, rather than characters, you can use <code>string.find</code> to find the index of your &quot;\\scalebox&quot;, and then <code>string.sub</code> to substring around that index:</p>\n<pre class="lang-lua prettyprint-override"><code>local s = &quot;sometext\\\\scalebox{0.74}&quot;\nlocal pattern = &quot;\\\\scalebox&quot;\n\nlocal index = s:find(pattern)\nlocal first = s:sub(1, index - 1)\nlocal second = s:sub(index + string.len(pattern), string.len(s))\n</code></pre>\n<p>This obviously can be made into a loop and be made to output as a table as needed, but you only mentioned needing the first/second halves.</p>\n"^^ . "0"^^ . "1"^^ . . . . . . . "If you know that your code is messy, why do you show it to us? so you're basically saying: My room looks like shit. Somewhere in that mess there must be my car key. Please search it for me. wouldn't it be nicer to first clean up your mess and then ask for help ( including the high chance that you'll find the key yourself while cleaning up) ??"^^ . . "0"^^ . . "0"^^ . . . "UserInputService isn't detecting inputs"^^ . "0"^^ . "0"^^ . "proxy"^^ . "nginx"^^ . . . "4"^^ . "0"^^ . . "0"^^ . . . . . "0"^^ . . . . "<p>I've been working on a GUI system where I have a health, stamina and EXP bar.</p>\n<p>Once I finally got towards the end, I was given an error message on this part of code, saying:</p>\n<p>attempt to concatenate string with nil</p>\n<pre><code>HealthDisplay.Text = &quot;HP: &quot; .. Humanoid.Health .. &quot;/&quot; .. Humanoid.MaxHealth\nStaminaDisplay.Text = &quot;Stamina: &quot; .. Stamina.Value .. &quot;/&quot; .. MaxStamina.Value\nLvlDisplay.Text = &quot;Lvl: &quot; .. Level.Value\n</code></pre>\n<p>Im not sure how to fix this.</p>\n<p>I tried using the &quot;tostring()&quot; function but it would only say &quot;nil&quot; on the bars rather than the number.</p>\n"^^ . "<p>I'm programming a wx.grid application under lua. I want to change the width and colour of some single horizontal lines.</p>\n<p>I was looking for a function (method) like 'grid.wx.SetRowGridLineWidth(columnnumber,custom_width)', or 'grid.wx.SetRowGridLineColour(columnnumber,custom_wx.colour)'. Indeed such basic and elementary functions seem not to exist.\nI found some workaround based on 'grid.wx.GetRowGridLinePen(self, columnnumber)'. For that I would have to override this virtual function or derive a class.\nUnfortunately I have no idea at all how to derive a class, or how to override a function. I found an example using python, but I did not succeed in transferring it to lua and getting it to work. You see, I'm not an advanced programmer, but nevertheless I think that there ought to be a user-friendly solution to such a basic problem.</p>\n"^^ . . . "<p>I figure it. I went and downloaded the source from the official site and added it to the project, replacing a few of the files. Had to delete two of the C files that had main functions. I downloaded lua 5.3.6 since i'm not sure this version of sol supports higher.</p>\n"^^ . . . "1"^^ . "<p>Your code can find the <code>EyeModel</code> successfully, but it doesn't have the <code>PrimaryPart</code> property set when it errors.</p>\n<p>This can be caused by StreamingEnabled-&gt;Atomic or because you're setting PrimaryPart around the same time as when you're trying to access it. This would cause a race condition.</p>\n<p>Is the name of the PrimaryPart always the same? Then you can consider doing a <code>:WaitForChild(&quot;&quot;)</code> for the PrimaryPart's name as well. This is the easiest and cleanest solution.</p>\n"^^ . "0"^^ . . . . . . . . . . . . . . . . "0"^^ . "0"^^ . "0"^^ . . . . . "0"^^ . . "<p>You're a lot closer than you might think! It comes down to a very subtle error in your last line, which should instead read:</p>\n<pre class="lang-lua prettyprint-override"><code>displayMessageEvent.OnClientEvent:Connect(onDisplayMessage)\n</code></pre>\n<p>Notice that I removed the inner parentheses after <code>onDisplayMessage</code>.</p>\n<h2>What you got right</h2>\n<p>Your initial intuition was correct. When you bind a function to an event with <code>Connect</code>, you don't have to do much work with arguments in the moment. You just have to make sure to call <code>FireAllClients</code> with the same number of arguments your connected function is expecting whenever you use it. In other words, <em>assuming you connected the function to the event properly</em>, your code does exactly what you wanted it to.</p>\n<h2>Why it didn't work</h2>\n<p>The problem is how you're connecting your function to the event. <code>Connect</code> expects a function (also known as a callback in this context), but you're actually not giving it one since <code>onDisplayMessage()</code> isn't a function. More specifically, there's a difference between <code>onDisplayMessage</code> and <code>onDisplayMessage()</code> - the first is a function, and the second is a function <em>call</em>.</p>\n<p>So when Roblox sees this line:</p>\n<pre class="lang-lua prettyprint-override"><code>displayMessageEvent.OnClientEvent:Connect(onDisplayMessage())\n</code></pre>\n<p>It doesn't bind the function <code>onDisplayMessage</code> to the event. Instead, it calls <code>onDisplayMessage</code> with no arguments, then binds its return value to the event.<sup>1</sup></p>\n<p>Removing the parentheses ensures that you're binding the function itself, not calling the function and binding the value it returns.</p>\n<hr />\n<p><sup>1. This is probably throwing a quiet error since you're calling the function with the wrong number of arguments, but I honestly don't know.</sup></p>\n"^^ . . "0"^^ . . "Without seeing your filter I guess that one approach is to have a styled `Block` instead of a styled `Inline` in your markdown document."^^ . . . . "0"^^ . . . . . "Unable to read headers in NGINX from gRPC request"^^ . . "animation"^^ . "0"^^ . "2"^^ . . . . "1"^^ . "1"^^ . . "why would you want to do that? that's pretty bad style"^^ . . . . "<p>I'm working on a FiveM script that integrates an AI-powered NPC chat system using QBCore. The goal is for players to be able to approach NPCs, press &quot;E&quot; to interact, and have a conversation where both the player's messages and the NPC's AI-generated responses appear in a UI chat window.</p>\n<p>The issue I'm facing is that while the AI responses are correctly generated and logged in the console, they do not appear in the UI in the game. The player's messages show up in the UI chat window, but the NPC's responses are missing.</p>\n<p>Here's a brief overview of my setup:</p>\n<pre><code>Server Script (server.lua): Handles the AI API request and sends the response back to the client.\n\nClient Script (client.lua): Sends the player's message to the server, receives the AI response, and sends it to the NUI.\n\nUI Scripts (index.html, style.css**,** script.js**):** Manages the chat window and displays messages.\n</code></pre>\n<p>I tried everything but nothing worked.</p>\n<p>If you wanna test it guys, just create an access token on huggingface and add it to the config.lua.</p>\n<p>here is my Code:</p>\n<pre><code>--fxmanifest.lua\nfx_version 'cerulean'\ngame 'gta5'\n\nauthor 'Revo'\ndescription 'Interactive NPCs with LLM'\nversion '1.0.0'\n\nshared_script 'config.lua'\n\nclient_scripts {\n 'client/client.lua'\n}\n\nserver_scripts {\n 'server/server.lua'\n}\n\nfiles {\n 'ui/index.html',\n 'ui/style.css',\n 'ui/script.js'\n}\n\nui_page 'ui/index.html'\n</code></pre>\n<pre><code>--config.lua\nConfig = {}\nConfig.HuggingFaceAPIKey = &quot;API-Key&quot;\nConfig.ModelEndpoint = &quot;https://api-inference.huggingface.co/models/facebook/blenderbot-400M-distill&quot;\n\n</code></pre>\n<pre><code>--server.lua\nlocal json = require('json')\n\nRegisterNetEvent('InteractiveNPCS:RequestLLMResponse')\nAddEventHandler('InteractiveNPCS:RequestLLMResponse', function(text)\n print(&quot;Received text from client: &quot; .. text)\n local apiKey = Config.HuggingFaceAPIKey\n local endpoint = Config.ModelEndpoint\n\n PerformHttpRequest(endpoint, function(err, responseText, headers)\n if err == 200 then\n print(&quot;Received response from LLM API: &quot; .. tostring(responseText))\n local response = json.decode(responseText)\n local reply = response and response[1] and response[1].generated_text or &quot;Sorry, I don't understand.&quot;\n print(&quot;Sending response to client: &quot; .. reply)\n TriggerClientEvent('InteractiveNPCS:ReceiveLLMResponse', source, reply)\n else\n print(&quot;Error from LLM API: &quot; .. tostring(err))\n print(&quot;Response text: &quot; .. tostring(responseText))\n TriggerClientEvent('InteractiveNPCS:ReceiveLLMResponse', source, &quot;Sorry, something went wrong.&quot;)\n end\n end, 'POST', json.encode({\n inputs = text\n }), {\n [&quot;Authorization&quot;] = &quot;Bearer &quot; .. apiKey,\n [&quot;Content-Type&quot;] = &quot;application/json&quot;\n })\nend)\n</code></pre>\n<pre><code>--client.lua\nlocal function showChat()\n SetNuiFocus(true, true)\n SendNUIMessage({\n type = &quot;show&quot;\n })\nend\n\nlocal function closeChat()\n SetNuiFocus(false, false)\n SendNUIMessage({\n type = &quot;close&quot;\n })\nend\n\nlocal function getClosestPed(coords)\n local handle, ped = FindFirstPed()\n local success\n local closestPed = nil\n local closestDistance = -1\n\n repeat\n local pedCoords = GetEntityCoords(ped)\n local distance = #(coords - pedCoords)\n\n if closestDistance == -1 or distance &lt; closestDistance then\n closestPed = ped\n closestDistance = distance\n end\n\n success, ped = FindNextPed(handle)\n until not success\n\n EndFindPed(handle)\n return closestPed\nend\n\nRegisterNUICallback('closeChat', function(data, cb)\n closeChat()\n cb('ok')\nend)\n\nRegisterNUICallback('sendMessage', function(data, cb)\n local text = data.text\n print(&quot;Client: Sending message - &quot; .. text)\n local playerPed = PlayerPedId()\n local coords = GetEntityCoords(playerPed)\n local closestPed = getClosestPed(coords)\n\n if closestPed then\n TriggerServerEvent('InteractiveNPCS:RequestLLMResponse', text)\n else\n SendNUIMessage({\n type = &quot;npcReply&quot;,\n text = &quot;No one is around to talk to.&quot;\n })\n end\n cb('ok')\nend)\n\nCitizen.CreateThread(function()\n while true do\n Citizen.Wait(0)\n if IsControlJustReleased(0, 38) then -- E key\n local playerPed = PlayerPedId()\n local coords = GetEntityCoords(playerPed)\n local closestPed = getClosestPed(coords)\n\n if closestPed then\n showChat()\n end\n end\n end\nend)\n\nRegisterNetEvent('InteractiveNPCS:ReceiveLLMResponse')\nAddEventHandler('InteractiveNPCS:ReceiveLLMResponse', function(response)\n print(&quot;Client: Received response - &quot; .. response)\n SendNUIMessage({\n type = &quot;npcReply&quot;,\n text = response\n })\nend)\n</code></pre>\n<pre><code>&lt;!-- &lt;div&gt; index.html &lt;/div&gt; --&gt;\n&lt;!DOCTYPE html&gt;\n&lt;html lang=&quot;en&quot;&gt;\n&lt;head&gt;\n &lt;meta charset=&quot;UTF-8&quot;&gt;\n &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;\n &lt;title&gt;Interactive NPC Chat&lt;/title&gt;\n &lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot;&gt;\n&lt;/head&gt;\n&lt;body&gt;\n &lt;div id=&quot;chatContainer&quot;&gt;\n &lt;div id=&quot;messagesContainer&quot;&gt;&lt;/div&gt;\n &lt;div id=&quot;inputContainer&quot;&gt;\n &lt;input type=&quot;text&quot; id=&quot;inputMessage&quot; placeholder=&quot;Type a message...&quot; /&gt;\n &lt;button id=&quot;sendButton&quot;&gt;Send&lt;/button&gt;\n &lt;button id=&quot;closeButton&quot;&gt;X&lt;/button&gt;\n &lt;/div&gt;\n &lt;/div&gt;\n &lt;script src=&quot;script.js&quot;&gt;&lt;/script&gt;\n&lt;/body&gt;\n&lt;/html&gt;\n</code></pre>\n<pre><code>/* style.css */\n\nbody {\n font-family: Arial, sans-serif;\n margin: 0;\n padding: 0;\n display: flex;\n justify-content: center;\n align-items: flex-end;\n height: 100vh;\n background: transparent;\n}\n\n#chatContainer {\n position: fixed;\n bottom: 10px;\n width: 90%;\n max-width: 600px;\n background: rgba(0, 0, 0, 0.8);\n padding: 10px;\n border-radius: 10px;\n color: white;\n display: none;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);\n}\n\n#messagesContainer {\n max-height: 200px;\n overflow-y: auto;\n margin-bottom: 10px;\n padding: 5px;\n border: 1px solid #444;\n border-radius: 5px;\n background: rgba(0, 0, 0, 0.6);\n}\n\n#inputContainer {\n display: flex;\n align-items: center;\n}\n\n#inputMessage {\n flex: 1;\n padding: 10px;\n margin-right: 10px;\n border-radius: 5px;\n border: none;\n}\n\nbutton {\n padding: 10px 15px;\n background: #3498db;\n border: none;\n border-radius: 5px;\n color: white;\n cursor: pointer;\n margin-left: 5px;\n}\n\nbutton:hover {\n background: #2980b9;\n}\n\n.chat-message.npc {\n color: #ffcc00;\n}\n\n.chat-message.user {\n color: #ffffff;\n}\n</code></pre>\n<pre><code>// script.js\n\nconsole.log(&quot;UI: Script loaded&quot;);\n\ndocument.getElementById(&quot;sendButton&quot;).addEventListener(&quot;click&quot;, sendMessage);\ndocument.getElementById(&quot;closeButton&quot;).addEventListener(&quot;click&quot;, closeChat);\n\nfunction closeChat() {\n console.log(&quot;UI: Closing chat&quot;);\n fetch(`https://${GetParentResourceName()}/closeChat`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n }\n }).then(resp =&gt; resp.json()).then(resp =&gt; {\n if (resp === 'ok') {\n document.getElementById('chatContainer').style.display = 'none';\n }\n });\n}\n\nfunction sendMessage() {\n const text = document.getElementById('inputMessage').value;\n console.log(&quot;UI: Sending message - &quot; + text);\n\n // Add user's message to the chat\n addMessageToChat(&quot;User&quot;, text);\n\n fetch(`https://${GetParentResourceName()}/sendMessage`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({ text })\n }).then(resp =&gt; resp.json()).then(resp =&gt; {\n if (resp === 'ok') {\n document.getElementById('inputMessage').value = '';\n }\n });\n}\n\nfunction addMessageToChat(sender, message) {\n const messagesContainer = document.getElementById('messagesContainer');\n const messageElement = document.createElement('div');\n messageElement.className = `chat-message ${sender.toLowerCase()}`;\n messageElement.innerText = `${sender}: ${message}`;\n messagesContainer.appendChild(messageElement);\n messagesContainer.scrollTop = messagesContainer.scrollHeight;\n}\n\nwindow.addEventListener('message', (event) =&gt; {\n console.log(&quot;UI: Received message - &quot; + JSON.stringify(event.data));\n\n if (event.data.type === 'show') {\n console.log(&quot;UI: Showing chat&quot;);\n document.getElementById('inputMessage').value = '';\n document.getElementById('messagesContainer').innerHTML = ''; // Clear previous messages\n document.getElementById('chatContainer').style.display = 'block';\n } else if (event.data.type === 'close') {\n console.log(&quot;UI: Closing chat&quot;);\n document.getElementById('chatContainer').style.display = 'none';\n } else if (event.data.type === 'npcReply') {\n console.log(&quot;UI: NPC replied with text - &quot; + event.data.text);\n\n // Add NPC's message to the chat\n addMessageToChat(&quot;Random NPC&quot;, event.data.text);\n }\n});\n</code></pre>\n<p>i tried everything and nothing worked.</p>\n"^^ . . "0"^^ . . "1"^^ . . . . . . "0"^^ . "<p>You can use something like:</p>\n<pre><code>async function get_obfuscated_token(r) {\n r.setReturnValue(&quot;abc&quot;);\n}\n</code></pre>\n<p>The <code>r.setReturnValue</code> keeps <code>js_set</code> happy.\nThe call to <code>js_set</code> just looks like:</p>\n<pre><code> js_path &quot;/etc/nginx&quot;;\n js_import obfuscate.js;\n\n js_set $obfuscated_token obfuscate.get_obfuscated_token;\n</code></pre>\n<p>IOW, sometimes you <em>can</em> 'return' a value from an async function. njs requires it sometimes too.</p>\n"^^ . . . "<p>I saw a lot of coders do this when init new table, set __index to itself. Why?</p>\n<pre class="lang-lua prettyprint-override"><code> local Backpack = {}\n Backpack.__index = Backpack\n</code></pre>\n<p>To clone we still use <code>obj.__index = self</code> So why do we need the second line? Does it do something I don't understand?</p>\n<pre class="lang-lua prettyprint-override"><code> local Backpack = {}\n -- why we need this?\n Backpack.__index = Backpack\n Backpack.initial = &quot;Water, cloths&quot;\n function Backpack.new()\n local obj = {}\n -- If we have this?\n obj.__index = self\n return obj\n end\n \n local AlexBackpack = Backpack:new()\n AlexBackpack.initial = &quot;Water, cloths, knife, fire starter&quot;\n \n -- Backpack.initial: Water, cloths\n -- AlexBackpack.initial: Water, cloths, knife, fire starter\n print('Backpack.initial:', Backpack.initial)\n print('AlexBackpack.initial:', AlexBackpack.initial)\n</code></pre>\n<p>Check this code online <a href="https://onecompiler.com/lua/42fqg7s34" rel="nofollow noreferrer">https://onecompiler.com/lua/42fqg7s34</a></p>\n"^^ . "0"^^ . . "2"^^ . . "0"^^ . "1"^^ . . . . . . . . . "0"^^ . . "@Nifim actually, I still do not get why you need to put the return tableName, when I've done it without it in pure Lua. I mean not using this Lua wrapper (Sol2)."^^ . . . . . . "How to parse JSON with Ofelia in Puredata"^^ . . . . "0"^^ . . "<p>You could do this by splitting the string on $$ occurrences.</p>\n<p>Given the input of something like</p>\n<pre><code>Some text\n$$ Something else $$\nSome more text\n$$\nAnother example\n$$\nend\n</code></pre>\n<pre class="lang-lua prettyprint-override"><code>local inputStr = [[Some text\n$$ Inside area $$\nSome more text\n$$\nAnother\n$$\nend]]\n\n-- Taken from https://stackoverflow.com/questions/1426954/split-string-in-lua\nfunction splitString(inputstr, sep)\n if sep == nil then\n sep = &quot;%s&quot;\n end\n local t = {}\n for str in string.gmatch(inputstr, &quot;([^&quot;..sep..&quot;]+)&quot;) do\n table.insert(t, str)\n end\n return t\nend\n\nlocal stringParts = splitString(inputStr, &quot;$$&quot;)\n\nfor i, v in ipairs(stringParts) do\n if i % 2 == 0 then\n -- When i is a multiple of 2 its inside the $$ tags, supports multi line\n print(&quot;$$ area detected&quot;, i, v)\n end\nend\n</code></pre>\n<p>The above code splits the input string into an array on the $$ tags, if the current index is even we are between $$ tags, if it is odd then we are in normal text.</p>\n<p>This doesn't cover the case of the $$ being at the start or end of a line, but that should be relatively trivial to implement. If the index is even you can just check the previous segment to see if it ended in a new line and check if the next segment starts with a new line.</p>\n"^^ . "0"^^ . . . "If your specific question changes then yes, create a new topic. "^^ . . . . "Basketball not bouncing properly in Lua in Roblox Studio (I am making a game in Roblox Studio)"^^ . . . . "spring-boot"^^ . . . "1"^^ . "<pre class="lang-lua prettyprint-override"><code>local mux = wezterm.mux\nwezterm.on(&quot;gui-startup&quot;, function(cmd)\n local tab, pane, window = mux.spawn_window(cmd or {})\n window:gui_window():maximize()\nend)\n</code></pre>\n<p>Maybe you can try this.</p>\n"^^ . . . "<p>This is the code:</p>\n<pre class="lang-lua prettyprint-override"><code>game.Players.PlayerAdded:Connect(function(player)\n local leaderstats = Instance.new(&quot;Folder&quot;)\n leaderstats.Name = &quot;leaderstats&quot;\n\n money = Instance.new(&quot;IntValue&quot;)\n money.Name = &quot;Money&quot;\n money.Parent = leaderstats\n money.Value = 0\n ---------------------------------------------------------------------\n multiplier = Instance.new(&quot;IntValue&quot;)\n multiplier.Name = &quot;Multiplier&quot;\n multiplier.Parent = player\n multiplier.Value = 1.0\n ---------------------------------------------------------------------\n leaderstats.Parent = player\nend) : \n\nworkspace:WaitForChild(&quot;Upgrades&quot;):WaitForChild(&quot;Upgrade_1&quot;):WaitForChild(&quot;ClickDetector&quot;).MouseClick:Connect(function(player)\n workspace:WaitForChild(&quot;Upgrades&quot;):WaitForChild(&quot;Upgrade_1&quot;):WaitForChild(&quot;ClickDetector&quot;):Destroy() -- Removes ClickDetector\n local money = player:WaitForChild(&quot;leaderstats&quot;):WaitForChild(&quot;Money&quot;)\n --------------------------------------------------------------------- ---------------------------------------------------------------------\n while True wait(0.025) do\n local currentMultiplier = player:WaitForChild(&quot;Multiplier&quot;).Value\n money.Value = money.Value + (1.0 * currentMultiplier) \n end\nend)\n</code></pre>\n<p>The problem is that when I change the <code>multiplier.Value</code> in Roblox Studio, it doesn't change in the code. However, when I change it in the code, it works fine. I don't know how to get the code to update when I change the variable manually in Roblox Studio.</p>\n<p>One of my theories is that <code>money.Value</code> is not checking if the variable changed while the loop is running.</p>\n"^^ . . . "I performed my test by using the working directory specified in `cwd` from launch.json. So they are identical."^^ . . . . . . . . "Visionary Render Lua, Moving Assembly"^^ . . "@Rob OK, so I really should be replacing <p><strong> with <h1> etc. Thanks."^^ . . "0"^^ . "0"^^ . . . . . "lua-scripting-library"^^ . . . . "1"^^ . "when you use studio test you dont have network ownership over the the IntValue so it wont replicate. you'll have to switch over to server simulation and change it while inside server simulation: https://create.roblox.com/docs/studio/testing-modes#clientserver-toggle"^^ . . . "0"^^ . "<p>I am creating a chat app and want a server to broadcast every message that a client sends it, but the client is receiving no data after the server broadcasts the client message.\nI am using Lua lanes for multithreading, Lua-JSON for json encoding and decoding and Lua socket for networking.</p>\n<p>Here is the server code:</p>\n<pre class="lang-lua prettyprint-override"><code>local socket = require 'socket'\nlocal json = require 'json'\nlocal log = require '3rd.log'\nlocal connection = require 'src.connection'\n\nlocal udp = socket.udp()\nudp:setsockname('*', 7777) -- Bind to all interfaces with *\nlog.info('Created server socket.')\nlocal rest_time = 0 -- Everytime the server handles a request, it will rest for X time.\nlocal connections = {}\n\nwhile true do\n local data, msg_or_ip, port_or_nil = udp:receivefrom()\n\n if data then\n log.info(string.format('Received data from %s:%d: %s', msg_or_ip, port_or_nil, data))\n\n local connection_exists = false\n for _, client in pairs(connections) do\n if client.ip == msg_or_ip and client.port == port_or_nil then\n connection_exists = true\n -- Break so then we dont loop through anymore connections (saving time)\n break\n end\n end\n\n if not connection_exists then\n local new_connection = connection.new()\n new_connection.ip = msg_or_ip\n new_connection.port = port_or_nil\n print(json.encode(new_connection))\n\n table.insert(connections, new_connection)\n log.info(string.format('Added new connection: %s:%d', new_connection.ip, new_connection.port))\n end\n\n -- Broadcast message\n for _, client in pairs(connections) do\n print('broad')\n print(json.encode(client))\n udp:sendto(data, client.ip, client.port)\n log.info(string.format('Sent data to %s:%d: %s', client.ip, client.port, data))\n end\n\n elseif msg_or_ip ~= 'timeout' then\n log.error('Network error: '..tostring(msg_or_ip))\n end\n\n socket.sleep(rest_time)\nend\n</code></pre>\n<p>Here is the client code:</p>\n<pre class="lang-lua prettyprint-override"><code>local lanes = require 'lanes'.configure()\nlocal log = require '3rd.log'\nlocal packet = require 'src.packet'\n\n-- Sender thread: sends data\nlocal start_sender = lanes.gen('*', function(linda, address, port)\n local socket = require 'socket'\n local json = require 'json'\n\n local udp = socket.udp()\n udp:setpeername(address, port)\n\n local user = 'Unknown'\n\n while true do\n local msg = io.read()\n\n if msg == ':quit' then\n -- Send a should_quit signal.\n linda:set('should_quit', true)\n break\n end\n\n local msg_packet = packet.new()\n msg_packet.msg = msg\n msg_packet.user = user\n\n local json_data = json.encode(msg_packet)\n udp:send(json_data)\n log.info('Sent JSON data: '..json_data)\n end\nend)\n\nlocal socket = require 'socket'\nlocal address, port = 'localhost', 7777\nlocal udp = socket.udp()\nudp:setpeername(address, port)\nudp:settimeout(10)\n\n-- Start listener and sender threads\n-- Linda is a part of Lanes that lets you essentially send data between threads.\nlocal linda = lanes.linda()\nlinda:set('should_quit', false)\nstart_sender(linda, address, port)\n\n-- Wait until we receive a signal from linda that we should quit.\nwhile not linda:get('should_quit') do\n print('a')\n local data, msg = udp:receive()\n print(data)\n\n if data then\n log.info(string.format('Received data: %s', data))\n print('data gotten')\n elseif msg ~= 'timeout' then\n log.error('Network error: '..tostring(msg))\n print('network error')\n end\n print('b')\nend\n</code></pre>\n<p>Thank you!</p>\n"^^ . . "mouse"^^ . . . "1"^^ . . . . . . "<p>Here's a slightly different perspective. (The answer is still no.)</p>\n<p>Part of the reason that <code>&lt;const&gt;</code> works like it does is because (at least in the standard Lua implementation) it is evaluated purely at compile time. This is very simple to do -- local variables are lexically scoped, and the compiler needs to know about the variable declaration to do anything anyway -- for example it needs to know that it is in fact a local, and whether or not it is an upvalue.</p>\n<p>The VM runtime knows nothing about <code>&lt;const&gt;</code>. The only difference is if the compiler decided to use the information to make some optimization.</p>\n<p>This paradigm doesn't work so well for a theoretical const table feature. We can ask if it is reasonable to expect the compiler to be able to determine whether a table is const (and if so, which fields, or whatever depending on how you implement this feature). In many cases this may be possible through complicated static analysis, but such analysis is probably much more complicated that anything the Lua compiler is currently doing, and you may start running into Halting Problem kinds of issues in more complex edge cases.</p>\n<p>Or, you might invent a way to provide additional information to the compiler that helps it resolve this question. But, if the compiler easily knows which value is a const table, and in what way it is const, I think you have just reinvented strong typing. People have given Lua stronger typing before. It may be an interesting discussion, but it is somewhat of a philosophical departure.</p>\n<p>If you don't do it at compile time, I guess you do it at runtime. This means, you would have some tag or metadata carried with the table object in memory and the VM would check this at runtime. As you know Lua has a flexible user-accessible system that allows this kind of feature -- metatables. Yes, it is true that your suggested syntax may be pretty convenient for your exact use case, but maybe it is not good to use the same syntax for two features that actually work quite differently from each other. (Imagine the question &quot;Why did <code>&lt;const&gt;</code> fail at compile/load time here, but crash at runtime there?&quot;) And I think creative use of the existing features and defining appropriate helper functions may be able to achieve some kind of compromise between syntax convenience, runtime cost, and readability.</p>\n"^^ . . . . "kong"^^ . . . "2"^^ . . . . . "nominatim"^^ . . . . "<p>Depending on where your LocalScript is, you are likely going to run into a timing issue. If this is in <code>StarterPlayer &gt; StarterCharacterScripts</code>, then the code won't execute until the player's character is already created. So the order of events will be this :</p>\n<ol>\n<li>Player joins the game</li>\n<li>Player's Character spawns in the world</li>\n<li>Your LocalScript starts to execute...</li>\n</ol>\n<ul>\n<li>1st line grabs the Local Player</li>\n<li>2nd line waits for the player's character to spawn....</li>\n</ul>\n<p>And here's where your problem hits, the character has already spawned, and this event won't trigger again until the player dies and respawns. So your code is stuck on line 2.</p>\n<p>Typically, scripts will check if the character exists first, and if it doesn't then it waits until the signal fires. So try something like this :</p>\n<pre class="lang-lua prettyprint-override"><code>local player = game.Players.LocalPlayer\nlocal character = player.Character\nif not character then\n character = player.CharacterAdded:Wait()\nend\n-- after this point, the player's character is guaranteed to exist\n</code></pre>\n"^^ . . . "<p>First of all, <code>vim.loop</code> is now called <code>vim.uv</code>: <a href="https://github.com/neovim/neovim/pull/22846" rel="nofollow noreferrer">https://github.com/neovim/neovim/pull/22846</a></p>\n<p>But <a href="https://github.com/neovim/neovim/pull/22846/files#diff-438cabcc877e34fbb948241c7e7e611579449d08085f5e38817a11450214a35bL454" rel="nofollow noreferrer">before that change</a>, the documentation said this:</p>\n<blockquote>\n<p><code>vim.loop</code> exposes all features of the Nvim event-loop.</p>\n</blockquote>\n<p>Anyway, that's the <code>luv</code> library for Lua (<a href="https://github.com/luvit/luv" rel="nofollow noreferrer">https://github.com/luvit/luv</a>), which is a wrapper around the <code>libuv</code> library for C (<a href="https://github.com/libuv/libuv" rel="nofollow noreferrer">https://github.com/libuv/libuv</a>). <code>luv</code> calls it <code>fs_stat</code> because the library it's wrapping calls it <code>uv_fs_stat</code>. The <code>fs</code> part of the name is because it's a <a href="https://docs.libuv.org/en/v1.x/fs.html" rel="nofollow noreferrer">file system operation</a>. The <code>stat</code> part of the name is because that's <a href="https://docs.libuv.org/en/v1.x/fs.html#c.uv_fs_stat" rel="nofollow noreferrer">the name of the underlying syscall</a>:</p>\n<blockquote>\n<p>Equivalent to stat(2), fstat(2) and lstat(2) respectively.</p>\n</blockquote>\n<p>And <code>stat</code> is short for <code>status</code>, and that syscall gets a file's status. (That might be one reason for your confusion: it can do a lot more than just check if a file exists.)</p>\n"^^ . . "2"^^ . "ProximityPrompt seems to only work in certain locations"^^ . . "<p>Details:</p>\n<p>Atomic Operations: I understand that Lua scripts in Redis are executed atomically. However, I need clarification on whether the atomicity affects only the Redis database being accessed by the script or the entire Redis server.</p>\n<p>Concurrency: Will executing a Lua script block other clients from accessing Redis, especially if they are working with the same keys involved in the Lua script's operations?</p>\n<p>Performance: Are Lua scripts generally efficient for operations like checking queues and managing locks in Redis, or should I consider alternative approaches for high-throughput scenarios?</p>\n<p>Objective:\nI want to ensure that my application can handle multiple concurrent requests efficiently without unnecessary blocking or performance degradation due to Lua script execution.</p>\n<p>Request:\nCould someone clarify the impact of Lua script execution in Redis on overall server performance and concurrency? Additionally, any best practices or alternatives for managing distributed locks and queues in Redis would be greatly appreciated.</p>\n<p>Request:\nCould someone clarify the impact of Lua script execution in Redis on overall server performance and concurrency? Additionally, any best practices or alternatives for managing distributed locks and queues in Redis would be greatly appreciated.</p>\n"^^ . "4"^^ . . . . . . . . . . "1"^^ . . . "0"^^ . "How to make ENT:Touch only detect touches from a certain entity [GLua]"^^ . . "0"^^ . "lua-5.4"^^ . "0"^^ . . . . . . . . "0"^^ . "0"^^ . "Thank you. It would have been nice if the docs mentioned this detail!"^^ . . . "0"^^ . . "The code you showed is totally wrong, or did you omit any important part?"^^ . . . . "0"^^ . "roblox-studio"^^ . "0"^^ . . "<p>I want to create a docstring for a Lua function in Roblox Studios so that when i look at that function that i instantly know what this function does.</p>\n<p>And currently the Popup looks like this:\n<a href="https://i.sstatic.net/BOgolcTz.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/BOgolcTz.png" alt="enter image description here" /></a></p>\n<p>But the Popup should look like this:\n<a href="https://i.sstatic.net/H3NtPQUO.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/H3NtPQUO.png" alt="enter image description here" /></a></p>\n<p>I tried with:</p>\n<pre><code>-- @param\n\n-- Description\n\n--// Description\n\n\n</code></pre>\n<p>and even with:</p>\n<pre><code>-- [[ ... ]]\n</code></pre>\n"^^ . "static-analysis"^^ . . . "<h1><strong>Question:</strong></h1>\n<p>I'm working on a project where I need to create an MP4 video and control its frames entirely using Lua, without relying on any external APIs. The goal is to both generate and read video frames.</p>\n<h1><strong>Details:</strong></h1>\n<ul>\n<li><em><strong>I'm looking for guidance on how to:</strong></em></li>\n</ul>\n<p>Create video frames in Lua.\nAssemble these frames into an MP4 file.\nRead frames from an existing MP4 file.\nSince I'm doing this from the ground up, I'm interested in understanding the necessary steps and any Lua functions or techniques that could help me achieve this.</p>\n<ul>\n<li><em><strong>What I Tried:</strong></em></li>\n</ul>\n<p>I've written some Lua code to create an MP4 file with frames, but it doesn't seem to be working as expected. Here's my code:</p>\n<pre class="lang-lua prettyprint-override"><code>local function create_ftyp_box()\n local major_brand = &quot;isom&quot;\n local minor_version = &quot;\\0\\0\\2\\0&quot; -- Version 2.0\n local compatible_brands = &quot;isom&quot; .. &quot;iso2&quot; .. &quot;avc1&quot; .. &quot;mp41&quot;\n local ftyp_data = major_brand .. minor_version .. compatible_brands\n return ftyp_data\nend\n\nlocal function create_mvhd_box()\n local version = &quot;\\0&quot; -- version 0\n local flags = &quot;\\0\\0\\0&quot; -- flags\n local creation_time = &quot;\\0\\0\\0\\0&quot;\n local modification_time = &quot;\\0\\0\\0\\0&quot;\n local timescale = &quot;\\0\\0\\03\\xe8&quot; -- 1000 units per second\n local duration = &quot;\\0\\0\\03\\xe8&quot; -- 1 second duration\n local rate = &quot;\\0\\0\\01\\00&quot; -- 1.0\n local volume = &quot;\\0\\01\\00\\00&quot; -- full volume\n local reserved = &quot;\\0\\0&quot; .. string.rep(&quot;\\0&quot;, 10)\n local matrix = string.rep(&quot;\\0&quot;, 36) -- identity matrix\n local pre_defined = string.rep(&quot;\\0&quot;, 24)\n local next_track_ID = &quot;\\0\\0\\0\\2&quot;\n return version .. flags .. creation_time .. modification_time .. timescale .. duration ..\n rate .. volume .. reserved .. matrix .. pre_defined .. next_track_ID\nend\n\nlocal function create_tkhd_box()\n local version = &quot;\\0&quot; -- version 0\n local flags = &quot;\\0\\0\\7&quot; -- track enabled, track in movie, track in preview\n local creation_time = &quot;\\0\\0\\0\\0&quot;\n local modification_time = &quot;\\0\\0\\0\\0&quot;\n local track_ID = &quot;\\0\\0\\0\\1&quot;\n local reserved = &quot;\\0\\0\\0\\0&quot;\n local duration = &quot;\\0\\0\\03\\xe8&quot; -- 1 second duration\n local reserved2 = string.rep(&quot;\\0&quot;, 8)\n local layer = &quot;\\0\\0&quot;\n local alternate_group = &quot;\\0\\0&quot;\n local volume = &quot;\\0\\01\\00\\00&quot;\n local reserved3 = &quot;\\0\\0&quot;\n local matrix = string.rep(&quot;\\0&quot;, 36) -- identity matrix\n local width = &quot;\\0\\01\\00\\00&quot; -- 1.0\n local height = &quot;\\0\\01\\00\\00&quot; -- 1.0\n return version .. flags .. creation_time .. modification_time .. track_ID .. reserved .. duration ..\n reserved2 .. layer .. alternate_group .. volume .. reserved3 .. matrix .. width .. height\nend\n\nlocal function create_mdhd_box()\n local version = &quot;\\0&quot; -- version 0\n local flags = &quot;\\0\\0\\0&quot;\n local creation_time = &quot;\\0\\0\\0\\0&quot;\n local modification_time = &quot;\\0\\0\\0\\0&quot;\n local timescale = &quot;\\0\\0\\03\\xe8&quot; -- 1000 units per second\n local duration = &quot;\\0\\0\\03\\xe8&quot; -- 1 second duration\n local language = &quot;\\x55\\xc4&quot; -- undetermined language\n local pre_defined = &quot;\\0\\0&quot;\n return version .. flags .. creation_time .. modification_time .. timescale .. duration .. language .. pre_defined\nend\n\nlocal function create_hdlr_box()\n local version = &quot;\\0&quot; -- version 0\n local flags = &quot;\\0\\0\\0&quot;\n local pre_defined = &quot;\\0\\0\\0\\0&quot;\n local handler_type = &quot;vide&quot; -- video track\n local reserved = string.rep(&quot;\\0&quot;, 12)\n local name = &quot;VideoHandler\\0&quot;\n return version .. flags .. pre_defined .. handler_type .. reserved .. name\nend\n\nlocal function create_vmhd_box()\n local version = &quot;\\0&quot; -- version 0\n local flags = &quot;\\0\\0\\1&quot; -- default flags\n local graphics_mode = &quot;\\0\\0&quot;\n local opcolor = &quot;\\0\\0\\0\\0\\0\\0&quot;\n return version .. flags .. graphics_mode .. opcolor\nend\n\nlocal function create_dinf_box()\n local version = &quot;\\0&quot; -- version 0\n local flags = &quot;\\0\\0\\0&quot;\n local entry_count = &quot;\\0\\0\\0\\1&quot;\n local data_reference_box = &quot;\\0\\0\\0\\x0c&quot; .. &quot;url &quot; .. &quot;\\0\\0\\0\\1&quot;\n return version .. flags .. entry_count .. data_reference_box\nend\n\nlocal function create_stsd_box()\n local version = &quot;\\0&quot; -- version 0\n local flags = &quot;\\0\\0\\0&quot;\n local entry_count = &quot;\\0\\0\\0\\1&quot;\n local sample_entry = &quot;\\0\\0\\0\\x86&quot; .. &quot;avc1&quot; .. string.rep(&quot;\\0&quot;, 24) .. &quot;\\0\\0\\0\\1&quot; .. &quot;\\0\\0\\0\\0&quot; .. &quot;\\0\\0\\0\\0&quot;\n return version .. flags .. entry_count .. sample_entry\nend\n\nlocal function create_stts_box()\n local version = &quot;\\0&quot; -- version 0\n local flags = &quot;\\0\\0\\0&quot;\n local entry_count = &quot;\\0\\0\\0\\1&quot;\n local sample_count = &quot;\\0\\0\\0\\1&quot;\n local sample_delta = &quot;\\0\\0\\03\\xe8&quot;\n return version .. flags .. entry_count .. sample_count .. sample_delta\nend\n\nlocal function create_stsc_box()\n local version = &quot;\\0&quot; -- version 0\n local flags = &quot;\\0\\0\\0&quot;\n local entry_count = &quot;\\0\\0\\0\\1&quot;\n local first_chunk = &quot;\\0\\0\\0\\1&quot;\n local samples_per_chunk = &quot;\\0\\0\\0\\1&quot;\n local sample_description_index = &quot;\\0\\0\\0\\1&quot;\n return version .. flags .. entry_count .. first_chunk .. samples_per_chunk .. sample_description_index\nend\n\nlocal function create_stsz_box()\n local version = &quot;\\0&quot; -- version 0\n local flags = &quot;\\0\\0\\0&quot;\n local sample_size = &quot;\\0\\0\\0\\0&quot; -- non-uniform sample sizes\n local sample_count = &quot;\\0\\0\\0\\1&quot;\n local sample_sizes = &quot;\\0\\0\\0\\1&quot;\n return version .. flags .. sample_size .. sample_count .. sample_sizes\nend\n\nlocal function create_stco_box()\n local version = &quot;\\0&quot; -- version 0\n local flags = &quot;\\0\\0\\0&quot;\n local entry_count = &quot;\\0\\0\\0\\1&quot;\n local chunk_offset = &quot;\\0\\0\\0\\0&quot; -- placeholder offset\n return version .. flags .. entry_count .. chunk_offset\nend\n\nlocal function create_minf_box()\n local vmhd = create_vmhd_box()\n local dinf = create_dinf_box()\n local stbl = create_stsd_box() .. create_stts_box() .. create_stsc_box() .. create_stsz_box() .. create_stco_box()\n return vmhd .. dinf .. stbl\nend\n\nlocal function create_mdia_box()\n local mdhd = create_mdhd_box()\n local hdlr = create_hdlr_box()\n local minf = create_minf_box()\n return mdhd .. hdlr .. minf\nend\n\nlocal function create_trak_box()\n local tkhd = create_tkhd_box()\n local mdia = create_mdia_box()\n return tkhd .. mdia\nend\n\nlocal function create_moov_box()\n local mvhd = create_mvhd_box()\n local trak = create_trak_box()\n return mvhd .. trak\nend\n\nlocal function create_mdat_box()\n local data = string.rep(&quot;\\0&quot;, 4) -- placeholder for actual media data\n return data\nend\n\nlocal function create_frame_data(color)\n local width = 1280\n local height = 720\n local bytes_per_pixel = 3 -- RGB\n local frame_size = width * height * bytes_per_pixel\n\n local data = &quot;&quot;\n\n if color == &quot;white&quot; then\n for i = 1, frame_size do\n data = data .. &quot;\\xff&quot;\n end\n elseif color == &quot;black&quot; then\n for i = 1, frame_size do\n data = data .. &quot;\\x00&quot;\n end\n end\n\n return data\nend\n\nlocal function write_box(f, box_type, data)\n local size = 8 + #data\n f:write(string.pack(&quot;&gt;I4&quot;, size)) -- Box size\n f:write(box_type) -- Box type\n f:write(data) -- Box data\nend\n\nlocal function create_mp4(filename, color)\n local f = assert(io.open(filename, &quot;wb&quot;))\n\n -- Write ftyp box\n write_box(f, &quot;ftyp&quot;, create_ftyp_box())\n\n -- Write moov box\n write_box(f, &quot;moov&quot;, create_moov_box())\n\n -- Write mdat box\n local frame_data = create_frame_data(color)\n write_box(f, &quot;mdat&quot;, frame_data)\n\n f:close()\nend\n\ncreate_mp4(&quot;black_frame.mp4&quot;, &quot;black&quot;)\ncreate_mp4(&quot;white_frame.mp4&quot;, &quot;white&quot;)\n</code></pre>\n<p>However, when I try to open the resulting MP4 files, they don't seem to work correctly. I suspect there might be an issue with how I'm structuring the MP4 boxes or assembling the video frames.</p>\n"^^ . . . "<p>I am trying to take a markdown file that looks like this (this is from a <code>pandoc</code> conversion of a Word document):</p>\n<pre><code># Standard 1.1\n\n## Narrative\n\n::: {custom-style=&quot;Body Text&quot;}\nPlease see artifact 1 ([Artifact 1]{custom-style=&quot;Link to Artifact&quot;}). You can also \nadd references here as links ([[This is a reference]{custom-style=&quot;Hyperlink&quot;}](https://www.website.link/path_to/reffile.pdf)).\n:::\n\n## Conclusion\n\n::: {custom-style=&quot;Body Text&quot;}\nThis is my conclusion.\n:::\n\n## Sources\n\n[All sources will be automatically listed here. Do not modify this\nsection.]{custom-style=&quot;Sources&quot;}\n\n</code></pre>\n<p>and convert it to something like this (this would be HTML or PDF as the real output, but this is what the equivalent Markdown would be):</p>\n<pre><code># Standard 1.1\n\n## Narrative\n\n::: {custom-style=&quot;Body Text&quot;}\nPlease see artifact 1 ([Artifact 1]{custom-style=&quot;Link to Artifact&quot;}). You can also \nadd references here as links ([[This is a reference]{custom-style=&quot;Hyperlink&quot;}](https://www.website.link/path_to/reffile.pdf)).\n:::\n\n## Conclusion\n\n::: {custom-style=&quot;Body Text&quot;}\nThis is my conclusion.\n:::\n\n## Sources\n\n- [Artifact 1](./path_to/Artifact-1.pdf)\n- [This is a reference](./path_to/reffile.pdf)\n\n</code></pre>\n<p>using Quarto (with Pandoc and a Lua extension in the background).</p>\n<p>My extension captures the custom-styles <code>Link to Artifact</code> and <code>Hyperlink</code> (which show up in Span elements) and converts them to Link elements (well, it does a lot more, but that is the important part for this question). When that conversion is complete, I save the link in a global table. When I encounter the <code>Sources</code> custom-style, I want to dump out that table as an unordered list (later I will output as either an ordered or unordered list depending on configuration).</p>\n<p>This is where I am running into trouble. It seems my table is a Block element and Span is an Inline. How do I convert this table of links into an inline element that will work for both HTML and PDF?</p>\n<p>I have tried to convert it using <code>pandoc.utils.blocks_to_inlines</code>, <code>RawInline</code>, <code>RawBlock</code>, etc. Obviously, none of those worked. I can get the list of links in HTML by creating HTML code and just concatenating all the rows into a string and outputting a <code>RawInline</code>. But that does not solve my PDF problem.</p>\n<p>While I have figured much of this out, I am still trying to get my head wrapped around how Pandoc and Lua really work. Any help would be greatly appreciated!</p>\n"^^ . . "That would be far better and describes the content."^^ . . . . "0"^^ . . . "0"^^ . "openresty"^^ . "1"^^ . "How to maximize wezterm on startup?"^^ . "1"^^ . . "1"^^ . "<p>I have installed Lua and Solar2d on my ubuntu machine using snap. It runs fine but when I try to open a project or create a new project and try to start emulator, it gives me errors.</p>\n<pre><code>rai@rai-ThinkPad-Yoga-260:~/Documents/Solar2D Projects/langraan$ solar2d .\nlibGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)\nlibGL error: failed to load driver: iris\n\nCopyright (C) 2009-2100 C o r o n a L a b s I n c .\n Version: 3.0.0\n Build: 2100.9999\nWARNING: Cannot create path for resource file 'resource.car (/snap/solar2d/24/usr/local/bin/Solar2D/Resources/resource.car)'. File does not exist.\n\nPlatform: rai-ThinkPad-Yoga-260 / x86_64 / #41~22.04.2-Ubuntu SMP PREEMPT_DYNAMIC Mon Jun 3 11:32:55 UTC 2 / llvmpipe (LLVM 12.0.0, 256 bits) / 3.1 Mesa 21.2.6 / 2100.9999 / En:En | nil | En:En | `��\nLoading project from: /snap/solar2d/24/usr/local/bin/Solar2D/Resources/homescreen\nProject sandbox folder: /home/rai/snap/solar2d/24/.Solar2D/Sandbox/homescreen\n</code></pre>\n"^^ . . "Is there something wrong with putting the second snippet at the top of the function?"^^ . . . . . "2"^^ . . . . "Tab keymap collision between nvim-cmp and copilot.vim in AstroNvim"^^ . . "3"^^ . "@tkausl: it's a table with two parameters. Isn't it ?"^^ . "0"^^ . . . . . . "0"^^ . "@Mey I'd be hesitant to say it's "worth it". If there is a performance problem with your code, try such optimizations, then measure the impact. Don't just litter your code with "premature" optimization. On the PUC-Rio implementation there *might* be a noticeable impact, on LuaJIT I would not expect that much of an impact. But yes, the memory cost is practically not a concern."^^ . "5"^^ . . . . . . "<p>I'm using pypandoc to use pandoc in python to convert html to markdown\nI'm trying to make pypandoc apply lua filters. But non of the filters are applied. I put checkpoints at every function head and none of them are visited, so the filters aren't even called, even though pypandoc registers them.\nI know that pypandoc registers the filters, because when I put some syntax error into one of my lua scripts, it is specifically my pypandoc call that throws an error, specifically referencing that lua script.</p>\n<p>Here is my pypandoc call:</p>\n<pre><code>\nfilters = [&quot;lua/&quot; + f for f in os.listdir(&quot;lua&quot;)]\nmd = pypandoc.convert_file(source_file=sourcepath, format='html', to='gfm-raw_html', filters = filters)\n</code></pre>\n<p>Here are some of my filters:</p>\n<p>lua/Nav.lua:</p>\n<pre><code>\nfunction Nav(el)\n return {}\nend\n</code></pre>\n<p>lua/Img.lua:</p>\n<pre><code>\nfunction Img(el)\n if el.attributes.alt == &quot;question_mark&quot; then\n return ' &quot;?&quot; '\n else\n return {}\n end\nend\n</code></pre>\n<p><strong>What I tried:</strong> Using lua filters in pypandoc.</p>\n<p><strong>Expected behavior:</strong> The filters get applied.</p>\n<p><strong>Actual behavior:</strong> The filters are ignored. Pypandoc converts files without applying any filters. No errors are thrown.</p>\n"^^ . . . . . . "0"^^ . "0"^^ . . . . . "It should `print` `userdata`, it is `printing` `string`, because `Enum` is `converted` into a `string`, it is `converted` into `Enums`. When `printing` `Enum` you can see that it does that. `Enum` is a `userdata` when using the `type` function. Also I need newproxy for userdata (In Lua 5.2 it is removed, I just wanted it to be universal if someone uses it in an newer version of Lua, that is why `newproxy = newproxy or function` is there.)"^^ . . . . . . "1"^^ . "0"^^ . . . . . . . . "Removing the 2 lines also works, and self is not defined."^^ . . "<p>I'm currently trying to make a message system in Roblox. The server should be able to send a message via a RemoteEvent, and the client should be able to accept it by displaying the message on a GUI TextBox.</p>\n<p>However, I can't seem to pass arguments to onDisplayMessage() from the displayMessageEvent. When I fire the RemoteEvent, nothing happens.</p>\n<p>This is the server script thus far:</p>\n<pre class="lang-lua prettyprint-override"><code>local displayMessageEvent = Instance.new(&quot;RemoteEvent&quot;)\ndisplayMessageEvent.Name = &quot;DisplayMessageEvent&quot;\ndisplayMessageEvent.Parent = ReplicatedStorage\ndisplayMessageEvent:FireAllClients(&quot;Hello, World!&quot;)\n</code></pre>\n<p>And this is the client script:</p>\n<pre class="lang-lua prettyprint-override"><code>local ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal Players = game:GetService(&quot;Players&quot;)\n\nlocal displayMessageEvent = ReplicatedStorage:WaitForChild(&quot;DisplayMessageEvent&quot;)\n\nlocal function onDisplayMessage(message)\n local player = Players.LocalPlayer\n local playerGui = player:WaitForChild(&quot;PlayerGui&quot;)\n local screenGui = playerGui:WaitForChild(&quot;ScreenGui&quot;)\n local textLabel = screenGui:WaitForChild(&quot;TextLabel&quot;)\n\n textLabel.Text = message\nend\n\ndisplayMessageEvent.OnClientEvent:Connect(onDisplayMessage())\n</code></pre>\n<p>I tried replacing the last line with the following, with similar results:</p>\n<pre class="lang-lua prettyprint-override"><code>displayMessageEvent.OnClientEvent:Connect(onDisplayMessage(displayMessageEvent.event))\n</code></pre>\n<p>How can I get the client to handle the RemoteEvent correctly?</p>\n"^^ . . . . "0"^^ . . "0"^^ . "0"^^ . "match"^^ . . . "0"^^ . . . "<p>I am having some trouble when trying to read request headers in my NGINX configuration, there are being sent from my gRPC client. The other parts of my configuration works as expected, and I have data flowing from client to server and back using gRPC. Only this part doesn't work for me for some reason.</p>\n<p>I don't know if this is related, but I was able to write &quot;headers&quot; back to the client using <code>add_trailer</code> in NGINX, and the <code>grpc.Trailer</code> on the client side.</p>\n<p>I am using OpenResty docker image.</p>\n<p>This is how I write the headers in the client:</p>\n<pre class="lang-golang prettyprint-override"><code>import (\n &quot;google.golang.org/grpc/metadata&quot;\n)\n\n// ... \n\nctx = metadata.AppendToOutgoingContext(ctx, &quot;custom-header-name&quot;, &quot;foobar&quot;)\nclient.MyRpcCall(ctx)\n\n// ...\n</code></pre>\n<p>And this is how I've tried to read them in the NGINX lua block:</p>\n<pre><code>// 1.\nlocal headers = ngx.req.get_headers()\n \nfor k, v in pairs(headers) do\n ngx.log(ngx.ERR, &quot;got header: &quot;, k, &quot;:&quot;, v)\nend\n\n// My header was not logged :(\n\n// 2.\nlocal customHeader = headers[&quot;custom-header-name&quot;]\n</code></pre>\n<p>I have also tried to add the <code>grpc_pass_header custom-header-name;</code> and <code>set $value $http_custom_header_name;</code></p>\n<p>Thanks in advance!</p>\n"^^ . . . . . . . "0"^^ . . . . . . . "0"^^ . . . "Good question! It looks like you don't need the `districtId` parameter. The other parameters (`uiLang` and `uiCity`) match the values in the URL provided in the original question."^^ . . . . . "<p>I took a slightly different approach (as i was seeing same as you :-( )</p>\n<pre><code>cat user3204810.lua \nlocal instr = &quot;sometext\\\\scalebox{0.74}&quot;\nlocal strip = &quot;\\\\scalebox&quot;\n\nlocal res = string.gsub(instr, strip, &quot;&quot;)\n\nprint( 'orig:', instr, &quot; result:&quot;, res )\n\nlua user3204810.lua \norig: sometext\\scalebox{0.74} result: sometext{0.74}\n</code></pre>\n<p>as always, check/test/double-check all suggestions</p>\n"^^ . . "1"^^ . . . . . . . . . . "0"^^ . . . . . . . "1"^^ . . . "0"^^ . . "You should also incoperate the other suggestion regarding the removing the `'` around `'machineData={serial=1,name="mob2",}' ` in your answer, as right now it does not actually address the issue from the question"^^ . "rest"^^ . . "0"^^ . "3"^^ . . . . . "Very well written answer thank you. So that means that if I'm willing to go through the trouble of slightly longer code for localizing variables, the tradeoff in speed is worth compared to the very little additional memory cost of localizing?"^^ . . . . "1"^^ . . "lazyvim"^^ . . . . . . . . "<pre><code>local ms = require(game.ReplicatedStorage.ModuleScript)\nif not ms then\n \n local ms = require(game.ReplicatedStorage:WaitForChild(&quot;ModuleScript&quot;)) \nend\n</code></pre>\n<p>The second <code>ms</code> is local to the if statement. It shadows the first <code>ms</code>. So in case the first require failed you'll store the return value of the second require into the wrong variable.</p>\n<p>Remove the local keyword.</p>\n<pre><code>local ms = require(game.ReplicatedStorage.ModuleScript)\nif not ms then\n \n ms = require(game.ReplicatedStorage:WaitForChild(&quot;ModuleScript&quot;)) \nend\n</code></pre>\n<p>Or simply</p>\n<pre><code>local ms = require(game.ReplicatedStorage.ModuleScript)\n or require(game.ReplicatedStorage:WaitForChild(&quot;ModuleScript&quot;)) \n</code></pre>\n<p>Of course you should still check if the second require attempt succeeded befor you proceed.</p>\n<p>No to your actual problem.</p>\n<pre><code>local info = {}\n\n local stamina = 100\n local maxstamina = 100\n \nreturn info\n</code></pre>\n<p>You return an empty table here. So any index operation on <code>ms</code> will result in nil.</p>\n<p>You want to do this:</p>\n<pre><code>local info = {\n\n stamina = 100,\n maxstamina = 100,\n}\n \nreturn info\n</code></pre>\n<p>or</p>\n<pre><code>local info = {}\n\ninfo.stamina = 100\ninfo.maxstamina = 100\n \nreturn info\n</code></pre>\n<p>As <code>stamina</code> and <code>maxstamina</code> need to be fields of the table info, not local variables to your script.</p>\n<p>Then the result of your require statement will be the table <code>{ maxstamina = 100, stamina = 100 }</code> instead of <code>{ }</code></p>\n"^^ . . . . "4"^^ . . "<p><code>Player</code> objects in Roblox have a <code>Character</code> property that you can access pretty easily. It can be accessed as such, barring any timing issues:</p>\n<pre class="lang-lua prettyprint-override"><code>local info = {\n localplayer = game.Players.LocalPlayer,\n localcharacter = localplayer.Character,\n}\nreturn info\n</code></pre>\n"^^ . "1"^^ . . . . . "<p>I'm writing a Wireshark dissector in Lua for a custom packet type and Wireshark versions including Lua 5.2 and below (current release versions) have the BitOp library included, whereas upcoming releases will have Lua 5.3 or greater and will use builtin bitwise operations.</p>\n<p>My goal is to have this changeover automatically handled by Lua version without having to update the dissector for each version. My current code is:</p>\n<pre><code>local bit = nil\nif tonumber(string.sub(_VERSION, 5)) &lt; 5.3 then\n bit = require(&quot;bit&quot;)\nend\n\nlocal version_byte = 0xaf\nif bit then\n print(&quot;BitOp method&quot;)\nelse\n print((version_byte &gt;&gt; 4) * 10 + (version_byte &amp; 0xf))\nend\n</code></pre>\n<p>The issue is that Lua 5.2 (of course) doesn't recognize the bitwise shift and &amp; operators and throws <code>unexpected symbol near '&gt;'</code>. Is there a way to conditionally evaluate something like this?</p>\n"^^ . "logitech ghub can not run old script from LGS"^^ . "Awesome answer, thanks! Accepted."^^ . "Talking about \nlocal Backpack = {}\nBackpack.__index = Backpack"^^ . "1"^^ . "<p>You can do this by using the <code>CFrame.new(Position, LookAt)</code> function.</p>\n<pre class="lang-lua prettyprint-override"><code>-- // Services\nlocal Players = game:GetService(&quot;Players&quot;);\n\n-- // Variables\nlocal client = Players.LocalPlayer;\nlocal Character = client.Character;\nlocal Root = Character:WaitForChild(&quot;HumanoidRootPart&quot;);\nlocal Wall = workspace.FX:WaitForChild(&quot;Wall&quot;);\n\n-- CFrame.new(position (Vector3), lookAt (Vector3))\nWall.CFrame = CFrame.new( (Root.Position + Root.CFrame.LookVector * 35), Root.Position );\n</code></pre>\n"^^ . "0"^^ . . . . . "<p>Here is the code snippet that works for me.</p>\n<pre><code>cmp.setup {\n mapping = {\n [&quot;&lt;Tab&gt;&quot;] = function(fallback)\n local copilot_keys = vim.fn['copilot#Accept']()\n if cmp.visible() then\n cmp.select_next_item()\n elseif copilot_keys ~= '' and type(copilot_keys) == 'string' then\n vim.api.nvim_feedkeys(copilot_keys, 'i', true)\n else\n fallback()\n end\n end,\n },\n experimental = {\n ghost_text = true,\n },\n}\n</code></pre>\n"^^ . . "network-programming"^^ . . . . "<p>Dictionaries in Lua aren't in order, only arrays are. If you want to be able to iterate over it in the correct order try something like</p>\n<pre class="lang-lua prettyprint-override"><code>a = {\n {\n key = &quot;5robux&quot;,\n value = 10,\n name = &quot;21&quot;\n },\n {\n key = &quot;10robux&quot;,\n value = 13,\n name = &quot;31&quot;\n },\n {\n key = &quot;15robux&quot;,\n value = 20,\n name = &quot;41&quot;\n },\n}\nfor i, v in ipairs(a) do\n print(i, v.key)\nend\n</code></pre>\n<p>Which will output this</p>\n<pre><code>1 5robux\n2 10robux\n3 15robux\n</code></pre>\n"^^ . "0"^^ . "<p>I'm just trying to set up a language server for a language that is not included in the popular lspconfig repo. I'm not a Lua developer and am only superficially familiar with Lua.</p>\n<p>I am looking at the <a href="https://neovim.io/doc/user/lsp.html" rel="nofollow noreferrer" title="lsp example">example in the documentation</a>. The first example uses the <code>vim.fs.root()</code> function. Looking at the documentation for <a href="https://neovim.io/doc/user/lua.html#vim.fs.root()" rel="nofollow noreferrer" title="root">vim.fs.root()</a>, I see that I can use it to find the top level of my git repo:</p>\n<pre><code>-- Find the root of a git repository\nvim.fs.root(0, '.git')\n</code></pre>\n<p>However, when I try that in my configuration, I get an error that says I can't use <code>root()</code> because it is <code>nil</code>.</p>\n<pre><code>local augroup_foo = vim.api.nvim_create_augroup('foo', { clear = true })\nvim.api.nvim_create_autocmd({ 'FileType' }, {\n group = augroup_foo,\n pattern = { &quot;cue&quot; },\n callback = function(ev)\n vim.lsp.start({\n name = &quot;cuepls&quot;,\n cmd = { &quot;cuepls&quot; },\n root_dir = vim.fs.root(ev.buf, '.git'), &lt;--- I can't use root\n })\n end,\n})\n</code></pre>\n<p>The full error:</p>\n<pre><code>Error detected while processing BufNewFile Autocommands for &quot;*&quot;: Error executing lua callback: ...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:21: Error executing lua: ...brew/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:22: BufNewFile Autocommands for &quot;*&quot;..FileType Autocommands for &quot;cue&quot;: Vim(append):Error executing lua callback: /Users/me/.config/nvim/lua/me/lsp.lua:98: attempt to call field 'root' (a nil value)\n</code></pre>\n<h1>The question is this</h1>\n<p>How do I use <code>vim.fn.root()</code> inside of a <code>vim.lsp.start()</code>?</p>\n"^^ . "0"^^ . "lua-table"^^ . . . "Thanks @mb21 The link is to a sort of example that converts strong to smallcaps. Do you happen to know how to specify h1 elements?"^^ . . "2"^^ . . "As an aside, do check https://www.hammerspoon.org/docs/hs.grid.html"^^ . . . "shouldn't stats go into StarterPlayerScripts or StarterCharacterScripts? if your event does not fire you can always call the event handling functioin manually btw."^^ . "0"^^ . . "0"^^ . . "Cant access table entry at index"^^ . . "1"^^ . . "0"^^ . . . "logitech-gaming-software"^^ . "Make sure you have read [How to ask a good question](https://stackoverflow.com/help/how-to-ask) before posting any questions here."^^ . "0"^^ . "1"^^ . . . "0"^^ . . "<p>I'm trying to use Lua scripting with <code>NGINX</code> to handle <code>TCP/UDP</code> traffic within the <code>stream</code> context. Specifically, I want to modify the response data being proxied through my NGINX server using Lua. I've seen examples using the <code>http</code> context with directives like <code>header_filter_by_lua</code> and <code>body_filter_by_lua</code> based on : <a href="https://gist.github.com/ejlp12/b3949bb40e748ae8367e17c193fa9602" rel="nofollow noreferrer">https://gist.github.com/ejlp12/b3949bb40e748ae8367e17c193fa9602</a></p>\n<p>this work great for http directive.</p>\n<p><code>header_filter_by_lua</code> and <code>body_filter_by_lua</code> not exist for stream directive like this :</p>\n<pre><code>stream {\n\n server {\n listen 12345;\n proxy_pass 10.0.0.1:567;\n }\n}\n</code></pre>\n<p>Here’s what I’ve tried so far:</p>\n<pre><code> stream {\n \n server {\n listen 12345;\n\n preread_by_lua_block {\n local sock = ngx.req.socket()\n local data, err = sock:receive(&quot;*a&quot;)\n if not data then\n ngx.log(ngx.ERR, &quot;failed to read data: &quot;, err)\n return\n end\n\n -- Modify data\n local modified_data = string.gsub(data, &quot;old_text&quot;, &quot;new_text&quot;)\n ngx.req.set_body_data(modified_data)\n }\n\n\n proxy_pass 10.0.0.1:567;\n }\n }\n</code></pre>\n<p>but is not working</p>\n"^^ . "1"^^ . "-2"^^ . "<p>I am working on a ProximityPrompt based teleportation system, and everything seems to work save for one. It does not work in it's usual spot, but works in other rooms. I have tried everything, but it only seems to work near the spawn point.</p>\n<pre><code>\nlocal Soin = game.Workspace.Pori[&quot;Button Press&quot;]\n\nlocal ProximityPrompt = script.Parent\nlocal Part = game.Workspace.Pairt.NeonPoart\nProximityPrompt.Triggered:Connect(function(Player)\n Soin:Play()\n ProximityPrompt.Enabled = false\n\n\n \n for i = 1,10 do\n game.Lighting.ColorCorrectionEffect.Brightness = game.Lighting.ColorCorrectionEffect.Brightness - 0.1\n wait()\n end\n \n Player.Character.HumanoidRootPart.Position = game.workspace.SpawnTP2.Position\n wait(1)\n\n for i = 1,10 do\n game.Lighting.ColorCorrectionEffect.Brightness = game.Lighting.ColorCorrectionEffect.Brightness + 0.1\n wait()\n end\n wait(1)\n \n \n ProximityPrompt.Enabled = true\nend)\n</code></pre>\n<p>This is my code, is there anything within that could ruin it?</p>\n<p>I've moved the part it's connected to, it works fine at the location where the bulk of the other prompts are and also where spawn is nearby, but does not work in other rooms. I have tried to make rooms from scratch, and have tried duplicating the working location but to no avail.</p>\n"^^ . . . "0"^^ . . . "`const` is used to declare a local variable constant, but tables are not variables: they are objects. There are no immutable tables in Lua. In your code `x` is a constant variable; you can't assign anything else to `x`. But the value assigned to `x` is a table, and that object is mutable."^^ . . . "4"^^ . . . "0"^^ . "0"^^ . . . . . . "0"^^ . . "0"^^ . . . "0"^^ . "1"^^ . . . . . . "0"^^ . "2"^^ . . . . . . . "roblox"^^ . "1"^^ . . . . "0"^^ . . . "@Nifim -- `newproxy` is still in [Luau](https://luau-lang.org/), I believe."^^ . "kong-plugin"^^ . . . . . "locks"^^ . "1"^^ . . . "<p>You could write a couple of compatibility shim modules that define a common interface to the bit operations: one that defines functions that perform bit operations in pre-5.3 Lua, and one that defines functions for 5.3 and later which use the built-in operators under the hood:</p>\n<pre class="lang-lua prettyprint-override"><code>-- bit_shim_5_2.lua\n-- Defines a common interface to bit operations.\nlocal M = {}\n\nfunction M.bitop ()\n print(&quot;Lua pre-5.3 bit ops&quot;)\nend\n\nreturn M\n</code></pre>\n<pre class="lang-lua prettyprint-override"><code>-- bit_shim_5_3.lua\n-- Defines a common interface to bit operations.\nlocal M = {}\n\nfunction M.bitop ()\n print(&quot;built-in Lua 5.3 bit ops&quot;)\nend\n\nreturn M\n</code></pre>\n<pre class="lang-lua prettyprint-override"><code>-- main.lua\nlocal bit = nil\nlocal version = tonumber(string.sub(_VERSION, 5))\nif version &lt; 5.3 then\n bit = require(&quot;bit_shim_5_2&quot;)\nelse\n bit = require(&quot;bit_shim_5_3&quot;)\nend\n\nbit.bitop()\n</code></pre>\n<p>Running this program on Lua 5.4.7 yields:</p>\n<pre class="lang-none prettyprint-override"><code>$ lua main.lua\nbuilt-in Lua 5.3 bit ops\n</code></pre>\n"^^ . . . . . . "Seems like sol is header-only, so a linker error is probably failing to link against Lua itself. Looks like Visual Studio, so Windows? Your solution shows a liblua54.a which is probably a static Lua library, but not for Windows. A Windows static library would usually be .lib. So I would suggest double checking that you have a compatible static library (if that's how you want to link -- or link dynamically, or compile Lua from source as part of your solution) and make sure the linker is using it (e.g. Linker > Input > Additional Dependencies property and handling paths properly)."^^ . "0"^^ . . . . . . "0"^^ . "1"^^ . . . . . "Effectively a duplicate of https://stackoverflow.com/questions/7335920/what-specifically-are-wall-clock-time-user-cpu-time-and-system-cpu-time-in-uni. `os.clock()` is in CPU time, `ts` shows wall time. Your CPU is idling, because logging is I/O bottlenecked."^^ . . "neovim"^^ . "0"^^ . . . "<p><code>const</code> is used to declare a local variable constant, but tables are not variables: they are objects (or values in Lua parlance). There are no immutable tables in Lua. In the OP code <code>x</code> is a constant variable initialized to hold a table as its value; no further assignments can be made to <code>x</code>. The value which <code>x</code> holds is a table, and that object is mutable.</p>\n<p>It is not possible in Lua to use <code>const</code> in the manner described in the OP question. In the posted code <code>x</code> is a (constant) variable to which is bound a table. In that table, <code>a</code> and <code>b</code> are not variables, but they are <em>keys</em>. In Lua a key (or an associative array index) is another value. But remember: values are not variables, rather variables store values. It may help to recall that <code>x.a</code> is just syntactic sugar for <code>x[&quot;a&quot;]</code>, i.e., the table <code>x</code> has a slot indexed by the value <code>&quot;a&quot;</code>. Lua allows the <code>const</code> attribute to be associated with variables, but not values, so <code>a</code> and <code>b</code> cannot be made <code>const</code>.</p>\n<p>There may be some ways to simulate immutable tables using metatable magic, but I suspect that these would come with performance penalties which would defeat <em>one</em> of the reasons for using immutable objects in the first place. I would avoid this sort of thing. There may be some instances where it would be convenient to have immutable tables built into Lua, but if you really think that you need this you should probably consider whether another language is more appropriate for your problem.</p>\n"^^ . . "Error parsing config from lua tables in boost unit test"^^ . . . "0"^^ . . . . "<p>The reason that rule exists is because you could get a CROSSSLOT error in a clustered environment. If you'll never be clustered, you can ignore it. That said, once you do this, you can never be clustered. So be sure.</p>\n<p>If you <em>will</em> be clustered, you can solve this with hashtags. By putting part of the key in curly braces, you can guarantee that those keys will be on the same shard and <em>never</em> get a CROSSSLOT error. Of course, that means that these particular keys can never benefit from clustering. So, tradeoffs.</p>\n<p>I'd probably use transactions to do this as well. Guarantees the atomicity of the change without having to write Lua. And, it allows out clients to get in while you are doing stuff. Doesn't tie up the single thread that is Redis as long.</p>\n<pre class="lang-bash prettyprint-override"><code>WATCH DATA:{color}:ID1\nGET DATA:{color}:ID1 // returns red\nMULTI\n SADD INDEX:{color}:blue ID1\n SREM INDEX:{color}:red ID1\n SET DATA:{color}:ID1 blue\nEXEC\n</code></pre>\n<p>Hope this helps!</p>\n"^^ . . . "0"^^ . "1"^^ . . . "0"^^ . . "How to create and manipulate MP4 video frames using only native Lua?"^^ . "0"^^ . "1"^^ . . . . "0"^^ . . . "os.clock() in lua return wrong value"^^ . . . . . . "@adabsurdum I want the function "PressKeySequenceA" to run at the same time as MoveMouseRelative. I'm using this script for a game and the PressKeySequenceA moves my character in the game around while MoveMouseRelative is supposed to move my mouse around. I want to move my character using WASD which is already in the function and I want to move my mouse at the same time. My bad if my tech language is bad because I don't have much experience in this besides some youtube videos and an AP class"^^ . "1"^^ . . . . "0"^^ . . "0"^^ . . . . . . "-1"^^ . . "<p>It seems that LuaSocket can be a good answer: <a href="https://w3.impa.br/%7Ediego/software/luasocket/socket.html#gettime" rel="nofollow noreferrer">https://w3.impa.br/~diego/software/luasocket/socket.html#gettime</a></p>\n<p>You can have even more precise timing with LuaPosix: <a href="https://luaposix.github.io/luaposix/modules/posix.time.html#clock_gettime" rel="nofollow noreferrer">https://luaposix.github.io/luaposix/modules/posix.time.html#clock_gettime</a> but for some I cannot make it work on my machine (the <code>clock_gettime</code> function returns a number instead of a table with the seconds and the nanoseconds). So LuaSocket may be a safer choice.</p>\n<p>With LuaSocket:</p>\n<pre class="lang-lua prettyprint-override"><code>local socket = require('socket')\n\ntest = function()\n print(&quot;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;start record id: &quot;, record_id)\n local t = socket.gettime()\n\n ...\n body\n ...\n\n print(&quot;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;end record id: &quot;, record_id, &quot;time taken: &quot;, socket.gettime() - t)\nend\n\n</code></pre>\n<p>With LuaPosix:</p>\n<pre class="lang-lua prettyprint-override"><code>local posix = require('posix')\n\ntest = function()\n print(&quot;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;start record id: &quot;, record_id)\n local t = posix.clock_gettime(0)\n\n ...\n body\n ...\n\n local t2 = posix.clock_gettime(0)\n\n local elapsed_time = end_time.tv_sec - start_time.tv_sec + (end_time.tv_nsec - start_time.tv_nsec)\n\n print(&quot;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;end record id: &quot;, record_id, &quot;time taken: &quot;, elapsed_time)\nend\n</code></pre>\n<p>Here I take the first timestamp after the first print, so it doesn't count in the time measured. But if it is part of what you want to measure, you would need to put it before.</p>\n"^^ . . . . . . . . "1"^^ . . "In your MULTI block, I need to generate this command dynamically: `SREM INDEX:{color}:red ID1` as I will not know the "red" in this key."^^ . . . . . "2"^^ . . . "1"^^ . . . "0"^^ . "GetClass is the way to do it! How you tried to use it?"^^ . . . . . "I don't know about python but javascript doesn't run them in parallel. For lua, a function which resumes the coroutine until all are finished has the same effect."^^ . . "@NiTerleski from a quick look at your code I think I found some issues. I cannot test LUA code. Please share a file if possible (small 320x240 resolution)."^^ . . . "<p>&quot;Your&quot; code is creating this error message you complain about:</p>\n<pre><code>if not (player and ItemName and Value and button) then\n warn(&quot;Missing argument in inventoryEvent.OnServerEvent&quot;) &lt;--- here\n return\nend\n</code></pre>\n<p>print the arguments' values to find out which one is missing and fix that.</p>\n"^^ . "<p>I'm just starting with Lua. I have the newest pre-build lua 5.4 binaries for Windows, and the newest pre-built luarocks binaries for Windows, both from the &quot;original sites&quot;, but luarocks just won't work. Neither with my lua54 install, nor with the lua 5.1 with which it is delivered. I tried both as a normal user, and as an Administrator, with the same result. The luarocks installation does not seem to itself copy it's own lua version anywhere, so I copied it myself, and edited &quot;luarocks.bat&quot; to use it.</p>\n<pre><code>C:\\Windows\\system32&gt;luarocks\nC:\\Lua\\lua54.exe: C:\\Program Files (x86)\\LuaRocks\\lua\\luarocks\\core\\util.lua:18: attempt to concatenate a nil value\nstack traceback:\n C:\\Program Files (x86)\\LuaRocks\\lua\\luarocks\\core\\util.lua:18: in function 'luarocks.util.popen_read'\n C:\\Program Files (x86)\\LuaRocks\\lua\\luarocks\\util.lua:420: in function 'luarocks.util.check_lua_version'\n C:\\Program Files (x86)\\LuaRocks\\lua\\luarocks\\util.lua:491: in upvalue 'find_lua_bindir'\n C:\\Program Files (x86)\\LuaRocks\\lua\\luarocks\\util.lua:512: in function 'luarocks.util.find_lua'\n (...tail calls...)\n C:\\Program Files (x86)\\LuaRocks\\lua\\luarocks\\cmd.lua:633: in function 'luarocks.cmd.run_command'\n C:\\Program Files (x86)\\LuaRocks\\luarocks.lua:35: in main chunk\n [C]: in ?\n\nC:\\Windows\\system32&gt;luarocks\nC:\\Program Files (x86)\\LuaRocks\\win32\\lua5.1\\bin\\lua5.1.exe: ...gram Files (x86)\\LuaRocks\\lua\\luarocks\\core\\util.lua:18: attempt to concatenate a nil value\nstack traceback:\n ...gram Files (x86)\\LuaRocks\\lua\\luarocks\\core\\util.lua:18: in function 'popen_read'\n ...:\\Program Files (x86)\\LuaRocks\\lua\\luarocks\\util.lua:420: in function 'check_lua_version'\n ...:\\Program Files (x86)\\LuaRocks\\lua\\luarocks\\util.lua:491: in function 'find_lua_bindir'\n ...:\\Program Files (x86)\\LuaRocks\\lua\\luarocks\\util.lua:512: in function &lt;...:\\Program Files (x86)\\LuaRocks\\lua\\luarocks\\util.lua:510&gt;\n (tail call): ?\n C:\\Program Files (x86)\\LuaRocks\\lua\\luarocks\\cmd.lua:633: in function 'run_command'\n C:\\Program Files (x86)\\LuaRocks\\luarocks.lua:35: in main chunk\n [C]: ?\n</code></pre>\n"^^ . "_"...I want them to execute at the same time."_ -- You want the two scripts to run in parallel on two different cores? This doesn't make much sense, and seems like [an XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). What is the actual problem that you are trying to solve?"^^ . "How to fix my luarocks installation, on Windows?"^^ . "<p>So I'm writing an inventory for a game in lua, but I have some issues when it saves the inventory.</p>\n<p>The function code is as follows</p>\n<pre><code>function SaveInventory(source, offline)\n local source = source\n local xPlayer = ESX.GetPlayerFromId(source)\n local PlayerName = xPlayer.getName()\n\n items = AllItemData[source]\n\n local ItemsJson = {}\n\n if items and table.type(items) ~= 'empty' then\n for slot, item in pairs(items) do\n if items[slot] then\n for k, v in pairs(items) do\n ItemsJson[#ItemsJson + 1] = {\n name = v.name,\n amount = v.amount,\n info = v.info,\n type = v.type,\n slot = v.slot,\n }\n end\n\n end\n end\n\n MySQL.prepare('UPDATE users SET inventory = ? WHERE identifier = ?', { json.encode(ItemsJson), xPlayer.identifier })\n end\n\nend\n</code></pre>\n<p>The inventory saves fine, however, with every item it duplicates and I wonder why it's doing that.</p>\n<p>So with just a phone, it returns</p>\n<pre><code>[\n {\n &quot;name&quot;: &quot;phone&quot;,\n &quot;amount&quot;: 1,\n &quot;slot&quot;: 6,\n &quot;info&quot;: []\n }\n]\n</code></pre>\n<p>However if I add another item lets say a male id card to the inventory, it doubles the entry as such</p>\n<pre><code>[\n {\n &quot;name&quot;: &quot;idcard_m&quot;,\n &quot;amount&quot;: 1,\n &quot;slot&quot;: 7,\n &quot;info&quot;: []\n },\n {\n &quot;name&quot;: &quot;phone&quot;,\n &quot;amount&quot;: 1,\n &quot;slot&quot;: 6,\n &quot;info&quot;: []\n },\n {\n &quot;name&quot;: &quot;idcard_m&quot;,\n &quot;amount&quot;: 1,\n &quot;slot&quot;: 7,\n &quot;info&quot;: []\n },\n {\n &quot;name&quot;: &quot;phone&quot;,\n &quot;amount&quot;: 1,\n &quot;slot&quot;: 6,\n &quot;info&quot;: []\n }\n]\n</code></pre>\n<p>As far as I can see there is nothing wonky in the code, so I hope a fresh pair of eyes can shed some light.</p>\n<p>The expected behavior is that json.encode should return unduplicated as such</p>\n<pre><code>[\n {\n &quot;name&quot;: &quot;idcard_m&quot;,\n &quot;amount&quot;: 1,\n &quot;slot&quot;: 7,\n &quot;info&quot;: []\n },\n {\n &quot;name&quot;: &quot;phone&quot;,\n &quot;amount&quot;: 1,\n &quot;slot&quot;: 6,\n &quot;info&quot;: []\n }\n]\n</code></pre>\n"^^ . . . . "0"^^ . "What do you mean by "when I change the `multiplier.value`"? Is `multiplier` an `IntValue` in your workspace? If it is, when is it created? Where is it located? I have a suspicion as to what's happening, but I can't be sure without a little more information."^^ . . . . "0"^^ . . . . "Lua: await the completion of multiple coroutines"^^ . . . "0"^^ . "premake"^^ . . . . . . "1"^^ . "<p>This is conditional compilation. Of course, you can.</p>\n<pre class="lang-lua prettyprint-override"><code>if bit then\n print(&quot;BitOp method&quot;)\nelse\n load[[\n -- arbitrary chunk of code\n print((version_byte &gt;&gt; 4) * 10 + (version_byte &amp; 0xf))\n ]]()\nend\n</code></pre>\n<p>However, this will cause problems with access to locals (e.g. <code>local version_byte</code>). So you'll have to rewrite your code accordingly.</p>\n"^^ . "0"^^ . "<p>The first answer is correct, but if the module is not found, then <code>require</code> will not return <code>nil</code>!</p>\n<p>Use this check when loading a module:</p>\n<pre><code>local _, ms = pcall(require, game.ReplicatedStorage.ModuleScript) \n\nif type(ms)~=&quot;table&quot; then \n ms = require( game.ReplicatedStorage:WaitForChild(&quot;ModuleScript&quot;) )\nend\n</code></pre>\n"^^ . "0"^^ . . . "5"^^ . "<p>I need to replace one log field, from <code>nginx.conf</code>, with its SHA-512 hash, for security reasons. I'd prefer to do this with njs, but would consider Lua.</p>\n<p>However, the only way I know of to modify a log field is <code>js_set</code>, but <code>js_set</code> wants <em>synchronous</em> code, while njs' <code>crypto.subtle.digest(&quot;SHA-512&quot;, msgUint8)</code> is <em>asynchronous</em>.</p>\n<p>Is there an alternative to <code>js_set</code> that can accept an asynchronous function, that can be used in the <code>http</code> block of an <code>nginx.conf</code>?</p>\n<p>I suspect I could use a 3rd party synchronous SHA-512 module, but we'd prefer to avoid that if possible. It'd mean more code to maintain, and a license review.</p>\n<p>Here's a summarized version of what I have right now:\n<code>nginx.conf</code>, in the <code>http</code> section:</p>\n<pre><code>js_import obfuscate.js;\njs_set $obfuscated_token obfuscate.get_obfuscated_token_test;\nlog_format main escape=json '{'\n'&quot;http_authorization&quot;:&quot;$obfuscated_token&quot;,'\n'}';\n\n</code></pre>\n<p>And a little test code in <code>obfuscate.js</code>:</p>\n<pre><code>async function get_obfuscated_token_test(r) {\n return &quot;abc&quot;;\n}\n</code></pre>\n<p>This replaces the <code>http_authorization</code> field with:</p>\n<pre><code>&quot;http_authorization&quot;:&quot;[object Promise]&quot;\n</code></pre>\n<p>...which is not what I want. Instead of <code>[object Promise]</code>, I want a SHA-512 hash in hexadecimal, or at least just <code>&quot;abc&quot;</code>.</p>\n"^^ . "updated to provide error message and the most basic case of it working whilst still very ocassionally getting the error"^^ . "<p>I wanted to watch my SBS VR video files in VLC. currently there is no straight forward way to play these files like other player. in other player you just select 3D &gt; SBS and it shows the typical VR in 2d view. If I want to play these files in VLC I need to inject VR metadata to make the vlc recognize the format. I'm working on how to make a script that forces the vlc to play the files in VR view. I tried few things but still no luck. I browsed through source code and found the thing I might want. Looking at libvlc_video.h</p>\n<pre class="lang-c prettyprint-override"><code>typedef enum libvlc_video_projection_t\n{\n libvlc_video_projection_rectangular,\n libvlc_video_projection_equirectangular, /**&lt; 360 spherical */\n\n libvlc_video_projection_cubemap_layout_standard = 0x100,\n} libvlc_video_projection_t;\n\ntypedef enum libvlc_video_multiview_t\n{\n libvlc_video_multiview_2d, /**&lt; No stereoscopy: 2D picture. */\n libvlc_video_multiview_stereo_sbs, /**&lt; Side-by-side */\n libvlc_video_multiview_stereo_tb, /**&lt; Top-bottom */\n libvlc_video_multiview_stereo_row, /**&lt; Row sequential */\n libvlc_video_multiview_stereo_col, /**&lt; Column sequential */\n libvlc_video_multiview_stereo_frame, /**&lt; Frame sequential */\n libvlc_video_multiview_stereo_checkerboard, /**&lt; Checkerboard pattern */\n} libvlc_video_multiview_t;\n</code></pre>\n<p>I found that I need to somehow make the <strong>video_multiview</strong> to be <strong>multiview_stereo_sbs</strong> and maybe also <strong>libvlc_video_projection</strong> to <strong>video_projection_rectangular</strong>. I am not so experienced in vlc lua scripting nor how vlc codebase even work. Can someone tell me how to change the thing if at all possible?</p>\n<p>I tried something like</p>\n<pre class="lang-lua prettyprint-override"><code>function activate()\n local input_item = vlc.input.item()\n local name = input_item:name()\n vlc.msg.info(&quot;Activating extension for: &quot; .. name)\n \n if string.match(name, &quot;3dh&quot;) then\n vlc.msg.info(&quot;SBS file detected: &quot; .. name)\n \n -- Attempt to set stereoscopy mode using libvlc_video_multiview_t\n local vout = vlc.object.vout()\n if vout then\n -- set the stereoscopy mode, assuming supported by the VLC and API\n local multiview_mode = 'stereo-sbs' -- translating the C enum to Lua supported string, if exact match required consult API documentation\n \n vlc.var.set(vout, &quot;video-multiview&quot;, multiview_mode)\n -- Assuming libvlc_video_projection_t is properly set for VR mode supported by the libVLC\n local projection_mode = 'equirectangular' -- 360 spherical projection \n\n vlc.var.set(vout, &quot;video-projection&quot;, projection_mode)\n vlc.msg.info(&quot;VR mode enabled for: &quot; .. name)\n else\n vlc.msg.err(&quot;No video output object found&quot;)\n end\n end\nend\n</code></pre>\n<p>but then I got <code>...\\AppData\\Roaming\\vlc\\lua\\extensions\\detectvr.lua:23:VLC lua error in file /builds/videolan/vlc/extras/package/win32/../../../modules/lua/libs/variables.c line 139 (function vlclua_tovalue)</code>. I think I am stuck on finding the right variable to set</p>\n"^^ . . . . . . . . "0"^^ . . . "Custom Lua Plugin in Kong Failed to Properly Send HTTP Request to Spring Boot Rest API (or the other way around)"^^ . "0"^^ . . . . "0"^^ . . . "<p>Try this instead:</p>\n<pre><code>function Tile:shimmer()\n if self.alpha == SHINYHIGHESTALPHA then\n Timer.tween(1, {\n [self] = {alpha = SHINYLOWESTALPHA}\n })\n elseif self.alpha == SHINYLOWESTALPHA then\n Timer.tween(1, {\n [self] = {alpha = SHINYHIGHESTALPHA}\n })\n end\nend\n</code></pre>\n<p>You're not supposed to put <code>self.</code> prefixes inside of table constructors.</p>\n"^^ . . . . "how use fzf-lua to prompt with directory listing ; then file listing in selected directory"^^ . . "Guess I found smth interesting, try maproxy https://github.com/zferentz/maproxy/tree/master according to this sample https://github.com/zferentz/maproxy/blob/master/demos/logging_proxy.py you can take a control over upstream data with `on_p2s_done_read` and then put modified data to the `super.on_p2s_done_read`. Unless it seems to be kind of outdated it satisfy declared needs. Have a look and let me know if it's handy for you. @nikolay @AHmedRef"^^ . "<p>I have an <strong>rtf</strong> file that, ultimately, I want to convert into a chunked <strong>html</strong>, splitting on the level 1 headings.</p>\n<p>My first step is to convert the rtf to one html file, which is straightforward with:</p>\n<pre><code>pandoc -f rtf -t html -o inputfile.html inputfile.rtf\n</code></pre>\n<p>The resulting html file has headings defined by <code>&lt;strong&gt;&lt;/strong&gt;</code> rather than <code>&lt;h1&gt;&lt;/h1&gt;</code> so I have to edit the file in a text editor to change all these. Here is a sample from the file:</p>\n<pre><code>&lt;p&gt;&lt;strong&gt;George Stewart&lt;/strong&gt;&lt;/p&gt;\n&lt;p&gt;Title: George Stewart&lt;/p&gt;\n&lt;p&gt;Type: Task&lt;/p&gt;\n&lt;p&gt;Date:1734&lt;/p&gt;\n&lt;p&gt;Description: Christening&lt;/p&gt;\n&lt;p&gt;Status: +open&lt;/p&gt;\n&lt;p&gt;Repository: LDS Library&lt;/p&gt;\n&lt;p&gt;Last action: 8 May 2024&lt;/p&gt;\n&lt;p&gt;&lt;strong&gt;Ann Hill&lt;/strong&gt;&lt;/p&gt;\n&lt;p&gt;Title: Ann Hill&lt;/p&gt;\n&lt;p&gt;Type: Task&lt;/p&gt;\n&lt;p&gt;Date: 1799&lt;/p&gt;\n&lt;p&gt;Description: Family&lt;/p&gt;\n&lt;p&gt;Status: +ToDo&lt;/p&gt;\n&lt;p&gt;Repository: LDS Library&lt;/p&gt;\n</code></pre>\n<p>which has to be edited to:</p>\n<pre><code>&lt;p&gt;&lt;h1&gt;George Stewart&lt;/h1&gt;&lt;/p&gt;\n&lt;p&gt;Title: George Stewart&lt;/p&gt;\n&lt;p&gt;Type: Task&lt;/p&gt;\n&lt;p&gt;Date:1734&lt;/p&gt;\n&lt;p&gt;Description: Christening&lt;/p&gt;\n&lt;p&gt;Status: +open&lt;/p&gt;\n&lt;p&gt;Repository: LDS Library&lt;/p&gt;\n&lt;p&gt;Last action: 8 May 2024&lt;/p&gt;\n&lt;p&gt;&lt;h1&gt;Ann Hill&lt;/h1&gt;&lt;/p&gt;\n&lt;p&gt;Title: Ann Hill&lt;/p&gt;\n&lt;p&gt;Type: Task&lt;/p&gt;\n&lt;p&gt;Date: 1799&lt;/p&gt;\n&lt;p&gt;Description: Family&lt;/p&gt;\n&lt;p&gt;Status: +ToDo&lt;/p&gt;\n&lt;p&gt;Repository: LDS Library&lt;/p&gt;\n</code></pre>\n<p>Then I can run the next step which is to chunk the html into many files splitting at the h1 level with another Pandoc command.</p>\n<pre><code>pandoc -t chunkedhtml --split-level=1 -o RN_File inputfile.html\n</code></pre>\n<p>I would like to be able to do that heading conversion inline as part of the Pandoc command. It may be possible with a filter (json/lua?) but I cannot work out the syntax.</p>\n<p>Ideally, I would also like to merge the two Pandoc steps, but do not know if this is possible. It seems there might be a method of doing this with a pipe function, but perhaps someone could confirm with an example.</p>\n<p>The Pandoc <a href="https://pandoc.org/lua-filters.html" rel="nofollow noreferrer">Lua filters</a> guide suggests I need a code block like:</p>\n<pre><code>function Strong(elem)\n return pandoc.SmallCaps(elem.content)\nend\n</code></pre>\n<p>but I need to capture <code>&lt;p&gt;&lt;strong&gt;</code> and replace with <code>&lt;h1&gt;</code>, this does not work but may be gives a clue of what I am trying to achieve ...</p>\n<pre><code>function Para+Strong(elem)\n return pandoc.Header(1)\nend\n</code></pre>\n"^^ . "Neovim key command r is to be customized"^^ . . . . . "<p>I have a file structured like this</p>\n<p>$$ some text $$</p>\n<p>and I would like to make my script reveal when there is a block of text present within the &quot;$$&quot; tags. This script works well when the text is of the form <code>$$ some text $$</code></p>\n<pre><code>function file_exists(name)\n local f = io.open(name, &quot;r&quot;)\n if f ~= nil then\n io.close(f)\n return true\n else\n return false\n end\nend\n\nfunction rows_from(file)\n if not file_exists(file) then\n return {}\n end\n local rows = {}\n for line in io.lines(file) do\n rows[#rows + 1] = line\n end\n return rows\nend\n\nfunction detect_non_indexed_equations(rows,j)\n if rows[j]:sub(1,2) == &quot;$$&quot; then\n for i=j, #rows do\n if rows[i]:sub(-2) == &quot;$$&quot; then\n print(&quot;text between $$ detected&quot;)\n break\n end\n end\n end\nend\n\nfunction fetch_equations(start)\n local rows = rows_from(file)\n for j = start, #rows do\n detect_non_indexed_equations(rows,j)\n end\nend\n\nfetch_equations(1)\n</code></pre>\n<p>But the block is written like</p>\n<pre><code>$$\n some text\n$$\n</code></pre>\n<p><code>print(&quot;text between $$ detected&quot;)</code> run twice, and the block is not revealed correctly.</p>\n<p>Any ideas?</p>\n"^^ . "3"^^ . . "2"^^ . "0"^^ . . "0"^^ . . "Are you sure you did not mixed up events, and if not, where is FireServer? https://create.roblox.com/docs/reference/engine/classes/RemoteEvent#OnServerEvent"^^ . "0"^^ . . . . . . . . . . "3"^^ . . . . "0"^^ . . . "1"^^ . "<p>Having trouble reading header values on my Ngnix configuration, on the client side, I am using Golang and appending the header. usually on the server side, there is no issue with extracting the information from the headers\nmetadata.AppendToOutgoingContext(ctx, MD)</p>\n<p>while reading works using metadata.FromIncomingContext(ctx)</p>\n<p>I need to make a decision on the ngnix which requires reading a specific header &quot;lb-header: value&quot; but having trouble reading the value and setting a local variable.</p>\n<p>tried so far</p>\n<ol>\n<li>set $value $http_lb_header</li>\n<li>lua code</li>\n</ol>\n<pre><code>local headers = ngx.req.get_headers()\n \nfor k, v in pairs(headers) do\n ngx.log(ngx.ERR, &quot;we got header: &quot;, k, &quot;:&quot;, v)\nend\n</code></pre>\n<p>thanks in advance!</p>\n"^^ . . . . . . . "0"^^ . . . "@shingo why is it wrong? it works https://onecompiler.com/lua/42fqg7s34 what I am missing? =("^^ . . . . . "0"^^ . . . . . . "The code works just fine for me; seems like the function isn't being called properly. For eg, `win:setFrame(f, 0)` 0 is animation duration, which should be instantaneous but yours is still animating. Maybe try adding logs to debug?"^^ . "0"^^ . . "1"^^ . . . . . . . "<p>In addition to the stack overflow error in certain circumstances, the grid falls apart very quickly after a move or two.</p>\n<p>There are fundamental design issues here which I'd resolve before fighting bugs. In fact, following these principles will likely automatically resolve the bugs, because they're likely caused by subtle math errors that leave the grid in a bad state.</p>\n<ol>\n<li><p>Avoid magic values.</p>\n<p>The abundant magic values like 63, 64, 8, 65 scattered throughout the code are difficult to understand and make it challenging to keep the grid in non-corrupt state as you perform complex manipulations. It's best to assign these one time as constants and derive all other values from the base values using simple mathematical operations.</p>\n</li>\n<li><p>Keep the UI and game logic separate.</p>\n<p>Convert to and from real-world coordinates immediately after receiving a mouse click and when rendering the grid to the UI. This will also help reduce the need for confusing magic numbers.</p>\n</li>\n<li><p>Model a 2d grid with a 2d table, rather than a 1d table.</p>\n<p>A 2d table corresponds better to what the actual grid looks like. With a 2d grid that doesn't care about UI coordinates (63, 64, 65 and so forth), all row and column values are implicit in the cell's 2d table position. You only need to track the colors of each cell.</p>\n</li>\n<li><p>Avoid recursion, which is generally harder to reason about and debug than loops.</p>\n</li>\n</ol>\n<p>Applying these principles (getting rid of magic values, decoupling the UI and game logic and using a 2d grid, avoiding recursion) cleans things up considerably:</p>\n<pre class="lang-lua prettyprint-override"><code>local grid = {}\nlocal gridSize = 8\nlocal gapSize = 15\nlocal squareSize = 50\nlocal squareSizeWithGap = gapSize + squareSize\nlocal selectedTile = nil\nlocal colors = {\n {1, 0, 0},\n {0, 1, 0},\n {0, 0, 1},\n {1, 1, 0},\n {0, 1, 1},\n {1, 0, 1},\n {0.5, 0.5, 0.5},\n}\n\nfunction initializeGrid()\n for row = 1, gridSize do\n grid[row] = {}\n end\n fillGrid()\n resolveMatches()\nend\n\nfunction drawGrid()\n for row = 1, gridSize do\n for col = 1, gridSize do\n love.graphics.setColor(colors[grid[row][col]])\n love.graphics.rectangle(\n &quot;fill&quot;,\n (col - 1) * squareSizeWithGap,\n (row - 1) * squareSizeWithGap,\n squareSize,\n squareSize\n )\n end\n end\n\n if selectedTile then\n love.graphics.setColor(1, 1, 1)\n love.graphics.rectangle(\n &quot;line&quot;,\n (selectedTile.col - 1) * squareSizeWithGap,\n (selectedTile.row - 1) * squareSizeWithGap,\n squareSize,\n squareSize\n )\n end\nend\n\nfunction resolveMatches()\n while removeHorizontalMatch() or removeVerticalMatch() do\n shiftTilesDown()\n fillGrid()\n end\nend\n\nfunction removeHorizontalMatch()\n for row = 1, gridSize do\n for col = 1, gridSize - 2 do\n local color = grid[row][col]\n if color == grid[row][col + 1] and color == grid[row][col + 2] then\n grid[row][col] = nil\n grid[row][col + 1] = nil\n grid[row][col + 2] = nil\n return true\n end\n end\n end\nend\n\nfunction removeVerticalMatch()\n for col = 1, gridSize do\n for row = 1, gridSize - 2 do\n local color = grid[row][col]\n if color == grid[row + 1][col] and color == grid[row + 2][col] then\n grid[row][col] = nil\n grid[row + 1][col] = nil\n grid[row + 2][col] = nil\n return true\n end\n end\n end\nend\n\nfunction fillGrid()\n for col = 1, gridSize do\n for row = 1, gridSize do\n if not grid[row][col] then\n grid[row][col] = love.math.random(#colors)\n end\n end\n end\nend\n\nfunction shiftTilesDown()\n for col = 1, gridSize do\n for row = gridSize, 1, -1 do\n if not grid[row][col] then\n -- Find the next non-nil tile above to move down\n for aboveRow = row - 1, 1, -1 do\n if grid[aboveRow][col] then\n grid[row][col] = grid[aboveRow][col]\n grid[aboveRow][col] = nil\n break\n end\n end\n end\n end\n end\nend\n\nfunction handleMove(row, col)\n if row &lt;= gridSize and col &lt;= gridSize then\n if selectedTile then\n local s = selectedTile\n grid[row][col], grid[s.row][s.col] = grid[s.row][s.col], grid[row][col]\n resolveMatches()\n selectedTile = nil\n else\n selectedTile = { row = row, col = col }\n end\n end\nend\n\nfunction love.load()\n initializeGrid()\nend\n\nfunction love.draw()\n drawGrid()\nend\n\nfunction love.mousepressed(x, y, button)\n if button == 1 then\n local col = math.floor(x / squareSizeWithGap) + 1\n local row = math.floor(y / squareSizeWithGap) + 1\n handleMove(row, col)\n end\nend\n</code></pre>\n"^^ . "hex"^^ . . . . . . . "0"^^ . . "<p>What you could try is running the PressKeySequenceA() on a separate thread. It's probably not running at the same time because its waiting for PressKeySequenceA() to be finished. Try doing something like this:</p>\n<pre><code>function OnEvent(event, arg)\n if EnableRCS ~= false then\n\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 8 then\n local co = coroutine.create(PressKeySequenceA)\n coroutine.resume(co)\n end\n\n if IsMouseButtonPressed(3) then\n repeat\n if IsMouseButtonPressed(1) then\n repeat\n MoveMouseRelative(0, RecoilControlStrength)\n Sleep(DelayRate)\n until not IsMouseButtonPressed(1)\n end\n until not IsMouseButtonPressed(3)\n end\n end\nend\n</code></pre>\n"^^ . "where is LuaXML_lib on your machine?"^^ . "1"^^ . "0"^^ . "How to spawn part 35 studs in front of player, facing same direction as player?"^^ . . . "minecraft"^^ . "<p>You could set a recursion limit so that it will recursively load the imports until it reaches a certain depth.</p>\n<pre class="lang-lua prettyprint-override"><code>function search_for_import(tex, depth) -- First time this is called set depth to 0\n if depth &gt; 5 then\n return\n end\n local tbl = {}\n for j = 1, #rows_from(tex) do\n if string.sub(rows[j],1,7) == &quot;\\\\import&quot; then\n table.insert(tbl,{\n [1] = j, --line\n [2] = string.sub(rows[j],13,-2), --file name\n })\n print(string.sub(rows[j],13,-2))\n search_for_import(string.sub(rows[j],13,-2), depth + 1)\n end\n end\n ... Rest of the code\n</code></pre>\n<p>This way it only ever recurses to a depth of 5.</p>\n<p>If you want it to recurse for any depth you could also implement some logic to detect if you have already visited this node. (This may require some tweaking to make it work properly)</p>\n<pre class="lang-lua prettyprint-override"><code>function tableContains(haystack, needle)\n for _, v in ipairs(haystack)\n if v == needle then\n return true\n end\n end\nend\nfunction search_for_import(tex, visited) -- First time this is called set visited to an empty array\n if tableContains(visited, tex) then\n return -- Dont visit an import weve already seen.\n end\n table.insert(visited, tex)\n local tbl = {}\n for j = 1, #rows_from(tex) do\n if string.sub(rows[j],1,7) == &quot;\\\\import&quot; then\n ...\n search_for_import(string.sub(rows[j],13,-2), visited)\n end\n end\n ... Rest of the code\n os.execute(&quot;move &quot;..temp..&quot; &quot;..tex) --final result\n table.remove(visited, #visited)\nend\n</code></pre>\n"^^ . . "0"^^ . "filter"^^ . "0"^^ . . . "3"^^ . . . . . "What is the asset ID for the `FireballThrow` animation and is it public? You should make sure your place has access to the animation."^^ . . "0"^^ . . "0"^^ . . "key-bindings"^^ . . . "3"^^ . . . . . "0"^^ . "0"^^ . . "<p>We have a Wireshark dissector written in Lua.\nThere is a top-level script <code>general.lua</code> which contains:</p>\n<pre><code>-- Create a protocol object\nxran_protocol = Proto(&quot;xran&quot;, &quot;&lt;snip&gt;&quot;) &lt;-- line 27\n\n&lt;snip&gt;\n</code></pre>\n<p>and we have a second script <code>cplane.lua</code> to handle part of the protocol, which contains:</p>\n<pre><code>require &quot;general&quot;\n\n-- Create a protocol object\nxran_cplane_proto = Proto(&quot;cplane&quot;, &quot;&lt;snip&gt;&quot;)\n\n&lt;snip&gt;\n\ndebug_level = xran_protocol.prefs.c_plane_debug_level &lt;-- line 348\n\n&lt;snip&gt;\n\n</code></pre>\n<p>Without the require statement I see:</p>\n<pre><code>Lua Error: \\cplane.lua:348: attempt to index global 'xran_protocol' (a nil value)\n</code></pre>\n<p>So I added require but then get:</p>\n<pre><code>general.lua:27: bad argument \n#2 to 'Proto' (Proto new: there cannot be two protocols with the same \ndescription) \n</code></pre>\n<p>Is require causing the code in general.lua to be executed twice?</p>\n<p>What is the correct way for the second script to access xran_protocol?</p>\n"^^ . . "<p>My question is exactly as the heading. I can't find any good documentation explaining what it is and any usecase.</p>\n<p>I found the code being used in many many lua.init files (the file where neovim configs are kept). I've included a snippet.</p>\n<p>I know what it's doing. It is checking whether the path exists. But, why is it under <code>loop</code> and why is it called <code>fs_stat</code>? I'd greatly appreciate it if anyone could refer me to the documentation of vim or neovim that explains it.</p>\n<p><a href="https://i.sstatic.net/oJ8ulSOA.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oJ8ulSOA.png" alt="enter image description here" /></a></p>\n"^^ . "0"^^ . . . . "0"^^ . . "Why doesn't my Roblox Studio print script execute correctly"^^ . "<p>If you're using Luau in VS Code, I'm assuming that you have <a href="https://eryn.io/moonwave/docs/intro" rel="nofollow noreferrer">Luau Language Server</a> installed.</p>\n<p>Luau Language Server supports Moonwave-like docstrings. According to the <a href="https://eryn.io/moonwave/docs/intro#documenting-functions" rel="nofollow noreferrer">documentation</a>, you can do this:</p>\n<pre class="lang-lua prettyprint-override"><code>--[=[\n This is a very fancy function that adds a couple numbers.\n\n @param a number -- The first number you want to add\n @param b number -- The second number you wanna add\n @return number -- Returns the sum of `a` and `b`\n]=]\nfunction MyFirstClass:add(a, b)\n return a + b\nend\n</code></pre>\n"^^ . . "web-scraping"^^ . "0"^^ . . "In `craft()` the item variables are lowercase, but elsewhere they seem to be uppercase. _"I'm more worried about it functioning than form...."_ This is one of many reasons that you _should_ be concerned about writing reasonably clean code with better style: better style should help you avoid some types of bugs, like this one."^^ . "0"^^ . "luarocks"^^ . "Nginx OpenResty : How to Use Lua in NGINX Stream Context for Modifying TCP/UDP Traffic Response"^^ . . . . . . . . . . "0"^^ . . . "0"^^ . "2"^^ . . . . . . . "@shingo ok so if I change function Backpack.new() to function Backpack:new(), print(AlexBackpack.__index) works... but still why do we need the second line in the code? what are the use cases....."^^ . . "Passing arguments through a RemoteEvent in Roblox"^^ . . "0"^^ . . "how to setup and run Solar2d on Ubuntu?"^^ . . "Converting Measurement Signal to Hexadecimal String in Lua for Excel Template Integration"^^ . "fastapi"^^ . . . . . . . "<p>The answer was actually, that WaitForChild is better to be used in an if, for example:\nif not character then\ncharacter = player:WaitForChild(&quot;Character&quot;)</p>\n"^^ . "0"^^ . . . "0"^^ . . . . . . . "-1"^^ . . . "0"^^ . "How to combine two logitech scripts?"^^ . . "Lua Variables And Its Effect On Speed And Memory"^^ . "0"^^ . "Lua table.sort invokes the comparing function with the same element"^^ . . "0"^^ . "placeholder"^^ . . . . "0"^^ . . . "0"^^ . "@MatthewKlassen If my answer solved your problem, please accept it with the check mark."^^ . "1"^^ . "All ModuleScript variables == nil"^^ . . . . . "@adabsurdum The script runs PressKeySequenceA which moves my character using WASD in the game but MoveMouseRelative doesn't run until PressKeySequenceA ends.It causes an observable problem because inside of PressKeySequenceA there are sleep functions because I'm trying to automate a video game and I want it to be precise so having both MoveMouseRelative and PressKeySequenceA running at the exact same time is my goal"^^ . . . . . . "1"^^ . "<p>For some reason a simple script that I wrote, that should call a function whenever a player joins, which after that checks if the players ID is one of the either.</p>\n<pre><code>game.Players.PlayerAdded:Connect(function(player)\n\n print(&quot;player join&quot;)\n if player.UserId == 3193848005 or 2601513514 then\n \n print(&quot;owner join&quot;)\n ms.stamina.Value = 250\n ms.maxstamina.Value = 250\n ms.recover.Value = 10\n\n end\nend)\n</code></pre>\n<p>As well as I understand, a local script runs after you launch the server, and join. Which means that it can't utilise PlayerAdded if YOU join. My problem is that the changes still have to remain client sided, so that the stats only change for the player that joined if he is either of above UserIds. Does anyone has an answer?</p>\n"^^ . "1"^^ . "<p>To solve your problem, simply return when comparing the same element.</p>\n<pre><code>if a == b then\n return\nend\n</code></pre>\n<p>Internally <a href="https://www.lua.org/source/5.4/ltablib.c.html#partition" rel="nofollow noreferrer">the sorting algorithm of Lua</a> is the quick sort of <a href="https://en.wikipedia.org/wiki/Quicksort#Hoare_partition_scheme" rel="nofollow noreferrer">Hoare partition scheme</a>. During partitioning, the pivot value will compare each element one by one from each side until it finds the element with the same or opposite value, so there is a chance that the same element is compared.</p>\n"^^ . . "Lua Minimalization (literally minimizing it to it's smallest format)"^^ . . "0"^^ . "video-processing"^^ . . . "1"^^ . "Yes I have but I have no clue how to do anything like "if getclass()= entity then run code" and when I try it just gives errors (also I already said this in the original post)"^^ . "2"^^ . . "<p>As the title clearly suggests, I am making a basketball game in roblox so I have recently been trying to make my basketball part, named &quot;B-Ball&quot; bounce in a continuous motion. This can be seen here with this code:</p>\n<pre><code>local bball = script.Parent\n\nlocal function setPlayerJumpPower(player)\n local character = player.Character\n if character then\n local humanoid = character:FindFirstChildOfClass(&quot;Humanoid&quot;)\n if humanoid then\n humanoid.JumpHeight = 3\n print(&quot;Jump Power has been set to 3 for player &quot; .. player.Name)\n end\n end\nend\n\nlocal function weldBallToHand(player)\n local character = player.Character\n if not character then return end\n\n local righthand = character:FindFirstChild(&quot;RightHand&quot;) or character:FindFirstChild(&quot;Right Arm&quot;)\n if not righthand then\n print(&quot;RightHand or Right Arm not found for player &quot; .. player.Name)\n return\n end\n\n local wc = Instance.new(&quot;WeldConstraint&quot;)\n wc.Part0 = righthand\n wc.Part1 = bball\n wc.Parent = bball\n bball.Position = righthand.Position + Vector3.new(0, 2, 0) \nend\n\n\nfor _, player in pairs(game.Players:GetPlayers()) do\n setPlayerJumpPower(player)\nend\ngame.Players.PlayerAdded:Connect(function(player)\n player.CharacterAdded:Connect(function(character)\n setPlayerJumpPower(player)\n end)\nend)\n\nlocal function animateBallContinuously()\n local initialPosition = bball.Position\n local bounceHeight = 6 \n local bounceTime = 0.5 \n\n local tweenService = game:GetService(&quot;TweenService&quot;)\n local upTweenInfo = TweenInfo.new(bounceTime, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)\n local downTweenInfo = TweenInfo.new(bounceTime, Enum.EasingStyle.Quad, Enum.EasingDirection.In)\n\n local goalPositionUp = initialPosition + Vector3.new(0, bounceHeight, 0)\n local goalPositionDown = initialPosition\n\n local upTween = tweenService:Create(bball, upTweenInfo, {Position = goalPositionUp})\n local downTween = tweenService:Create(bball, downTweenInfo, {Position = goalPositionDown})\n\n upTween.Completed:Connect(function()\n downTween:Play()\n end)\n\n downTween.Completed:Connect(function()\n wait(0.1)\n upTween:Play()\n end)\n upTween:Play()\nend\n\nbball.Touched:Connect(function(hit)\n if not hit then return end\n local character = hit.Parent\n if not character then return end\n local player = game.Players:GetPlayerFromCharacter(character)\n if not player then return end\n\n print(&quot;Touched part: &quot; .. hit.Name)\n print(&quot;Character: &quot; .. character.Name)\n weldBallToHand(player)\n animateBallContinuously()\nend)\nbball.Anchored = false\nbball.CanCollide = true\nbball.Velocity = Vector3.new(0, -50, 0)\nprint(&quot;Ball initial position: &quot; .. tostring(bball.Position))\n</code></pre>\n<p>When I try and run it, there is no error (so clearly a logic error) but the ball slowly rises up and instead of bouncing just sort of levitates and hovers about. I expected it the bounce up and down. Do you have any idea what could be causing this?</p>\n<p>Many thanks in advance</p>\n"^^ . . . . . "Scrapy splash cannot perform js like what I did directly in the browser terminal"^^ . . . "slimv"^^ . "One possible difference could be the working directory, where is the xml lib and from what working dir do you start using cmd?"^^ . "wireshark-dissector"^^ . "0"^^ . . "This is an awesome answer and a good solution. I think for simplicity I'm going with just using `load()`, but the module solution could definitely be the answer to someone else's needs. For Wireshark it's easier to not have to deal with modules in the Lua dissector folder, but it's a very clean solution for other situations."^^ . "html"^^ . "0"^^ . "Variable is not updating when I change it in Roblox Studio Lua"^^ . . "<p>The error says:</p>\n<blockquote>\n<p>Proto new: there cannot be two protocols with the same description.</p>\n</blockquote>\n<p>So what is a description?<br />\n<a href="https://www.wireshark.org/docs/wsdg_html_chunked/lua_module_Proto.html#lua_class_Proto" rel="nofollow noreferrer">According to the documentation</a>, description is the second parameter to the <code>Proto</code> function.</p>\n<p>So <code>&lt;snip&gt;</code> is the description, when you do <code>xran_protocol = Proto(&quot;xran&quot;, &quot;&lt;snip&gt;&quot;)</code> in one file and then <code>xran_cplane_proto = Proto(&quot;cplane&quot;, &quot;&lt;snip&gt;&quot;)</code> in another you are using the same description twice.</p>\n<p>You simply need to change one of those descriptions to make it unique from the other.</p>\n<hr />\n<p>Also if you are running <code>general.lua</code> before you do the require in the other file it will get run twice. So to prevent the error from occurring from running the same file twice, you can make it a proper module returning it's self to the caller and not running it outside of the require statement.</p>\n<pre class="lang-lua prettyprint-override"><code>local general = {}\n\n-- Create a protocol object\ngeneral.xran_protocol = Proto(&quot;xran&quot;, &quot;&lt;snip&gt;&quot;) \n\n&lt;snip&gt;\n...\nreturn general\n</code></pre>\n<p>Or less properly, you could have the file add its output to the packages which will then return that output to any call of <code>require 'general'</code></p>\n<pre class="lang-lua prettyprint-override"><code> package.loaded['general'] = { xran_protocol = xran_protocol }\n</code></pre>\n<p>and change the other file to</p>\n<pre class="lang-lua prettyprint-override"><code>local general = require &quot;general&quot;\n...\ndebug_level = general.xran_protocol.prefs.c_plane_debug_level\n\n</code></pre>\n"^^ . . "<p>My development tool can't use PIPE/socket connections, so…</p>\n<p>Is there another way to control MPV from another application using a different protocol/interface? I need just standard functions: play, pause, get current time, seek, select audio track, etc.</p>\n<p>Lua should be an option, but it seems that Lua scripts are executed <strong>from inside</strong> MPV. I can't find how to execute a Lua script from another application.</p>\n<p>I can do that with VLC using its http interface, sending and receiving JSON, but I need another media player.</p>\n<ul>\n<li><p>Is there an another interface, protocol or technique?</p>\n</li>\n<li><p>Is there another controllable media player for Mac and Windows? (it seems that MPlayer also uses PIPE/Socket for the slave mode, so it's not an option for me).</p>\n</li>\n</ul>\n"^^ . . "grpc"^^ . . . . . . "<p>The issue with the current code is that it is unable to perform number conversation and formatting properly.</p>\n<pre class="lang-lua prettyprint-override"><code>_lua(R&quot;§(string.format(&quot;%08X&quot;, tonumber(@measdata:Diag_DTC[1].max($tStep1,$tStep1End)) or 0))§&quot;)\n</code></pre>\n<ul>\n<li><p>In your case <code>tonumber()</code> to convert the measurement value to a number, is not already in the correct format</p>\n</li>\n<li><p><code>string.format(&quot;%08X&quot;, ...)</code> formats the number as an uppercase hexadecimal string, zero-padded to 8 characters</p>\n</li>\n</ul>\n<p><code>or 0</code> as a fallback in case the tonumber() conversion fails, to prevent errors.</p>\n<p>Tip : Next time don't add quotes around the entire <code>string.format()</code> call, as they were unnecessary and causing issues.</p>\n"^^ . "0"^^ . . . "0"^^ . . "2"^^ . . . . "<p>I'm trying to debug a lua program using VSCode with <a href="https://marketplace.visualstudio.com/items?itemName=actboy168.lua-debug" rel="nofollow noreferrer">Lua Debug</a>.</p>\n<p>This is the program</p>\n<pre><code>require 'luaxml'\nprint('Hello')\n</code></pre>\n<p>When I run it from the CMD it works fine.</p>\n<p>But when I run it from VSCode it complains the library cannot be found</p>\n<pre><code>C:\\Program Files (x86)\\Lua\\5.1\\lua.exe: C:/Program Files (x86)/Lua/5.1/lua/luaxml.lua:1: module 'LuaXML_lib' not found:\n no field package.preload['LuaXML_lib']\n no file './LuaXML_lib.lua'\n no file 'C:/Program Files (x86)/Lua/5.1/lua/LuaXML_lib.lua'\n no file 'C:/Program Files (x86)/Lua/5.1/lua/LuaXML_lib/init.lua'\n no file 'C:/Program Files (x86)/Lua/5.1/LuaXML_lib.lua'\n no file 'C:/Program Files (x86)/Lua/5.1/LuaXML_lib/init.lua'\n no file 'C:/Program Files (x86)/Lua/5.1/lua/LuaXML_lib.luac'\n no file 'C:\\Users\\Me\\Documents/LuaXML_lib.lua'\n no file 'C:\\Program Files (x86)\\Lua\\5.1/LuaXML_lib.lua'\n no file 'C:\\Users\\Me\\Documents\\LuaXML_lib.lua'\n no file 'C:\\Users\\Me\\Documents\\LuaXML_lib.dll'\n no file 'C:\\Program Files (x86)\\Lua\\5.1/LuaXML_lib.dll'\n no file 'C:\\Users\\Me\\Documents\\LuaXML_lib.dll'\nstack traceback:\n [C]: in function 'require'\n C:/Program Files (x86)/Lua/5.1/lua/luaxml.lua:1: in main chunk\n [C]: in function 'require'\n ...Documents\\test.lua:4: in main chunk\n [C]: ?\n</code></pre>\n<p>This is the content of my <code>launch.json</code>. I have specified the path to the lua that runs when I call <code>which lua</code> from the CMD.</p>\n<pre><code>{\n // Use IntelliSense to learn about possible attributes.\n // Hover to view descriptions of existing attributes.\n // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\n &quot;version&quot;: &quot;0.2.0&quot;,\n &quot;configurations&quot;: [\n {\n &quot;type&quot;: &quot;lua&quot;,\n &quot;luaexe&quot;: &quot;C:\\\\Program Files (x86)\\\\Lua\\\\5.1\\\\lua.exe&quot;,\n &quot;request&quot;: &quot;launch&quot;,\n &quot;luaVersion&quot;: &quot;lua51&quot;,\n &quot;luaArch&quot;: &quot;x86&quot;,\n &quot;name&quot;: &quot;Debug&quot;,\n &quot;program&quot;: &quot;C:\\\\Users\\\\Me\\\\Documents\\\\test.lua&quot;,\n &quot;cwd&quot;: &quot;C:\\\\Users\\\\Me\\\\Documents&quot;,\n &quot;arg&quot;: [&quot;C:\\\\Users\\\\Me\\\\Documents\\\\output&quot;]\n }\n ]\n}\n</code></pre>\n<p>Why is the debugger version from Lua unable to find the library ? Why isn't it exactly the same executable as the one from the CMD ? (since it is the one I specified in <code>launch.json</code>).</p>\n"^^ . "scrapy-splash"^^ . "<p>I have a lot of data in <strong>Redis</strong> like\n<code>User_DB_1:&lt;user_id&gt;</code> , <code>User_Main:&lt;user_id&gt;</code>, <code>Skills_DB_1:&lt;user_id&gt;</code></p>\n<p>I set the maxmemory to 50MB and write a lua script and run it in <strong>Redis</strong> that lua file should remove data that has pattern <code>User_DB_1:&lt;user_id&gt;</code> and shouldn't remove any data for Skills pattern</p>\n<p>I have tried a lot and I see that each time remove data matches Skills pattern and I run it uses</p>\n<p><code>redis-cli --eval /data/redis_evication.lua</code>\nand the output is (integer) 1000</p>\n<p>I am trying to know how can I write a lua file and execute it with the expected results</p>\n<pre><code>local cursor = &quot;0&quot;\nlocal patterns = {&quot;User_DB_1:*&quot;, &quot;User_Main:*&quot;}\nlocal total_evicted = 0\nlocal limit = 1000 -- Limit of keys to evict per script run\n\nrepeat\n -- Scan for the first pattern\n local res = redis.call(&quot;SCAN&quot;, cursor, &quot;MATCH&quot;, patterns[1], &quot;COUNT&quot;, limit)\n cursor = res[1]\n local keys = res[2]\n\n for _, key in ipairs(keys) do\n if string.match(key, &quot;^User_DB_1:%d+$&quot;) then\n redis.call(&quot;DEL&quot;, key)\n redis.log(redis.LOG_NOTICE, &quot;Deleted key: &quot; .. key)\n total_evicted = total_evicted + 1\n if total_evicted &gt;= limit then\n return total_evicted\n end\n end\n end\n\n -- Scan for the second pattern\n res = redis.call(&quot;SCAN&quot;, cursor, &quot;MATCH&quot;, patterns[2], &quot;COUNT&quot;, limit)\n cursor = res[1]\n keys = res[2]\n\n for _, key in ipairs(keys) do\n if string.match(key, &quot;^User_Main:%d+$&quot;) then\n redis.call(&quot;DEL&quot;, key)\n redis.log(redis.LOG_NOTICE, &quot;Deleted key: &quot; .. key)\n total_evicted = total_evicted + 1\n if total_evicted &gt;= limit then\n return total_evicted\n end\n end\n end\nuntil cursor == &quot;0&quot;\n\nreturn total_evicted```\n</code></pre>\n"^^ . . "1"^^ . "0"^^ . . "<p>In Lua, is there a way to check if a string is a <strong>valid PCRE pattern</strong>?</p>\n<p>Examples:</p>\n<pre class="lang-lua prettyprint-override"><code>local function is_valid_regex(pattern)\n -- Check if the pattern is PCRE-compliant\nend\n\n-- Test\nprint(is_valid_regex(&quot;.*&quot;)) -- true\nprint(is_valid_regex(&quot;[a-z]+&quot;)) -- true\nprint(is_valid_regex(&quot;([0-9]&quot;)) -- false (unbalanced parentheses)\nprint(is_valid_regex(&quot;*invalid&quot;)) -- false (invalid usage of *)\n</code></pre>\n"^^ . . . . . . "How to check if a regex string is PCRE-compliant?"^^ . . "0"^^ . "<p>I am trying to print a staff list with all the online staff members on the server</p>\n<p>This is my code:</p>\n<pre><code>RegisterCommand('staff', function(source)\n local catistaff = 0\n local staff = vRP.getOnlineAdmins{};\n for k,v in pairs(staff) do\n local player = vRP.getUserSource{v}\n local name = GetPlayerName(player) or &quot;Unknown&quot;\n if name ~= &quot;Unknown&quot; then\n TriggerClientEvent('chatMessage', player, '^5' .. name .. ' ^0(^5' .. v .. '^0) -&gt; ^1' .. vRP.getUserAdminTitle{v})\n catistaff = catistaff +1\n end\n end\n TriggerClientEvent('chatMessage', source, 'Staff Online: ^1' .. catistaff)\nend)\n</code></pre>\n<p>And this is the error that I ve got:</p>\n<pre><code>[ c-scripting-core] InvokeNative: execution failed: Argument at index 1 was null.\n[ script:vrp] SCRIPT ERROR: Execution of native 000000002f7a49e6 in script host failed: Argument at index 1 was null.\n[ script:vrp] &gt; [global chunk] (TriggerClientEventInternal.lua:3)\n[ script:vrp] &gt; sendStaffMessage (@vrp/modules/admin.lua:411)\n[ script:vrp] &gt; callback (@vrp/modules/admin.lua:317)\n[ script:vrp] &gt; handler (vrp-lib/Tunnel.lua:139)\n[ script:vrp] null\n</code></pre>\n"^^ . . "0"^^ . . "1"^^ . . . "0"^^ . "<p>Just set the maxStamina to 100 because that value never changes. Make sure to update the stamina script.</p>\n<pre class="lang-lua prettyprint-override"><code>local info = {\n \n stamina = Instance.new(&quot;IntValue&quot;),\n maxstamina = 100\n \n}\nreturn info\n</code></pre>\n"^^ . "0"^^ . "4"^^ . "0"^^ . "workspace"^^ . . "1"^^ . "Add a docstring to a lua function in Roblox Studio"^^ . "0"^^ . "Can`t get constraint.HasConstraints working in Lua gmod"^^ . . "You're looking for a [pandoc lua filter](https://pandoc.org/lua-filters.html) that converts _all_ strong elements to h1 elements? That should be doable..."^^ . . . . "Lua function: 'type', recreated in Luau"^^ . "<p>I'm trying to spawn a wall in front of the player, 35 studs out, and perpendicular to their view (so the wall is flat in front of them). When I spawn the wall, it doesn't show up in the correct spot and I'm not sure why. Please see <a href="https://drive.google.com/file/d/1kzcjVPnEVibt49zhpGRKRnKDUUb5XcJG/view?usp=sharing" rel="nofollow noreferrer">this video</a> for example.</p>\n<pre class="lang-lua prettyprint-override"><code>local player = game.Players.LocalPlayer\nlocal char = player.Character\nlocal rootPart = char:WaitForChild(&quot;HumanoidRootPart&quot;)\nlocal wall = workspace.FX:WaitForChild(&quot;Wall&quot;)\n\n-- Note that the wall is cloned into the FX folder in a different script.\n\nwall.Position = rootPart.CFrame.LookVector.Unit * 35 + rootPart.Position\n</code></pre>\n"^^ . "0"^^ . . . . "1"^^ . . . . "1"^^ . "regex"^^ . . . "<p>I'm using os.clock in lua to measure working time of a function. I add debug log like below</p>\n<pre><code>test = function()\n print(&quot;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;start record id: &quot;, record_id, &quot;clock: &quot;, os.clock())\n\n ...\n body\n ...\n\n print(&quot;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;end record id: &quot;, record_id, &quot;clock: &quot;, os.clock())\nend\n</code></pre>\n<p>I also use <code>&lt;your commadn&gt; | ts &quot;[%Y-%m-%d %H:%M:%S]&quot;</code> to monitor output console.</p>\n<p>When monitoring output console, I figure out time stamp in <code>ts</code> command is different from <code>os.clock()</code> result in lua.</p>\n<pre><code>[2024-07-01 22:46:29] &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;start record id: 2 clock: 0.143632\n[2024-07-01 22:46:29] &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;end record id: 2 clock: 0.152762\n[2024-07-01 22:46:29] &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;start record id: 3 clock: 0.152998\n...\n...\n[2024-07-01 22:50:25] &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;end record id: 3639 clock: 48.124877\n[2024-07-01 22:50:25] &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;start record id: 3640 clock: 48.125138\n[2024-07-01 22:50:25] &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;end record id: 3640 clock: 48.137237\n</code></pre>\n<p>Following above result logs, to log 3639 records, <code>ts</code> command needs 4 minutes to complete but <code>os.clock()</code> only needs 48 seconds.</p>\n<p>Do I misunderstanding about <code>os.clock()</code> result?</p>\n<p><strong>Expected</strong>\nI just wanna know how much time do my system need to log 1 record. Because it's very fast so I use <code>os.clock()</code> but the result make me confuse</p>\n"^^ . . "0"^^ . . . "2"^^ . . "1"^^ . . . "My animation in Roblox Studio plays, but in a actual Roblox game it dosen't play, but the projectile works"^^ . "python"^^ . . "People don't use it like this, they use `setmetatable`, that's why I think you omitted something."^^ . . "0"^^ . . "@DavidA the local environment is a crucial factor in your actual problem, I am not sure you can get around it due to the sand boxing, aside from simply combining the scripts into 1 file which is not a great solution."^^ . "1"^^ . . . . . . "logitech ghub doesn't have the coroutine library"^^ . . . . . "2"^^ . . . "0"^^ . "you can implement this using the __newindex metamethod in a proxy table. Read this: https://www.lua.org/pil/13.4.4.html you'll basically replace info by a proxy table that acts as an interface to your data. when you assign to proxy.stamina proxy's __newindex method will store the value in your data table and call a notification function."^^ . . "0"^^ . . . "1"^^ . . "in your code you have the comment `-- Output: userdata (But it Outputs: string)` do you mean `but is SHOULD output string`?"^^ . . . . . . "<p>So if I understand this correctly, Lua data types of string, numbers are values, while functions and tables are references. Does this mean that if I do:</p>\n<pre><code>local x = 5\nlocal y = x\n</code></pre>\n<p>Is the variable y, a copy of x and is not a reference, which means doing it this way will consume twice the memory?</p>\n<p>While doing:</p>\n<pre><code>local myTab = { one = &quot;hello&quot; }\nlocal myTab2 = myTab\n</code></pre>\n<p>Would mean that myTab and myTab2 reference the same table and assigning myTab to myTab2 won't consume extra memory?</p>\n<p>I ask this since I usually tend to reassign global variables to local variables to improve speed.</p>\n<p>Such as:</p>\n<pre><code>Config = {} -- This is in file1.lua\n\n-- On file2. lua we do:\n\nlocal Config = Config\n</code></pre>\n<p>So this should theoretically improve speed by a bit since we're assigning it to a local variable, but I wonder if doing so will consume significantly more memory, especially when we're dealing with larger programs with bigger data.</p>\n"^^ . "0"^^ . . . . . . . "luajit"^^ . "2"^^ . "<p>My Problem is that the animation I labelled as <code>FireballThrow</code> and the fireball projectile does play in the Roblox Studio environment, HOWEVER, in a real game it doesn't execute properly, only the projectile is successful.</p>\n<p>Here is my original code:</p>\n<p>My Local Script (Below) in the <code>StarterPack</code> folder:</p>\n<pre><code>local player = game.Players.LocalPlayer\nlocal cooldown = false\nlocal UIS = game:GetService(&quot;UserInputService&quot;)\nlocal RS = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal mouse = player:GetMouse()\n\n\nUIS.InputBegan:Connect(function(Input,gpe)\n\n if Input.KeyCode == Enum.KeyCode.E and not gpe and not cooldown then\n print(&quot;Skill Thrown&quot;)\n cooldown = true\n local animation = player.Character:WaitForChild(&quot;Humanoid&quot;):LoadAnimation(script.FireballThrow)\n animation:Play()\n wait(.5)\n RS.ThrowRemote:FireServer(mouse.Hit.p)\n game.Debris:AddItem(animation,2)\n wait(2)\n cooldown = false\n end\n\nend)\n</code></pre>\n<p>And my server side script (Below) in <code>ServerScriptService</code>:</p>\n<pre><code>local remote = game.ReplicatedStorage.ThrowRemote\n\nremote.OnServerEvent:Connect(function(player,MousePosition)\n local fireball = game.ReplicatedStorage.Fireball:Clone()\n fireball.Parent = workspace\n fireball.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-2)\n\n local NewForce = Instance.new(&quot;BodyForce&quot;)\n NewForce.Force = Vector3.new(0,workspace.Gravity * fireball:GetMass(),0)\n NewForce.Parent = fireball\n\n fireball.Velocity = CFrame.new(player.Character.HumanoidRootPart.Position,MousePosition).LookVector * 70\n\n fireball.Touched:Connect(function(hit)\n if hit.Parent:FindFirstChild(&quot;Humanoid&quot;) and not hit:IsDescendantOf(player.Character) then\n hit.Parent.Humanoid.Health -= 50 -- You can choose how much damage they take\n fireball:Destroy()\n end\n wait(4)\n fireball:Destroy()\n end)\n\nend)\n</code></pre>\n<p>I used <code>RemoteEvents</code> to trigger the server-side script.\nThe animation for the fireball is nested in the local script, and the <code>RemoteEvents</code> and fireball model are in <code>Replicated Storage</code>.</p>\n<p>I've tried reaching out to other people who have made other functions to the code that work but the animation still doesn't work which is kind of the main thing. Most things I've managed to fiddle around with is getting the animation to run within Roblox Studio itself.</p>\n<p>I'm not too advanced with <code>Lua</code> as I've been teaching myself here and there and wanted to make a game for myself to have on my portfolio of things I've created. Any help with explaining where I may be going wrong would be much appreciated.</p>\n"^^ . . . "Lua: Missing argument in inventoryEvent.OnServerEvent"^^ . . . . "Why are you testing `if items[slot] then`? You already know that `items[slot]` is not `nil` since `slot` was handed to you as a key. Perhaps more importantly, why are you iterating over `items` twice in a nested loop?"^^ . "0"^^ . . . "Detect text block between two tags"^^ . . "pypandoc"^^ . . . . . "Yes thankyou that worked. Looking at it now its kind of obvious that the `self.` was redundant."^^ . "@NiTerleski Writing an encoder of frame data is gonna be tricky but writing a muxer / demuxer is do-able. It's a skill worth having (_eg:_ ability to trim MP4 by duration, extract or replace the audio track, replace specific video frames, etc)... You need to **share a test output file** that you made (for our checking if the bytes structure is correct) to get faster advice."^^ . "@tkausl: thanks, but it still throws: [sol2] An error occurred and panic has been invoked: stack index 1, expected table, received no value: value is not a table or a userdata that can behave like one (type check failed in constructor)"^^ . . "0"^^ . . . . "0"^^ . . "0"^^ . . . "0"^^ . . "0"^^ . . "2"^^ . "0"^^ . . . . "0"^^ . . "The question is pretty clear: OP wrote `CheckType` to behave as the built-in `type` function. Currently `CheckType(Enum)` returns `"string"`, but it should return `"userdata"`, the same as `type(Enum)`. What is _not_ clear is whether OP is running under Lua, and what version, or under Luau."^^ . "0"^^ . . . "pandoc"^^ . . . . "0"^^ . . . . "<p>I also couldn't get this to work with Splash.</p>\n<p>However, there is an API behind the site and you can just extract the data directly from that.</p>\n<p>This will grab the first page of 15 results.</p>\n<pre><code>import requests\n\nheaders = {\n 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0',\n 'Accept': '*/*',\n 'Accept-Language': 'en-US,en;q=0.5',\n}\n\nparams = {\n 'uiLang': 'zh',\n 'uiCity': 'hongkong',\n 'districtId': '2008',\n 'regionId': '0',\n 'startAt': '0',\n 'rows': '15',\n 'pageToken': 'CONST_DUMMY_TOKEN',\n}\n\nresponse = requests.get('https://www.openrice.com/api/v2/search', params=params, headers=headers)\n\ndata = response.json()\n\nfor result in data[&quot;paginationResult&quot;][&quot;results&quot;]:\n print(result[&quot;name&quot;])\n</code></pre>\n<p>Here's what the data look like:</p>\n<pre><code>Gram cafe &amp; pancakes\nLady Nara\nMamaday\nOutdark (H8)\nNara Thai Cuisine (港威商場)\n十和田總本店\nJUST'er Bar &amp; Restaurant\nAmitie Kitchen\nThe Grill Room (The Humphreys)\nCafé Crêpe (K11購物藝術館)\n牛魔\nhoo韓國包車\n古今二 (The ONE)\n小魚兒 (金馬大廈)\n鬼金棒\n</code></pre>\n<p>The JSON returned by the API has got a lot more data than just the name. You can dump the response to a text file and dig around in the JSON to find what you are looking for.</p>\n<p>To implement pagination via the API you'd just need to loop over the requests, incrementing the value in the <code>'startAt'</code> parameter by 15 each time. Stop when there are no new results.</p>\n"^^ . . . . "1"^^ . "0"^^ . . . . "Rephrased to avoid making an impression that the question is about genuinely parallel programming/"^^ . . . . . "lnk2019"^^ . "<p>This seems to be a relatively new feature given the age of this post.</p>\n<p>I stumbled across this while messing around in Roblox Studio. It seems that docstring capability has been added to studio, but not much has been reported on it yet.</p>\n<p>This implementation of docstrings also seems to not follow the javadoc standard of @param / @return or the sphinx standard of :param / :return as markup does not seem to be implemented.</p>\n<p>As with most things Roblox, I'd recommend utilizing the docstrings on Roblox methods - as OP mentions in his post - as example of what to do until community standards take precedent.</p>\n<p><a href="https://i.sstatic.net/kZ8dKWKb.png" rel="nofollow noreferrer">Screenshot of docstrings in Roblox Studio.</a></p>\n"^^ . "0"^^ . . "<p>just following theprimeagen neovim setup tutorial, try to map Ex to pv not working.</p>\n<pre class="lang-lua prettyprint-override"><code>print(&quot;Setting leader key&quot;)\nvim.g.mapleader = &quot; &quot;\nprint(&quot;Setting key mapping&quot;)\nvim.keymap.set('n', '&lt;leader&gt;pv', vim.cmd.Ex)\nprint(&quot;Configuration loaded&quot;)\n</code></pre>\n<pre><code>\nSetting leader key\nSetting key mapping\nConfiguration loaded\nPress ENTER or type command to continue\n</code></pre>\n<p>the debug info seems to be working</p>\n<p>and also in :map</p>\n<pre><code>n &lt;Space&gt;pv * &lt;Lua 29: vim/_editor.lua:0&gt; \n</code></pre>\n<p>but when i try : pv</p>\n<pre><code>E492:Not an editor command: pv\n\n</code></pre>\n"^^ . "0"^^ . . . . "1"^^ . . . "0"^^ . . . "0"^^ . . "4"^^ . . . . . . "<p>There is a task to get a large enough amount of data for certain purposes. Usually it's 2-4 million records, which I retrieve from various SQL tables.</p>\n<p>I'm not happy with the time taken to retrieve the data, so I want to use an in-memory database but leave the ability to run SQL queries, which I've tried using tarantool for.<br />\nSince the database needs to be integrated with a python project, I'm using the python connector <a href="https://github.com/tarantool/tarantool-python" rel="nofollow noreferrer">https://github.com/tarantool/tarantool-python</a>.</p>\n<p>Loading and unloading large amounts of data is not a standard use of tarantool, but I thought that due to the very high speed of inserting and retrieving individual records there would be no performance issues. However, even retrieving 500,000 tuples from 1 space already has performance issues and there is no big gain in retrieval speed compared to postgres.</p>\n<p>Instance is configured in the most basic way on a local machine, memtx_memory = 2048 Mb</p>\n<p>To solve these problems, I tried offloading the data in batches.\nTo offload data in batches, I created a test time space into which I moved certain data from the space where I had made previous measurements:</p>\n<pre class="lang-py prettyprint-override"><code>import tarantool\n\n\ntarantool_config = {\n 'host': '127.0.0.1',\n 'port': 3301,\n 'user': 'user',\n 'password': 'password',\n}\n\n\ndef create_and_fill_temp_space():\n conn = tarantool.connect(**tarantool_config)\n\n create_temp_space = &quot;box.schema.space.create('temp_space', {temporary = true})&quot;\n conn.eval(create_temp_space)\n\n configure_temp_space = f&quot;&quot;&quot;\n box.space.temp_space:format({{\n {{name = 'id', type = 'unsigned'}},\n {{name = 'data', type = 'any'}}\n }})\n box.space.temp_space:create_index('primary', {{\n type = 'tree',\n parts = {'id'},\n if_not_exists = true\n }})\n &quot;&quot;&quot;\n conn.eval(configure_temp_space)\n\n lua_query = f&quot;&quot;&quot;\n local fiber = require('fiber')\n\n for i, row in ipairs(box.space.test_space.index.someid_idx:select{{{id}}}) do\n box.space.temp_space:insert{{i, row}}\n if i % 100 == 0 then\n fiber.yield()\n end\n end\n &quot;&quot;&quot;\n conn.eval(lua_query)\n\n conn.close()\n</code></pre>\n<p>Then I unload data from the temporary space by registering a function in tarantool.</p>\n<pre><code>box.schema.func.create('fetch_all_records', {\n body = [[\n function(page_size)\n local result = {}\n local start_key = nil\n\n while true do\n local page = {}\n\n if start_key == nil then\n for _, tuple in box.space.temp_space.index.primary:pairs(nil, {iterator = 'GE'}) do\n table.insert(page, tuple)\n if #page &gt;= page_size then\n break\n end\n end\n else\n for _, tuple in box.space.temp_space.index.primary:pairs(start_key, {iterator = 'GT'}) do\n table.insert(page, tuple)\n if #page &gt;= page_size then\n break\n end\n end\n end\n\n if #page == 0 then\n break\n end\n\n for _, tuple in ipairs(page) do\n table.insert(result, tuple)\n end\n\n start_key = page[#page][1]\n end\n\n return result\n end\n ]],\n if_not_exists = true\n})\n</code></pre>\n<p>And using it later.</p>\n<pre class="lang-py prettyprint-override"><code>@measuring_time\ndef fetch_data_from_temp_space(space_name):\n conn = tarantool.connect(**tarantool_config)\n\n page_size = 1000\n result = conn.call('fetch_all_records', page_size)\n \n conn.close()\n</code></pre>\n<p>The retrieval time remains the same as if I had run a normal query to retrieve all the data from the space. What could be the error? Maybe I need to get some in batches in a different way?</p>\n"^^ . "0"^^ . . "javascript"^^ . . . "2"^^ . "5"^^ . . . "0"^^ . . "1"^^ . . . . "1"^^ . "quarto"^^ . "neovim + lua + slimv: how to start swank server in the current folder/project?"^^ . "Hi, I have 2 points confuse:\n- Do socket.gettime() and posix.clock_gettime can measure timestamp in another process. My flow code is: a record will be log in C function and then it will be sync to an application which written by lua. I wanna calculate time sync from the beginning in C function to the end in application.\n- My system report `module 'posix' not found` when I import the module. I can't update luajit version. How to bypass it"^^ . . "Inline conversion of headers from RTF to HTML with Pandoc"^^ . . "InvokeNative: execution failed: Argument at index 1 was null"^^ . "3"^^ . "@AndrewYim I tried doing that but the two separate scripts don't run simultaneously"^^ . "function"^^ . "1"^^ . . . . . . . . . "Well I have no idea what this code is supposed to do. I just see a confusing pile of nested numeric for loops, meaningless or even misleading names, way to many levels of indentation, zero comments (which would be required you're code doesn't speak for itself which it clearly doesn't)\n\nI think you're pretty entangled in your logic. Get out pen and paper, draw a flow chart. pick meaningful names. like what is 64 in your loop? give it a name. learn how to use the break statement so you don't have to implement its functionality using goto. use local variables,"^^ . . "These all seem to work for me. Is your output window enabled in "View"? Are you running this code in a LocalScript? Is that LocalScript in StarterPlayer.StarterPlayerScripts?"^^ . . . . . . . "<p>Figured it out. Short answer, I just commented out the function that asks to input directions of the chests and just edited the variables myself for each different turtle. I guess the MaterialLocation variables were not getting set correctly for some reason so it was just using the default I set when I declared the variable. But this also makes it so I don't have to manually start the program again if the turtle gets unloaded, so honestly it's an improvement.</p>\n<p>That and fixing a number of typos that were definitely made in my half asleep stupor/forgetting to change them when copying the same lines of code 9 times.</p>\n"^^ . . "1"^^ . "<p>As in neovim key command:</p>\n<pre><code>r\n</code></pre>\n<p>is to get into insert mode await a key being hit then automatically go back to normal</p>\n<p>Then does neovim have possible way to append it a key sequence, e.g. <code>l</code> that is can automatically go to right<br />\nIt'd be preferred being a Lua keybinding</p>\n<p>Please help</p>\n"^^ . . "1"^^ . . . "0"^^ . "0"^^ . . "0"^^ . . "Cloning classes with obj.__index = self in lua. Why do we need the other one?"^^ . "horizontal-line"^^ . . . . . . "1"^^ . "0"^^ . . "1"^^ . . . "<p>For some reason, my local variables in the module script all seem to be nil, with no exact explanation for it, or solution.\nLocal Script (Stamina bar Script):</p>\n<pre><code>local ms = require(game.ReplicatedStorage.ModuleScript)\nif not ms then\n \n local ms = require(game.ReplicatedStorage:WaitForChild(&quot;ModuleScript&quot;))\n \nend\n\nlocal TW = game:GetService(&quot;TweenService&quot;)--Get Tween Service\n\nlocal Staminabar = script.Parent -- Get The Stamina bar\n\nlocal function UpdateStaminabar() --Stamina Bar Size Change Function\n local stamina = math.clamp(ms.stamina / ms.maxstamina, 0, 1) --Maths\n local info = TweenInfo.new(ms.stamina / ms.maxstamina,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0) --Tween Info\n TW:Create(script.Parent,info,{Size = UDim2.fromScale(ms.stamina, 1)}):Play() -- Create The Tween Then Play It\nend\n\nUpdateStaminabar()--Update The Health Bar\n\nms.stamina:GetPropertyChangedSignal(&quot;Value&quot;):Connect(UpdateStaminabar) --Update The Health Bar When The Health Change\nms.maxstamina:GetPropertyChangedSignal(&quot;Value&quot;):Connect(UpdateStaminabar) --Update The Health Bar Wheb The MaxHealth Change\n</code></pre>\n<p>LocalScript (Combat Script):</p>\n<pre><code>local ms = require(game.ReplicatedStorage.ModuleScript)\nif not ms then\n \n local ms = require(game.ReplicatedStorage:WaitForChild(&quot;ModuleScript&quot;))\n \nend \nlocal uis = game:GetService(&quot;UserInputService&quot;)\nlocal cas = game:GetService(&quot;ContextActionService&quot;)\nlocal rs = game:GetService(&quot;ReplicatedStorage&quot;)\n\nlocal events = rs:WaitForChild(&quot;Events&quot;)\nlocal hitbox = events:WaitForChild(&quot;Hitbox&quot;)\n\nlocal plr = game.Players.LocalPlayer\nlocal character = plr.Character\nif not character then\n \n plr:WaitForChild(&quot;Character&quot;)\n \nend\nlocal humanoid = character.Humanoid\nlocal animator = humanoid:WaitForChild(&quot;Animator&quot;)\n\nlocal idle = animator:LoadAnimation(script:WaitForChild(&quot;idle&quot;))\nlocal jab = animator:LoadAnimation(script:WaitForChild(&quot;jab&quot;))\nlocal rightcross = animator:LoadAnimation(script:WaitForChild(&quot;rightstraight&quot;))\nlocal lefthook = animator:LoadAnimation(script:WaitForChild(&quot;lefthook&quot;))\nlocal righthook = animator:LoadAnimation(script:WaitForChild(&quot;righthook&quot;))\nlocal swingsfx = script:WaitForChild(&quot;Air swing&quot;)\n\nlocal currentPunch = 0\nlocal currentPunch2 = 0\nlocal debounce1 = false\nlocal debounce2 = false\n\nlocal function onInputBegan(input)\n \n if debounce2 == true then return end\n if ms.stamina &lt;= 0 then return end\n \n \n if input.KeyCode == Enum.KeyCode.Q then\n \n ms.stamina -= 20\n debounce2 = true\n humanoid.WalkSpeed = 0.5\n lefthook:Play()\n swingsfx:Play()\n hitbox:FireServer(Vector3.new(4, 5, 3), Vector3.new(4.5, 1), 7.5, 0.15)\n task.wait(0.5)\n humanoid.WalkSpeed = 10\n lefthook:Stop()\n task.wait(6)\n debounce2 = false\n \n end \n \n if input.KeyCode == Enum.KeyCode.E then\n\n ms.stamina -= 20\n debounce2 = true\n humanoid.WalkSpeed = 0.5\n righthook:Play()\n swingsfx:Play()\n hitbox:FireServer(Vector3.new(4, 5, 3), Vector3.new(4.5, 1), 7.5, 0.15)\n task.wait(0.5)\n humanoid.WalkSpeed = 10\n righthook:Stop()\n task.wait(6)\n debounce2 = false\n\n end \nend\n\nlocal function punch()\n \n if debounce1 then return end\n \n debounce1 = true\n if currentPunch == 0 then\n \n ms.stamina -= 10\n humanoid.WalkSpeed = 0.6\n jab:Play()\n swingsfx:Play()\n hitbox:FireServer(Vector3.new(4, 5, 3), Vector3.new(5.7, 1), 2.5, 0.15)\n task.wait(0.5)\n humanoid.WalkSpeed = 10\n jab:Stop()\n debounce1 = false\n \n elseif currentPunch == 1 then\n \n ms.stamina -= 10\n humanoid.WalkSpeed = 0.6\n rightcross:Play()\n swingsfx:Play()\n hitbox:FireServer(Vector3.new(4, 5, 3), Vector3.new(5.7, 1), 2.5, 0.15)\n task.wait(0.5)\n humanoid.WalkSpeed = 10\n rightcross:Stop()\n debounce1 = false\n \n elseif currentPunch == 2 then\n \n ms.stamina -= 10\n humanoid.WalkSpeed = 0.6\n jab:Play()\n swingsfx:Play()\n hitbox:FireServer(Vector3.new(4, 5, 3), Vector3.new(5.7, 1), 2.5, 0.15)\n task.wait(0.5)\n humanoid.WalkSpeed = 10\n jab:Stop()\n debounce1 = false\n \n elseif currentPunch == 3 then\n \n ms.stamina -= 10\n debounce2 = true\n humanoid.WalkSpeed = 0.6\n rightcross:Play()\n swingsfx:Play()\n hitbox:FireServer(Vector3.new(4, 5, 3), Vector3.new(5.7, 1), 5, 0.15)\n task.wait(0.5)\n humanoid.WalkSpeed = 10\n rightcross:Stop()\n debounce1 = false\n debounce2 = false\n \n end\n\n if currentPunch == 3 then\n \n currentPunch = 0\n debounce1 = true\n wait(2)\n debounce1 = false\n \n else\n \n currentPunch += 1\n \n end\n \nend\n\ncas:BindAction(&quot;Punch&quot;, punch, true, Enum.UserInputType.MouseButton1)\nuis.InputBegan:Connect(onInputBegan)\n</code></pre>\n<p>ModuleScript:</p>\n<pre><code>local info = {}\n\n local stamina = 100\n local maxstamina = 100\n \nreturn info\n</code></pre>\n<p>I was trying to make a stamina system, together with a stamina bar, but they just refuse to use the locals, and instead print out errors like:</p>\n<blockquote>\n<p>15:00:30.915 Players.Morelval1.PlayerGui.ScreenGui.StaminaBar.Frame.StaminaBar Script:12: attempt to perform arithmetic (div) on nil - Client - StaminaBar Script:12\n15:00:32.505 Players.Morelval1.PlayerGui.Main.PunchScript:39: attempt to compare nil &lt;= number - Client - PunchScript:39</p>\n</blockquote>\n<p>I was expecting for the variables to be interacted with, and be used.</p>\n"^^ . . "0"^^ . . . "0"^^ . . "Also to run Love2D, you can just open command prompt and run `love .` (assuming you are in folder with `main.lua`), or drop *folder* containing `main.lua` onto love.exe"^^ . "user-input"^^ . "timestamp"^^ . . . "0"^^ . "What is vim.loop.fs_stat()?"^^ . "It looks like Lua LSP doesn't have enabled love2d 3rd party workspace support, try to look at Lua LSP settings or contact extension authors"^^ . "<p>There is another way to detect when a specific player joins, and it is by checking if there is any players (in game.Players) called &quot;MorelvalVoid&quot; or &quot;Morelval1&quot;. Here is an example:</p>\n<pre><code>print(&quot;player join&quot;)\nlocal MorelvalVoid = game.Players:FindFirstChild(&quot;MorelvalVoid&quot;)\nlocal Morelval1 = game.Players:FindFirstChild(&quot;Morelval1&quot;)\n\nwhile task.wait(0,1) do\n if MorelvalVoid or Morelval1 then\n print(&quot;owner&quot;)\n -- Your code here\n else\n task.wait(30)\n print(&quot;not owner&quot;)\n end\nend\n\n</code></pre>\n"^^ . "0"^^ . . . . . . "0"^^ . . . . "<p>I have a measurement signal that is diagnosed and returns a positive numeric value. I need to convert this value to a hexadecimal string using Lua, integrated within an Excel template, and passed to Python. Here is the Lua code I've tried, but it's not working:</p>\n<pre class="lang-lua prettyprint-override"><code>_lua(R&quot;§(&quot;string.format(&quot;%8X&quot;, @measdata:Diag_DTC[1].max($tStep1,$tStep1End))&quot;)§&quot;)\n</code></pre>\n<p>The signal from the array, for example, <code>@measdata:Diag_DTC[1].max($tStep1,$tStep1End)</code> which equals 10555136, should be converted to <code>A10F00</code>.</p>\n<p>Does anyone have any suggestions on how to fix this? Thank you in advance.</p>\n"^^ . . . . . "0"^^ . "1"^^ . . . . "Lua strings *behave* as if copied, but I suspect they aren't actually deep copied. Maybe I'll look into the C implementation."^^ . . . "perhaps you are using `RequiresLineOfSight` prop., which is True by default"^^ . "looking for help on changing line attributes of single horizontal lines in wxgrid.lua"^^ . . "our source follow is: a record will be log in C function and then it will be sync to an application which written by lua. I wanna calculate time sync from the beginning in C function to the end in application"^^ . "<p>In your Lua filter <code>filter.lua</code> use somehting like the following:</p>\n<pre class="lang-lua prettyprint-override"><code>local links = {}\n\nLink = function(link)\n table.insert(links, pandoc.Plain(link))\nend\n\nPandoc = function(elem)\n return elem:walk{\n Block = function(s)\n if pandoc.utils.stringify(s) == &quot;YOURSOURCES&quot; then\n return {pandoc.BulletList(links)}\n end\n end\n }\nend\n</code></pre>\n<p>with this markdown document <code>input.md</code></p>\n<pre class="lang-markdown prettyprint-override"><code>([Link 1](http://www.somedomain.org))\n\n([Link 2](http://www.anotherdomain.org))\n\n[YOURSOURCES]{custom-style=&quot;Sources&quot;}\n</code></pre>\n<p>and the following <code>pandoc</code> commmand</p>\n<pre class="lang-bash prettyprint-override"><code>pandoc input.md -f markdown -t markdown --lua-filter filter.lua\n</code></pre>\n<p>You get this output:</p>\n<pre class="lang-markdown prettyprint-override"><code>([Link 1](http://www.somedomain.org))\n\n([Link 2](http://www.anotherdomain.org))\n\n- [Link 1](http://www.somedomain.org)\n- [Link 2](http://www.anotherdomain.org)\n</code></pre>\n"^^ . . "1"^^ . "2"^^ . . "<p>I`m writing a gmod lua script which checks if there are constraints for prop spawned by user (like ropes), but it always return false even if I spawn constrained props</p>\n<pre><code>if SERVER then\n hook.Add(&quot;PlayerSpawnedProp&quot;, &quot;PrintConstraintsCount&quot;, function(player, entity)\n print(constraint.HasConstraints(entity))\n end)\nend\n</code></pre>\n"^^ . . . "0"^^ . . "0"^^ . . . . . . . "love2d"^^ . . . . "0"^^ . . "0"^^ . "1"^^ . . . . . . . . "2"^^ . "0"^^ . . "Is there a way to use <const> inside a Lua table?"^^ . . . "<blockquote>\n<p><em>&quot;I'm looking for guidance on how to:&quot;</em><br></p>\n<ul>\n<li>Create video frames in Lua</li>\n<li>Read frames from an existing MP4 file.</li>\n</ul>\n</blockquote>\n<p>Decide which one and focus each of your StackOverflow questions on that topic. You can create frames with RGB data converted to YUV. It won't be compressed but it's okay for practice. Reading frames is just Array operation (find elements, extract range of array elements, etc).</p>\n<p>Get a <strong>hex editor</strong> to see the file structure of a working file versus your file.</p>\n<p>Later when asking, you need to be specific about how or where you're stuck.</p>\n<blockquote>\n<p><em>&quot;I've written some Lua code to create an MP4 file with frames, but it doesn't seem to be working as expected...&quot;</em></p>\n</blockquote>\n<p>You must fix the following to be able to get a picture from a media player loading your file...</p>\n<ul>\n<li>You don't have an <code>STSS</code> box (for listing keyframes).</li>\n</ul>\n<p>The first frame must be of type: <strong>IDR keyframe</strong>. It's not clear if your frame data is raw YUV, or H.264, or H.265, or AV1 or VP9, etc. Find out what you have and identify the first given/found keyframe, those bytes is what you will mux as the first frame in your MP4 file.</p>\n<ul>\n<li>About fixing <code>function create_stsz_box()</code>:</li>\n</ul>\n<p>Also try to add at least <strong>2 frames</strong> (for a start &amp; end frame). It can be same frame data copied twice.</p>\n<pre><code>local function create_stsz_box()\n local version = &quot;\\0&quot; -- version 0\n local flags = &quot;\\0\\0\\0&quot;\n local sample_size = &quot;\\0\\0\\0\\0&quot; -- non-uniform sample sizes\n local sample_count = &quot;\\x00\\x00\\x00\\x02&quot; -- total entries of sizes\n local sample_sizes_1 = &quot;\\0\\0\\0\\1&quot; -- use real size (bytes length) of frame 1\n local sample_sizes_2 = &quot;\\0\\0\\0\\1&quot; -- use real size (bytes length) of frame 2\n return version .. flags .. sample_size .. sample_count .. sample_sizes_1 .. sample_sizes_2\nend\n</code></pre>\n<p>But now you must update <code>STTS</code> to have two time display entries. <br>(called PTS and is related to the <code>MDHD</code> <strong>timescale</strong> entry).</p>\n<pre><code>local function create_stts_box()\n local version = &quot;\\0&quot; -- version 0\n local flags = &quot;\\0\\0\\0&quot;\n local entry_count = &quot;\\0\\0\\0\\1&quot;\n local sample_count = &quot;\\0\\0\\0\\2&quot; -- use total frames as the sample count\n local sample_delta = &quot;\\0\\0\\03\\xe8&quot; -- one entry because we want Constant FPS mode for all frames\n return version .. flags .. entry_count .. sample_count .. sample_delta\nend\n</code></pre>\n<p>Also fix the <strong>Duration</strong> numbers in <code>TKHD</code> and <code>MVHD</code> and finally in <code>MDHD</code>.</p>\n<p>Good luck &amp; share a file (link) for some checking, if still stuck.</p>\n"^^ . . "openstreetmap"^^ . "Does executing a Lua script in Redis block the entire Redis server or just the database being accessed?"^^ . . "1"^^ . . . . "You should expand your print test, to show other values, make sure what you are seeing the false printing for is the rope you expect it to be checking. add things specifically from the `entity` that you pass in to `HasConstraints`"^^ . . "0"^^ . . . "0"^^ . . . . . "0"^^ . . . "0"^^ . . . . "0"^^ . . "1"^^ . "0"^^ . . "<p>According to the paths in your error, you're using neovim 0.9.1, but <code>vim.fs.root</code> is new to neovim 0.10.0 (specifically, commit <a href="https://github.com/neovim/neovim/commit/38b9c322c97b63f53caef7a651211fc9312d055e" rel="nofollow noreferrer">38b9c322c97b (&quot;feat(fs): add vim.fs.root (#28477)&quot;)</a>).</p>\n"^^ . "fzf"^^ . "0"^^ . . . . "0"^^ . . . . . "Recently I performed several experiments with 89K rows, 5MB responses from one tarantool storage to many clients. I see that the TX thread consumes 100% CPU on encoding Lua tables to msgpack (better if it is a table of box tuples, but still suboptimal). A practical solution would be acquire the data directly without Lua, using IPROTO_SELECT request (<connection>.select() in tarantool-python), using SQL, using a C procedure (box_index_iterator() + box_iterator_next() + box_return_tuple()) or using some prepared msgpack.object() object. Also I suggest to glance on asynctnt connector for python."^^ . "3"^^ . "0"^^ . . . "Ok! I'll try doing that, if it doesn't work i post another question about the linkage with libmp4, or add an answer in this question?"^^ . . "2"^^ . . "6"^^ . "[Please do not upload images of code/data/errors.](//meta.stackoverflow.com/q/285551)"^^ . "1"^^ . . . "0"^^ . . "1"^^ . "0"^^ . "mpv"^^ . . . . . . "1"^^ . "Also why do you want a `newproxy`? it is no longer needed to do a deconstructor when the table gets GC'ed, or were you using it for something else? You may want to split that question off into it's own post."^^ . . . "1"^^ . "1"^^ . . "Controlling MPV via http requests, like VLC, or an alternative"^^ . . . . . "0"^^ . . . . "@AndrewYim It seems that because the error is thrown in compilation it won't even allow reaching the pcall portion. I tested it and the result was no different, still failing when it compiled an "unknown" operator."^^ . "Strange issue with hammerspoon window movement"^^ . "<p>I used these snippets:</p>\n<p>In <code>cmp.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;hrsh7th/nvim-cmp&quot;,\n opts = function(_, opts)\n local cmp = require(&quot;cmp&quot;)\n opts.mapping[&quot;&lt;Tab&gt;&quot;] = nil\n end\n}\n</code></pre>\n<p>In <code>astrocore.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;AstroNvim/astrocore&quot;,\n options = {...},\n mappings = {\n i = {\n [&quot;&lt;CR&gt;&quot;] = &quot;copilot#Accept('\\\\&lt;CR&gt;')&quot;\n }\n }\n}\n</code></pre>\n"^^ . . . "1"^^ . . "0"^^ . "4"^^ . . "1"^^ . "0"^^ . "How do I make a hitbox part move with the character"^^ . "1"^^ . . "2"^^ . . . . "Having trouble showing a ScreenGUI by clicking a Part in the workspace"^^ . "2"^^ . . . . . . . . "please show how the second snippet is executed in your code"^^ . "You could still use a similar approach to the above, for each line split on the $$ and keep track of how many elements in the array. Have a global counter somewhere, if a line has more than 1 parts iterate over it and increment the global counter by one for each part the current line array has"^^ . . . . "0"^^ . . . . . . "Thank you so much! It worked. Didnt know there wasnt any order in dictionaries"^^ . . "<p>Hi I have nominatim installed on a ubuntu VM which I use for reverse geo-lookup. All is going well, but nominatim doesn't return the correct object when I do a reverse lookup for a highway entrance (motorway_link). For this import I have used <a href="https://download.geofabrik.de/europe/netherlands/flevoland-latest.osm.obf" rel="nofollow noreferrer">https://download.geofabrik.de/europe/netherlands/flevoland-latest.osm.obf</a> which is the smallest province of the netherlands. The import takes 30 minutes.</p>\n<p><strong>call:</strong></p>\n<pre><code>[secret_url]/nominatim/reverse?format=geojson&amp;lat=52.3976067014153&amp;lon=5.348081447780394&amp;adressdetails=1&amp;zoom=17&amp;namedetails=1\n</code></pre>\n<p><strong>expected result</strong></p>\n<pre><code>{\n &quot;type&quot;: &quot;FeatureCollection&quot;,\n &quot;licence&quot;: &quot;Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright&quot;,\n &quot;features&quot;: [\n {\n &quot;type&quot;: &quot;Feature&quot;,\n &quot;properties&quot;: {\n &quot;place_id&quot;: 10189945,\n &quot;osm_type&quot;: &quot;way&quot;,\n &quot;osm_id&quot;: 6972708,\n &quot;place_rank&quot;: 26,\n &quot;category&quot;: &quot;highway&quot;,\n &quot;type&quot;: &quot;motorway_link&quot;,\n &quot;importance&quot;: 0.09999999999999998,\n &quot;addresstype&quot;: &quot;road&quot;,\n &quot;name&quot;: &quot;A6&quot;,\n &quot;display_name&quot;: &quot;A6, Almere, Flevoland, Nederland, 1336 ZG, Nederland&quot;,\n &quot;address&quot;: {\n &quot;road&quot;: &quot;A6&quot;,\n &quot;city&quot;: &quot;Almere&quot;,\n &quot;state&quot;: &quot;Flevoland&quot;,\n &quot;ISO3166-2-lvl4&quot;: &quot;NL-FL&quot;,\n &quot;country&quot;: &quot;Nederland&quot;,\n &quot;postcode&quot;: &quot;1336 ZG&quot;,\n &quot;country_code&quot;: &quot;nl&quot;\n },\n &quot;namedetails&quot;: {\n &quot;ref&quot;: &quot;A6&quot;\n }\n },\n &quot;bbox&quot;: [\n 5.3463977,\n 52.3966557,\n 5.3518242,\n 52.4009178\n ],\n &quot;geometry&quot;: {\n &quot;type&quot;: &quot;Point&quot;,\n &quot;coordinates&quot;: [\n 5.348065750718098,\n 52.397617756544484\n ]\n }\n }\n ]\n}\n</code></pre>\n<p><strong>actual result</strong></p>\n<pre><code>{\n &quot;type&quot;: &quot;FeatureCollection&quot;,\n &quot;licence&quot;: &quot;Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright&quot;,\n &quot;features&quot;: [\n {\n &quot;type&quot;: &quot;Feature&quot;,\n &quot;properties&quot;: {\n &quot;place_id&quot;: 338896,\n &quot;osm_type&quot;: &quot;way&quot;,\n &quot;osm_id&quot;: 261859776,\n &quot;place_rank&quot;: 26,\n &quot;category&quot;: &quot;highway&quot;,\n &quot;type&quot;: &quot;motorway&quot;,\n &quot;importance&quot;: 0.0533433333333333,\n &quot;addresstype&quot;: &quot;road&quot;,\n &quot;name&quot;: &quot;A6&quot;,\n &quot;display_name&quot;: &quot;A6, Almere, Flevoland, 1336 ZG, Nederland&quot;,\n &quot;address&quot;: {\n &quot;road&quot;: &quot;A6&quot;,\n &quot;city&quot;: &quot;Almere&quot;,\n &quot;state&quot;: &quot;Flevoland&quot;,\n &quot;ISO3166-2-lvl4&quot;: &quot;NL-FL&quot;,\n &quot;postcode&quot;: &quot;1336 ZG&quot;,\n &quot;country&quot;: &quot;Nederland&quot;,\n &quot;country_code&quot;: &quot;nl&quot;\n },\n &quot;namedetails&quot;: {\n &quot;ref&quot;: &quot;A6&quot;,\n &quot;official_name&quot;: &quot;A6&quot;\n }\n },\n &quot;bbox&quot;: [\n 5.3447124,\n 52.3981918,\n 5.3504999,\n 52.4004294\n ],\n &quot;geometry&quot;: {\n &quot;type&quot;: &quot;Point&quot;,\n &quot;coordinates&quot;: [\n 5.347445791083126,\n 52.39924864036557\n ]\n }\n }\n ]\n}\n</code></pre>\n<p><a href="https://i.sstatic.net/wipbeaQY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wipbeaQY.png" alt="enter image description here" /></a></p>\n<p>I have faced this issue in an earlier version of Nominatim (4.3.0). The solution there was to simply edit <code>extratags-import.style</code> file, go to the highway section and replace <code>&quot;motorway_link&quot; : &quot;main,with_name&quot;,</code> with <code>&quot;motorway_link&quot; : &quot;main&quot;,</code></p>\n<p>With nominatim 4.4.0 these <code>import*.style</code> files have changed to lua files. So I attempt the following:</p>\n<pre><code>flex.set_main_tags{\n building = 'fallback',\n emergency = 'always',\n healthcare = 'fallback',\n historic = 'always',\n military = 'always',\n natural = 'named',\n highway = {'always',\n street_lamp = 'named',\n traffic_signals = 'named',\n service = 'named',\n cycleway = 'named',\n path = 'named',\n footway = 'named',\n steps = 'named',\n bridleway = 'named',\n track = 'named'\n motorway_link = 'always',\n trunk_link = 'always',\n primary_link = 'always',\n secondary_link = 'always',\n tertiary_link = 'always'\n },\n</code></pre>\n<p>Yet still I don't get the desired result. Is there anyone that can help me?</p>\n"^^ . . . "0"^^ . . "<p>Well, it wasn't so hard. I opened &quot;util.lua&quot;, and the problem was clear: The &quot;TMP&quot; environment variable was not defined anymore. I can't count anymore, how many times I defined this. I <em>hate</em> Windows sometimes ...</p>\n"^^ . . . "0"^^ . . . "0"^^ . . . . . "0"^^ . . . . . . "0"^^ . . "libvlc"^^ . "So how can I measure time to log 1 record in milisecons in lua? os.clock() is just return CPU times of the process. Do u have any suggestions?"^^ . "installation"^^ . . . . . "<p>Just capture anything that is before and after <code>\\\\scalebox</code>.</p>\n<pre><code>local pattern = &quot;(.*)\\\\scalebox(.*)&quot;\n\nlocal text = &quot;text before\\\\scaleboxtext after&quot;\n\nlocal before, after = text:match(pattern)\n\nprint(before)\nprint(after)\n</code></pre>\n<p>Please refer to the Lua manual. Square brackets define a character set. The pattern <code>[xy]</code> means any of ( x or y ). While <code>^</code> negates the set. So <code>[^xy]</code> means none of ( no x and no y ).</p>\n<p>If you want to match a specific word you need to use the actual word.</p>\n"^^ . "<p>Since Lua 5.4, the <code>&lt;const&gt;</code> syntax lets us set const variables. I noticed that this doesn't transitively affect fields inside a table.</p>\n<pre><code>local x &lt;const&gt; = {\n a = {1,2,3},\n b = {5,6,7}\n}\n\nx = 5 -- error\nx.a = 9 -- no error\n\n</code></pre>\n<p>The table <code>x</code> is const and cannot be reassigned, but fields inside the table can.</p>\n<p>Is there any way to make the fields inside a table also const via syntax alone? I know that it's possible <a href="https://www.lua.org/pil/13.4.5.html" rel="nofollow noreferrer">via the index and newindex metamethods</a>, but I'm curious if it's possible with simple syntax like <code>&lt;const&gt;</code>.</p>\n<p>I tried the following, but it produces a syntax error:</p>\n<pre><code>\nlocal x &lt;const&gt; = {\n a &lt;const&gt; = {1,2,3},\n b &lt;const&gt; = {5,6,7}\n}\n</code></pre>\n"^^ . "`'machineData={serial=1,name="mob2",}'` is just invalid lua, what did you expect?"^^ . "game-engine"^^ . . . . . . . "computercraft"^^ . . . "1"^^ . "<p>On a 13 inch macbook pro what I ended up doing is simply hard coding the initial rows/cols</p>\n<pre class="lang-lua prettyprint-override"><code>config.initial_rows = 100\nconfig.initial_cols = 205\nconfig.window_decorations = &quot;NONE&quot;\n</code></pre>\n<p>This got me the perfect result.</p>\n"^^ . . . . . . . "<p>For some reason, my pretty short script just refuses to print out or do anything after declaring variables, does anyone have an answer? I think it may actually be the wait for child and wait() but I don't know, because I just started Lua.\nCode:</p>\n<pre><code>local player = game.Players.LocalPlayer\nlocal character = player.CharacterAdded:Wait()\nlocal humanoid = character:WaitForChild(&quot;Humanoid&quot;)\nlocal health = humanoid.Health\nprint(player)\nprint(character)\nprint(humanoid)\n</code></pre>\n<p>and another one, in which it does work but, I can't use the variable or functions declared:</p>\n<pre><code>local player = game.Players.LocalPlayer\nUIS = game:GetService(&quot;UserInputService&quot;)\nUIS.InputBegan:Connect(function(input, typing)\n if typing then return end\n if input.UserInputType == Enum.UserInputType.MouseButton1 then\n print(player, &quot; pressed lmb&quot;)\n end\nend)\nlocal character = player.CharacterAdded:Wait()\nlocal humanoid = character:WaitForChild(&quot;Humanoid&quot;)\nlocal debounce = false\nlocal health = humanoid.Health\n</code></pre>\n<p>I already tried to alter, but it seems that the only variable that I can do print after is player, which is the first one, so I can't get the other ones information.</p>\n"^^ . "0"^^ . . "4"^^ . . . "0"^^ . . "1"^^ . . "<p><code>{self.alpha = SHINYLOWESTALPHA}</code> is invalid syntax</p>\n<p><code>{ someKey = someValue }</code> is syntactic sugar for <code>{ [&quot;someKey&quot;] = someValue}</code> but this is only allowed for valid Lua identifiers which may not contain a dot.</p>\n<p>Lua names may consist of numbers, letters and underscore and may not start with a number.</p>\n<p>So depending on what you want to achieve you either need to use</p>\n<p><code>{ [&quot;self.alpha&quot;] = SHINYLOWESTALPHA }</code> to use &quot;self.alpha&quot; as your key (unlikely) or <code>{ [&quot;alpha&quot;] = SHINYLOWESTALPHA}</code> or <code>{ alpha = SHINYLOWESTALPHA}</code> to use &quot;alpha&quot; as your key</p>\n<p>or if you actually want to use the value self.alpha as the key:</p>\n<pre><code>{ [self.alpha] = SHINYLOWESTALPHA }\n</code></pre>\n"^^ . . . . . "<p>I wasn't understand how it work, I was think it looks like redisgear that it run auto but no.</p>\n<p>lsu file you should run it each time you need to free a memory, and i can't find any thing help me to run evication policy with specific pattern auto.</p>\n<p>and to achive that, you need to run lua file in cron job to help you free memory.</p>\n<p>there is also one thing, if your cron job doens't run before memory reached the maxmemory, the evication policy will run and delete the data with any pattern.</p>\n<p>until now I can't find any way that help me on that.</p>\n<p>Edit: The best approach for that is to use another policy like <strong>volatile-ttl</strong> that will help you in case you need to delete a specific patter\n<strong>Usage</strong> : you will add a ttl for the pattern that you need to be deleted if <strong>Redis</strong> reached the maxmemory, and don't add a ttl for the values that you don't want to be deleted and using volatile-ttl will delete from the data that has a ttl\nyou also can read about it in Redis <a href="https://redis.io/docs/latest/develop/reference/eviction/" rel="nofollow noreferrer">Documentation</a></p>\n"^^ . "linker errors LNK2019 integrating Lua 503 into a C++ game engine using Sol v3.2.1"^^ . . . . . "reading request headers on ngnix from a grpc client"^^ . "thats the solution... Thank you very much man!"^^ . . "Syntactically yeah there is no different to an array vs a dictionary, but internally there is a difference. All integer keys get stored in the array part, any other key is stored in the hash array. (There is a bit more that goes on under the hood, if over 50% of the integer keys are empty it goes into the hash part"^^ . . "<p>Is it possible to make a part that is welded to the Humanoid Root Part move with it?\nIt serves as a hitbox, but I encounter the problem that if I move forward while attacking it hurts the player.\nFor this I have 2 scripts\nLocal Script:</p>\n<pre><code>`local cas = game:GetService(&quot;ContextActionService&quot;)\nlocal rs = game:GetService(&quot;ReplicatedStorage&quot;)\n\nlocal events = rs:WaitForChild(&quot;Events&quot;)\nlocal hitbox = events:WaitForChild(&quot;Hitbox&quot;)\n\nlocal plr = game.Players.LocalPlayer\nlocal character = plr.Character\nif not character then\n \n plr:WaitForChild(&quot;Character&quot;)\n \nend\nlocal humanoid = character.Humanoid\nlocal animator = humanoid:WaitForChild(&quot;Animator&quot;)\n\nlocal idle = animator:LoadAnimation(script:WaitForChild(&quot;idle&quot;))\nlocal jab = animator:LoadAnimation(script:WaitForChild(&quot;jab&quot;))\nlocal rightcross = animator:LoadAnimation(script:WaitForChild(&quot;rightstraight&quot;))\nlocal lefthook = animator:LoadAnimation(script:WaitForChild(&quot;lefthook&quot;))\n\nlocal currentPunch = 0\nlocal debounce = false\n\nlocal function punch()\n \n if debounce then return end\n \n debounce = true\n if currentPunch == 0 then\n \n jab:Play()\n hitbox:FireServer(Vector3.new(3, 5, 2), Vector3.new(4.5, 1), 10, 0.1)\n task.wait(0.5)\n jab:Stop()\n debounce = false\n \n elseif currentPunch == 1 then\n \n jab:Play()\n hitbox:FireServer(Vector3.new(3, 5, 2), Vector3.new(4.5, 1), 10, 0.1)\n task.wait(0.5)\n jab:Stop()\n debounce = false\n \n elseif currentPunch == 2 then\n \n rightcross:Play()\n hitbox:FireServer(Vector3.new(3, 5, 2), Vector3.new(4.65, 1), 10, 0.1)\n task.wait(0.5)\n rightcross:Stop()\n debounce = false\n \n elseif currentPunch == 3 then\n \n lefthook:Play()\n hitbox:FireServer(Vector3.new(3, 5, 2), Vector3.new(4, 1), 10, 0.2)\n task.wait(0.5)\n lefthook:Stop()\n debounce = false\n \n end\n \n if currentPunch == 3 then\n \n currentPunch = 0\n debounce = true\n wait(1.5)\n debounce = false\n \n else\n \n currentPunch += 1\n \n end\n \nend\n\ncas:BindAction(&quot;Punch&quot;, punch, true, Enum.UserInputType.MouseButton1)\n\n</code></pre>\n<p>and the server sided one:</p>\n<pre><code>local rs = game:GetService(&quot;ReplicatedStorage&quot;)\n\nlocal events = rs:WaitForChild(&quot;Events&quot;)\nlocal hitboxEvent = events:WaitForChild(&quot;Hitbox&quot;)\n\nfunction newHitbox(character, size, offset, damage, linger)\n \n local hrp = character:FindFirstChild(&quot;HumanoidRootPart&quot;)\n if hrp == nil then return end\n local weld = Instance.new(&quot;WeldConstraint&quot;)\n local hitbox = Instance.new(&quot;Part&quot;)\n \n weld.Part0 = hrp\n weld.Part1 = hitbox\n \n hitbox.CanCollide = false\n hitbox.CanQuery = false\n hitbox.Massless = true\n hitbox.Anchored = true\n \n hitbox.Size = size\n hitbox.CFrame = hrp.CFrame + hrp.CFrame.LookVector * offset.X + Vector3.new(0, offset.Y)\n hitbox.Parent = character\n \n hitbox.Touched:Connect(function(hit)\n \n if hit.Parent:FindFirstChild(&quot;Humanoid&quot;) == nil then return end\n \n for _, v in pairs(hitbox:GetChildren()) do\n \n if v:IsA(&quot;ObjectValue&quot;) then\n \n if v.Value == hit.Parent then return end\n \n end\n \n end\n \n local hitCounter = Instance.new(&quot;ObjectValue&quot;, hitbox)\n hitCounter.Value = hit.Parent\n \n hit.Parent.Humanoid:TakeDamage(damage)\n \n end)\n \n task.wait(linger)\n hitbox:Destroy()\n \nend\n\nhitboxEvent.OnServerEvent:Connect(function(plr, size, offset, damage, linger)\n \n newHitbox(plr.Character, size, offset, damage, linger)\n \nend)\n</code></pre>\n<p><code>LocalScript</code> is in <code>StarterGUI</code>\nServer Script is in <code>ServerScriptService</code>\nI can make it so that player slows down when clicking but I just wanna know the answer so I can grow as a programmer.</p>\n"^^ . "Thank you! The only problem is that these strings are file lines, so the multiline string you reported must be created by reading some file section line by line."^^ . . . "<p>For some reason whenever I launch my experience, like a second or a half passes and the bar goes from full to empty. I also can't make any interactions with the value. (example: whenever I try to make a if condition that if it's equal or less than 0, then it stops doing the punches. It works, but, when I try to make an if that has the condition of it being less than a hundred, that waits for 0.2 seconds, and adds 2 to the stamina value.) If I made a repeat until it's 100, then it just starts to increment onto it for no particular reason, no matter the condition.\nMaybe someone knows the answer?\nModuleScript:</p>\n<pre><code>local info = {\n \n stamina = Instance.new(&quot;IntValue&quot;),\n maxstamina = Instance.new(&quot;IntValue&quot;),\n \n}\nreturn info\n</code></pre>\n<p>Stamina bar Script:</p>\n<pre><code>local ms = require(game.ReplicatedStorage.ModuleScript)\nif not ms then\n \n ms = require(game.ReplicatedStorage:WaitForChild(&quot;ModuleScript&quot;))\n \nend\n\nlocal TW = game:GetService(&quot;TweenService&quot;)--Get Tween Service\n\nlocal Staminabar = script.Parent -- Get The Stamina bar\nlocal function UpdateStaminabar() --Stamina Bar Size Change Function\n local stamina = math.clamp(ms.stamina.Value / ms.maxstamina.Value, 0, 1) --Maths\n local info = TweenInfo.new(ms.stamina.Value / ms.maxstamina.Value,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0) --Tween Info\n TW:Create(script.Parent,info,{Size = UDim2.fromScale(ms.stamina, 1)}):Play() -- Create The Tween Then Play It\nend\n\nUpdateStaminabar()--Update The Stamina Bar\n\nms.stamina:GetPropertyChangedSignal(&quot;Value&quot;):Connect(function()\n \n UpdateStaminabar()\n \nend)\n</code></pre>\n<p>PunchScript:</p>\n<pre><code>local ms = require(game.ReplicatedStorage.ModuleScript)\nif not ms then\n \n ms = require(game.ReplicatedStorage:WaitForChild(&quot;ModuleScript&quot;))\n \nend \nlocal uis = game:GetService(&quot;UserInputService&quot;)\nlocal cas = game:GetService(&quot;ContextActionService&quot;)\nlocal rs = game:GetService(&quot;ReplicatedStorage&quot;)\n\nlocal events = rs:WaitForChild(&quot;Events&quot;)\nlocal hitbox = events:WaitForChild(&quot;Hitbox&quot;)\n\nlocal plr = game.Players.LocalPlayer\nlocal character = plr.Character\nif not character then\n \n plr:WaitForChild(&quot;Character&quot;)\n \nend\nlocal humanoid = character.Humanoid\nlocal animator = humanoid:WaitForChild(&quot;Animator&quot;)\n\nlocal idle = animator:LoadAnimation(script:WaitForChild(&quot;idle&quot;))\nlocal jab = animator:LoadAnimation(script:WaitForChild(&quot;jab&quot;))\nlocal rightcross = animator:LoadAnimation(script:WaitForChild(&quot;rightstraight&quot;))\nlocal lefthook = animator:LoadAnimation(script:WaitForChild(&quot;lefthook&quot;))\nlocal righthook = animator:LoadAnimation(script:WaitForChild(&quot;righthook&quot;))\nlocal swingsfx = script:WaitForChild(&quot;Air swing&quot;)\n\nlocal currentPunch = 0\nlocal currentPunch2 = 0\nlocal debounce1 = false\nlocal debounce2 = false\nms.stamina.Value = 100\n\nlocal function onInputBegan(input)\n \n if debounce2 == true then return end\n if ms.stamina.Value &lt;= 0 then return end\n \n \n if input.KeyCode == Enum.KeyCode.Q then\n \n ms.stamina.Value -= 20\n debounce2 = true\n humanoid.WalkSpeed = 0.5\n lefthook:Play()\n swingsfx:Play()\n hitbox:FireServer(Vector3.new(4, 5, 3), Vector3.new(4.5, 1), 7.5, 0.15)\n task.wait(0.5)\n humanoid.WalkSpeed = 10\n lefthook:Stop()\n task.wait(6)\n debounce2 = false\n \n end \n \n if input.KeyCode == Enum.KeyCode.E then\n\n ms.stamina.Value -= 20\n debounce2 = true\n humanoid.WalkSpeed = 0.5\n righthook:Play()\n swingsfx:Play()\n hitbox:FireServer(Vector3.new(4, 5, 3), Vector3.new(4.5, 1), 7.5, 0.15)\n task.wait(0.5)\n humanoid.WalkSpeed = 10\n righthook:Stop()\n task.wait(6)\n debounce2 = false\n\n end \nend\n\nlocal function punch()\n \n if debounce1 then return end\n \n debounce1 = true\n \n if currentPunch == 0 then\n if ms.stamina.Value &gt;= 1 then\n ms.stamina.Value -= 10\n humanoid.WalkSpeed = 0.6\n jab:Play()\n swingsfx:Play()\n hitbox:FireServer(Vector3.new(4, 5, 3), Vector3.new(5.7, 1), 2.5, 0.15)\n task.wait(0.5)\n humanoid.WalkSpeed = 10\n jab:Stop()\n debounce1 = false\n end \n \n elseif currentPunch == 1 then\n if ms.stamina.Value &gt;= 1 then\n ms.stamina.Value -= 10\n humanoid.WalkSpeed = 0.6\n rightcross:Play()\n swingsfx:Play()\n hitbox:FireServer(Vector3.new(4, 5, 3), Vector3.new(5.7, 1), 2.5, 0.15)\n task.wait(0.5)\n humanoid.WalkSpeed = 10\n rightcross:Stop()\n debounce1 = false\n end\n elseif currentPunch == 2 then\n if ms.stamina.Value &gt;= 1 then\n ms.stamina.Value -= 10\n humanoid.WalkSpeed = 0.6\n jab:Play()\n swingsfx:Play()\n hitbox:FireServer(Vector3.new(4, 5, 3), Vector3.new(5.7, 1), 2.5, 0.15)\n task.wait(0.5)\n humanoid.WalkSpeed = 10\n jab:Stop()\n debounce1 = false\n end\n elseif currentPunch == 3 then\n if ms.stamina.Value &gt;= 1 then\n ms.stamina.Value -= 10\n debounce2 = true\n humanoid.WalkSpeed = 0.6\n rightcross:Play()\n swingsfx:Play()\n hitbox:FireServer(Vector3.new(4, 5, 3), Vector3.new(5.7, 1), 5, 0.15)\n task.wait(0.5)\n humanoid.WalkSpeed = 10\n rightcross:Stop()\n debounce1 = false\n debounce2 = false\n end\n end\n\n if currentPunch == 3 then\n \n currentPunch = 0\n debounce1 = true\n wait(2)\n debounce1 = false\n \n else\n \n currentPunch += 1\n \n end\n \nend\n\ncas:BindAction(&quot;Punch&quot;, punch, true, Enum.UserInputType.MouseButton1)\nuis.InputBegan:Connect(onInputBegan)\n</code></pre>\n<p>Hope that will help solve the case, but I think I just need to set the variables value right in the module script, I just don't know how.</p>\n<p>Alright I just made it somehow work now but it only changes when it's either 100 or 0, btw I updated the scripts that are presented in here.</p>\n"^^ . . . "<p>It is not clear what is the issue here. I can only assume that it is caused by:</p>\n<pre><code>local player = vRP.getUserSource{v}\n</code></pre>\n<p>According to <a href="https://jamesuk.gitbook.io/fivem-guides/dunko-vrp/docs#vrp.getusersource-user_id" rel="nofollow noreferrer">https://jamesuk.gitbook.io/fivem-guides/dunko-vrp/docs#vrp.getusersource-user_id</a></p>\n<p><code>vRP.getUserSource(user_id)</code> takes a single argument, where user_id seems to be an integer. You are providing a table with a single integer instead.</p>\n<p><code>vRP.getUserSource{v}</code> is syntactic sugar for <code>vRP.getUserSource({v})</code> but you probably want to call <code>vRP.getUserSource(v)</code></p>\n<p>Same for <code>vRP.getOnlineAdmins{}</code> but here it does not have any effect as the function does not evaluate any parameters.</p>\n"^^ . . . "3"^^ . . . . "0"^^ . "0"^^ . . "2"^^ . . "1"^^ . . "@DavidA, I made a few rapid edits before you posted your comment, but there are 2 code examples in the post right now. the shows what you would need to add at the end of the `general.lua` file, and the next shows the changes that would be needed for the other file. Edit: I have added an example that shows making the general file into a module."^^ . "0"^^ . . . "I have the same issue, but not for all apps. iTerm windows for instance behave as you show, moving slowly and then sometimes ending up somewhere else while vscode, Finder, etc. immediately and without animation move to the correct location. My hs console window also moves correctly. I think it's just iTerm2 that's misbehaving. The function is called correctly with identical frame for all apps."^^ . . . . . "4"^^ . "3"^^ . . . . "0"^^ . . . "1"^^ . "0"^^ . "Converting a Span element to a BulletList in a pandoc Lua extension that works for pdf and html"^^ . . "0"^^ . . . . . "1"^^ . . "UPDATE: I upgraded neovim and ran into other issues with my config but NOT this one. Thanks!"^^ . . . "0"^^ . "0"^^ . "1"^^ . . "0"^^ . . . . . . "2"^^ . . . "<p>I'm attempting to control an assembly in VisRen using an event script (e.g. to move forward, the script is activated when W is pressed/ held).\nI've currently got a very simple script, simply using a while loop to keep adding 0.01 to the x/y/z axis, however this is causing the script to crash since it's just continuously adding onto itself.</p>\n<p>Does anyone know of a way to make it move at a specified velocity instead? Would be a huge help, thank you. :)</p>\n"^^ . "0"^^ . . . . . "entity"^^ . . . . "1"^^ . "1"^^ . . . . "Redis eviction policy using lua script"^^ . . "0"^^ . . . "3"^^ . . . . . "0"^^ . . . . . "Not really, stats are being managed by the local script, which is also doing the job of managing the combat system. Basically all changes to module script values are client sided. My script basically should've set the stats differently if the players User ID is matching with the ones that are shown here. LocalScripts trigger after the player joins, which means that they can't utilise PlayerAdded. Which is the reason I made the post in the first place. I need an alternative for PlayerAdded in this situation, as it can't be activated by the player that joins."^^ . "njs"^^ . . . . "pypandoc ignores lua filters"^^ . . . . . . "0"^^ . "1"^^ . . . "0"^^ . "0"^^ . "In vim, `r` is use to go in replace mode to replace a single character. For replacing multiple characters consecutively while staying in replace mode use `R`. Also see `:h Replace`"^^ . "<p>I would need to extract everything that comes before and everything that comes after the &quot;\\\\scalebox&quot; string. I tried with</p>\n<pre><code>local example = &quot;sometext\\\\scalebox{0.74}&quot;\nfor i in string.gmatch(example, &quot;[^\\\\scalebox]+&quot;) do\n print(i)\nend\n</code></pre>\n<p>I expect</p>\n<pre><code>sometext\n{0.74}\n</code></pre>\n<p>but the result is</p>\n<pre><code>m\nt\nt\n{0.74}\n</code></pre>\n<p>EDIT: not an escape chatacter problem, because</p>\n<pre><code>local example = &quot;sometextscalebox{0.74}&quot;\nfor i in string.gmatch(example, &quot;[^scalebox]+&quot;) do\n print(i)\nend\n</code></pre>\n<p>leads to same result</p>\n<p>Any ideas?</p>\n"^^ . . . . "Python and JavaScript have actual "event loops", implemented for example via `select`, `epoll` or similar syscalls (no code is running in parallel on the CPU, however). Lua does not have this. As tkausl said, you can implement something similar yourself, by using nonblocking functions in your coroutines and resuming (polling) them until they have run to completion. A good example of this is given [in the PIL](https://www.lua.org/pil/9.4.html)."^^ . "<p><a href="https://mpv.io/manual/master/" rel="nofollow noreferrer"><code>mp.command_native_async</code></a> allows one to call an external executable from an MPV script. It accepts a completion callback, which receives the results of the call.</p>\n<p>The following attempt at coroutinization even works:</p>\n<pre><code>local function co_subprocess(...)\n local co = coroutine.running()\n mp.command_native_async({\n name = 'subprocess',\n args = { ... },\n playback_only = false,\n capture_stdout = true,\n }, function(...)\n coroutine.resume(co, ...) -- RESUME POINT\n end)\n return coroutine.yield() -- YIELD POINT\nend\n\ncoroutine.wrap(function ()\n success, result, error = co_subprocess('echo', 'Hello from MPV')\n print('success = ', success)\n print('error = ', error)\n if result then\n print('status = ', result.status)\n print('stdout = ', result.stdout)\n end\nend)()\n</code></pre>\n<p>but I have questions about its correctness. <code>co_subprocess</code> yields immediately after calling <code>mp.command_native_async</code>. Callback is called by MPV at some later unspecified time, and that callback resumes the coroutine.</p>\n<ol>\n<li>Are there any guarantees by Lua runtime or by MPV that the callback will be called only after the coroutine has yielded?</li>\n<li>If there are no such guarantees, what's gonna happen if someone tries to resume a coroutine that haven't yielded?</li>\n</ol>\n"^^ . . . . "Is there a way to detect if local players character is touching the hitbox instead of the victim? Luau"^^ . . . . "0"^^ . . "<p>The issue is that one or multiple the <code>Humanoid.Health</code>, <code>Humanoid.MaxHealth</code>, <code>Stamina.Value</code>, <code>MaxStamina.value</code>, <code>Level.Value</code> variables are empty(nil).</p>\n<p>Try printing them out one by one untill you find every single empty variable there is. After that, try finding out why they are empty - try looking for them in your files (or the <a href="https://create.roblox.com/docs" rel="nofollow noreferrer">documentation</a> if it's a constant).</p>\n"^^ . . . . . "<p>I don't have Roblox Studio to test, but according to its documentation a block comment like this should be used to document functions</p>\n<pre><code>--[[\n Shuts off the cosmic moon ray immediately.\n\n Should only be called within 15 minutes of midnight Mountain Standard\n Time, or the cosmic moon ray may be damaged.\n]]\n</code></pre>\n<p>Maybe <code>-- [[ ... ]]</code> does not work because it is a single line?</p>\n"^^ . . "0"^^ . "0"^^ . . "0"^^ . . . . . "@LV_Embedded You could get same time measurments in your C process with `clock_gettime` (https://stackoverflow.com/questions/10192903/time-in-milliseconds-in-c) and log them along side the lua measurments, the differences would be the time taken.\nFor the inclusion of the posix module, you need to install the lib if it is not on your computer, using `luarocks` is the best way : `luarocks install luaposix`."^^ . . . . . . "0"^^ . "@JosephSible-ReinstateMonica - [suggested edit](https://stackoverflow.com/review/suggested-edits/36185135) != [my edit](https://stackoverflow.com/posts/78660346/revisions)."^^ . . . . . "0"^^ . "redis"^^ . "1"^^ . "<p>I'm using AstroNvim, and just installed <code>copilot.vim</code>. It's working fine, except that I want to use the <code>Tab</code> key to accept a copilot suggestion. However, the <code>Tab</code> key is mapped to 'Next Completion' according to the <a href="https://docs.astronvim.com/mappings/#completion" rel="nofollow noreferrer">AstroNvim docs</a>. How do I disable this behavior so that the <code>Tab</code> key is only used for accepting Copilot suggestions?</p>\n<p>I have tried adding the following code in my <code>lua/plugins/cmp.lua</code> file:</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;hrsh7th/nvim-cmp&quot;,\n opts = function(_, opts)\n local cmp = require(&quot;cmp&quot;)\n opts.mapping[&quot;&lt;Tab&gt;&quot;] = nil\n end\n}\n</code></pre>\n<p>It hasn't had any effect however.</p>\n"^^ . . . . "0"^^ . "5"^^ . . "0"^^ . . . . "solar2d"^^ . . . "Why do you have the same `if` statement twice? And why are you working on `part` instead of `torsoPart` in the second `if` statement?"^^ . . . "<pre><code>main.lua:147: stack overflow\n\nTraceback\n\n[love &quot;callbacks.lua&quot;]:228: in function 'handler'\nmain.lua:94: in function 'matches'\nmain.lua:80: in function 'checkforNil'\nmain.lua:89: in function 'removeMatches'\nmain.lua:148: in function 'matches'\nmain.lua:80: in function 'checkforNil'\nmain.lua:89: in function 'removeMatches'\nmain.lua:148: in function 'matches'\nmain.lua:80: in function 'checkforNil'\nmain.lua:89: in function 'removeMatches'\n...\nmain.lua:89: in function 'removeMatches'\nmain.lua:148: in function 'matches'\nmain.lua:80: in function 'checkforNil'\nmain.lua:89: in function 'removeMatches'\nmain.lua:148: in function 'matches'\nmain.lua:161: in function 'swap'\nmain.lua:183: in function &lt;main.lua:175&gt;\n[love &quot;callbacks.lua&quot;]:154: in function &lt;[love &quot;callbacks.lua&quot;]:144&gt;\n[C]: in function 'xpcall'\n</code></pre>\n<p>I'm was working a tile matching game using Love2D. The game involves a grid of colored tiles that players can swap to form matches of three or more. When matches are formed, the tiles are removed, and new tiles drop down to fill the empty spaces. However, I'm encountering a &quot;stack overflow&quot; error, and I'm not sure how to resolve it. Here is my code:\nHow can I resolve this stack overflow error? It seems to occur in the matches and removeMatches functions, causing an infinite loop or recursion issue.</p>\n<p>updated to provide error and minimal case of working.</p>\n<pre><code>local game = {}\n\n-- Table to store the grid elements\ngridTable = {}\nlocal selectedTile = nil\n\n-- Function to initialize the gridTable with colors\nfunction game:initializeGrid()\n for i = 1, 64 do\n gridTable[i] = {\n x = ((i - 1) % 8) * 65,\n y = (math.floor((i - 1) / 8) * 65),\n color = love.math.random(7)\n }\n end\nend\n\n-- Function to draw the grid elements\nfunction game:drawGrid()\n for i, cell in ipairs(gridTable) do\n if cell.color then\n love.graphics.setColor(self:getColor(cell.color))\n love.graphics.rectangle(&quot;fill&quot;, cell.x, cell.y, 50, 50)\n end\n end\n if selectedTile then\n love.graphics.setColor(1, 1, 1)\n love.graphics.rectangle(&quot;line&quot;, gridTable[selectedTile].x, gridTable[selectedTile].y, 50, 50)\n end\nend\n\n-- Helper function to get color by index\nfunction game:getColor(index)\n local colors = {\n {1, 0, 0},\n {0, 1, 0},\n {0, 0, 1},\n {1, 1, 0},\n {0, 1, 1},\n {1, 0, 1},\n {0.5, 0.5, 0.5}\n }\n return colors[index]\nend\n\nfunction game:checkforNil() -- looks for nil values in the table\n for i = 64, 56, -1 do --grid is 8x8 so 64 items\n local counter = 8 -- looks through each row\n for j = i, 1, -8 do\n local tempY, tempColor = 0, 0\n\n if gridTable[j].y == nil then -- if value at j is nil we swap the nil value with what's about it and repeats until all values are filled\n for test = j, 1, -8 do\n if gridTable[test].y ~= nil then\n tempY = gridTable[test].y\n tempColor = gridTable[test].color\n\n gridTable[j].y = ((counter) * 50) + (((counter) - 1) * 15)\n gridTable[j].color = tempColor\n\n gridTable[test].y = nil\n gridTable[test].color = nil\n break\n end\n end\n end\n\n for k = 1, 8 do -- loops through the top and assigns random colours\n if gridTable[k].y == nil then\n gridTable[k].y = 50\n gridTable[k].color = love.math.random(7)\n end\n end\n\n counter = counter - 1\n end\n end\n self:matches(gridTable)\nend\n\nfunction game:removeMatches(grid)\n for _, v in ipairs(listofMatches) do --lists of matches contain where in the table there are 3 or more colours of the same \n grid[v].y = nil --and removes them\n grid[v].color = nil\n end\n listofMatches = {} --resets the list \n self:checkforNil() -- calls the function that pushes bricks down\nend\n\nfunction game:matches(grid) --searches everytime we swap for a match\n matchTest = false --if we find at least one match we'll set this to true\n listofMatches = {}\n local matches = 0 \n\n for i = 1, 63 do --loops through the table of which there are 64 items\n for _, y in ipairs(listofMatches) do\n if i == y then\n goto continue --if i and i+1 are a match we skip to i+2 to see if that matches too\n end\n end\n ::continue::\n for j = i + 1, 64 do --in this loop we are looking for horizontal matches\n local currentColor = grid[i].color --sets the current colour we are searching for\n if currentColor ~= grid[j].color then --we break out of searching for the same colour and if the\n if matches &gt; 1 then --matches are 3+ we set match test to tru and insert into list of matches\n matchTest = true\n for k = i, j - 1 do\n table.insert(listofMatches, k)\n end\n end\n matches = 0\n break\n else\n matches = matches + 1\n end\n end\n end\n\n for num = 1, 8 do --looking for vertical\n for vertical = num, 48, 8 do\n for _, y in ipairs(listofMatches) do\n if vertical == y then\n goto continue\n end\n end\n ::continue::\n for down = vertical + 8, 64, 8 do\n local currentColor = grid[vertical].color\n if currentColor ~= grid[down].color then\n if matches &gt; 1 then\n matchTest = true\n for k = vertical, down - 8, 8 do\n table.insert(listofMatches, k)\n end\n end\n matches = 0\n break\n else\n matches = matches + 1\n end\n end\n end\n end\n\n if matchTest then --if there is a match test we want to remove matches so call the function and add points\n self:removeMatches(grid)\n game.points = (game.points or 0) + 500\n matchTest = false\n end\nend\n\nfunction game:swap(swap1, swap2) --swapping blocks and then checking if there's a match\n local temp1 = gridTable[swap1].color\n local temp2 = gridTable[swap2].color\n\n gridTable[swap1].color = temp2\n gridTable[swap2].color = temp1\n\n self:matches(gridTable)\nend\n\n-- Love2D callback functions\nfunction love.load()\n game:initializeGrid()\nend\n\nfunction love.draw()\n game:drawGrid()\n love.graphics.setColor(1, 1, 1)\n love.graphics.print(&quot;Points: &quot; .. (game.points or 0), 10, 10)\nend\n\nfunction love.mousepressed(x, y, button)\n if button == 1 then\n local tileIndex = game:getTileIndex(x, y)\n if tileIndex then\n if not selectedTile then\n selectedTile = tileIndex\n else\n if selectedTile ~= tileIndex then\n game:swap(selectedTile, tileIndex)\n selectedTile = nil\n else\n selectedTile = nil\n end\n end\n end\n end\nend\n\nfunction game:getTileIndex(x, y)\n for i, cell in ipairs(gridTable) do\n if x &gt; cell.x and x &lt; cell.x + 50 and y &gt; cell.y and y &lt; cell.y + 50 then\n return i\n end\n end\n return nil\nend\n</code></pre>\n"^^ . "0"^^ . . . "0"^^ . . . . "location"^^ . . . . . . "-1"^^ . "0"^^ . . . . . . . "0"^^ . . . . . . "0"^^ . "<p>Roblox Studio does not support documentation comments so adding any comments to code won't be reflected in its popup.</p>\n<p>Documentation comments for Roblox Studio has been requested for years now on the <a href="https://devforum.roblox.com/" rel="nofollow noreferrer">Roblox Developer Forum</a>:</p>\n<ul>\n<li><a href="https://devforum.roblox.com/t/110378" rel="nofollow noreferrer">Custom Intellisense Documentation Comments</a></li>\n<li><a href="https://devforum.roblox.com/t/860413" rel="nofollow noreferrer">Add script editor support for Lua code documentation using comments (DocBlocks)</a></li>\n</ul>\n<p>There have been developments for documentation comments, called user-defined function documentation, but as of now, it isn't publicly available and requires you to modify Roblox Studio to get it:</p>\n<ul>\n<li><a href="https://devforum.roblox.com/t/2859011" rel="nofollow noreferrer">What do you guys think about User user defined function Documentation? A FFlag option</a></li>\n</ul>\n<p>In order to get documentation comments there's nothing you can do now but wait for the official release of user-defined function documentation or to use a different IDE such as <a href="https://code.visualstudio.com/" rel="nofollow noreferrer">Visual Studio Code</a> which does support code documentation using the syntax you are describing.</p>\n<pre class="lang-lua prettyprint-override"><code>-- Given a string, turns it into a number\nlocal function numberify(n: string): ()\n return tonumber(n)\nend\n</code></pre>\n<p>For the above in Visual Studio Code, it shows the popup as:</p>\n<blockquote>\n<p>Given a string, turns it into a number</p>\n</blockquote>\n"^^ . . "<p>This feature has been added to Studio!</p>\n<p>Adding a comment above a function definition will add it to the intellisense as a docstring</p>\n<p>example:</p>\n<pre class="lang-lua prettyprint-override"><code>-- This adds 2 numbers together\nlocal function add(a, b)\nreturn a + b\nend\n</code></pre>\n"^^ . . "1"^^ . . . . "0"^^ . "0"^^ . . . . . . . "android-emulator"^^ . "0"^^ . . . . . . "0"^^ . . . . . "Turns out I forgot to remove that, I think during the building phase I iterated twice, to make sure all the data came back the same, and forgot about that causing issues. Thanks for pointing that out because after 9 days straight looking at the same code, you can miss a thing or two"^^ . . . . "@Valkyrie -- now I am confused. I thought that you were writing Lual code, but now you mention portability to plain Lua. Does this code work in Lual, but not in Lua? Some clarification would be good, but it would be best to simplify: write code for one language, tell us what that language is, and edit your question appropriately."^^ . . . . . . . "macos"^^ . . "0"^^ . . . . "1"^^ . . . . . . "The filter functions must match the names that pandoc uses in it's internal data structure; so for example `Image` instead of `Img`."^^ . . . "Question about making lua extension for forcing VR SBS playback"^^ . . "3"^^ . . . . . . . "access-violation"^^ . "<p>I would like to use fzf-lua to prompt for a specific directory listing and then prompt for files in the selected directory. I have looked at the fzf-lua github repo and the advanced options are really over my head at this point. I believe I have to use 'actions' to accomplish this, but I don't know where and how. With the example below the idea is the function prompts with a listing of all the directories under ~/projects. Then when a directory is selected, the action should spawn an new fzf-lua command to list the files in that directory. When a file is selected it should be opened. Thanks for any help!</p>\n<pre><code>function Projects()\n coroutine.wrap(function()\n local actions = {\n [&quot;default&quot;] = {\n require(&quot;fzf-lua&quot;).files { cwd = project },\n },\n }\n local project = require(&quot;fzf-lua&quot;).fzf_exec(&quot;ls&quot;, { prompt = &quot;Projects&gt; &quot;, cwd = &quot;~/projects&quot; })\n end)()\nend\n</code></pre>\n"^^ . . "0"^^ . "0"^^ . . "0"^^ . "<p>the solution is simple: your script needs to return the table.You can do so by adding:</p>\n<pre><code>return machineData\n</code></pre>\n"^^ . . . "<p>Config file are read from my project directory, each of them run normally when I execute the main project target. I have an issue running a test case. I'm using sol2 from <a href="https://github.com/ThePhD/sol2" rel="nofollow noreferrer">here</a> as the lua-managing library.</p>\n<p>stack trace of error</p>\n<p><a href="https://i.sstatic.net/8MKXBQuT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8MKXBQuT.png" alt="" /></a></p>\n<p>The code I'm running is pretty simple:</p>\n<pre class="lang-cpp prettyprint-override"><code>BOOST_AUTO_TEST_CASE(SCENARIO_LOGIN_TEST)\n{\n sZone-&gt;general_conf().set_test_run();\n\n sZone-&gt;general_conf().set_config_file_path(&quot;../../../../../config/zone-server.lua.dist&quot;);\n sZone-&gt;read_config();\n \n sZone-&gt;config().set_static_db_path(std::string(&quot;../../../../../db/&quot;));\n HLog(info) &lt;&lt; &quot;Static database path set to &quot; &lt;&lt; sZone-&gt;config().get_static_db_path() &lt;&lt; &quot;&quot;;\n\n sZone-&gt;config().set_mapcache_path(std::string(&quot;../../../../../db/maps.dat&quot;));\n HLog(info) &lt;&lt; &quot;Mapcache file name is set to &quot; &lt;&lt; sZone-&gt;config().get_mapcache_path() &lt;&lt; &quot;, it will be read while initializing maps.&quot;;\n\n sZone-&gt;config().set_script_root_path(std::string(&quot;../../../../../scripts/&quot;));\n\n sZone-&gt;initialize();\n sZone-&gt;finalize();\n}\n</code></pre>\n<p>Any more project related code can be found <a href="https://github.com/horizonxyz/horizon" rel="nofollow noreferrer">here</a></p>\n"^^ . . . . . . . . . "1"^^ . . . . . "I am trying to make it run in Luau (aka Lua 5.1 Fork, Roblox). The rest of the Checks work fine."^^ . "<p>I'll just quote <a href="https://www.lua.org/pil/9.html" rel="nofollow noreferrer">Programming in Lua</a>:</p>\n<blockquote>\n<p>A coroutine is similar to a thread (in the sense of multithreading): a\nline of execution, with its own stack, its own local variables, and\nits own instruction pointer; but sharing global variables and mostly\nanything else with other coroutines. The main difference between\nthreads and coroutines is that, conceptually (or literally, in a\nmultiprocessor machine), a program with threads runs several threads\nconcurrently. Coroutines, on the other hand, are collaborative: A\nprogram with coroutines is, at any given time, running only one of its\ncoroutines and this running coroutine only suspends its execution when\nit explicitly requests to be suspended.</p>\n</blockquote>\n<p>Hence there is no function to run several coroutines concurrently.</p>\n<p>Lua runs in a single thread, hence nothing is being executed in parallel. You can only isolate tasks and schedule them. For example if one coroutine has nothing to do at the moment, you can hand over control to another coroutine.</p>\n<p>You'll find some libraries to work around this though.</p>\n"^^ . "0"^^ . "<p>The following code:</p>\n<pre><code>sol::state lua; \n\nlua.open_libraries( sol::lib::base );\n\nsol::table result = lua.script( R&quot;( 'machineData={serial=1,name=&quot;mob2&quot;,}' )&quot; ); \n</code></pre>\n<p>throws the following error:</p>\n<blockquote>\n<p>[sol2] An error occurred and has been passed to an error handler: sol:\nsyntax error: [string &quot; 'machineData={serial=1,name=&quot;mob2&quot;,}' &quot;]:1:\nunexpected symbol near ''machineData={serial=1,name=&quot;mob2&quot;,}''\nterminate called after throwing an instance of 'sol::error'</p>\n</blockquote>\n"^^ . . . . . . . "fivem"^^ . . "0"^^ . "0"^^ . . "Thank you for the answer! Do you know a way I can detect that the value of stamina changed? it tells me I can't refer to numbers with getpropertychangedsignal."^^ . . "I believe this is an issue with the extension. I get the same error. After disabling the extension the error is also gone."^^ . "1"^^ . "0"^^ . . "0"^^ . "0"^^ . . . "0"^^ . . "3"^^ . . . . . . "FiveM Script - AI Responds in Console but Not in UI"^^ . . "1"^^ . . . "0"^^ . . . . "Ehh, tried that. .Changed doesn't work on numbers :/, and max stamina will be able to change. Thanks though"^^ . . . "`Item1=true` --> `item1=true`; or maybe it's the other way around: `while item1` --> `while Item1`. In any case, you seem to have a typo."^^ . . "0"^^ . . "Yep. That's what the call to GET right before the MULTI is for."^^ . "0"^^ . "(1) rewrite half of ffmpeg in pure lua (2) done. -- voting to close. question is WAY too broad. -- do you ***really*** plan to write your own code to mux/demux mp4 containers, and then implement *some* video codec for the video stream that goes into the container? -- I'd recommend looking for bindings to ffmpeg... not the CLI, but the libraries of ffmpeg. do not touch anything that merely runs a subprocess. those "wrappers" are all junk. all of them. no exception. fundamentally not worth anyone's time."^^ . . . . . . "0"^^ . . "0"^^ . . . . . . . . "1"^^ . . "0"^^ . "0"^^ . "Just fyi, Wireshark is still going to support the Lua BitOp library even with Lua 5.3 and 5.4. To quote [the upcoming release notes](https://gitlab.com/wireshark/wireshark/-/blob/master/doc/release-notes.adoc?ref_type=heads), _"The included Lua version has been updated to 5.4. While most Lua dissectors\nshould continue to work (the lua_bitop library has been patched to work with\nLua 5.3 and 5.4, in addition to the native Lua support for bit operations\npresent in those versions), different versions of Lua are not guaranteed to\nbe compatible."_."^^ . "0"^^ . "Currently, `userdata` checks are `Luau` only, the rest work in `Lua 5.2-5.4` too."^^ . . "Weird behaviour in Lua string.gmatch"^^ . . . . . . . . . "data-manipulation"^^ . "0"^^ . . "1"^^ . . "0"^^ . . . . . "<p>I am investigating kind of same problem and it seems like openresty is not giving your any tools to achieve that. At your example it's impossible to do <code>ngx.req.set_body_data(modified_data)</code> cause it's is part of http context API, while you are trying to deal with stream. In other words you are trying to manipulate L4(tcp traffic) with L7(http) methods which is not make sense.</p>\n<p>There are only one possible workaround - using cosoket API during access phase (use <code>access_by_lua</code> directive) and implement direct socket to socket communication with your upstream server, but this is really tricky.</p>\n<p>So in conclusion - I don't think it's possible with tools openresty provided. But you can try to use another server like apache or squid, I can't recommend you neither. If you find any way to manipulate tcp traffic with openresty without implementing s2s communication comment me, I will be glad to know.</p>\n"^^ . "0"^^ . "0"^^ . "-1"^^ . . . "0"^^ . . . "It would be without those `'` around it."^^ . . . "0"^^ . . "@LTyrone Your edit was the entirety of the suggested edit plus other stuff, so you should have done "Improve edit" rather than "Reject and edit"."^^ . "Script not detecting when a player with a set ID joins. Luau"^^ . "1"^^ . "I would suggest rewriting this just as a simple `file_contents:gmatch"%$%$(.-)%$%$"`; it isn't yet clear to me whether you need `$$` to be at the start / end of a line though."^^ . "1"^^ . "wireshark"^^ . "@adabsurdum right, that makes sense. Thanks!"^^ . . "0"^^ . . . . . "Client is not receiving anything of data in my chat app"^^ . . . . . . "<p>To fix this, add <code>local source = source</code> at the beginning of the register server event like this :</p>\n<pre><code>RegisterNetEvent('InteractiveNPCS:RequestLLMResponse')\nAddEventHandler('InteractiveNPCS:RequestLLMResponse', function(text)\n local source = source -- here, i don't remember this explanation but remember to do this when you create a server event\n print(&quot;Received text from client: &quot; .. text)\n local apiKey = Config.HuggingFaceAPIKey\n local endpoint = Config.ModelEndpoint\n\n PerformHttpRequest(endpoint, function(err, responseText, headers)\n if err == 200 then\n print(&quot;Received response from LLM API: &quot; .. tostring(responseText))\n local response = json.decode(responseText)\n local reply = response and response[1] and response[1].generated_text or &quot;Sorry, I don't understand.&quot;\n print(&quot;Sending response to client: &quot; .. reply)\n TriggerClientEvent('InteractiveNPCS:ReceiveLLMResponse', source, reply)\n else\n print(&quot;Error from LLM API: &quot; .. tostring(err))\n print(&quot;Response text: &quot; .. tostring(responseText))\n TriggerClientEvent('InteractiveNPCS:ReceiveLLMResponse', source, &quot;Sorry, something went wrong.&quot;)\n end\n end, 'POST', json.encode({\n inputs = text\n }), {\n [&quot;Authorization&quot;] = &quot;Bearer &quot; .. apiKey,\n [&quot;Content-Type&quot;] = &quot;application/json&quot;\n })\nend)\n</code></pre>\n"^^ . . . . . "<p>I'm using Slimv with NVim, and it works perfectly except when attempting to <code>(load ...)</code> files from the same folder. I presume it's an issue with translating vim shell commands (with <code>%</code> expansions, etc.) to <code>vim.cmd()</code> lua functions.</p>\n<p>I used to run Slimv with Vim and set <code>g:slimv_swank_cmd</code> to <code>'!osascript -e &quot;tell application \\&quot;Terminal\\&quot; to do script \\&quot;cd %:p:h &amp;&amp; sbcl --load ~/.vim/pack/plugins/start/slimv/slime/start-swank.lisp&quot;&quot;'</code>. This would load sbcl at the current folder without an issue.</p>\n<p>Now with neovim and using a Lua LazyVim config file, I have to call <code>vim.cmd([[let g:slimv_swank_cmd='!osascript -e &quot;tell application \\&quot;Terminal\\&quot; to do script \\&quot;cd %:p:h &amp;&amp; sbcl --load ~/.local/share/nvim/slimv/lazy/slime/start-swank.lisp\\&quot;&quot;']])</code>, but apparently the placeholders for folder location cannot be resolved.</p>\n<p>I'm guessing I'm missing something about how <code>vim.cmd</code> runs its argument.</p>\n<p>Tangentially would also appreciate a more thorough answer regarding how people run Slimv so that it opens to a given folder/project and thus allows files to be loaded easily via relative paths.</p>\n"^^ . . . "vlc"^^ . . "Lua: turn MPV's mp.command_native_async into a coroutine"^^ . "2"^^ . "0"^^ . . "1"^^ . "Thanks for your help and comments. I'm trying your second suggestion (package.loaded) but it's not changing the result yet. Should the package.loaded line be at the end of general.lua?"^^ . "0"^^ . "0"^^ . . . . "0"^^ . . "2"^^ . "0"^^ . . . . . . "0"^^ . "This question is similar to: [Roblox Why can't I get Players.LocalPlayer.Character in game](https://stackoverflow.com/questions/60696242/roblox-why-cant-i-get-players-localplayer-character-in-game). If you believe it’s different, please [edit] the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem."^^ . . . . . "3"^^ . . . . . "1"^^ . "4"^^ . "0"^^ . "0"^^ . "0"^^ . . "@user25690029 Please provide full error message and [minimum reproducible example](https://stackoverflow.com/help/minimal-reproducible-example)"^^ . . . . "0"^^ . . . . . . "0"^^ . . . "I wonder if it's possible with Varnish or HAProxy"^^ . "Stamina bar going from 100 to 0 for no reason, Stamina value not getting any interactions"^^ . . . . "<p>You can shorten identifiers like <code>coroutine</code>. Just <code>local c=coroutine</code> will work (or even just <code>c=coroutine</code> if you don't care about polluting the global namespace). You could go further, e.g., with <code>local r=c.resume</code>. You cannot shorten keywords like <code>end</code>.</p>\n"^^ . "-2"^^ . . "visual-studio-code"^^ . "puredata"^^ . . . . . "2"^^ . . . "you have to combine PressKeySequenceA and MoveMouseRelative into a PressAndMoveAtSameTime function"^^ . . . . . . . . . . . . . . "1"^^ . "Also, this question should be in the Game Dev Site. Ask questions like this over there."^^ . . . "0"^^ . . . "buttons not responding in roblox studio"^^ . . "2"^^ . "@skisp It still seems like there's a lot of redundant code. Do your best to reduce it to the absolute minimum needed to reproduce your problem. That may mean rewriting your code from the ground up, which is frustrating but ultimately helpful."^^ . . "1"^^ . "youtube-api"^^ . "<p>this</p>\n<pre class="lang-lua prettyprint-override"><code>local pointPart1 = game.Workspace.PointsPlaceFolder.PointPart1\n\nblacklist = {}\nblacklist.findPlayer = function(player)\n for i,v in ipairs(blacklist) do\n if v==player then\n return true\n end\n end\n return false\nend\n\nPointPart1.Touched:Connect(function(hit)\n if hit.Parent:FindFirstChild(“Humanoid”) then\n thePlayer = game.Players:GetPlayerFromCharacter(hit.Parent:FindFirstChild(“Humanoid”).Parent)\n if(thePlayer and not blacklist.findPlayer(thePlayer))\n thePlayer.leaderstats.Points.Value+=1\n table.insert(blacklist,thePlayer)\n end\nend)\n\n</code></pre>\n<p>will add a point to the player whenever the part is touched, but then add the player to the blacklist, so that the player isnt allowed to touch it again, if you still want the player to still be able to get points from the part later,it would require a different solution</p>\n"^^ . . "Is userdata in LuaJIT ffi garbage collected when it is returned from a C function by value?"^^ . . . . . . . . . . . "printing"^^ . . "0"^^ . "0"^^ . . "tex"^^ . . . . . . . . "global-variables"^^ . "@AndrewYim yes they are"^^ . "I don't know about `cppdialect`, but you can directly set compiler option with `buildoptions { "-std=c++17" }`. This is how I am doing on our code based using an outdated version of Premake5. And with a tiny patch it can support VS2022."^^ . . "<p>Classical. <code>=</code> in a numbered template parameter makes it technically named: <code>{{t|a=b}}</code> will not be treated as <code>{{t|1=a=b}}</code>.</p>\n<p>You should either replace <code>=</code> with <code>{{=}}</code>:</p>\n<pre><code>{{BubbleBox/hex\n|classes=tagInfobox\n|styles=width: 350px; padding: 8px; float: right;\n|{{InfoboxTitle/hex|TEST}}\n&lt;div style{{=}}&quot;text-align: center;&quot;&gt;\n[[File:Inkipedia Logo 2022 - S3.svg]]\nInsert caption here\n&lt;/div&gt;\n{{{!}}\n{{InfoboxProperty/hex|TEST|text 1}}\n{{InfoboxProperty/hex|TEST2|text 2}}\n{{InfoboxProperty/hex|TEST333333|text 3 loong}}\n{{!}}}\n}}\n</code></pre>\n<p>or explicitly state the argument name:</p>\n<pre><code>{{BubbleBox/hex\n|classes=tagInfobox\n|styles=width: 350px; padding: 8px; float: right;\n|1={{InfoboxTitle/hex|TEST}}\n&lt;div style=&quot;text-align: center;&quot;&gt;\n[[File:Inkipedia Logo 2022 - S3.svg]]\nInsert caption here\n&lt;/div&gt;\n{{{!}}\n{{InfoboxProperty/hex|TEST|text 1}}\n{{InfoboxProperty/hex|TEST2|text 2}}\n{{InfoboxProperty/hex|TEST333333|text 3 loong}}\n{{!}}}\n}}\n</code></pre>\n"^^ . "0"^^ . "<p>I recently discovered the world of lua and I'm testing simple macros to improve the language. When I discovered that GHUB uses lua to make scripts, I tried to do something simple to hold recoil in any game</p>\n<pre><code>EnableRCS = true -- Quando definido como false, desativa o controle de recuo.\n\nRecoilControlMode = &quot;High&quot; -- Predefinições: &quot;Low&quot;, &quot;Medium&quot;, &quot;High&quot;, &quot;Ultra&quot;, &quot;Insanity&quot;, &quot;Custom&quot;\n\nRcCustomStrength = 7 -- O valor DEVE ser ARREDONDADO! Sem valores decimais como 6.5!\n\nRequireToggle = true -- Mude para false se você quiser que ele esteja sempre ativado.\n\nToggleKey = &quot;CapsLock&quot; -- Teclas utilizáveis: &quot;CapsLock&quot;, &quot;NumLock&quot;, &quot;ScrollLock&quot;\n\nDelayRate = 7 -- NÃO ALTERE SE VOCÊ NÃO SABE O QUE ESTÁ FAZENDO.\n\n-- Predefinições de Recuo --\nif RecoilControlMode == &quot;Low&quot; then\n RecoilControlStrength = 8\nelseif RecoilControlMode == &quot;Medium&quot; then\n RecoilControlStrength = 10\nelseif RecoilControlMode == &quot;High&quot; then\n RecoilControlStrength = 14\nend\n-- Predefinições de Recuo --\n\nEnablePrimaryMouseButtonEvents(true)\n\nfunction OnEvent(event, arg)\n OutputLogMessage(&quot;Event: %s, Arg: %d\\n&quot;, event, arg) -- Adiciona depuração\n if EnableRCS then\n if RequireToggle then\n if IsKeyLockOn(ToggleKey) then\n if IsMouseButtonPressed(3) then -- Botão direito do mouse\n repeat\n if IsMouseButtonPressed(1) then -- Botão esquerdo do mouse\n repeat\n MoveMouseRelative(0, RecoilControlStrength)\n Sleep(DelayRate)\n until not IsMouseButtonPressed(1)\n end\n until not IsMouseButtonPressed(3)\n end\n end\n else\n if IsMouseButtonPressed(3) then -- Botão direito do mouse\n repeat\n if IsMouseButtonPressed(1) then -- Botão esquerdo do mouse\n repeat\n MoveMouseRelative(0, RecoilControlStrength)\n Sleep(DelayRate)\n until not IsMouseButtonPressed(1)\n end\n until not IsMouseButtonPressed(3)\n end\n end\n end\nend\n\nOutputLogMessage(&quot;Script Loaded\\n&quot;)\n\n</code></pre>\n<p>The Script works perfectly apart from a single detail, for it to be active, in addition to the left and right click being pressed, I need to hold the g9 (side button of the g600)... with some simple debugging codes and help from the documentation provided by logitech, I couldn't find anything to solve this bug</p>\n<p>With capslock on and pressing the left and right buttons, the cursor would go down, but for that to happen I need to hold down the g9 on my mouse</p>\n"^^ . . . "1"^^ . . "2"^^ . "Not possible unless you're willing to modify the Lua implementation. Note also that a Lua-side hash function would be extremely likely to be slower than whatever is currently implemented in C, especially on PUC Lua."^^ . . . . . . . "0"^^ . . . . . "scripting"^^ . . . "0"^^ . "You need to be very familiar with the syntax of both languages to write a polyglot. Hint: One useful trick is to use comments. `--expr` is a double negation of `expr` in Python, but a comment in Lua. `#expr` is the length of `expr` in Lua, but a comment in Python. That way you can write expressions which only run in one of the respective languages. Now figure out how to write your program as an expression syntactically (hint: you can either use `load` / `eval`, or actually write expression-oriented code)."^^ . "How to write a pandoc lua filter function that replaces (wraps) Paragraphs with a custom-style div? Filter only for AST top-level Para blocks?"^^ . . . . . . . . . "0"^^ . "<h3>Issue Description</h3>\n<p>I am writing a Lua script to read a CSV file and parse each line into a table. While processing the CSV file, I noticed that the output format of the last line is incorrect.</p>\n<p>Here is the critical part of my code:</p>\n<pre class="lang-lua prettyprint-override"><code>function split(s, delimiter)\n local result = {};\n for match in (s..delimiter):gmatch(&quot;(.-)&quot;..delimiter) do\n table.insert(result, match);\n end\n return result;\nend\n\n\n\nfunction readCSV(filename)\n local file = io.open(filename, &quot;r&quot;)\n if not file then\n error(&quot;Failed to open file: &quot; .. filename)\n end\n\n local header = file:read()\n local headerArr = split(header, &quot;,&quot;)\n print(&quot;length of headerArr: &quot; .. #headerArr)\n for i, value in ipairs(headerArr) do\n print(i, value)\n end\n\n local data = {}\n\n for line in file:lines() do\n line = line:gsub(&quot;\\n&quot;, &quot;&quot;):gsub(&quot;\\r&quot;, &quot;&quot;)\n print(&quot;line: &quot; .. line)\n local valuesArr = split(line, &quot;,&quot;)\n print(&quot;length of valuesArr: &quot; .. #valuesArr)\n\n for i, value in ipairs(valuesArr) do\n -- print(i, value)\n end\n\n local entry = {}\n\n for i = 1, #valuesArr do\n print(&quot;headerArr[&quot; .. i .. &quot;]:&quot; .. headerArr[i])\n print(&quot;valuesArr[&quot; .. i .. &quot;]:&quot; .. valuesArr[i])\n -- print(&quot;headerArr[&quot; .. i .. &quot;] key = '&quot; .. headerArr[i] .. &quot;' , value = &quot; .. valuesArr[i])\n print(string.format(&quot;headerArr[%d] key = '%s' , value = '%s'&quot;, i, headerArr[i], valuesArr[i]))\n print(&quot;-------------------------------------------------&quot;)\n end\n\n for key, value in pairs(entry) do\n -- print(&quot;&gt;&gt;&gt; Entry[&quot; .. key .. &quot;]: &quot; .. value)\n end\n\n -- table.insert(data, entry)\n end\n\n file:close()\n\n return data\nend\n\n-- Usage example\nlocal filename = &quot;/Users/weijialiu/Downloads/FC 24 CT v24.1.1.4/FC_24_LE_ICONS.csv&quot;\nlocal data = readCSV(filename)\n\n-- Print the data\nfor i, entry in ipairs(data) do\n for header, value in pairs(entry) do\n print(header .. &quot;: &quot; .. value)\n end\n print(&quot;--------------------&quot;)\nend\n</code></pre>\n<h3>Problem Details</h3>\n<p>While processing the CSV file, the output format of the last line is incorrect. Specifically, the issue appears as:</p>\n<pre><code>...\nheaderArr[1021]:runningcode2\nvaluesArr[1021]:0\nheaderArr[1021] key = 'runningcode2' , value = '0'\n-------------------------------------------------\nheaderArr[1022]:modifier\nvaluesArr[1022]:2\nheaderArr[1022] key = 'modifier' , value = '2'\n-------------------------------------------------\nheaderArr[1023]:gkhandling\nvaluesArr[1023]:9\nheaderArr[1023] key = 'gkhandling' , value = '9'\n-------------------------------------------------\nheaderArr[1024]:eyecolorcode\nvaluesArr[1024]:2\n' , value = '2' key = 'eyecolorcode\n-------------------------------------------------\n</code></pre>\n<p>As shown above, the output format is disrupted, which seems to be an issue with string concatenation or data processing.</p>\n<h3>What I've Tried</h3>\n<ol>\n<li>Ensured correct string concatenation before printing.</li>\n<li>Checked the CSV file format to ensure there are no extra delimiters or newlines.</li>\n<li>Added debugging information to check each step of data processing.</li>\n</ol>\n<p>Despite these efforts, I still cannot pinpoint the cause of this issue. I would appreciate any help to resolve this problem. Thank you!</p>\n<p>The strangest thing is that this issue only occurs with the last line in each loop. We have obtained the correct result, but when it is printed, there is a problem. This is very strange.</p>\n"^^ . . "module"^^ . "0"^^ . "0"^^ . "@Емил Славчев – \nWhich version of LÖVE is it?"^^ . . "0"^^ . . . . . . "<p>This is likely to be because you were reading a file with the CRLF as the line terminator, but you forgot to trim the CR character from the header line:</p>\n<pre><code>local header = file:read():gsub(&quot;\\r&quot;, &quot;&quot;)\n</code></pre>\n"^^ . . "Can I avoid humanoid:ApplyDescription resetting previous changes made to humanoid?"^^ . . . "It would be good to mark your answer as accepted, then folks will know you found a solution that works."^^ . . . . "datastore"^^ . "game-development"^^ . "1"^^ . . . "user-interface"^^ . . . . "1"^^ . "0"^^ . . . "<p>Rig:CreateHumanoidModelFromUserId(UserID)</p>\n<p>--Make this the dummy would be best way</p>\n"^^ . . . . "0"^^ . "5"^^ . . . "1"^^ . "0"^^ . . "1"^^ . . . . . . "0"^^ . "<p>I managed to write this filter to replace Markdown Blockquote environments with a div for export to a Word template that uses special styles (that are also named differently than the default styles pandoc uses). I have no experience programming, but I worked out how to accomplish this:</p>\n<pre><code>function BlockQuote(elem)\n return pandoc.Div (elem.content, {[&quot;custom-style&quot;] = &quot;Displayed quotation&quot;})\nend\n</code></pre>\n<p>The next task is to write a similar function to turn every Paragraph into a special div environment (wrap it in a div in the AST), and also every First Paragraph (At the beginning of a section or after a block quote.)</p>\n<p>However, the &quot;Para&quot; element in the AST is present within other element I don't want to change. In other words, I only want to change the top-level Paras, not the ones within other elements (such as blockquote). How can I test for the level where the element is in the tree? Or is there a better way?</p>\n<p>And how can I test for whether a paragraph comes after a paragraph, a heading, or a blockquote?</p>\n<p>I also have general beginner questions about the syntax, and would like to see if I get it. &quot;elem&quot; is a variable that holds the content of the BlockQuote element. That content is a &quot;block&quot; (as opposed to an inline element), or in Lua terms, a table (but everything is a table in Lua?).</p>\n<p>I am trying to understand the syntax of accessing the content via elem.content. I think what's after the dot is a field in the table? Or in this case the whole table? For headers, there would be the expression elem.level to manipulate the level of the heading.</p>\n<p>What is the meaning of this syntax: variable_name.field_name (elem.content)? Where can I look up what fields are available?</p>\n<p>And where can I find the most beginner-friendly Lua tutorial, ideally with a focus on Pandoc?</p>\n<p>I know these are many questions, but the first one is the most important (actual one). Any help or input is greatly appreciated!</p>\n<p>I don't even know where to begin.</p>\n"^^ . . "1"^^ . . . . "2"^^ . "<h2>The Problem</h2>\n<p>I would like to automatically set the scroll offset to half the value of <code>vim.opt.lines</code> (see <code>:help lines</code>).</p>\n<h2>I Tried</h2>\n<p>I tried the following:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.opt.scrolloff = vim.opt.lines // 2\n</code></pre>\n<h2>I Expected</h2>\n<p>I expected this to retrieve the current value of <code>vim.opt.lines</code>, divide it by 2, and assign the result to <code>vim.opt.scrolloff</code>.</p>\n<h2>Results</h2>\n<p>This is what happened instead (upon reopening NeoVim):</p>\n<pre><code>Error detected while processing C:\\Users\\&lt;user&gt;\\AppData\\Local\\nvim\\init.lua:\nE5112: Error while creating lua chunk: C:\\&lt;user&gt;\\AppData\\Local\\nvim\\init.lua:24: unexpected symbol near '/'\nPress ENTER or type command to continue\n</code></pre>\n<h2>My Questions</h2>\n<ol>\n<li>Is this a syntax error?</li>\n<li>Is there any way to access <code>vim.opt.lines</code> or an equivalent value?</li>\n<li>Can I not access vim option values? Is this universally true, or only true in this situation because vim options are still being defined while <code>init.lua</code> is being processed?</li>\n</ol>\n<hr />\n<h2>Note</h2>\n<p>I have previously just used</p>\n<pre class="lang-lua prettyprint-override"><code>vim.opt.scrolloff = 26\n</code></pre>\n<p>which worked fine, but I was experimenting and wondering whether I could set it dynamically, which would be useful if I ever want to set the scroll offset to a quarter of the screen or something.</p>\n"^^ . . . . . . "0"^^ . . . . . . "0"^^ . . "lua"^^ . . "lua-ngx-module"^^ . "1"^^ . "<p>I am experimenting in Roblox Studio, and I want to create a logic that would give all players the same skin. (All players must look the same during gameplay.)</p>\n<p>I found two options:</p>\n<p><strong>First option</strong>: Drag the model to <code>ReplicatedStorage</code> and add the following script to <code>ServerScriptService</code></p>\n<pre class="lang-lua prettyprint-override"><code>local Players = game:GetService(&quot;Players&quot;)\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\n\nlocal newSkin = ReplicatedStorage:WaitForChild(&quot;NewSkinModel&quot;)\n\nPlayers.PlayerAdded:Connect(function(player)\n    player.CharacterAdded:Connect(function(character)\n        character:WaitForChild(&quot;Humanoid&quot;)\n        \n        local newCharacter = newSkin:Clone()\n        newCharacter.Name = player.Name\n        \n        local humanoid = newCharacter:WaitForChild(&quot;Humanoid&quot;)\n        humanoid:ApplyDescription(player.Character.Humanoid:GetAppliedDescription())\n        \n        player.Character = newCharacter\n        newCharacter.Parent = workspace\n    end)\nend)\n</code></pre>\n<p><strong>Second option</strong>: Upload the model to <code>StarterPlayer</code>.</p>\n<p>But unfortunately neither option helps me. I tried to find issues in the code, but I couldn't find anything.</p>\n"^^ . "<p>I'm coding an inventory system in Computer Craft and I'd like to know if it would be possible to make a file edit variable that it doesn't exactly know about...</p>\n<p>Here's my file structure:</p>\n<pre><code>root\\\n inv.lua\n chestAPI\\\n inv_list.lua\n inv_scan.lua\n</code></pre>\n<p>So my <code>inv_scan.lua</code> file scans all my inventories and stores the data in a 2D array.\nMy <code>inv_list.lua</code> file is supposed to take that data and print it to a monitor.</p>\n<p>Scanning all the inventories takes some time and I'd like to only do it once when you boot up the computer OR when you click refresh on the monitor to keep it optimized.</p>\n<p>My listing script needs the scan script's variables to be able to print anything. The <code>inv.lua</code> script controls everything. It currently calls the scanning script when it gets executed and the it waits for a user input (because I'm going to add scripts to add or fetch items from the storage.</p>\n<p>So I want the <code>inv.lua</code> to call the scan, get all the variables, shoot them to the listing script if the user wants to display the items, and then the listing will read them and print them.</p>\n<p>I could do everything in one file but it would be horribly organized.</p>\n<p>I tried using require(), but then the listing would always call the scan and it wouldn't be as optimized as I want it to be.</p>\n<p>That's pretty much the only thing I tried that gave me a result. I learned Lua while making this project so I'm not that familiar with everything.</p>\n<hr />\n<h2><strong>EDIT</strong></h2>\n<p>While writing the minimal example, I fixed my problem. Here's how I did it.</p>\n<p>Minimal example:</p>\n<p>scan.lua</p>\n<pre class="lang-lua prettyprint-override"><code>--some heavy scanning\nfunction scan()\n data1 = 1 + 1\n data2 = 4/2\n return data1, data2\nend\n</code></pre>\n<p>print.lua</p>\n<pre class="lang-lua prettyprint-override"><code>--printing the data\nfunction print(data1, data2)\n print(data1)\n print(data2)\nend\n</code></pre>\n<p>main.lua</p>\n<pre class="lang-lua prettyprint-override"><code>local scanner = require(&quot;scan.lua&quot;)\nlocal printer = require(&quot;print.lua&quot;)\n\n--get the data\ndata1, data2 = scanner.scan()\n\n--wait for user input and then print it\nwhile true do\n input = read()\n if input == &quot;print&quot; then\n printer.print(data1, data2)\n end\nend\n</code></pre>\n<p>so with this, I can do the scan only when needed and I can print as much as I want.</p>\n"^^ . "Premake5 - cppdialect is ignored while creating project for VS2022"^^ . "0"^^ . "Is this the complete code, the visual inspection shows there are some syntactical problems"^^ . "<p>As long as the module is in your <code>LUA_PATH</code> (see <a href="https://www.lua.org/pil/8.1.html" rel="nofollow noreferrer">The require function</a> in Programming in Lua), you can just require it and execute the function:</p>\n<pre class="lang-lua prettyprint-override"><code>local yes_no = require(&quot;yesno&quot;)\nprint(yes_no(&quot;y&quot;)) -- should print true\n</code></pre>\n<p>It all comes down to where you're putting the module and how you intend to use it.</p>\n<p>If it's available on <a href="https://luarocks.org/" rel="nofollow noreferrer">LuaRocks</a> (though I couldn't find it there), you can just install it globally.</p>\n<p>You may also just copy-paste the code into any directory that's part of your <code>LUA_PATH</code> (or you can add a custom directory to your <code>LUA_PATH</code>), if you're only planning on using it in your CLI.</p>\n<p>If you need the module in a bigger project and it isn't available on LuaRocks, you can just put it somewhere in your project (while observing licensing conditions, if any, of course).</p>\n"^^ . . . "3"^^ . . . "0"^^ . . "Thanks, but I'd rather continue using `re` and not change how I implement the quoted rule."^^ . "0"^^ . . . . . . "0"^^ . . "0"^^ . "How to use LPeg to replace parts of the matched grammar?"^^ . "How to Apply the Same Skin to All Players in Roblox?"^^ . . . "0"^^ . "what is your question? you won't get a tutorial here. you need to ask a distinct question. what is the first thing you cannot solve?"^^ . "1"^^ . . "0"^^ . "0"^^ . "<p>I reinstalled <code>neovim</code> and followed <a href="https://www.youtube.com/watch?v=6pAG3BHurdM" rel="nofollow noreferrer">the suggestions in this video</a>. Lua syntax highlighting worked perfectly fine, until I added the following file <code>lazy.lua</code> file (and a <code>require</code> in my <code>init.lua</code>)</p>\n<pre><code>local lazypath = vim.fn.stdpath(&quot;data&quot;) .. &quot;/lazy/lazy.nvim&quot;\nif not vim.loop.fs_stat(lazypath) then\n vim.fn.system({\n &quot;git&quot;,\n &quot;clone&quot;,\n &quot;--filter=blob:none&quot;,\n &quot;https://github.com/folke/lazy.nvim.git&quot;,\n &quot;--branch=stable&quot;, -- latest stable release\n lazypath,\n })\nend\nvim.opt.rtp:prepend(lazypath)\n\n\nrequire(&quot;lazy&quot;).setup(&quot;my.plugins&quot;)\n</code></pre>\n<p>It is this last line that breaks things. If I comment it out, things work as before. If I leave it uncommented then:</p>\n<p><strong>I get this error whenever I open a Lua file</strong>:</p>\n<pre><code>Error detected while processing function &lt;SNR&gt;22_NetrwBrowseChgDir[194]..&lt;SNR&gt;22_NetrwEditFile[10]..BufRea\ndPost Autocommands for &quot;*&quot;: \nError executing lua callback: /usr/share/nvim/runtime/filetype.lua:36: function &lt;SNR&gt;22_NetrwBrowseChgDir[\n194]..&lt;SNR&gt;22_NetrwEditFile[10]..BufReadPost Autocommands for &quot;*&quot;..FileType Autocommands for &quot;*&quot;..function\n &lt;SNR&gt;1_LoadFTPlugin[20]..script /usr/share/nvim/runtime/ftplugin/lua.lua: Vim(runtime):E5113: Error while\n calling lua chunk: /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:107: no parser for 'lua' langu\nage, see :help treesitter-parsers \nstack traceback: \n [C]: in function 'error' \n /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:107: in function 'add' \n /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:111: in function 'new' \n /usr/share/nvim/runtime/lua/vim/treesitter.lua:41: in function '_create_parser' \n /usr/share/nvim/runtime/lua/vim/treesitter.lua:108: in function 'get_parser' \n /usr/share/nvim/runtime/lua/vim/treesitter.lua:416: in function 'start' \n /usr/share/nvim/runtime/ftplugin/lua.lua:2: in main chunk \n [C]: in function 'nvim_cmd' \n /usr/share/nvim/runtime/filetype.lua:36: in function &lt;/usr/share/nvim/runtime/filetype.lua:35&gt; \n [C]: in function 'pcall' \n vim/shared.lua: in function &lt;vim/shared.lua:0&gt; \n [C]: in function '_with' \n /usr/share/nvim/runtime/filetype.lua:35: in function &lt;/usr/share/nvim/runtime/filetype.lua:10&gt; \nstack traceback: \n [C]: in function '_with' \n /usr/share/nvim/runtime/filetype.lua:35: in function &lt;/usr/share/nvim/runtime/filetype.lua:10&gt; \n</code></pre>\n<p>I get a similar error with vimscript which I also don't get if I comment out the last line.</p>\n<hr />\n<p><strong>Background info</strong>: I am on Linux (Ubuntu), and have not added any other things to my .config/nvim folder, apart from a few key remappings. I have never installed treesitter, and the command <code>TSupdate</code> in nvim gives <code>E492: Not an editor command: TSupdate</code>. Yet there is a treesitter directory in my <code>/usr/share/nvim/runtime/lua/vim/</code>.</p>\n<p>Here is the output of tree inside <code>~/.config/nvim</code>:</p>\n<pre><code>├── init.lua\n├── lazy-lock.json\n└── lua\n └── my\n ├── core\n │   ├── init.lua\n │   ├── keymaps.lua\n │   └── options.lua\n ├── lazy.lua\n └── plugins\n └── init.lua\n</code></pre>\n<p>And the contents of <code>init.lua</code> inside <code>~/.config/nvim</code> are:</p>\n<pre><code>require(&quot;my.core&quot;)\nrequire(&quot;my.lazy&quot;)\n</code></pre>\n<p>The contents of lazy.lua is file at the start of this question. The contents of <code>core/</code> is just some minor unrelated keymappings and options changes. The contents of <code>plugins/init.lua</code> is either empty, or the following, both of which produce the error:</p>\n<pre><code>return {\n &quot;nvim-lua/plenary.nvim&quot;,\n &quot;christoomey/vim-tmux-navigator&quot;,\n}\n</code></pre>\n<hr />\n<p><strong>What could possibly explain this?</strong> How could adding a <code>require(&quot;lazy&quot;).setup(&quot;my.plugins&quot;)</code> suddenly break the parser?</p>\n<p><strong>EDIT</strong>:\nrunning <code>:checkhealth</code> inside vim gives the following:</p>\n<pre><code>==============================================================================\nlazy: require(&quot;lazy.health&quot;).check()\n\nlazy.nvim ~\n- {lazy.nvim} version `11.14.1`\n- OK {git} `version 2.34.1`\n- OK no existing packages found by other package managers\n- OK packer_compiled.lua not found\n\nluarocks ~\n- checking `hererocks` installation\n- OK no plugins require `luarocks`, so you can ignore any warnings below\n- OK {python3} `Python 3.11.7`\n- ERROR {/home/noahj/.local/share/nvim/lazy-rocks/hererocks/bin/luarocks} not installed\n- WARNING {/home/noahj/.local/share/nvim/lazy-rocks/hererocks/bin/lua} version `5.1` not installed\n- WARNING Lazy won't be able to install plugins that require `luarocks`.\n Here's what you can do:\n - fix your `luarocks` installation\n - disable *hererocks* with `opts.rocks.hererocks = false`\n - disable `luarocks` support completely with `opts.rocks.enabled = false`\n\n==============================================================================\nvim.deprecated: require(&quot;vim.deprecated.health&quot;).check()\n\n- OK No deprecated functions detected\n\n==============================================================================\nvim.health: require(&quot;vim.health.health&quot;).check()\n\nConfiguration ~\n- OK no issues found\n\nRuntime ~\n- OK $VIMRUNTIME: /usr/share/nvim/runtime\n\nPerformance ~\n- OK Build type: RelWithDebInfo\n\nRemote Plugins ~\n- OK Up to date\n\nterminal ~\n- ERROR command failed: infocmp -L\n infocmp: couldn't open terminfo file (null).\n \n- $COLORTERM=&quot;truecolor&quot;\n\nExternal Tools ~\n- WARNING ripgrep not available\n\n==============================================================================\nvim.lsp: require(&quot;vim.lsp.health&quot;).check()\n\n- LSP log level : WARN\n- Log path: /home/noahj/.local/state/nvim/lsp.log\n- Log size: 0 KB\n\nvim.lsp: Active Clients ~\n- No active clients\n\nvim.lsp: File Watcher ~\n- file watching &quot;(workspace/didChangeWatchedFiles)&quot; disabled on all clients\n\nvim.lsp: Position Encodings ~\n- No active clients\n\n==============================================================================\nvim.provider: require(&quot;vim.provider.health&quot;).check()\n\nClipboard (optional) ~\n- OK Clipboard tool found: xsel\n\nNode.js provider (optional) ~\n- Node.js: v12.22.9\n \n- WARNING Missing &quot;neovim&quot; npm (or yarn, pnpm) package.\n - ADVICE:\n - Run in shell: npm install -g neovim\n - Run in shell (if you use yarn): yarn global add neovim\n - Run in shell (if you use pnpm): pnpm install -g neovim\n - You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim\n\nPerl provider (optional) ~\n- WARNING &quot;Neovim::Ext&quot; cpan module is not installed\n - ADVICE:\n - See :help |provider-perl| for more information.\n - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim\n- WARNING No usable perl executable found\n\nPython 3 provider (optional) ~\n- WARNING No Python executable found that can `import neovim`. Using the first available executable for diagnostics.\n- WARNING Could not load Python :\n /home/noahj/anaconda3/bin/python3 does not have the &quot;neovim&quot; module.\n python3.12 not found in search path or not executable.\n /home/noahj/anaconda3/bin/python3.11 does not have the &quot;neovim&quot; module.\n /usr/bin/python3.10 does not have the &quot;neovim&quot; module.\n python3.9 not found in search path or not executable.\n python3.8 not found in search path or not executable.\n python3.7 not found in search path or not executable.\n /home/noahj/anaconda3/bin/python does not have the &quot;neovim&quot; module.\n - ADVICE:\n - See :help |provider-python| for more information.\n - You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim\n- Executable: Not found\n\nPython virtualenv ~\n- OK no $VIRTUAL_ENV\n\nRuby provider (optional) ~\n- Ruby: ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]\n- WARNING `neovim-ruby-host` not found.\n - ADVICE:\n - Run `gem install neovim` to ensure the neovim RubyGem is installed.\n - Run `gem environment` to ensure the gem bin directory is in $PATH.\n - If you are using rvm/rbenv/chruby, try &quot;rehashing&quot;.\n - See :help |g:ruby_host_prog| for non-standard gem installations.\n - You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim\n\n==============================================================================\nvim.treesitter: require(&quot;vim.treesitter.health&quot;).check()\n\n- Nvim runtime ABI version: 14\n</code></pre>\n"^^ . . . "<p>session:getState();</p>\n<p>or\nexecute_on_ring\nexecute_on_media\nexecute_on_answer</p>\n"^^ . . . . . . "<p>Here is the code:</p>\n<pre><code>--Esentials\nlocal tool = script.Parent\nrepeat wait() until tool.Parent:FindFirstChild(&quot;Humanoid&quot;)\n\nlocal player = game.Players:GetPlayerFromCharacter(tool.Parent)\nlocal animator = tool.Parent:FindFirstChild(&quot;Humanoid&quot;).Animator\n\nlocal dmgM = player.PlayerGui.Stats.DamageMultiplier.DMGmultiplier.Value\nlocal dmgMT = player.PlayerGui.Stats.DamageMultiplier\n\ntool.Activated:Connect(function()\n holding = true\n if combo == 0 then\n idle:Stop()\n hold1:Play()\n dmgMT.Visible = true\n repeat\n dmgM += 0.01\n dmgMT.Text = &quot;x&quot;..math.clamp(dmgM, 1, 2)\n wait(0.01)\n until holding == false or dmgM == 2\n elseif combo == 1 then\n idle:Stop()\n hold2:Play()\n dmgMT.Visible = true\n repeat\n dmgM += 0.01\n dmgMT.Text = &quot;x&quot;..math.clamp(dmgM, 1, 2)\n wait(0.01)\n until holding == false or dmgM == 2\n end\nend)\n\ntool.Deactivated:Connect(function()\n holding = false\n hold1:Stop()\n hold2:Stop()\n if combo == 0 and holding == false then\n dmgMT.Visible = false\n dmgM = 1\n tool.Enabled = false\n tool.Hitbox.CanTouch = true\n wait(0.3)\n idle:Play()\n tool.Enabled = true\n tool.Hitbox.CanTouch = false\n combo += 1\n elseif combo == 1 and holding == false then\n dmgMT.Visible = false\n dmgM = 1\n tool.Enabled = false\n tool.Hitbox.CanTouch = true\n wait(0.5)\n idle:Play()\n tool.Enabled = true\n tool.Hitbox.CanTouch = false\n end\nend)\n\ntool.Hitbox.Touched:Connect(function(hit)\n if hit.Parent:FindFirstChild(&quot;Humanoid&quot;) then\n local tgrPlayer = game.Players:GetPlayerFromCharacter(hit.Parent)\n if not tgrPlayer then\n local hum = hit.Parent:FindFirstChild(&quot;Humanoid&quot;)\n local humRP = hit.Parent:FindFirstChild(&quot;HumanoidRootPart&quot;)\n humRP.AssemblyLinearVelocity = Vector3.new(50, 25, 0)\n tool.Handle.Hit:Play()\n local total = baseDMG * dmgM\n hum:TakeDamage(total)\n print(total)\n tool.Hitbox.CanTouch = false\n elseif tgrPlayer then\n return end\n end\nend)\n</code></pre>\n<p>I tried making it where when the player charges the tool up for a specific amount of time, the damage output will be multiplied to the base damage.</p>\n<p>For example: When I charge the tool until it hits the maximum, the base damage will be multiplied by the damage multiplier.</p>\n<p>I tried doing &quot;Humanoid:TakeDamage(total)&quot; as you can see in the piece of code and tried printing the damage output. It was only printing the base damage, and not the total damage. How do I fix this?</p>\n"^^ . . . . . . . . . . "0"^^ . "1"^^ . . . . . "Lua scripting being used in mouse macro. (logitech)"^^ . . "0"^^ . "Thank you! This answers the first part of my question. But what happens to `foo` if I have a custom finalizer that doesn't explicitly callse `free` on it? Is the memory still released after the finalizer is done?"^^ . . . "0"^^ . . . . . "httprequest"^^ . . "@Luatic - Could you be more specific? If doable, how? I'd still like to know, and can you go more into detail of the performance hit and/or maintainability? Thank you."^^ . . "5"^^ . . . . . . . "0"^^ . . . . . "<p>Ok</p>\n<p>I just unninstalled Lua and Luarocks anyways and worked too.\nThis forum was completely unnecessary to post &gt;:(</p>\n"^^ . "0"^^ . . "0"^^ . . . . . . . . "0"^^ . . "You can even reproduce it with a simple CSV like this:\na,b,c\n1,2,3\n4,5,6\n7,8,9\n!!!"^^ . . . . . . . "1"^^ . "<p>I am reasonably new to Roblox studio and I am trying to make a train system. I would like to have a wheel(s) that follow another model (the track) and the rail inside that. this means when you apply movement via vector forces or change <code>CFrame</code> scripts, you want each wheel to follow the rail, applying a turning effect. The moving part also needs to be anchored. EDIT: Here is the bogie I have so far:<a href="https://i.sstatic.net/6jyPOyBM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6jyPOyBM.png" alt="The New Emd Bogie" /></a></p>\n<p>I haven't tried a lot as I'm not sure where to start.\nMaybe something along these lines:</p>\n<pre><code> local function position_wheel(object,wheel):\n if wheel:IsA(&quot;BasePart&quot;) and object:IsA(&quot;BasePart&quot;) then\n wheel.Position=object.PivotPoint.Position+Vector3(0,.2,0) \n \n\n \n for w in pairs(workspace) do\n if w:IsA(&quot;Model&quot;) or w:IsA(&quot;BasePart&quot;) then\n local objecT=w.Touched:Connect(function(part)\n position_wheel(object,w)\n \n</code></pre>\n<p>Note: This code does not contain any name checks, this is purely for example. Do not copy and paste without editing the code!</p>\n<p>Any suggestions would be greatly appreciated.</p>\n"^^ . . . . "3"^^ . . . . . . . . . . . "channel"^^ . . . . . "2"^^ . "2"^^ . "1"^^ . . "templates"^^ . . . . . . . "1"^^ . "1"^^ . . . . . . "2"^^ . . "<p>While ClickDetectors work in both the client (local scripts) and the server (normal scripts), it is important to note that local scripts do not run when they are parented to Workspace. They will either need to be in <code>PlayerGui</code> or <code>PlayerScripts</code>, which can be done through parenting them to <code>StarterPlayeScripts</code> or <code>StarterGui</code>. Generally, client-sided scripts are used for things such as animations but for this case (opening a door), doing it on the server is fine.</p>\n<p>Note: Having doors open on the server is still bad, and in the ideal case, you would want to register the <code>MouseClick</code> on the server, and then fire a remote event to all clients to tween the door open. However, doing the tween on the server is fine too, albeit more inefficient.</p>\n<p>Anyway, your script accesses the click detector through <code>script.Parent</code>, meaning your script will need to be placed directly inside the click detector. And, because local scripts do not run when inside workspace (and because you want all players to see the door opening), this will need to be a regular script.</p>\n<p>If this is a regular script and it is right inside the click detector, it will work. Make sure your click detector is right inside the part that is to be clicked.</p>\n"^^ . . "Thank you SO MUCH for responding, this is the only error I've had the entire time ;-;"^^ . . "The `InspectPlayerFromHumanoid` method is no longer used."^^ . "<p>I am trying to use a Tween to smoothly move a Part. My current script creates a part, then moves it to a target over the course of a second. For some reason the part's position cannot be changed via script or the move tool after being moved.</p>\n<p>Here's my LocalScript, which binds the creation and movement of a Part to a TextButton.</p>\n<pre class="lang-lua prettyprint-override"><code>local tweenService = game:GetService(&quot;TweenService&quot;)\nlocal runService = game:GetService(&quot;RunService&quot;)\nlocal player = game.Players.LocalPlayer\n\nlocal RunServiceEvent = nil\nlocal tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)\n\nfunction SpawnPart()\n local part = Instance.new(&quot;Part&quot;)\n part.Anchored = true\n part.Parent = game.Workspace.Clutter.Coins\n\n local startPos = Vector3.new(0, 2, 0)\n part.Position = startPos\n\n local TargetPosition = Vector3.new(5, 2, 0)\n\n local Tween = tweenService:Create(part, tweenInfo, {Position = TargetPosition})\n Tween:Play()\n\n local StartTime = tick()\n RunServiceEvent = runService.RenderStepped:Connect(function()\n local Time = (tick() - StartTime) / tweenInfo.Time\n\n if part == nil then return end\n\n if Time &gt; 1 then\n part.Position = TargetPosition\n return\n end\n end)\n\n task.spawn(function()\n Tween.Completed:Wait()\n task.wait()\n RunServiceEvent = nil\n end)\nend\n\nplayer:WaitForChild(&quot;PlayerGui&quot;):WaitForChild(&quot;ScreenGui&quot;):WaitForChild(&quot;TextButton&quot;).Activated:Connect(SpawnPart)\n</code></pre>\n<p>To reproduce, create the following structure, then play the game and click the GUI button.</p>\n<pre class="lang-none prettyprint-override"><code>├── StarterGui\n│ ├── ScreenGui\n│ │ ├── TextButton\n├── StarterPlayer\n│ ├── StarterPlayerScripts\n│ │ ├── LocalScript\n</code></pre>\n<p>After the Tween finishes, the move tool (or trying to move via script) no longer has any affect on the new part.</p>\n<p>You can also download this .rbxl file: <a href="https://github.com/SkitBoies/testplace" rel="nofollow noreferrer">TestPlace</a></p>\n"^^ . . . "<p>You could use a part surrounding the object/model/part to which you would like to give a hitbox. Here are a few details on how to do that. Create a normal part and resize it to what you want, covering the model with the hitbox. Set the <code>CanCollide</code> property to false. Weld the hitbox to the part you want to have a hitbox. Insert a script to check for the <code>Touched</code> event then connect a function. Example:</p>\n<pre><code>local hitbox=script.parent\nhitbox.Touched:Connect(function()\n print(&quot;object touched&quot;!)\n \n end)\n\n</code></pre>\n<p>Hope this helps!</p>\n"^^ . "0"^^ . . . "1"^^ . . "0"^^ . "0"^^ . . . . "0"^^ . . . "5"^^ . . . "Why does `for key, value in table` stop working in Lua 5.1 and later?"^^ . . "Thanks! That clarifies what I was wondering about, thank you for explaining!"^^ . . "How did you go about installing Neovim? If it was installed via some package manager, which one and with which command?"^^ . . "0"^^ . "1"^^ . . "1"^^ . . . "1"^^ . . "Read this https://create.roblox.com/docs/scripting/events and understand that `uis.InputBegan:Connect(function(input)...` just tells the game to call the anonymous function whenever an input begins. so doiing this once is enough. so if you want the game to do something on a mouse click, that provided function is the place to implement that. your movements also don't make any sense. I think you should spend more time reading documentations and thinking about your game. you seem pretty lost. I don*t want to discourage you but is is very important to understand the basics"^^ . "1"^^ . "0"^^ . . . . "3"^^ . . "@KyleF.Hartzenberg, so how is it possible that lua is still correctly parsed when I don't include `require("lazy").setup("my.plugins")`?"^^ . . . . . "0"^^ . "ClickDetector not detecting input"^^ . "arrays"^^ . . . . "logitech"^^ . "that's something that happens a lot. reducing the complexity is the key to solving problems."^^ . . . "0"^^ . . "1"^^ . . . . "<p>Turns out it wasn't as complex as I thought it would be. All I had to do was add this to the part that updates the player's skin color:</p>\n<pre><code>elseif changeName == &quot;Skin&quot; then\n if character:FindFirstChild(&quot;BodyColors&quot;) then\n character.BodyColors:Destroy()\n end\n local BodyColors = v2:Clone()\n BodyColors.Name = &quot;BodyColors&quot;\n BodyColors.Parent = character\n \n --What I added \n local humanoid = character:FindFirstChild(&quot;Humanoid&quot;)\n local description = humanoid:GetAppliedDescription()\n description.HeadColor = BodyColors.HeadColor3\n description.LeftArmColor = BodyColors.LeftArmColor3\n description.LeftLegColor = BodyColors.LeftLegColor3\n description.RightArmColor = BodyColors.RightArmColor3\n description.RightLegColor = BodyColors.RightLegColor3\n description.TorsoColor = BodyColors.TorsoColor3\n humanoid:ApplyDescription(description)\n</code></pre>\n<p>This uses <code>humanoid:ApplyDescription</code> to update the skin color after changing replacing the <code>BodyColors</code> instance within the character, so when updating the face via the same method the skin color no longer gets reset.</p>\n"^^ . . "You should follow the examples on the wiki: https://www.love2d.org/wiki/love.keypressed"^^ . "0"^^ . . "0"^^ . . . . . "1"^^ . . . . "0"^^ . . "2"^^ . . "<p>LocalScripts execute on each individual client, and objects created in LocalScripts are not replicated to other players.</p>\n<p>This means that Player A will have a ProximityPrompt in their torso that they can see, and Player B will have a ProximityPrompt in their torso that they can see, but Player A will not be able to see Player B's prompt and B will not be able to see A's either.</p>\n<p>The way to solve this is to move your logic into a Script in ServerScriptService that will create the ProximityPrompts on the server. And to keep communication simple, I would create a RemoteEvent that your LocalScripts can listen to for when the prompts are activated.</p>\n<p>That way, every player will be able to see and interact with each other's prompts :</p>\n<pre class="lang-lua prettyprint-override"><code>-- get services\nlocal Players = game:GetService(&quot;Players&quot;)\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\n\n-- find the RemoteEvent in ReplicatedStorage\nlocal CharacterProximityPromptActivated : RemoteEvent = ReplicatedStorage.CharacterProximityPromptActivated\n\n-- when a player joins the game, create the proximity prompt in the player's torso\nPlayers.PlayerAdded:Connect(function(player)\n player.CharacterAdded:Connect(function(character)\n -- check if they have an R6 or R15 character model\n local torso = character.Torso\n if not torso then\n torso = character.UpperTorso\n end\n local prompt : ProximityPrompt = Instance.new(&quot;ProximityPrompt&quot;, torso)\n prompt.Triggered:Connect(function(activator)\n -- tell the player that activated the prompt to do something...\n CharacterProximityPromptActivated:FireClient(activator, player)\n end)\n end)\nend)\n</code></pre>\n<p>Then, in your LocalScript, listen for when the RemoteEvent tells you that you've activated a ProximityPrompt :</p>\n<pre class="lang-lua prettyprint-override"><code>local GuiService = game:GetService(&quot;GuiService&quot;)\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\n\n-- find the RemoteEvent in ReplicatedStorage\nlocal CharacterProximityPromptActivated : RemoteEvent = ReplicatedStorage.CharacterProximityPromptActivated\n\nCharacterProximityPromptActivated.OnClientEvent:Connect(function(otherPlayer : Player)\n print(string.format(&quot;You have activated %s's ProximityPrompt&quot;, otherPlayer.Name))\n\n -- inspect the player\n local humanoid = player.Character.Humanoid\n local humanoidDescription = humanoid:GetAppliedDescription()\n GuiService:InspectPlayerFromHumanoidDescription(humanoidDescription, otherPlayer.Name)\nend)\n</code></pre>\n"^^ . . "c++"^^ . . . . "<p>I made a building out of parts, and grouped them together in order to move it easier. However, when I tried attaching a script to it that used the Anchored keyword, it did not work. Here is the code:</p>\n<pre class="lang-lua prettyprint-override"><code>task.wait(5)\n\nscript.Parent.Anchored = false\n</code></pre>\n<p>I expected the building to fall apart after 5 seconds, but it did not. I did some experimentation and the same problem applied to other grouped parts. Could someone please tell me a simple way to apply a script to a large amount of parts, with the &quot;Anchored&quot; keyword allowed?</p>\n"^^ . "My Script inside my model's part doesn't run when I clone it"^^ . . . . . "<p>Using Freeswitch, I am desperately trying to get the channel Call State value in Lua.</p>\n<p>The Lua script is executed by posting an HTTP request to Verto..</p>\n<p>This is the Lua code I have, so far:</p>\n<pre class="lang-lua prettyprint-override"><code>api = freeswitch.API()\nuuid = api:executeString(&quot;create_uuid&quot;)\n[... some blablabla code....]\ndialstr = &quot;{uuid=&quot; ... uuid ...&quot;,caller_id_number=&quot; ... callerId ... &quot; .....&quot; and so on\n\nret = api:execute(&quot;originate&quot;, dialstr)\ncon = freeswitch.EventComsumer(&quot;all&quot;)\ncheck = true\nwhile check do\n event = con:pop(1)\n event_name = event:getHeader(&quot;Event-Name&quot;)\n print(event_name)\n event_state = event:getHeader(&quot;Channel-Call-State&quot;)\n print(event_state)\nend -- end while\n</code></pre>\n<ol>\n<li>The above lines will fail when printing <code>event_state</code> because\n<code>event_state</code> is nil, but <code>event_name</code> will correctly show up.</li>\n<li>Changing to:</li>\n</ol>\n<pre><code>event_state = api:execute_string(&quot;eval uuid:&quot; .. uuid .. &quot; ${Channel-Call-State}&quot;\n</code></pre>\n<p>Will always return early!</p>\n<p>Any explanation for this behaviour? How can I get the call state using Lua and the Freeswitch API? I need to check when the call is ringing, answered, busy, congestion, hangup, etc.... until it is in the reporting state (and access CDR).</p>\n"^^ . . . . "<p>You can not do an assignment inside an if condition in lua.</p>\n<p>I dont really see the point, you could just run the function and assignment before your if condition.</p>\n<pre class="lang-lua prettyprint-override"><code>local matches = Regex(&quot;THIS IS a TEST&quot;, &quot;%a&quot;) \nif matches then\n print &quot;is a match&quot;\nend\n</code></pre>\n<p>If you are so inclined to keep that flow, you could have your regex function save to some global variable and then return true or false, or you could have it store the data internally to avoid the global.</p>\n<pre class="lang-lua prettyprint-override"><code>local regex = {\n matches = {}\n}\nlocal mt = {\n match = function(self, str, pattern)\n found = false\n for w in string.gmatch(str, pattern) do\n self.matches[w] = true; -- or like whatever you want to do here.\n found = true\n end\n return found\n end\n}\nmt.__index = mt\nsetmetatable(regex, mt)\n\nif (regex:match(&quot;THIS IS a TEST&quot;, &quot;%a&quot;))then\n print(&quot;is a match&quot;)\nend\n</code></pre>\n"^^ . . "<p>You can set the keyword to the door:\n<code>door.Keyword = &quot;sesame&quot;</code></p>\n<p>And than just check it:</p>\n<pre class="lang-lua prettyprint-override"><code>if (msg == door.Keyword) then\n-- open the door for 4 seconds\n</code></pre>\n<p>See also: <a href="https://stackoverflow.com/a/10158547/12968803">https://stackoverflow.com/a/10158547/12968803</a></p>\n"^^ . . . . . "<p>For some reason my Click Detector that I had put inside of my Local Script / Script (tried both) doesn't detect when it's clicked on. Does anyone know what causes this?\nCode:</p>\n<pre><code>local ts = game:GetService(&quot;TweenService&quot;)\n\nlocal labdoor = script.Parent.Parent[&quot;Laboratory door&quot;]\nlocal cframe = labdoor.CFrame\n\nlocal goal = {Position = Vector3.new(484.15, 67.44, 188.125)}\n\nlocal tweeninfo = TweenInfo.new(1)\n\nlocal tween = ts:Create(labdoor, tweeninfo, goal)\n\nscript.Parent.MouseClick:Connect(function(plr)\n\n print(plr.Name, &quot; pressed the button!&quot;)\n tween:Play()\n\nend)\n</code></pre>\n<p>I tried putting it both inside and outside of click detector, server sided and client sided script, but they don't seem to do anything.</p>\n<p>Now, the more correct question to ask, is why it works in a brand new place, but not in the one that I'm currently working on. The <code>ClickDetector</code> works on the same door, same everything, I just straight up can copy and paste from 1 experience to other, and it'll work. <code>ClickDetector</code> parent is the part that is the button, and the scripts parent is the <code>ClickDetector</code>.</p>\n"^^ . "<p>In general, when I add it to the workspace, it is added, but after I install it, the commands do not work. It works in another place.</p>\n<p>I tried deleting and adding back the pack, reopening the project and restarting Roblox studio, but it didn't help.\nHow can i fix this?</p>\n"^^ . . . . . . "0"^^ . . "<p>Using the <a href="https://github.com/pandoc-ext/multibib" rel="nofollow noreferrer">multibib filter</a>, it is possible to insert several bibliographies in a Quarto document, like this:</p>\n<pre class="lang-r prettyprint-override"><code>---\nformat:\n pdf\nfilters: \n - multibib\ntitle: &quot;Test&quot;\ncsl: elsevier-harvard.csl\n\n# Turn off YAML validation\nvalidate-yaml: false\n\nbibliography:\n main: references.bib\n lit: literature.bib \n\n# Disable citeproc\nciteproc: false\n---\n\n\n# Main text\n\n@bb\n\n@aa\n\n# Bibliography\n\n::: {#refs-main}\n:::\n\n# Appendix\n\n::: {#refs-lit}\n:::\n</code></pre>\n<p>with <code>references.bib</code> containing:</p>\n<pre><code>@Article{aa,\n author = {Author, A.},\n title = {Title},\n journal = {Journal},\n year = 2000\n}\n</code></pre>\n<p>and <code>literature.bib</code> containing;</p>\n<pre><code>@Article{bb,\n author = {Brother, B.},\n title = {Titling Titling Titling Titling Titling Titling Titling Titling Titling Titling Titling Titling Titling Titling Titling Titling},\n journal = {Ann. J.},\n year = 2002\n}\n</code></pre>\n<p>Would it be possible to apply different styles to each bibliography and their corresponding citations? For example, to get one main bibliography with authoryear citation and ordered by Author name, and one second bibliography in Appendix with numbered citation and ordered by numbers. I think this is can be a quite frequent use case.</p>\n<p>In the quarto YAML header, only one .csl file can be used to define the style of the whole document. Would there be a relatively simple approach to use two .csl files? Or another approach without .csl files?</p>\n<p>Maybe that would be only possible with a more elaborate approach with LaTeX?</p>\n"^^ . . . . "2"^^ . . . "tween"^^ . . . . . "0"^^ . . "_String method call_ style with `:` is syntactic sugar in Lua, which means it's essentially the same than the long way. Only more handy and readable and that's why I personally prefer it... Anyway, you are free to use both indistinctly, but in general keeping consistency, along the same project at least, it's always a good idea."^^ . "Building Visual Studio solution with C and C++"^^ . . . "<p>Well, I've been reading Luajit ffi's documents for several days and knew how to use it basically.</p>\n<p>Define symbols(<code>ffi.cdef(xxx)</code>),\nthen load libraries(<code>a = ffi.load(xxx)</code>),\nand simply call them(<code>a.xxx(...)</code>).\nAll amazed e a lot.</p>\n<p>But there's one thing confusing me is that ffi.cdef is a &quot;static&quot;(sorry I couldn't find words to describe it, so treat it as a Java static method...) function, which means all I have defined will be used to process of indexing symbols for all libraries.</p>\n<p>Let's show an example.\nTow C source files <code>a.c</code> and <code>b.c</code>\nIn a.c:</p>\n<pre class="lang-c prettyprint-override"><code>void func(int p1){}\n</code></pre>\n<p>In b.c:</p>\n<pre class="lang-c prettyprint-override"><code>void func(int p1, int p2){}\n</code></pre>\n<p>Build them separately to <code>liba.so</code> and <code>libb.so</code>\nIn lua:</p>\n<pre class="lang-lua prettyprint-override"><code>ffi.cdef &quot;void func(int)&quot;\nlocal lib = ffi.load(&quot;a&quot;)\nlib.func(1) -- Succeeded\n\nffi.cdef &quot;void func(int,int)&quot;\nlib = ffi.load(&quot;b&quot;)\nlib.func(1,2) -- Failed: wrong number of arguments for function call\n</code></pre>\n<p>I tried to set <code>lib = nil</code> and call <code>collectgargarbage(&quot;collect&quot;)</code> before loading libb.so because I read Luajit keeps caches of every symbols with its parameters and return type, until it has no reference.</p>\n<p>But failed...\nAnd many other tries also didn't work.\nHelp!</p>\n"^^ . . . "I suggest you take a step back and learn some basic logic first and also read something about event handling. for example you start loop `while not Parts` and 2 lines later you do `if not parts` that doesn't make any sense. how should `Parts` change within 2 lines of code that don't touch it. same for `if start_script` where you just assigned false to it a few lines before. then again the same with gravity_cancel. you lack very basic understanding of logic and control structures which makes you struggle implementing your game."^^ . "3"^^ . "<p>Let's say your array looks like this (and keep in mind that lua arrays are tables with numeric indexes):</p>\n<pre><code>monsters = {[1] = &quot;orc&quot;, [2] = &quot;troll&quot;, [3] = &quot;ogre&quot;}\n</code></pre>\n<p>yeah, you'll get into trouble if you try to create a single &quot;stats&quot; table template and assign it to each monster name in the array:</p>\n<pre><code>stats = {[&quot;strength&quot;] = 15, [&quot;health&quot;] = 10}\n\nmonster_stats = {} -- initialize new table for stats\n\nfor k,v in ipairs(monsters) do\n monster_stats[v] = stats\nend\n\nmonster_stats[&quot;orc&quot;].strength = 10 -- change strength\n\nprint(monster_stats[&quot;orc&quot;].strength)\n\nprint(monster_stats[&quot;troll&quot;].strength)\n</code></pre>\n<p>output:</p>\n<pre><code>10\n10\n</code></pre>\n<p>We want to only change the orc's strength, but we end up changing everyone's strength. That's because both monster_stats[&quot;orc&quot;] and monster_stats[&quot;troll&quot;]\n<strong>point at</strong> the same table in memory. What you want is a way to <strong>clone</strong> a table -- and there is an example at lua.org[0].</p>\n<p>Add that function to the top of your script, and now you can call clone() during the assignment. Things work out as intended this time, because each monster's &quot;stats&quot; variable points to a different table in memory.</p>\n<pre><code>function clone (t) -- t is a table\n local new_t = {} -- create a new table\n local i, v = next(t, nil) -- i is an index of t, v = t[i]\n while i do\n new_t[i] = v\n i, v = next(t, i) -- get next index\n end\n return new_t\nend\n \nmonsters = {[1] = &quot;orc&quot;, [2] = &quot;troll&quot;, [3] = &quot;ogre&quot;}\n\nstats = {[&quot;strength&quot;] = 15, [&quot;health&quot;] = 10}\n\nmonster_stats = {} -- initialize new table for stats\n\nfor k,v in ipairs(monsters) do\n monster_stats[v] = clone(stats)\nend\n\nmonster_stats[&quot;orc&quot;].strength = 10 -- change strength\n\nprint(monster_stats[&quot;orc&quot;].strength)\n\nprint(monster_stats[&quot;troll&quot;].strength)\n</code></pre>\n<p>output:</p>\n<pre><code>10\n15\n</code></pre>\n<p>You can see that the tables are now all separate by printing out the values of the tables themselves:</p>\n<pre><code>print(monster_stats[&quot;orc&quot;])\nprint(monster_stats[&quot;troll&quot;])\nprint(monster_stats[&quot;ogre&quot;])\n</code></pre>\n<p>output:</p>\n<pre><code>table: 0x55be070536b0\ntable: 0x55be07053bc0\ntable: 0x55be07053c80\n</code></pre>\n<p>References:</p>\n<p>[0] <a href="https://www.lua.org/manual/2.4/node31.html" rel="nofollow noreferrer">https://www.lua.org/manual/2.4/node31.html</a></p>\n"^^ . . . . . "1"^^ . . . . . . . . "type-conversion"^^ . . "0"^^ . . . . "0"^^ . "Error with the Lua File System(LFS), when importing the library"^^ . . . . . . . "0"^^ . . "0"^^ . "2"^^ . "i will try unninstall and install it again"^^ . "1"^^ . . . . . "1"^^ . . . . . . "0"^^ . "format"^^ . "What's the advantage and disadvantage that using string.format("str", ...) instead of "str":format(...) in Lua?"^^ . . . . . "visual-studio"^^ . "0"^^ . "From https://github.com/premake/premake-core/blob/master/modules/vstudio/vs2010_vcxproj.lua#L1746 it should be as expected... Would it be possible that one of your include also uses `cppdialect`?"^^ . "<p>I currently have 2 local scripts inside of StarterCharacterScripts, One of them puts the proximityprompt inside the UpperTorso, the other one inspects when the proximityprompt is triggered (Right now I have it set to ended for testing purposes) This works fine, but when I try to inspect another persons avatar so I hold their proximity inside their torso down it does not inspect theirs at all. But it works completely fine when I inspect my own but when someone else tries to inspect mine it does not work either meaning its only able to inspect the local persons and no one elses why is this? (Both local scripts are inside ProximityPrompt, and the proximity is inside SCS)</p>\n<p>It's described abov all works fine besides the fact that I can't inspect other peoples avatars.</p>\n<p>e, it</p>\n"^^ . "1"^^ . . . "VScode: inserting new line inside an array suddenly changes spacing"^^ . "<p>I am working on a module that converts the value of a specific value into a new value when mutliplying it by a certain percentage. EX 100 * 1.3754 = 137.54. When I use the module, it spits out my debug error, saying that it received '1150' in the case that I will link.\nI've asked on reddit several times now, even asked Fandom support, but no one has been successful. I've been working on this for almost 9 hours in total now, and I've gotten close, but I am still so 'far'.\nI will paste the most well worded request I've put below:</p>\n<pre class="lang-lua prettyprint-override"><code>local p = {}\n\nfunction p.calculateAlchValue(frame)\n local shop_value_str = frame.args[1] or &quot;&quot;\n local shop_value = tonumber(shop_value_str)\n\n \n-- Check if the conversion was successful\n if not shop_value then\n return &quot;Error: Invalid or missing shop_value. Received: &quot; .. tostring(shop_value_str)\n end\n\n local percentage = 1.3754\n local result = math.ceil(shop_value * percentage)\n\n return tostring(result)\nend\n\nreturn p\n</code></pre>\n<p>This isn't working, everytime I enter a value that uses dynamic values aka shop_value, it displays the error as: Error: Invalid or missing shop_value. Received: 1150</p>\n<p>When I open the visual editor, I get the actual answer of 1582. But only in the visual editor...</p>\n<p>If I send the code:</p>\n<pre class="lang-none prettyprint-override"><code>{{Item\n| Item name = {{PAGENAME}}\n| Item Image = [[File:{{PAGENAME}}.png]]\n| tradeable = Yes\n| stackable = No\n| examine = It is a(n) {{PAGENAME}}.\n| shop_value = 1150\n| alch_value = {{#invoke:CalcAlchValue|calculateAlchValue|1150}}\n| noteable = Yes\n}}\n</code></pre>\n<p>It returns the correct value of 1582.</p>\n<p>The code I'm using on the page:</p>\n<pre class="lang-none prettyprint-override"><code>{{Item\n| Item name = {{PAGENAME}}\n| Item Image = [[File:{{PAGENAME}}.png]]\n| tradeable = Yes\n| stackable = No\n| examine = It is a(n) {{PAGENAME}}.\n| shop_value = 1150\n| alch_value = {{#invoke:CalcAlchValue|calculateAlchValue|{{{shop_value}}}}}\n| noteable = Yes\n}}\n</code></pre>\n<p>If anyone knows how to fix any of this, I've reached out to different sub-reddits, and even fandom support, used GPT to help, but nothing has worked so far.</p>\n<p>Links to the fandom pages: <a href="https://remote-realms.fandom.com/wiki/Module:CalcAlchValue" rel="nofollow noreferrer">https://remote-realms.fandom.com/wiki/Module:CalcAlchValue</a> | <a href="https://remote-realms.fandom.com/wiki/Palatine_ore" rel="nofollow noreferrer">https://remote-realms.fandom.com/wiki/Palatine_ore</a></p>\n"^^ . . "i added `print(ogposition.PrimaryPart.Position + Vector3.new(0, 4 * (i + diffsubs), 0))` for debug, but i searched the name of the clone via the "Explorer" and nothing showed."^^ . "@KyleF.Hartzenberg, by the way, how did you learn about checkhealth? I never seem to be able to find useful things like that."^^ . "It seems like there aren't any parsers bundled with your installation that treesitter can use/see (read more [here](https://neovim.io/doc/user/treesitter.html) about treesitter). For example, when I run `:checkhealth treesitter` I get `- Nvim runtime ABI version: 14` followed by multiple lines corresponding to the parsers that are available. For example, `- OK Parser: lua ABI: 14, path: /home/username/.local/share/nvim/lazy/nvim-treesitter/parser/lua.so`. I would start with trying ensure that your installation has the default parsers (which includes Lua among others)."^^ . "^ just noticed I wrote file.open instead of io.open but its the same point anyway. Just use io.lines with the path"^^ . "<p>Lua filters support filtering on Inline, Block, Meta, and Pandoc elements. Thus this should work:</p>\n<pre class="lang-lua prettyprint-override"><code>return {{\n Block = action,\n Inline = action,\n Meta = action,\n Pandoc = action,\n}}\n</code></pre>\n<p>The <a href="https://pandoc.org/lua-filters" rel="nofollow noreferrer">docs</a> could probably be a little clearer on that point.</p>\n"^^ . "1"^^ . . . . . . . . . . "1"^^ . . . . "luau"^^ . "0"^^ . . . "You just need `gdb -c ./core.13456 /usr/bin/luajit`"^^ . "inheritance"^^ . "<p><a href="https://splatoonwiki.org/wiki/User:Exaskliri/Sandbox/Infobox/1" rel="nofollow noreferrer">The wiki page in question.</a>\nThe presence of <code>&lt;div style=&gt;</code> inside a Lua template's variable (<code>content</code> or <code>args[1]</code>) renders the entire variable nil.</p>\n<p>Template and module used:</p>\n<ul>\n<li><a href="https://splatoonwiki.org/wiki/Module:BubbleBox/hex" rel="nofollow noreferrer">Module:BubbleBox/hex</a>: A Lua module to sandwich <code>content</code>/<code>args[1]</code> between a preset <code>div</code> <code>class</code> and <code>style</code>.\n<ul>\n<li><a href="https://splatoonwiki.org/wiki/Template:BubbleBox/hex" rel="nofollow noreferrer">Template:BubbleBox/hex</a>: Mediawiki template that invokes the aforementioned Module.</li>\n</ul>\n</li>\n</ul>\n<p><a href="https://i.sstatic.net/6tpQEGBM.png" rel="nofollow noreferrer">Screenshot of expected vs. result</a></p>\n<ul>\n<li><a href="https://splatoonwiki.org/wiki/User:Exaskliri/Sandbox/Infobox/2" rel="nofollow noreferrer">Expected (how it should look)</a>: The image and caption shows and centered properly.</li>\n<li><a href="https://splatoonwiki.org/wiki/User:Exaskliri/Sandbox/Infobox/1" rel="nofollow noreferrer">Result</a>: Said <code>&lt;div style=&gt;</code> makes the entire <code>args[1]</code> variable <code>nil</code>.</li>\n</ul>\n"^^ . "5"^^ . "0"^^ . . . "If the HUD is showing the images as purple and black squares, that means your client can't find the image. As well as uploading the image to the server, **do you also have a copy of the image in your game**?"^^ . . "Lua table.insert refuses to work unless the expression given as second arg is saved to a var first"^^ . . . "garrys-mod"^^ . . "<p>One boring solution would be</p>\n<pre class="lang-lua prettyprint-override"><code>n = 1\n\n--1; &quot;&quot;&quot;\nprint((n % 2 == 0 and &quot;Even&quot; or &quot;Odd&quot;) .. &quot; in Lua&quot;)\n--1; &quot;&quot;&quot;\n\n\n--1; print((&quot;Even&quot; if n % 2 == 0 else &quot;Odd&quot;) + &quot; in Python&quot;)\n</code></pre>\n<p><code>--1;</code> is a safe comment for Lua, and within Python it was easier to &quot;disable&quot; Lua code by wrapping it into a multi line string.</p>\n<p>But I feel like this question belongs into <a href="https://codegolf.stackexchange.com/">https://codegolf.stackexchange.com/</a></p>\n"^^ . . "0"^^ . "Think about the sequence of events: if you press “W” and “A”, your InputBegan handler will get called twice with no intervening InputEnded event. What happens in this case? How might you prevent this from happening?"^^ . . "1"^^ . "0"^^ . . . "1"^^ . . . "require"^^ . . "3"^^ . . . . "Neovim BiomeJS not using biome.json formatting"^^ . . . . "0"^^ . . "1"^^ . . . . . . "1"^^ . "I figured it out while I was preparing for bed. Yeah, it's two return values. Damn Lua, this feature is kinda naughty."^^ . "0"^^ . "0"^^ . "lua-4.0"^^ . . "wikidata-api"^^ . . . . . . "0"^^ . . . "0"^^ . "0"^^ . "0"^^ . . . . . "Get parent of element in Lua Pandoc filter"^^ . . "1"^^ . "0"^^ . "clone"^^ . . . . . "0"^^ . "1"^^ . "haproxy"^^ . "Could you shorten your code to be the [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). Your code is long which makes it hard to pinpoint problems."^^ . . "luasocket"^^ . "This question is similar to: [expected table, got number when replacing strings with gsub](https://stackoverflow.com/questions/74916455/expected-table-got-number-when-replacing-strings-with-gsub). If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem."^^ . "I can't be absolutely certain without more details, but there's a decent chance using [`WaitForChild`](https://create.roblox.com/docs/reference/engine/classes/Instance#WaitForChild) could resolve this issue."^^ . . . . . . "@Andrew I did what you said and gdb says "/usr/bin/luajit ./main.lua". I'm not sure what I'm supposed to do now: I tried `'gdb -c ./core.13456 '/usr/bin/luajit ./main.lua'`, but that doesn't work."^^ . . . "<p>I recently published an application development toolkit written in lua. Here's a link to it: <a href="https://github.com/chris-montero/terra" rel="nofollow noreferrer">https://github.com/chris-montero/terra</a></p>\n<p>This library was architected from the beginning to support high performance animations. This lua library has some C code that compiles to a few .so files which get imported by the lua code.</p>\n<p>When you create a window, and keep resizing it for a while, at a certain point the whole program just segfaults. I get a coredump, but I am unsure how to use gdb (or anything else) to debug this kind of issue. I can't just do <code>gdb -c core.12345 executable</code> because there is no executable.</p>\n<p>How can I go about debugging a lua program that imports .so files that segfault at some point?</p>\n<p>Here's a link to the github issue, if you want more details: <a href="https://github.com/chris-montero/terra/issues/1" rel="nofollow noreferrer">https://github.com/chris-montero/terra/issues/1</a></p>\n"^^ . "1"^^ . . "<p>The reason your button isn't responding is that you didn't create an event for the click. Assuming you added a script to a GUI button, then here's the corrected code:</p>\n<pre><code>local button = script.Parent\nlocal main_menu = script.Parent.Parent.Parent.Parent\nlocal main_menu_frame = script.Parent.Parent.Parent\nmain_menu.Enabled = true\ngame.Lighting.Blur.Enabled = true\n\nbutton.Clicked:Connect(function()\n --Insert code when the button is clicked here\nend)\n</code></pre>\n"^^ . . "0"^^ . . . . "0"^^ . "0"^^ . . . "metatable"^^ . . "add-on"^^ . . . . . . . . . "0"^^ . . . . "Treesitter says "No parser for Lua" after adding lazy.nvim to my config"^^ . . . "Confused about part of the Knuth-Liang algorithm for hyphenation"^^ . . . . . "0"^^ . . "`checkhealth treesitter` gives: \n\n==============================================================================\nvim.treesitter: require("vim.treesitter.health").check()\n\n- Nvim runtime ABI version: 14"^^ . "0"^^ . "0"^^ . . . "0"^^ . . . "0"^^ . . . "1"^^ . "ffi"^^ . . . "@KyleF.Hartzenberg, yes I've done that now."^^ . . "<p>I already tried using this function after I posted this, but thanks anyway. I was able to accomplish my goal as wanted by going back and forth with the clients and server using RemoteEvents.</p>\n"^^ . "<p>Im making a main menu in Lua(Roblox Studio) and the start game/play button doesnt work</p>\n<p>i tried this code for the play button but the button wasnt responding</p>\n<pre><code>local button = script.Parent\nlocal main_menu = script.Parent.Parent.Parent.Parent\nlocal main_menu_frame = script.Parent.Parent.Parent\nmain_menu.Enabled = true\ngame.Lighting.Blur.Enabled = true\nwhile true do \n if button.MouseButton1Click == true then\n game.Lighting.Blur.Enabled = false\n main_menu.Enabled = false\n main_menu_frame.Active = false\n main_menu_frame.Transparency = 1\n main_menu_frame.Visible = false\n end\n task.wait(0.1)\nend\n</code></pre>\n"^^ . . "0"^^ . . . . "0"^^ . "<p>There is now a new Lua library that allows to do this: <a href="https://github.com/tarleb/jog" rel="nofollow noreferrer">jog</a> is a Lua-only reimplementation of pandoc's <code>walk</code> method. It is conceptually similar to panflute and such libraries, but also tries to stay close and mostly compatible with <code>walk</code>.</p>\n<p>Jog allows to enable element contexts, which is then passed in as a second function argument:</p>\n<pre class="lang-lua prettyprint-override"><code>--- show level\n\nlocal jog = require 'jog'\n\n--- Return the tag (e.g., `Str`) or type (e.g. `Meta`) of an element.\nlocal function tag_or_type (x)\n return x.t or pandoc.utils.type(x)\nend\n\nlocal function print_context(element, context)\n print(table.concat(context:map(tag_or_type), '-&gt;'))\nend\n\nlocal show_level_filter = {\n context = true, -- enable element contexts\n List = print_context,\n Inline = print_context,\n Block = print_context,\n Meta = print_context,\n Para = print_context,\n}\n\nfunction Pandoc(doc)\n return jog(doc, show_level_filter)\nend\n</code></pre>\n"^^ . . . . "1"^^ . . "string"^^ . . . "1"^^ . . "1"^^ . "conan"^^ . . . . . . . "0"^^ . . . "redis lua script can't call on global"^^ . "1"^^ . "nginx"^^ . "<p>I can't add an image to my HUD in GLUA. I've tried to do it in the code, and I think it should work, but it doesn't. I have the correct type of image and its format.<br />\nFolders</p>\n<pre><code>hud\n|---lua \n| |---autorun \n| |---client \n| |---cl_hud.lua\n|---materials \n| |---gui \n| |---add.png\n</code></pre>\n<p>cl_hud.lua</p>\n<pre><code>surface.CreateFont(&quot;HUDFont&quot;, {\n font = &quot;Roboto Medium&quot;,\n size = 30,\n weight = 1200,\n antialias = true,\n shadow = true\n})\n\nhook.Add(&quot;HUDPaint&quot;, &quot;CustomDarkRPHUD&quot;, function()\n local client = LocalPlayer()\n\n if not IsValid(client) then return end\n\n local health = client:Health()\n local armor = client:Armor()\n local maxArmor = 100\n local maxHealth = client:GetMaxHealth()\n local money = client:getDarkRPVar(&quot;money&quot;)\n local salary = client:getDarkRPVar(&quot;salary&quot;)\n local job = client:getDarkRPVar(&quot;job&quot;)\n local license = client:getDarkRPVar(&quot;HasGunlicense&quot;) and &quot;Yes&quot; or &quot;No&quot;\n local wanted = client:getDarkRPVar(&quot;wanted&quot;) and &quot;In wanted&quot; or &quot;Not in wanted&quot;\n local time = os.date(&quot;%H:%M:%S&quot;, os.time())\n\n local width = 350\n local height = 35\n\n --BG\n draw.RoundedBox(10, 20, ScrH() - 230, 400, 200, Color(100, 100, 100, 150))\n\n local iconMaterial = Material(&quot;gui/add.png&quot;, &quot;noclamp smooth&quot;)\n if not iconMaterial:IsError() then\n surface.SetDrawColor(255, 255, 255, 255)\n surface.SetMaterial(iconMaterial)\n surface.DrawTexturedRect(20, ScrH() - 500, 20, 20)\n else\n print(&quot;IMG error!&quot;)\n print(iconMaterial) -- console log &gt;&gt; Material [___error]\n\n end\n -- HP bar\n local healthWidth = (health / maxHealth) * width\n draw.RoundedBox(8, 29, ScrH() - 80, healthWidth, height, Color(255, 0, 0, 220))\n\n -- AR bar\n local armorWidth = (armor / maxArmor) * width\n draw.RoundedBox(8, 29, ScrH() - 120, armorWidth, height, Color(58, 138, 219, 220))\n \n if armor == 0 then\n draw.SimpleText(&quot;HP: &quot; .. health .. &quot;%&quot;, &quot;HUDFont&quot;, 32, ScrH() - 80, Color(255, 255, 255), 0)\n draw.SimpleText(&quot;Cash: &quot; .. money .. &quot;$&quot; .. &quot; | +&quot;.. salary .. &quot;$&quot;, &quot;HUDFont&quot;, 32, ScrH() - 120, Color(50, 200, 0), 0)\n else\n draw.SimpleText(&quot;HP: &quot; .. health .. &quot;%&quot;, &quot;HUDFont&quot;, 32, ScrH() - 80, Color(255, 255, 255), 0)\n draw.SimpleText(&quot;Armor: &quot; .. armor, &quot;HUDFont&quot;, 32, ScrH() - 120, Color(255, 255, 255), 0)\n draw.SimpleText(&quot;Cash: &quot; .. money .. &quot;$&quot; .. &quot; | +&quot;.. salary .. &quot;$&quot;, &quot;HUDFont&quot;, 32, ScrH() - 155, Color(50, 200, 0), 0)\n end\nend)\n</code></pre>\n<p>I don't know what to do because the HUDs I'm using can't load images. However, they are definitely working because when I download them, I saw screenshots of the pictures. But when I try to add them to the server, I see purple and black cubes instead.</p>\n"^^ . "0"^^ . "0"^^ . "0"^^ . "0"^^ . . . . . . . "runtime-error"^^ . "this is not a debugging service, narrow down your problem. There is no need to bother us with > 200 lines of code."^^ . . . . . "<p>Upon further investigation, I have found the solution. The following code works as desired:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.opt.scrolloff = math.floor(vim.opt.lines:get() / 2)\n</code></pre>\n<ol>\n<li>Yes. <a href="https://vi.stackexchange.com/a/35177">NeoVim uses Lua 5.1</a>, whereas the <code>//</code> operator was only introduced in Lua 5.3. Therefore, this is a syntax error.</li>\n<li>Yes. Use <code>vim.opts.lines:get()</code>.</li>\n<li>You can access option values using the following syntax: <code>vim.opts.&lt;option&gt;:get()</code>. See <code>:help vim.opt:get()</code> for more info.</li>\n</ol>\n"^^ . . "<pre><code>local expType = tostring(type1)\n local expTypeStat = expType:gsub(&quot;Exp&quot;, &quot;&quot;)\n local profileDataExpType = &quot;profile.Data.&quot;..expType\n</code></pre>\n<p>Here I want to change which data is pulled from profile.Data depending on which expType is given to the function I'm making.</p>\n<p>For an example, type1 would be something like StrengthExp. But when adding strength, I want to reference the Strength stat itself in the same function, so I used the gsub function to remove the Exp from StrengthExp.</p>\n<p>To access the player's stats and exp amounts, I need to use profile.Data.Strength or profile.Data.StrengthExp for example.</p>\n<pre><code>if profileDataExpType &lt;= math.round(100 * (expTypeStat / 2)) then\n</code></pre>\n<p>Here is the part of the function that I want to use the profileDataExpType and expTypeStat variables as code instead of strings.</p>\n<p>Is there a different way to access the right profile.Data depending on what expType is given to the function? Or is there a way to convert that string into code? I couldn't find anything online or in the documentation</p>\n<p>I tried writing the code like this, replacing the actual name of the data with expType:</p>\n<pre><code>if profile.Data.expType &lt;= math.round(100 * (profile.Data.expType/ 2)) then\n</code></pre>\n<p>I tried this before converting expType to a string thinking it would use the parameter expType instead of looking for data called &quot;expType&quot; within profile.Data</p>\n"^^ . . . "Basically, part that when touched damages the person who touches it, appears in front of the attacker, shouldn't damage them when touched. Figured out how to do this a while ago, just wanted to make it clear what I meant."^^ . "1"^^ . "1"^^ . . . . . "0"^^ . "0"^^ . . "0"^^ . . . "Whoops while making the minimal example, I answered my question. I will edit my post and include it."^^ . "0"^^ . "0"^^ . . . . . . . "0"^^ . . . . . . . . "<p>A polyquine is a program that is valid in multiple programming languages. The task is to write a polyquine that can switch between Python and Lua.</p>\n<p>The program should take a single integer argument <code>n</code>.</p>\n<p>In Python: If <code>n</code> is even, print &quot;Even in Python&quot;. If <code>n</code> is odd, print &quot;Odd in Python&quot;.\nIn Lua: If <code>n</code> is even, print &quot;Even in Lua&quot;. If <code>n</code> is odd, print &quot;Odd in Lua&quot;.</p>\n<p>The program should be valid syntax in both languages and produce the correct output when run with a Python interpreter or a Lua interpreter.</p>\n<pre><code>_=1\nn=...\n_=1\n\nif n==nil then n=int(input()) end\nif n%2==0 then print(&quot;Even in &quot;..(_ and &quot;Python&quot; or &quot;Lua&quot;)) else print(&quot;Odd in &quot;..(_ and &quot;Python&quot; or &quot;Lua&quot;)) end\n\n</code></pre>\n<p>i tried various other progrAams too but couldn't compile in both the compilers</p>\n"^^ . "plugins"^^ . "2"^^ . "0"^^ . . "windows"^^ . . . "0"^^ . "Yes it's doable, but not a good idea for performance or maintainability of the resulting code."^^ . . . . "1"^^ . . . . "3"^^ . "syntax"^^ . . . . . . . "1"^^ . . "5"^^ . . . "backend"^^ . "<p>Module script change that fixed the problem:</p>\n<pre><code>function ExpManager.updateExpBar()\n \n ExpManager.exp = ExpManager.player.Stats.expPoints.Value\n ExpManager.level = ExpManager.player.Stats.Level.Value\n ExpManager.expNeeded = math.round(100 * (ExpManager.level / 2))\n \n ExpManager.expGui.expBackground.expBar:TweenSize(UDim2.new(ExpManager.exp / ExpManager.expNeeded, 0, 1, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 0.15, true)\n ExpManager.expText.Text = math.round(ExpManager.exp).. &quot;/&quot; .. math.round(ExpManager.expNeeded)\n\nend\n</code></pre>\n<p>In this change I defined the expPoints value, level value, and expNeeded value within the function that updates the Exp bar GUI rather than outside of it. This seemed to fix the problem.</p>\n"^^ . . "You should really clarify what you mean by "*But I can't find a way to create new Lua tables, as assigning a new variable to a table doesn't copy it.*", preferably with a [mcve] (i.e., some code) to back it up."^^ . "0"^^ . . . . . . . "0"^^ . . . . . . . . . "2"^^ . "0"^^ . . "1"^^ . . . . . "[tag:roblox-studio] is for questions about the IDE, not Roblox programming in general. If this question is about the latter, please [edit] it to use [tag:roblox] instead."^^ . . "0"^^ . . . "1"^^ . . "2"^^ . . . "0"^^ . . . "<p>I is possible to change the default hash function that lua (or luajit) uses for the HashTable part of a talbe ?</p>\n<p>I want to speedup table access in pure Lua.</p>\n<p>I saw that:</p>\n<ul>\n<li>The Default hash function for lua is not exposed</li>\n<li>There is no metatable value for the hashing (not mentionned in the documentation, and by any chance __hash does not work)</li>\n</ul>\n"^^ . . . . "2"^^ . . . "Why isn't the "Anchored" keyword working on grouped parts?"^^ . . . . . "<p>If this script is local (which I think it is). When you clone a local script it stops working, for some reason. Try having the clone and script you posted server-sided. I had this same issue some time ago. Hope this helps :)</p>\n"^^ . . "1"^^ . "1"^^ . . "Is there a reason the existing [BasePart.Touched](https://create.roblox.com/docs/reference/engine/classes/Part#Touched) event is insufficient for what you're trying to do? A player's character model is a collection of Parts, and each Part has its own Touched event. That is to say, every part has its own hitbox that is managed by the engine so you don't have to. So what is driving you to reinvent this wheel in particular?"^^ . "0"^^ . . . . . . "0"^^ . "1"^^ . . . "0"^^ . "0"^^ . . "Work-around for co-socket api's not being available in log_by_lua giving 404 error"^^ . . . . "I did not realize python let you do an assignment inside of a if condition, but no lua does not allow that."^^ . . "<p>I am making a Lua Love 2d game and I wanted to use the love.keypressed function to make a dash a move. But there is an eror.\nI want my function to detect only once so I can make my dash.<a href="https://i.sstatic.net/fGKy5n6t.png" rel="nofollow noreferrer">enter image description here</a></p>\n<pre><code>function love.load()\n player = {}\n player.x = 400\n player.y = 500\n player.speedY = 3\n player.speedX = 4\n player.sprite = love.graphics.newImage('sprites/Spaceship.PNG')\n player.lives = 5\n player.points = 0\n\n background = love.graphics.newImage('sprites/SpaceBackground.png')\n\n asteroid = {}\n asteroid.x = {200, 460, 630}\n asteroid.y = {0, 0, 0}\n asteroid.speedY = 4\n asteroid.sprite = love.graphics.newImage('sprites/Asteroid.png') \n asteroid.number = 3\n asteroid.missed = 1 \n\n bullet = {}\n bullet.x = {}\n bullet.y = {}\n bullet.speed = 11\n bullet.sprite = love.graphics.newImage('sprites/bullet.png')\n bullet.number = 0\n\n\n heart = {}\n heart.x = {200}\n heart.y = {-200}\n heart.speed = 4\n heart.sprite = love.graphics.newImage('sprites/Heart.png')\n heart.number = 1\n\n whenIshotLast = 0\n updates = 0\n updates2 = 0\n updates3 = 0\n didAnewAsteroidSpawnSoon = 0\n updatesFromLastDashF = 0\n didWePressF = 0\nend\n\nfunction areColliding(x1, y1, sx1, sy1, x2, y2, sx2, sy2)\n if x2 &lt;= x1 + sx1 and x1 &lt;= x2 + sx2 and y2 &lt;= y1 + sy1 and y1 &lt;= y2 + sy2 then\n return true\n else \n return false\n end\nend\n\nfunction love.update(dt)\n\n if(player.lives &gt; 0) then\n \n updates = updates + 1\n updates2 = updates2 + 1\n updates3 = updates3 + 1\n \n if updates3 &gt; 200 then\n player.points = player.points + 1\n updates3 = 0\n end\n if(didWePressF == 1) then\n updatesFromLastDashF = updatesFromLastDashF + 1\n end\n -- Player movement controls\n if love.keyboard.isDown(&quot;right&quot;) or love.keyboard.isDown(&quot;d&quot;) then\n player.x = player.x + player.speedX\n end\n if love.keyboard.isDown(&quot;left&quot;) or love.keyboard.isDown(&quot;a&quot;) then\n player.x = player.x - player.speedX\n end\n if love.keyboard.isDown(&quot;down&quot;) or love.keyboard.isDown(&quot;s&quot;) then\n player.y = player.y + player.speedY\n end\n if love.keyboard.isDown(&quot;up&quot;) or love.keyboard.isDown(&quot;w&quot;) then\n player.y = player.y - player.speedY\n end\n if(love.keypressed(&quot;up&quot;, false) or love.keypressed(&quot;w&quot;, false)) then\n didWePressF = 1\n if(updatesFromLastDashF &lt; 30) then\n player.y = player.y - 50\n\n didWePressF = 0\n updatesFromLastDashF = 0\n end\n end\n if(player.y &gt; 525) then\n player.y = 525\n end\n if(player.y &lt; 0)then\n player.y = 0\n end\n if(player.x &lt; 0) then\n player.x = 720\n end\n\n if(player.x &gt; 720) then\n player.x = 0 \n end\n\n -- Reset shooting cooldown\n if updates &gt; 70 then\n updates = 0\n whenIshotLast = 0\n end\n if updates2 &gt; 400 then\n updates2 = 0\n didAnewAsteroidSpawnSoon = 0\n end\n\n \n \n\n -- Shooting bullets\n if love.keyboard.isDown(&quot;space&quot;) and whenIshotLast &lt; 1 then\n bullet.number = bullet.number + 1\n bullet.x[bullet.number] = player.x + 20\n bullet.y[bullet.number] = player.y\n whenIshotLast = whenIshotLast + 1\n end\n\n -- Update asteroid positions\n for i = 1, asteroid.number, 1 do\n asteroid.y[i] = asteroid.y[i] + asteroid.speedY\n if asteroid.y[i] &gt; 600 then\n asteroid.y[i] = -500\n asteroid.x[i] = math.random(0, 720)\n asteroid.missed = asteroid.missed + 1\n end\n end\n\n for i = 1, heart.number, 1 do\n heart.y[i] = heart.y[i] + heart.speed\n if(heart.y[i] &gt; 600) then\n heart.y[i] = -1200\n heart.x[i] = math.random(0, 720)\n end\n end\n\n -- Check for collisions between asteroids and the player\n for i = 1, heart.number, 1 do\n if areColliding(heart.x[i], heart.y[i], 3 * 32, 3 * 32, player.x, player.y, 0.6 * 150, 0.6 * 120) then\n heart.y[i] = -1200\n heart.x[i] = math.random(0, 720)\n player.lives = player.lives + 1\n end\n end\n\n for i = 1, asteroid.number, 1 do\n if areColliding(asteroid.x[i], asteroid.y[i], 0.5 * 150, 0.5 * 150, player.x, player.y, 0.6 * 150, 0.6 * 120) then\n asteroid.y[i] = -500\n asteroid.x[i] = math.random(0, 720)\n player.lives = player.lives - 1\n end\n end\n\n for n = 1, heart.number, 1 do\n for i = bullet.number, 1, -1 do\n if areColliding(bullet.x[i], bullet.y[i], 32, 32, heart.x[n], heart.y[n], 3 * 32, 3 * 32) then\n heart.y[n] = -1200\n heart.x[n] = math.random(0, 720)\n table.remove(bullet.y, i)\n table.remove(bullet.x, i)\n bullet.number = bullet.number - 1\n player.points = player.points + 2\n player.lives = player.lives + 1\n end\n end\n end\n\n -- Check for collisions between bullets and asteroids\n for n = 1, asteroid.number, 1 do\n for i = bullet.number, 1, -1 do\n if areColliding(bullet.x[i], bullet.y[i], 32, 32, asteroid.x[n], asteroid.y[n], 0.5 * 150, 0.5 * 150) then\n asteroid.y[n] = -500\n asteroid.x[n] = math.random(0, 720)\n table.remove(bullet.y, i)\n table.remove(bullet.x, i)\n bullet.number = bullet.number - 1\n player.points = player.points + 3\n end\n end\n end\n\n -- Update bullet positions and remove off-screen bullets\n for i = bullet.number, 1, -1 do\n bullet.y[i] = bullet.y[i] - bullet.speed\n if bullet.y[i] &lt; 0 then\n table.remove(bullet.y, i)\n table.remove(bullet.x, i)\n bullet.number = bullet.number - 1\n end\n \n end\n if(asteroid.missed % 4 == 0 and didAnewAsteroidSpawnSoon == 0 and asteroid.number &lt; 19) then\n asteroid.number = asteroid.number + 1\n asteroid.y[asteroid.number] = -500\n asteroid.x[asteroid.number] = math.random(0, 720)\n asteroid.missed = 0\n didAnewAsteroidSpawnSoon = 1\n end\n \nend\n \nend\n\nfunction love.draw()\n love.graphics.draw(background, 0, 0, 0, 1, 1.2)\n love.graphics.draw(player.sprite, player.x, player.y, 0, 0.6, 0.6)\n\n for i = 1, asteroid.number, 1 do\n love.graphics.draw(asteroid.sprite, asteroid.x[i], asteroid.y[i], 0, 0.5, 0.5)\n end\n for i = 1, bullet.number, 1 do\n love.graphics.draw(bullet.sprite, bullet.x[i], bullet.y[i], 0, 1, 1) \n end\n for i = 1, heart.number, 1 do\n love.graphics.draw(heart.sprite, heart.x[i], heart.y[i], 0, 3, 3) \n end\n\n love.graphics.print(player.lives, 25, 570, 0, 2, 2)\n\n-- 19\n love.graphics.print(player.points, 740, 570, 0, 2, 2)\n love.graphics.print(asteroid.number, 740, 0, 0, 2, 2)\n if(player.lives == 0) then\n love.graphics.print(&quot;Loser&quot;, 240, 200, 0, 10, 10)\n end\n\nend\n\n</code></pre>\n<p>Can you tell me how am I supposed to use the love.keypressed function?<a href="https://i.sstatic.net/M6vZjrYp.png" rel="nofollow noreferrer">enter image description here</a>\n[<a href="https://i.sstatic.net/4x7whSLj.png" rel="nofollow noreferrer">enter image description here</a>](<a href="https://i.sstatic.net/z1jllHg5.png" rel="nofollow noreferrer">https://i.sstatic.net/z1jllHg5.png</a>)\nDo you have any suggestions?</p>\n"^^ . "0"^^ . . . . "<p>I'm trying to open classic player unit popup (right click on player unit frame) to update my favourite addon for 11.0.0 but I'm kinda lost in the new <code>blizzard_menu</code> framework.</p>\n<p>Addon looks like orbs from diablo and my original code looks like:</p>\n<pre class="lang-lua prettyprint-override"><code>orb:SetScript(&quot;OnClick&quot;,function ()\n if GetMouseButtonClicked() == &quot;RightButton&quot; then\n ToggleDropDownMenu(1, 1, PlayerFrameDropDown, &quot;cursor&quot;, 0, 0)\n end\nend)\n</code></pre>\n<p>and I have no idea how can i rewrite this to new framework.</p>\n<p>I tried to recreate it with guides on <a href="https://warcraft.wiki.gg/wiki/Patch_11.0.0/API_changes" rel="nofollow noreferrer">wiki</a> and <a href="https://www.townlong-yak.com/framexml/beta/Blizzard_Menu/11_0_0_MenuImplementationGuide.lua" rel="nofollow noreferrer">implementation_guide</a> but nothing i tried works (get unit menumanager and then open it).</p>\n"^^ . "<p>Basically, I am trying to edit the <code>vlcrc</code> file(<code>%APPDATA%\\vlc\\vlcrc</code>) from within the <em>VLC &gt; View &gt; Edit the path for saving recordings</em> menu item by running the below extension code file:</p>\n<pre><code>function descriptor()\n return {\n title = &quot;VLC Edit Record Dir&quot;;\n version = &quot;0.0.1&quot;;\n author = &quot;vicky-dev&quot;;\n shortdesc = &quot;&amp;Edit the path for saving recordings&quot;;\n }\nend\n\nfunction main_fn()\n local id = vlc.playlist.current()\n local item = (vlc.player or vlc.input).item()\n local uri = item:uri()\n vlc.msg.dbg(&quot;[VLC Playing] Write File!&quot;)\n local fname_tmp = item:uri():match(&quot;([^/\\\\]*)$&quot;)\n local file_name = vlc.strings.decode_uri(fname_tmp)\n write_file(vlc.config.userdatadir()..&quot;\\n&quot;)\n edit_vlcrc_file(file_name)\nend\n\nfunction activate()\n main_fn()\nend\n\nfunction deactivate()\n vlc.deactivate()\nend\n\nfunction close()\n deactivate()\nend\n\nfunction write_file(data)\n local file = vlc.config.userdatadir() .. &quot;/VLC_Current_Playing.txt&quot;\n assert(os.remove(file))\n vlc.msg.dbg(&quot;[VLC Playing] Write File!&quot;)\n local VLCPlayingFile = vlc.config.userdatadir() .. &quot;/VLC_Current_Playing.txt&quot;\n local file = io.open(VLCPlayingFile, &quot;a+&quot;)\n file:write('Current Media File: '..data)\n file:close()\nend\n\nfunction edit_vlcrc_file(videoName)\n local vlcRc = vlc.config.userdatadir() .. &quot;\\\\vlcrc&quot;\n write_file(vlcRc)\n local file = io.open(vlcRc, &quot;w+&quot;)\n for line in io.lines(file) do\n line:gsub(&quot;input-record-path*&quot;, &quot;input-record-path=C:\\Users\\&lt;Username&gt;\\Videos\\&lt;CustomFolder&gt;&quot;..&quot;\\\\&quot;..videoName)\n end\n -- file:write('Current Media File: '..data)\n file:close()\nend\n\n</code></pre>\n<p>Notice that I am getting the path of vlcrc file correctly, as you can see in the text file that I have made for debug purpose using <code>write_file()</code> method.</p>\n<p>But the code when trying to open vlcrc file for write mode (w+), it throws this error:</p>\n<pre><code>&lt;codefile&gt;.lua:47: bad argument #1 to 'lines' (string expected, got userdata)\n</code></pre>\n<p>Can anyone help out in understanding why it's throwing that error on <code>for line in io.lines(file) do</code> and fixing it therein ?</p>\n"^^ . "0"^^ . . "2"^^ . . . . . . . . . . . "<p>I've been banging my head on this problem for a few days now, and have gotten a bit stuck, so I thought I'd ask here. Would really appreciate any help.</p>\n<h1>Context:</h1>\n<p>The issue that I'm currently facing with my site is that we are getting a lot of nginx 499 errors being raised when clients disconnect before hitting a refresh_token endpoint. (The purpose of this endpoint is to generate a new access token and refresh token from the provided refresh token in the request, and return it to the client). We also block the refresh_token being used to make this request. The problem is, that when the client disconnects, their local storage does not get updated with the new token, and so, the next time they reconnect they are forcibly logged out, as their local storage token is treated as blocked when it hits the refresh_token endpoint the following time.</p>\n<h1>High level solution:</h1>\n<p>What I wanted to do to approach this problem was to essentially catch the 499 error raised by nginx when it occurs, and hit another endpoint on my backend to cache this token. On subsequent hits for this user to the refresh_token endpoint, it can also check if the token exists in the cache, and generate a new one in those cases.</p>\n<h1>The Problem:</h1>\n<p>So, from what I've found, the phase in which I can catch the nginx response status at the end of the request is <a href="https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#log_by_lua" rel="nofollow noreferrer">log_by_lua</a> (specifically in my case, <code>log_by_lua_file</code>). The problem is that <code>log_by_lua_file</code> does not have access to cosocket apis, as per these <a href="https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#cosockets-not-available-everywhere" rel="nofollow noreferrer">docs</a>, and therefore I am unable to make requests to new endpoints with lua scripts here. Now the workaround that the docs recommend is to use <code>ngx.timer.at</code> (Context for the workaround is in the same place as the cosocket apis information docs I linked to previously). I have implemented this workaround using <a href="https://github.com/ledgetech/lua-resty-http" rel="nofollow noreferrer">resty-http</a>, however, am currently getting 404 errors on the endpoint. Is there something I am missing? To be sure that I am using the right endpoint, I also made a curl request from the openresty pod directly to the endpoint, and it worked. (I also logged the url to ensure that it is resolving to the correct url, since I know that ngx.timer doesn't have access to ngx.var, so I want to make sure that data.authenticator field had been passed correctly).</p>\n<pre><code>My script that I am trying to use with log_by_lua_file is below: \n-- Function to send the original request data to the internal endpoint on 499 error\nlocal function send_499_notification(premature, data)\n local http = require &quot;resty.http&quot;\n local cjson = require &quot;cjson&quot;\n\n if premature then\n ngx.log(ngx.WARN, &quot;Premature timer trigger&quot;)\n return\n end\n ngx.log(ngx.WARN, &quot;Request url: &quot;, &quot;http://&quot; .. data.authenticator .. &quot;/handle_499_error/&quot;)\n ngx.log(ngx.WARN, &quot;Request method: &quot;, data.method)\n ngx.log(ngx.WARN, &quot;Request body: &quot;, data.body)\n ngx.log(ngx.WARN, &quot;Request headers: &quot;, cjson.encode(data.headers))\n ngx.log(ngx.WARN, &quot;Request args: &quot;, cjson.encode(data.args))\n\n local httpc = http.new()\n local res, err = httpc:request_uri(&quot;http://&quot; .. data.authenticator .. &quot;/handle_499_error/&quot;, {\n method = data.method,\n body = data.body,\n query = data.args,\n headers = data.headers,\n })\n\n if not res then\n ngx.log(ngx.WARN, &quot;Failed to notify internal endpoint: &quot;, err)\n else\n ngx.log(ngx.WARN, &quot;Successfully notified internal endpoint for 499 error, res status &quot;, res.status)\n end\nend\n\n-- Function to handle 499 error\nlocal function handle_499()\n local req_body = ngx.ctx.req_body or &quot;&quot;\n local req_headers = ngx.ctx.req_headers or {}\n local req_args = ngx.ctx.req_args or {}\n local req_method = ngx.ctx.req_method or &quot;&quot;\n\n local data = {\n authenticator = ngx.var.authenticator,\n method = req_method,\n body = req_body,\n args = req_args,\n headers = req_headers,\n }\n\n local ok, err = ngx.timer.at(0, send_499_notification, data)\n if not ok then\n ngx.log(ngx.ERR, &quot;Failed to create timer: &quot;, err)\n end\nend\n\n-- Retrieve NGINX status code\nlocal nginx_status = ngx.status\n\nif nginx_status == 499 then\n handle_499()\nend\n\nngx.log(ngx.WARN, &quot;NGINX status code: &quot;, nginx_status)\n</code></pre>\n<p>While I cannot share the whole log sequence, I do see the final log, with:</p>\n<pre><code>2024/07/22 11:15:59 [warn] 7#0: *13017 [lua] handle_499.lua:27: Successfully notified internal endpoint for 499 error, res status 404, context: ngx.timer, client: 10.76.170.103, server: 0.0.0.0:80\n</code></pre>\n<p>Also, just for reference, the ngx.ctx fields were created in the access_by_log phase, I am aware that access request methods and fields are not available in log_by_lua, which was why I saved them in ngx.ctx earlier.</p>\n"^^ . . . "1"^^ . . . . . . "<p>Firstly, the &quot;rocks&quot; check health error is likely because you don't have <a href="https://luarocks.org/" rel="nofollow noreferrer">LuaRocks</a> installed on your system. LuaRocks is a <a href="https://github.com/folke/lazy.nvim?tab=readme-ov-file#%EF%B8%8F-requirements" rel="nofollow noreferrer">requirement</a> for <code>lazy.nvim</code> so that it can install rockspecs. You can either install it, or disable its use in <code>lazy.nvim</code> by uncommenting the line <code>rocks = { enabled = false },</code> below.</p>\n<p>Secondly, by moving <code>lazy.lua</code> from <code>~/.config/nvim/lua/config</code> to <code>~/.config/nvim/lua</code>, you've inadvertently created a name clash between your <code>lazy.lua</code> file and the lazy module <code>~/.local/share/nvim/lazy</code>.</p>\n<p>The solution is to rename <code>~/.config/nvim/lua/lazy.lua</code> to something other than <code>lazy.lua</code>, or put it in some <code>{name}</code> directory like you've done prior. Renaming the file to something simple and read-able like <code>lazy-config.lua</code> will suffice.</p>\n<p>More concretely, assuming you want the following structured setup, you need the three things listed below.</p>\n<pre class="lang-none prettyprint-override"><code>~/.config/nvim\n├── init.lua\n└── lua\n ├── lazy-config.lua\n └── plugins\n ├── spec1.lua\n ├── **\n └── spec2.lua\n</code></pre>\n<ol>\n<li>Ensure the <code>~/.config/nvim/init.lua</code> file exists, and calls the following function:</li>\n</ol>\n<pre class="lang-lua prettyprint-override"><code>require(&quot;lazy-config&quot;)\n</code></pre>\n<ol start="2">\n<li>Ensure the directory <code>~/.config/nvim/lua</code> directory exists, and within that directory, there is the <code>lazy-config.lua</code> file which contains at least the following code:</li>\n</ol>\n<pre class="lang-lua prettyprint-override"><code>-- Bootstrap lazy.nvim\nlocal lazypath = vim.fn.stdpath(&quot;data&quot;) .. &quot;/lazy/lazy.nvim&quot;\nif not (vim.uv or vim.loop).fs_stat(lazypath) then\n local lazyrepo = &quot;https://github.com/folke/lazy.nvim.git&quot;\n local out = vim.fn.system({ &quot;git&quot;, &quot;clone&quot;, &quot;--filter=blob:none&quot;, &quot;--branch=stable&quot;, lazyrepo, lazypath })\n if vim.v.shell_error ~= 0 then\n vim.api.nvim_echo({\n { &quot;Failed to clone lazy.nvim:\\n&quot;, &quot;ErrorMsg&quot; },\n { out, &quot;WarningMsg&quot; },\n { &quot;\\nPress any key to exit...&quot; },\n }, true, {})\n vim.fn.getchar()\n os.exit(1)\n end\nend\nvim.opt.rtp:prepend(lazypath)\n\n-- Make sure to setup `mapleader` and `maplocalleader` before\n-- loading lazy.nvim so that mappings are correct.\n-- This is also a good place to setup other settings (vim.opt)\nvim.g.mapleader = &quot; &quot;\nvim.g.maplocalleader = &quot;\\\\&quot;\n\n-- Setup lazy.nvim\nrequire(&quot;lazy&quot;).setup({\n spec = {\n -- import your plugins\n { import = &quot;plugins&quot; },\n },\n -- Configure any other settings here. See the documentation (https://lazy.folke.io/configuration) for more details.\n -- colorscheme that will be used when installing plugins.\n install = { colorscheme = { &quot;habamax&quot; } },\n -- automatically check for plugin updates\n checker = { enabled = true },\n -- disable luarocks if it is not available on system\n -- rocks = { enabled = false },\n})\n</code></pre>\n<ol start="3">\n<li>Ensure the directory <code>~/.config/nvim/plugins</code> exists, where each file within that directory contains the specifications of a plugin you want to install, returned via a table. For example, to install <a href="https://github.com/nvim-lualine/lualine.nvim" rel="nofollow noreferrer">lualine</a>, you'd create a <code>lualine.lua</code> file within <code>~/.config/nvim/plugins</code> that contains the following:</li>\n</ol>\n<pre class="lang-lua prettyprint-override"><code>return { -- Status line for Neovim\n &quot;nvim-lualine/lualine.nvim&quot;,\n opts = {\n options = {\n icons_enabled = false,\n component_separators = &quot;|&quot;,\n section_separators = &quot;&quot;,\n },\n sections = {\n lualine_x = {\n &quot;encoding&quot;,\n &quot;filetype&quot;,\n },\n lualine_c = {\n { &quot;filename&quot;, path = 3 },\n },\n },\n },\n}\n</code></pre>\n<p>Read more about <code>lazy.nvim</code> installation <a href="https://lazy.folke.io/installation" rel="nofollow noreferrer">here</a>.</p>\n"^^ . . . . . "<p>I recommend reading StackOverflow's article on how to produce a <a href="https://stackoverflow.com/help/minimal-reproducible-example">Minimal and Reproducible Sample</a>. Regardless, <a href="https://create.roblox.com/docs/reference/engine/classes/PVInstance#PivotTo" rel="nofollow noreferrer">Roblox's documentation on PivotTo</a> shows that it takes in a single CFrame parameter. I am guessing that you want to create a stack of noobs that matches the number of subscribers that you have on YouTube.</p>\n<p>It seems as if you want to create a stack of noobs. In this case, you can determine the height of the current noob by doing a bit of math.</p>\n<pre class="lang-lua prettyprint-override"><code>for i = 1, finaldiffsubs do\n local clone = game.Workspace.Noob:Clone()\n\n clone.Parent = game.Workspace\n local ogposition = script.Parent\n clone:PivotTo(\n ogposition.PrimaryPart.CFrame * CFrame.new(0, 4 * (i + diffsubs), 0)\n )\n -- You can continue the code you had in the for loop here...\nend\n</code></pre>\n<p>For a bit of explanation on what you were doing wrong, you were trying to construct a CFrame through passing three parameters into the PivotTo function, when you would need to pass these 3 numbers into the CFrame constructor. This would construct a CFrame object, which is exactly what PivotTo wants to take in as input. I went a step further and made the noob model have the same rotation as the <code>ogposition</code> part, however you can undo this by creating a CFrame by passing it a Vector3 (which is how Roblox represents 3D vectors for things such as position). and do something like:</p>\n<pre class="lang-lua prettyprint-override"><code>clone:PivotTo(\n CFrame.new(\n ogposition.PrimaryPart.Position + Vector3.new(0, 4 * (i + diffsubs), 0)\n )\n)\n</code></pre>\n"^^ . "<p>When you group parts, it creates a Model, which is its own separate object. Applying changes to the Model does not necessarily impact its children. So a simple way to make changes is to use the Model:GetDescendants() function, which will give you a list of all of the objects in the hierarchy, and you can unanchor them manually.</p>\n<p>Also, if you have assembled the model yourself, there is a good chance that there are Welds holding the model together, so if you want it to fall apart, be sure to destroy these as well.</p>\n<p>So you can do something like this.</p>\n<pre class="lang-lua prettyprint-override"><code>local model : Model = script.Parent\n\nwait(5.0)\n\n-- remove the anchors and welds holding the thing together\nlocal children = model:GetDescendants()\nfor i, child in ipairs(children) do\n if child:IsA(&quot;Weld&quot;) then\n child:Destroy()\n elseif child:IsA(&quot;BasePart&quot;) then\n child.Anchored = false\n end\nend\n\n-- if your building needs a little... convincing to fall apart...\nlocal force = Instance.new(&quot;Explosion&quot;)\nforce.BlastRadius = model:GetExtentsSize().Magnitude\nforce.Position = model:GetPivot().Position\nforce.TimeScale = 1\nforce.Visible = false\nforce.ExplosionType = Enum.ExplosionType.NoCraters\nforce.Parent = model\n</code></pre>\n"^^ . . . . . "Perhaps, the only purpose of patterns with even numbers is to override smaller odd numbers, thus effectively forbidding hyphenation."^^ . . "0"^^ . "0"^^ . . "0"^^ . . "roblox-studio"^^ . . "1"^^ . "0"^^ . "0"^^ . . "openresty"^^ . . "0"^^ . . . "0"^^ . "0"^^ . "Creating separate lua tables for each object in an array"^^ . . "<p>My <code>lsp.lua</code> is as follows:</p>\n<pre class="lang-lua prettyprint-override"><code>local util = require(&quot;lspconfig.util&quot;)\n\nreturn {\n {\n &quot;williamboman/mason.nvim&quot;,\n opts = function(_, opts)\n vim.list_extend(opts.ensure_installed, {\n &quot;biome&quot;,\n &quot;stylua&quot;,\n &quot;selene&quot;,\n &quot;luacheck&quot;,\n &quot;shellcheck&quot;,\n &quot;shfmt&quot;,\n &quot;tailwindcss-language-server&quot;,\n &quot;typescript-language-server&quot;,\n &quot;css-lsp&quot;,\n })\n end,\n },\n {\n &quot;neovim/nvim-lspconfig&quot;,\n opts = {\n --- other options\n servers = {\n tsserver = {\n on_attach = function(client)\n client.server_capabilities.documentFormattingProvider = false\n end,\n },\n biome = {\n cmd = { &quot;biome&quot;, &quot;lsp-proxy&quot; },\n filetypes = {\n &quot;javascript&quot;,\n &quot;javascriptreact&quot;,\n &quot;json&quot;,\n &quot;jsonc&quot;,\n &quot;typescript&quot;,\n &quot;typescript.tsx&quot;,\n &quot;typescriptreact&quot;,\n &quot;astro&quot;,\n &quot;svelte&quot;,\n &quot;vue&quot;,\n &quot;css&quot;,\n },\n root_dir = util.root_pattern(&quot;biome.json&quot;),\n },\n },\n },\n },\n}\n</code></pre>\n<p>So in my project, I have a <code>biome.json</code> which I have configured to follow the formatting and linting we are using in our project (we migrated from eslint and prettier). This seems to work fine for my fellow colleagues who are using VSCode. For me, however, I use neovim in my daily work, so I can't seem to make it follow <code>biome.json</code> configuration and hence resulting in different formatting everytime I save a file. What is it I'm missing here?</p>\n"^^ . . "nvm, i fixed the problem, thanks! but still one problem, how do i delete the main script from the clones? every clone have the subscriver script INSIDE, so that makes an Exponential effect when some one subs."^^ . . "<p>First of all, beware of premature optimization. If <code>g(f())</code> calls are relatively infrequent then the difference might be negligible.</p>\n<p>Next, creating an extra table takes time, so option (1) is always slower than (3).</p>\n<p>Concerning option (2), it really depends on what <code>g()</code> actually does with the arguments. <code>local args = {...}</code> is an equivalent of option (1), while <code>local x, y, z = ...</code> is the same as (3).</p>\n"^^ . . . . . "0"^^ . "<p>I have a local script that should add an item to the player's StarterPack when I call a function in it and provide the name of the item as a parameter.</p>\n<pre><code>local replicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal assets = replicatedStorage:WaitForChild(&quot;Assets&quot;)\nlocal player = game.Players.LocalPlayer\n\n\nlocal function addItem(itemName)\n\n local item = assets:FindFirstChild(itemName)\n \n if not item then return end\n \n print(item)\n print(&quot;Adding &quot;..itemName..&quot; to backpack!&quot;)\n \n item:Clone().Parent = player.Backpack\n\nend\n</code></pre>\n<p>I tried replacing the <code>item:Clone().Parent = player.Backpack</code> with this:</p>\n<pre><code> local clone = item:Clone()\n clone.Parent = player.Backpack\n</code></pre>\n<p>Which also doesn't add the item into the StarterPack.</p>\n<p>No errors or warnings are thrown up. As you can see, I put some <code>print()</code> functions in there and here is what they print:</p>\n<p>Cloth Tunic -- from the <code>print(item)</code></p>\n<p>Adding Cloth Tunic to backpack! -- from the other print</p>\n<p>Cloth Trousers -- from the <code>print(item)</code></p>\n<p>Adding Cloth Trousers to backpack! -- from the other print</p>\n<p>(The function gets called two separate times at the beginning of the game, once for each item in the inventory)</p>\n<p>So I'm not sure why the items aren't being put into the StarterPack if the code is making to the <code>Clone()</code> function and the item names are correct.</p>\n"^^ . "0"^^ . . . . . . . . . . . . . "1"^^ . "3"^^ . . "How can I run the Wikipedia Module Yesno.lua from the lua cli?"^^ . . "Can undefine a symbol defined by ffi.cdef in Luajit?"^^ . . . "@histrueandfalse's comment applies here, too - everything after `main_menu.Enabled = false` is redundant. But that's not particularly important for this post."^^ . "Also, Remember that parts of my answer are not needed. For example, you can just say main_menu.visible=false, rather than all the other code. the .visible attributes also set the visibility of all its descendants."^^ . . . . "<p>I have written logs for the server Garry's mod but I do not display information in the parameters &quot;Damage&quot; and &quot;Connect&quot; anyone can say what is wrong with the script?\nI would like to add more logs of profession change how can it be done?</p>\n<pre><code>local logs = {\n kill = {},\n damage = {},\n changename = {},\n connect = {},\n disconnect = {},\n Kd = nil\n}\n\n-- Entity killed logging\ngameevent.Listen(&quot;entity_killed&quot;)\nhook.Add(&quot;entity_killed&quot;, &quot;&quot;, function(data)\n if not logsEnabled then return end\n\n local victim = &quot;unknown&quot;\n local attacker = &quot;map&quot;\n local weapon = &quot;Unknown gun&quot;\n \n for _, ply in pairs(player.GetAll()) do\n if ply:EntIndex() == data.entindex_killed then\n victim = ply:Nick()\n end\n if ply:EntIndex() == data.entindex_attacker then\n attacker = ply:Nick()\n local weaponEntity = ply:GetActiveWeapon()\n if IsValid(weaponEntity) then\n weapon = weaponEntity:GetPrintName()\n end\n end\n end\n\n table.insert(logs.kill, &quot;[&quot; .. os.date(&quot;%H:%M:%S&quot;) .. &quot;] &quot; .. attacker .. &quot; killed player &quot; .. victim .. &quot; weapon &quot; .. weapon)\nend)\n\n-- Entity damage logging\nhook.Add(&quot;EntityTakeDamage&quot;, &quot;&quot;, function(target, dmginfo)\n if not logsEnabled then return end\n if not target:IsPlayer() then return end\n\n local attacker = dmginfo:GetAttacker()\n local attackerName = &quot;Unknown&quot;\n local weapon = &quot;Unknown gun&quot;\n \n if attacker:IsPlayer() then\n attackerName = attacker:Nick()\n local weaponEntity = attacker:GetActiveWeapon()\n if IsValid(weaponEntity) then\n weapon = weaponEntity:GetPrintName()\n end\n end\n\n table.insert(logs.damage, &quot;[&quot; .. os.date(&quot;%H:%M:%S&quot;) .. &quot;] &quot; .. attackerName .. &quot; did damage to a player &quot; .. target:Nick() .. &quot; на &quot; .. dmginfo:GetDamage() .. &quot; HP&quot; .. &quot; weapon &quot; .. weapon)\nend)\n\n-- Chat name change and connect/disconnect logging\nhook.Add(&quot;ChatText&quot;, &quot;&quot;, function(index, name, text, type)\n if not logsEnabled then return end\n if type == &quot;namechange&quot; then\n table.insert(logs.changename, &quot;[&quot; .. os.date(&quot;%m/%d/%Y-%H:%M:%S&quot;) .. &quot;] &quot; .. name)\n elseif type == &quot;joinleave&quot; then\n local nickname, steamID = text:match(&quot;([^#]+)#([^%(]+)%(%d+:.-%)(.-)joined&quot;)\n if nickname and steamID then\n table.insert(logs.connect, &quot;[&quot; .. os.date(&quot;%H:%M:%S&quot;) .. &quot;] &quot; .. nickname .. &quot; (&quot; .. steamID .. &quot;) connected.&quot;)\n end\n end\nend)\n\n-- Player disconnect logging\ngameevent.Listen(&quot;player_disconnect&quot;)\nhook.Add(&quot;player_disconnect&quot;, &quot;&quot;, function(data)\n if not logsEnabled then return end\n table.insert(logs.disconnect, &quot;[&quot; .. os.date(&quot;%H:%M:%S&quot;) .. &quot;] &quot; .. data.name .. &quot; (&quot; .. data.networkid .. &quot;). &quot; .. data.reason)\nend)\n\n-- Create fonts\nsurface.CreateFont(&quot;LogFont&quot;, { font = &quot;Arial&quot;, size = 22, weight = 1000 })\nsurface.CreateFont(&quot;TitleFont&quot;, { font = &quot;Amb&quot;, size = 20 })\n\nlocal function createLogWindow()\n local frame = vgui.Create(&quot;DFrame&quot;)\n frame:SetSize(670, 370)\n frame:Center()\n frame:SetTitle(&quot;&quot;)\n frame:ShowCloseButton(false)\n frame:SetRenderInScreenshots(false)\n frame:MakePopup()\n\n function frame:Paint()\n local blur = Material(&quot;pp/blurscreen&quot;)\n local x, y = self:LocalToScreen(0, 0)\n local screenW, screenH = ScrW(), ScrH()\n surface.SetDrawColor(255, 255, 255)\n surface.SetMaterial(blur)\n for i = 1, 3 do\n blur:SetFloat(&quot;$blur&quot;, i / 3 * 6)\n blur:Recompute()\n render.UpdateScreenEffectTexture()\n surface.DrawTexturedRect(-x, -y, screenW, screenH)\n end\n draw.RoundedBox(4, 0, 0, self:GetWide(), self:GetTall(), Color(0, 0, 0, 170))\n draw.SimpleText(&quot;ClientSide Logs&quot;, &quot;TitleFont&quot;, 5, 3, Color(255, 255, 255, 255), 0, 0)\n surface.SetDrawColor(Color(0, 0, 0, 255))\n surface.DrawOutlinedRect(0, 0, self:GetWide(), self:GetTall())\n surface.DrawOutlinedRect(0, 0, 619, 26)\n surface.DrawOutlinedRect(0, 25, self:GetWide(), self:GetTall() - 25)\n surface.SetDrawColor(Color(0, 0, 0, 255))\n surface.DrawOutlinedRect(0, 25, 170, 610)\n end\n\n local closeButton = vgui.Create(&quot;DButton&quot;, frame)\n closeButton:SetTextColor(Color(150, 150, 150))\n closeButton:SetText(&quot;X&quot;)\n closeButton:SetFont(&quot;LogFont&quot;)\n closeButton:SetPos(619, 1)\n closeButton:SetSize(50, 24)\n closeButton.DoClick = function()\n frame:SizeTo(0, 0, 0.2, 0, 0.2)\n timer.Simple(0.3, function()\n frame:SetVisible(false)\n end)\n end\n closeButton.Paint = function(self, w, h)\n surface.SetDrawColor(Color(0, 0, 0, 255))\n surface.DrawOutlinedRect(0, 0, w, h)\n draw.RoundedBox(0, 0, 0, w, h, Color(139, 0, 0, 255))\n end\n closeButton.OnCursorEntered = function()\n surface.PlaySound(&quot;garrysmod/ui_hover.wav&quot;)\n closeButton.Paint = function(self, w, h)\n draw.RoundedBox(0, 0, 0, w, h, Color(220, 20, 60, 255))\n end\n end\n closeButton.OnCursorExited = function()\n closeButton.Paint = function(self, w, h)\n draw.RoundedBox(0, 0, 0, w, h, Color(139, 0, 0, 255))\n end\n end\n\n local searchBox = vgui.Create(&quot;DTextEntry&quot;, frame)\n searchBox:SetPos(410, 1)\n searchBox:SetSize(200, 24)\n searchBox:SetPlaceholderText(&quot;Search logs...&quot;)\n\n local function updateLogs(logTable)\n if IsValid(logs.Kd) then logs.Kd:Remove() end\n logs.Kd = vgui.Create(&quot;RichText&quot;, frame)\n logs.Kd:SetPos(174, 30)\n logs.Kd:SetSize(491, 335)\n logs.Kd:SetFontInternal(&quot;LogFont&quot;)\n logs.Kd.Paint = function(self, w, h)\n self:SetBGColor(Color(0, 0, 0, 120))\n surface.SetDrawColor(Color(0, 0, 0, 255))\n surface.DrawOutlinedRect(0, 0, w, h)\n end\n logs.Kd:InsertColorChange(255, 255, 255, 255)\n local searchQuery = searchBox:GetValue():lower()\n for _, log in pairs(logTable) do\n if searchQuery == &quot;&quot; or string.find(log:lower(), searchQuery) then\n logs.Kd:AppendText(log .. &quot;\\n&quot;)\n end\n end\n end\n\n searchBox.OnChange = function()\n if IsValid(logs.Kd) and IsValid(logs.Kd.activeButton) then\n logs.Kd.activeButton.DoClick()\n end\n end\n\n local buttonYPos = 30\n local function createLogButton(text, logTable)\n local button = vgui.Create(&quot;DButton&quot;, frame)\n button:SetPos(5, buttonYPos)\n button:SetSize(160, 30)\n button:SetText(text)\n button:SetFont(&quot;LogFont&quot;)\n button:SetTextColor(Color(255, 255, 255, 255))\n button.DoClick = function()\n if IsValid(logs.Kd) then\n logs.Kd.activeButton = button\n updateLogs(logTable)\n end\n end\n button.OnCursorEntered = function()\n surface.PlaySound(&quot;garrysmod/ui_hover.wav&quot;)\n end\n function button:Paint(w, h)\n draw.RoundedBox(0, 0, 0, w, h, Color(0, 0, 0, 120))\n surface.SetDrawColor(Color(0, 0, 0, 255))\n surface.DrawOutlinedRect(0, 0, w, h)\n end\n buttonYPos = buttonYPos + 35\n end\n\n createLogButton(&quot;Kill&quot;, logs.kill)\n createLogButton(&quot;Damage&quot;, logs.damage)\n createLogButton(&quot;Connect&quot;, logs.connect)\n createLogButton(&quot;Disconnect&quot;, logs.disconnect)\n\n return frame\nend\n\nhook.Add(&quot;Think&quot;, &quot;&quot;, function()\n if input.IsKeyDown(KEY_END) and not Q then\n if v then\n v:Close()\n v = nil\n else\n v = createLogWindow()\n end\n end\n Q = input.IsKeyDown(KEY_END)\nend)\n\nconcommand.Add(&quot;toggle_logs&quot;, function()\n logsEnabled = not logsEnabled\n print(&quot;Logging is now &quot; .. (logsEnabled and &quot;enabled&quot; or &quot;disabled&quot;))\nend)\n\nconcommand.Add(&quot;logs_stop&quot;, function()\n logsEnabled = false\n print(&quot;Logging has stopped.&quot;)\nend)\n</code></pre>\n<p>To get the information about the connected player I wanted to get it from the chat, but it didn't work.</p>\n"^^ . . "0"^^ . . . . "1"^^ . "0"^^ . . "No, there is no Output from the door whatsoever."^^ . "0"^^ . . . "<p>Don't make it look harder than it is. Just exec <code>curl</code> or <code>wget</code> through <code>io.popen</code> and parse with the help of a builtin JSON decoder.</p>\n<pre class="lang-lua prettyprint-override"><code>local h = io.popen(&quot;wget -qO- https://example.org/example.json&quot;)\nlocal rawdata = h:read(&quot;all&quot;)\nh:close()\nlocal t = vim.json.decode(rawdata)\nprint(vim.inspect(t))\n</code></pre>\n<p>And if you need some extra modules then put them all under your plugin's <code>/lua</code> subdirectory.</p>\n"^^ . . . . . "0"^^ . . "Are you really using Lua 5.0??"^^ . "1"^^ . "0"^^ . . "@KyleF.Hartzenberg, I used `sudo apt install neovim`. I am on Ubuntu."^^ . "<p>At the time of writing this, LuaJIT's <code>ffi.cdef</code> ignores redeclarations. Source: <a href="https://github.com/LuaJIT/LuaJIT/issues/28" rel="nofollow noreferrer">https://github.com/LuaJIT/LuaJIT/issues/28</a>.</p>\n"^^ . . "Interesting. The Lua parser should be installed by default with the distribution. Are there any issues when you run `:checkhealth treesitter`? And also just `:checkhealth` from within Neovim?"^^ . . . "'luarocks' doesnt find the executable even if i specify"^^ . . "image"^^ . "Judging by later Lua versions, I would expect the table argument to be the slowest (it requires first moving the vararg from the stack to a table on the heap; note also that this is lossy in case of trailing nils), the variadic function to be the second slowest, and the function with the known number of arguments to be the fastest (it requires keeping track of vararg info, such as length). But measure."^^ . . . . . "<p>The answer to finding an elements depth is a bit complicated: pandoc's traversal methods don't have any hooks that would trigger on level changes, but implementing a custom traversal method would be a lot of work.</p>\n<p>We take the middle road: we still let pandoc do <em>most</em> of the traversal, but we implement a custom hook into it. The functions and filters are mutually recursive, so the code is a bit confusing:</p>\n<pre class="lang-lua prettyprint-override"><code>-- The level counter. Modified as we traverse the AST\nlocal level = 0\n\n-- A filter to bump the level. It's used recursively,\n-- so it's only declared here, but defined later.\nlocal bump_level_filter\n\n-- Print the element tag, indented by `level` spaces.\n-- Calls the `bump_level_filter` recursively\nlocal print_tag = function (elem)\n print(string.rep(' ', level) .. elem.t)\n return elem:walk(bump_level_filter)\nend\n\nlocal bump_level = function (elems)\n level = level + 1\n local result = elems:map(print_tag)\n level = level - 1\n -- Return the elements unchanged, but DON'T continue\n -- walking to deeper levels. That's done manually\n -- in `print_tag`.\n return result, false\nend\n\nbump_level_filter = {\n traverse = 'topdown',\n Inlines = bump_level,\n Blocks = bump_level,\n}\n\nreturn {bump_level_filter}\n</code></pre>\n<p>The result isn't <em>quite</em> correct though, because the code doesn't account for nesting in list items etc. That would have to happen manually.</p>\n<p>Using the input given above, the filter produces:</p>\n<pre><code> Para\n Str\n Space\n Str\n BulletList\n Plain\n Str\n Plain\n Str\n BulletList\n Plain\n Str\n Plain\n Str\n</code></pre>\n"^^ . . . . . . "You could also apply this technique to your `line` rule, to become `line <- {~ (quoted / 'a' -> '' / . [^a"]*) ~}`. Go check the performance difference and see if it's faster. :)"^^ . . . "1"^^ . "Thanks for the reply! I actually managed to resolve the issue by hitting the endpoint through nginx itself, via `"http://" .. ngx.var.fenginx .. "/auth/handle_499_error/"`, and it worked, but I'm still not fully sure why hitting via the microservice directly was failing."^^ . "1"^^ . . . . "I am making a Lua Love 2d game and I wanted to use the love.keypressed function to make a dash a move. But there is an eror"^^ . . . . . . . "<p>I've been trying to wrap my head around utilizing inheritance with Lua (<a href="https://www.lua.org/pil/16.2.html" rel="nofollow noreferrer">https://www.lua.org/pil/16.2.html</a> and <a href="https://stackoverflow.com/questions/7313794/case-insensitive-array-in-lua">Case insensitive array in Lua</a> as references) but also integrating a case-insensitive solution, too. Namely using metatables/metamethod calls to intercept __index and __newindex, lowercasing the calls, and then proceeding.</p>\n<p>However, I've been unable to get anything working. Can anyone help? Thanks.</p>\n<p>In case the question arises on what I'm trying to achieve:</p>\n<p>Create a function that uses (or creates) a base object, apply case-insensitive functionality, setup inheritance functionality, and use the base object for core functions.</p>\n<p>From here, create mixins table (with case-insensitive functionality and inheritance off of base) for the purpose of shared functions (and can be added to, base.mixins or child.mixins) or called directly in case any child object has modified functions of same name, the shared can still be called via child.mixins.func, respectively.</p>\n<p>Child functions (modules) are created off of the mixins table (case-insensitive functionality and inheritance). Can directly call any shared functions via child.mixins.func or add to mixins table. Ideally, the base table would be inaccessible from the child for manipulation, though core functions could still be called by inheritance (lofty goal?)</p>\n<p>In any case, some responders may shred my query to bits, so be gentle please.</p>\n"^^ . "3"^^ . . . . . "0"^^ . . "Could you share the code you have?"^^ . "lazyvim"^^ . . "You can improve your answer by explaining it. Pretend you are a teacher."^^ . . "There must be an executable ... something is running. If I understand you correctly then the executable will be the lua interpreter I guess, but if you start GDB then do `core-file COREFILE` you should see a line like `Core was generated by ....` which should indicate the executable name, load that as the executable."^^ . . "what is your actual question? add a [mcve]"^^ . "1"^^ . "0"^^ . . . . . "Oh my god, you’re such an angel! That's really the reason—it’s working great now!!!"^^ . "0"^^ . . "I am attempting to pass an infobox value into a LUA module that outputting an answer based on the infobox value (FANDOM WIKIA)"^^ . "@Gabriel - no such thing as a dumb question (en.wikipedia.org/wiki/No_such_thing_as_a_stupid_question). The answer is no, the clone function continues to create new tables every time it's called, thanks to the "local" keyword. I've edited my answer to demonstrate."^^ . . . . . "0"^^ . . . . "<p>I have to move to Lua for a scripting language and trying to recreate a condition I use a lot</p>\n<ul>\n<li><p>line 1: if the pattern returns capture groups, assign them to &quot;match&quot; and this condition returns true</p>\n<ul>\n<li>regFind is my function that runs pattern matches and returns the matches as a python dictionary</li>\n</ul>\n</li>\n<li><p>line 2: if true, then use the capture group values</p>\n</li>\n</ul>\n<p>is this even possible in Lua?</p>\n<p>thanks so much for your help</p>\n<pre><code>1. if (match := o.regFind(&quot;(?P&lt;test&gt;\\d+)\\s(?P&lt;letters&gt;[A-Z]+)&quot;,&quot;1111111 GGGG&quot;)):\n2. if match[&quot;test&quot;]:\n3. value = match.get(&quot;test&quot;)\n4. print(value)\n5. if match[&quot;letters&quot;] != None:\n6. print(match)\n</code></pre>\n<p>I created a lua function called &quot;Regex&quot; that will return the capture matches as a table. But this gets a syntax error because it's expecting ==</p>\n<pre><code>if matches = Regex(&quot;THIS IS a TEST&quot;, &quot;%a&quot;) then\n print &quot;is a match&quot;\nend\n</code></pre>\n"^^ . . . "0"^^ . . "1"^^ . "Yes, I think you're right, it's a way of encoding 'don't hyphenate here' into the hyphenation algorithm. It might have been clearer to use, say negative numbers, but that would have made the algorithm more cumbersome, because you'd have to get the absolute value of the number, and then find out if the value was negative. You can tell this was written when CPU cycles were were scarcer."^^ . . "0"^^ . . . . "lua-table"^^ . "0"^^ . . "scribunto"^^ . "why is part:GetTouchingParts() returning parts when no parts are touching"^^ . . "Your answer is correct but if you want a faster grammar, don't write `quoted` like this. Repetition is faster than this continuation style definition. `quoted <- '"' [^"]* '"'`."^^ . "looks like you don't know what your code is doing. a) your script basically does nothing because you connect an event handler and then immediately skip the rest of your script because your condition is false. b) you're connecting more event handlers in a while loop. this doesn't make any sense in this case. make sure you understand what uis.InputBegan:Connect does and how to use it properly."^^ . "0"^^ . "Freeswitch Lua API - how to get Channel State?"^^ . "0"^^ . . . . "logitech-gaming-software"^^ . . . . "0"^^ . . . "How can I "ApplyDescription()" locally?"^^ . . . . . . . . "world-of-warcraft"^^ . . . . . "scroll-offset"^^ . . . . . . . "1"^^ . . . "0"^^ . . . . . . . . "1"^^ . "<p>This only answers one part of the question: check whether a Str is in a ListItem. The answer implements @tarleb's comment in the question above.</p>\n<p>@tarleb: please feel free to copy or adopt this to an own answer. I would then mark it accepted and delete my answer.</p>\n<pre class="lang-lua prettyprint-override"><code>function uppercase_str_in_bullet_list(bullet_list)\n return bullet_list:walk{\n Str = function(str)\n str.text = pandoc.text.upper(str.text)\n return str, false\n end\n }\nend\n\nreturn {{\n BulletList = uppercase_str_in_bullet_list\n}}\n</code></pre>\n<pre class="lang-hs prettyprint-override"><code>[ Para [ Str &quot;some&quot; , Space , Str &quot;text&quot; ]\n, BulletList\n [ [ Plain [ Str &quot;ITEM1&quot; ] ]\n , [ Plain [ Str &quot;ITEM2&quot; ]\n , BulletList\n [ [ Plain [ Str &quot;SUBITEMA&quot; ] ]\n , [ Plain [ Str &quot;SUBITEMB&quot; ] ]\n ]\n ]\n ]\n]\n</code></pre>\n"^^ . "<p>It is important to note that data stores can store any kind of data you want (if you encode it). In your case, it seems that you just want to store a single string, which is the theme that the user has selected. Assuming this is a client-sided application, you will want a remote event to get the theme and one to set the theme. This is because data-stores can only be accessed from the server.</p>\n<p>The Roblox documentation has articles on <a href="https://create.roblox.com/docs/scripting/events/remote" rel="nofollow noreferrer">Remote Events and Callbacks</a> and on <a href="https://create.roblox.com/docs/cloud-services/data-stores" rel="nofollow noreferrer">Data Stores</a>.</p>\n<p>Here is some code that I wrote up that handles saving and retrieving data from data-stores through a remote event called <code>GetTheme</code> and a remote function called <code>UpdateTheme</code>, both of which are inside <code>ReplicatedStorage</code>. The script itself should be in <code>ServerScriptService</code> as a server-sided script.</p>\n<pre class="lang-lua prettyprint-override"><code>local THEME_DATASTORE_NAME = &quot;Themes&quot;\n\nlocal DataStoreService = game:GetService(&quot;DataStoreService&quot;)\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\n\nlocal themeDataStore = DataStoreService:GetDataStore(THEME_DATASTORE_NAME)\n\nlocal getThemeRemoteEvent = ReplicatedStorage.GetTheme\nlocal updateThemeRemoteFunction = ReplicatedStorage.UpdateTheme\n\n-- We want to return true if this was successful, and false if it was not,\n-- so that the client can display an appropriate error to the user.\nupdateThemeRemoteFunction.OnServerInvoke = function(player, theme)\n if theme == &quot;default&quot; or theme == &quot;green&quot; then\n local wasSuccess, result = pcall(function()\n themeDataStore:SetAsync(player.UserId, theme)\n end)\n\n if not wasSuccess then\n print(&quot;Unable to save data to data-store: &quot; .. result)\n end\n\n return wasSuccess\n end\n\n return false\nend\n\ngetThemeRemoteEvent.OnServerEvent:Connect(function(player)\n -- Retrieve the theme that the user saved\n return themeDataStore:GetAsync(player.UserId) or &quot;default&quot;\nend)\n</code></pre>\n<p>Edit: It is important to note here that I did not implement any rate limiting, which I would highly recommend. All you would need to do in this case is have a have a table of players and their last theme update / retrieval and make sure that they can only perform that operation after, say, 5-10 seconds.</p>\n"^^ . . "@CarlosAranas yea u need a local script"^^ . "thank u @Piglet but how do i add code that checks if left mouse button is clicked in the while loop without breaking the script"^^ . . "1"^^ . "0"^^ . . . "roblox"^^ . "1"^^ . . . . . "0"^^ . "0"^^ . "@RelaxingGaming you shoudn't need to. You should be able to ask questions straight away, like stack overflow. If you have the wrong website, look here:https://gamedev.stackexchange.com/"^^ . . . . . "Damage multiplier will not work on "BaseDamage""^^ . "<p>I got this script</p>\n<pre><code>door = script.Parent\nfunction onChatted(msg, recipient, speaker) \nsource = string.lower(speaker.Name) \nmsg = string.lower(msg) \n-- thecharacter = script.Parent.TheCharacter\nif (msg == string.match(File.name)) then \ndoor.CanCollide = false \ndoor.Transparency = 0.7 \nwait(4) \ndoor.CanCollide = true \ndoor.Transparency = 0 \nend \nend \ngame.Players.ChildAdded:connect(function(plr)\nplr.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, plr) end) \nend)\n\n</code></pre>\n<p>Is it possible to match the user msg with an image name instead of a character?</p>\n<p>I m new to lua and can t seem to find anything about this.</p>\n"^^ . . . . . . "Do you have any errors?"^^ . . . . . . "1"^^ . "What did you change? Can you provide more explanation to aid future readers with similar problems?"^^ . . . . "2"^^ . . . "a temporary solution is to simply downgrade the lua extension to a older one, i downgraded to a version released 2mo ago and the behavior no longer occurs"^^ . . "0"^^ . . . . "Infinite yield possible on Players:WaitForChild("CombatStatus")"^^ . "0"^^ . "<p>I'm wondering if I can add a C file to a C++ project. I use premake5 and conan to get the dependencies and build the solution but every file I've used so far is C++. Now, I need a C file that has a kdtree that I need to make new features in my engine. But I don't know if I can work with both C and C++ in one project or how to do it. This is my lua definition for the project. What can I do to add one C file to the project?</p>\n<pre><code>project&quot;Particles&quot;\n\n kind &quot;ConsoleApp&quot;\n language &quot;C++&quot;\n targetdir &quot;../build/%{prj.name}/%{cfg.buildcfg}&quot;\n includedirs { &quot;../include&quot;, &quot;../deps/include&quot;, &quot;../include/engine&quot;, &quot;../deps/include/stb&quot;, &quot;../deps/include/imgui&quot;, &quot;../deps/include/tests&quot; }\n conan_config_exec()\n debugargs { _MAIN_SCRIPT_DIR .. &quot;/examples/data&quot; }\n files {\n &quot;../deps/src/**&quot;,\n &quot;../deps/include/**&quot;,\n &quot;../src/**&quot;,\n &quot;../include/**&quot;,\n &quot;../tests/particles_test.cpp&quot;,\n &quot;../assets/**&quot;,\n }\n filter &quot;files:**.obj&quot;\n flags { &quot;ExcludeFromBuild&quot; }\n</code></pre>\n"^^ . "1"^^ . "1"^^ . "3"^^ . "<p>I'm implementing the Knuth-liang algorithm in Lua to create a text-wrapping plugin for Davinci resolve. I've looked at the explanation of the algorithm and there's one part that I don't understand. Here's the part that confuses me from the <a href="https://pyhyphen.readthedocs.io/en/latest/algorithm.html" rel="nofollow noreferrer">pyhyphen readme</a>:</p>\n<blockquote>\n<p>Knuths algorithm basically just does pattern matches from the rule set, then applies the matches. The patterns in this case that match are “xa”, “xam”, “mp”, and “pl”. These are actually stored as “x1a”, “xam3”, “4m1p”, and “1p2l2”. Whenever numbers appear between the letters, they are added in. If two (or more) patterns have numbers in the same place, the highest number wins. Here’s the example:</p>\n</blockquote>\n<pre><code> . e x a m p l e .\n x1a\n x a m3\n 4m1p\n 1p2l2\n-----------------\n. e x1a4m3p2l2e .\n</code></pre>\n<blockquote>\n<p>Finally, hyphens are placed wherever odd numbers appear</p>\n</blockquote>\n<p>Why only odd numbers?</p>\n"^^ . . . . . . . . . "1"^^ . . "0"^^ . "1"^^ . "0"^^ . "neovim"^^ . . "0"^^ . "0"^^ . "1"^^ . "1"^^ . "0"^^ . . . . . . . "0"^^ . "0"^^ . . "0"^^ . . "wikibase"^^ . . . . "0"^^ . "1"^^ . . . "this code didnt work maybe it's because i didnt use a local script"^^ . . . . . "0"^^ . "1"^^ . "1"^^ . "<p>Neovim doesn't like it when it can't access language parsers for a few languages.</p>\n<p>According to the <a href="https://lazy.folke.io/configuration" rel="nofollow noreferrer">docs</a>, <code>lazy.nvim</code> &quot;resets the runtime path to $VIMRUNTIME and your config directory&quot;. That renders the builtin parsers unreachable. The solution would be to either turn this default setting off or to install the required parsers with the <code>nvim-treesitter</code> plugin.</p>\n<p>Here is how I do it:</p>\n<pre class="lang-lua prettyprint-override"><code>local opts = {\n ensure_installed = {\n 'c',\n 'lua',\n 'vim',\n 'vimdoc',\n 'query',\n 'markdown',\n 'markdown_inline',\n },\n}\n\nlocal function config()\n require('nvim-treesitter.configs').setup(opts)\nend\nreturn {\n 'nvim-treesitter/nvim-treesitter',\n config = config,\n build = ':TSUpdate',\n}\n\n</code></pre>\n"^^ . . . . . . . . . . . . "mediawiki"^^ . . "<p><a href="https://pastebin.com/vPgjPdnK" rel="nofollow noreferrer">https://pastebin.com/vPgjPdnK</a></p>\n<pre><code>local Players = game:GetService(&quot;Players&quot;)\nlocal pointPart1 = game.Workspace.PointsPlaceFolder.PointPart1\n\nlocal function onCharacterAdded(character, player)\n player:SetAttribute(&quot;IsAlive&quot;, true)\n \n local humanoid = character:WaitForChild(&quot;Humanoid&quot;)\n \n humanoid.Died:Connect(function()\n local points = player.leaderstats.Points\n points.Value = 0\n player:SetAttribute(&quot;IsAlive&quot;, false)\n end)\nend\n\nlocal function onPlayerAdded(player)\n local leaderstats = Instance.new(&quot;Folder&quot;)\n leaderstats.Name = &quot;leaderstats&quot;\n leaderstats.Parent = player\n \n local points = Instance.new(&quot;IntValue&quot;)\n points.Name = &quot;Points&quot;\n points.Value = 0\n points.Parent = leaderstats\n \n player:SetAttribute(&quot;IsAlive&quot;, false)\n \n player.CharacterAdded:Connect(function(character)\n onCharacterAdded(character, player)\n end)\nend\n\nPlayers.PlayerAdded:Connect(onPlayerAdded)\n\nwhile true do\n task.wait(1)\n local playerList = Players:GetPlayers()\n for i = 1, #playerList do\n local player = playerList[i]\n if player:GetAttribute(&quot;IsAlive&quot;) then\n local points = player.leaderstats.Points\n points.Value += 1\n end\n end\nend\n\n</code></pre>\n<p>I tried adding a another function that basically onTouch it will cause 10 points to gain and then breaks. I have conceptual issues so it may have not accurately been carried out but there were no error/syntax's.</p>\n"^^ . "1"^^ . . "0"^^ . "It's a little hard to tell what you're asking. Please read [ask] for more information on what kind of details you need. It also seems like your questions could use a [mre]."^^ . . . . . . . . . "<p>I've already searched everywhere\nnothing helped me\nliterally nothing\nLike, I've never programmed in LUA before, but I'm having trouble installing luarocks on <em><strong>Windows</strong></em>\n<code>luarocks</code> is not finding the executable, as mentioned in the title</p>\n<pre><code>Error: Lua 5.4 interpreter not found at C:\\Program Files (x86)\\Lua\\5.1\n\nPlease set your Lua interpreter with:\n\n luarocks --local config variables.LUA &lt;d:\\path\\lua.exe&gt;\n</code></pre>\n<p>I have already specified the path several times and still nothing</p>\n<p>I noticed two files were missing, in different directories\nI wrote them both in <code>--local</code> and normal</p>\n<pre><code>luarocks config variables.LUA &quot;C:\\Program Files (x86)\\Lua\\5.1\\lua.exe&quot;\n</code></pre>\n<p>and it appears</p>\n<pre><code>Wrote\n variables.LUA = &quot;C:\\\\Program Files (x86)\\\\Lua\\\\5.1\\\\lua.exe&quot;\nto\n C:\\Program Files\\luarocks\\config-5.4.lua\n</code></pre>\n<p>same as <code>local</code></p>\n<pre><code>Wrote\n variables.LUA = &quot;C:\\\\Program Files (x86)\\\\Lua\\\\5.1\\\\lua.exe&quot;\nto\n C:\\Users\\POSITO\\AppData\\Roaming\\luarocks\\config-5.4.lua\n</code></pre>\n<ul>\n<li>the files <code>luarocks.exe</code> and <code>luarocks admin.exe</code> are in the folder along with the interpreter</li>\n<li>even with all this, there is still the error</li>\n</ul>\n<pre><code>Error: Lua 5.4 interpreter not found at C:\\Program Files (x86)\\Lua\\5.1\n\nPlease set your Lua interpreter with:\n\n luarocks --local config variables.LUA &lt;d:\\path\\lua.exe&gt;\n</code></pre>\n<p>is the same error\nand yes, i typed <code>luarocks</code> for see and i always see this part</p>\n<pre><code>\nConfiguration:\n Lua:\n Version : 5.4\n LUA : (interpreter not found)\n ****************************************\n Use the command\n\n luarocks config variables.LUA &lt;d:\\path\\lua.exe&gt;\n\n to fix the location\n ****************************************\n LUA_INCDIR : (lua.h not found)\n LUA_LIBDIR : (Lua library itself not found)\n\n Configuration files:\n System : C:\\Program Files\\luarocks\\config-5.4.lua (ok)\n User : C:\\Users\\POSITO\\AppData\\Roaming\\luarocks\\config-5.4.lua (ok)\n\n Rocks trees in use:\n C:\\Users\\POSITO\\AppData\\Roaming\\luarocks (&quot;user&quot;)\n</code></pre>\n<p><strong>if this question is marked as a duplicate of another question that helped me in no way, I will quit the forum because I hate the forum and I'm being forced</strong></p>\n"^^ . "Lua Script for Reading CSV Produces Incorrect Output Format on Last Line"^^ . "0"^^ . . "<p>So, I finally figured it (not myself, but another user on the fandom discord server) basically, the way I am trying to #invoke the template on the page of the item, needs to be invoked by default in the Template:Item. So I was able to change the default to</p>\n<pre><code> &lt;data source=&quot;alch_value&quot;&gt;&lt;label&gt;Chrysopoeia Value&lt;/label&gt;&lt;default&gt;{{#invoke:CalcAlchValue|calculateAlchValue|{{{shop_value}}}}}&lt;/default&gt;&lt;/data&gt;\n</code></pre>\n<p>Doing it inside the Template:Item itself, magically fixed the issue. Gotta love AI not knowing how to do stuff all the way ^^</p>\n"^^ . . "wikia"^^ . . "0"^^ . . . "2"^^ . . . "1"^^ . . "how can i add a unit popup to my orb, what am I missing in adding a player menu popup"^^ . "<p>Is there a way to get the parent of an element, i.e. the element in which an element is in?</p>\n<p>Use cases: when printing the traversal of the elements (<code>show_level</code>) or when checking whether a <code>Str</code> is in a <code>ListItem</code> (<code>str_in_listitem</code>). See my python example below.</p>\n<p>If there is no <code>parent</code> in Lua, how are those use cases implemented in a Lua filter?</p>\n<pre class="lang-py prettyprint-override"><code>from panflute import *\nfrom panflute.utils import debug\n\ndef get_level(elem: Element, level=0):\n if elem.parent is None:\n return level\n else:\n return get_level(elem.parent, level=level + 1)\n\ndef is_ancestor_of(elem: Element, clazz: Element):\n if elem.parent is not None:\n if type(elem.parent) == clazz:\n return True\n else:\n return is_ancestor_of(elem.parent, clazz)\n else:\n return False\n\ndef show_level(elem: Element, doc: Doc):\n debug(&quot; &quot; * get_level(elem) + elem.tag)\n\ndef str_in_listitem(elem: Element, doc: Doc):\n if type(elem) == Str:\n if is_ancestor_of(elem, ListItem):\n debug(stringify(elem))\n\nif __name__ == &quot;__main__&quot;:\n run_filters([show_level, str_in_listitem])\n</code></pre>\n<p>Appying this filter to the following input:</p>\n<pre class="lang-hs prettyprint-override"><code>[ Para [ Str &quot;some&quot; , Space , Str &quot;text&quot; ]\n, BulletList\n [ [ Plain [ Str &quot;item1&quot; ] ]\n , [ Plain [ Str &quot;item2&quot; ]\n , BulletList\n [ [ Plain [ Str &quot;subitemA&quot; ] ]\n , [ Plain [ Str &quot;subitemB&quot; ] ]\n ]\n ]\n ]\n]\n</code></pre>\n<p>shows the following output for <code>show_level</code>:</p>\n<pre><code> MetaMap\n Str\n Space\n Str\n Para\n Str\n Plain\n ListItem\n Str\n Plain\n Str\n Plain\n ListItem\n Str\n Plain\n ListItem\n BulletList\n ListItem\n BulletList\nDoc\n</code></pre>\n<p>and the following for <code>str_in_listitem</code>:</p>\n<pre><code>item1\nitem2\nsubitemA\nsubitemB\n</code></pre>\n"^^ . . "0"^^ . "0"^^ . . . "Performance of calling a function, passing multiple return values from another function call?"^^ . . "As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . . "0"^^ . . . . "3"^^ . "premake"^^ . . "1"^^ . . . . "1"^^ . "<p>Given a LPeg grammar, I want to do a find/replace on some of the sub-matches.</p>\n<p>For example, suppose that I want to replace all the occurrences of the letter &quot;a&quot; that are outside of double quotes. I came up with a grammar for that:</p>\n<pre><code>local re = require &quot;re&quot;\nlocal pattern = re.compile([[\n line &lt;- (quoted / 'a' / .)*\n\n quoted &lt;- '&quot;' rest\n rest &lt;- '&quot;' / . rest\n]])\n</code></pre>\n<p>It seems that <code>re.gsub</code> is not useful here, because it would mess with the parts inside quotes. The best I could come up with was to use a table capture, where we capture everything besides the &quot;a&quot;. But it was unwieldy because the pattern returns a table instead of a string.</p>\n<pre><code>line &lt;- {| ({quoted} / 'a' / {.})* |}\n</code></pre>\n<p>I also looked into substitution captures, but got stuck because I needed to add <code>-&gt;'%1'</code> around everything other than the <code>'a'</code>.</p>\n"^^ . "0"^^ . "1"^^ . . "0"^^ . . . . . "0"^^ . . . "1"^^ . "0"^^ . . . . . . "1"^^ . "1"^^ . "0"^^ . . "`cppdialect` should work (you might check in generated solution that your have `/std:c++17` flag). You probably need `filter { "toolset:msc*" } buildoptions {"/Zc:__cplusplus"} -- else __cplusplus would be 199711L`"^^ . . . . . . . . . . . . . "<p>You usually get this error when the Lua interpreter executable you're loading a Lua module from doesn't export any symbols (so <code>lua_gettop</code> is not found). See <a href="https://stackoverflow.com/a/68147931/1442917">this SO answer</a> for details and a potential solution.</p>\n"^^ . "3"^^ . "1"^^ . . "0"^^ . "2"^^ . . . . . . "Neovim config lazy.lua file error on moving the file to its parent's directory"^^ . . . . "2"^^ . . "Hi, i tried inserting you code, but nothing happens, the clone is invisible."^^ . . . . . . "<p>I have a Lua script for Logitech G Hub that moves my mouse for me. It's set to use MB4 for that. I want to remap MB5 to press shift, mb4. But when I have the script running and press MB5, it only outputs shift being pressed.</p>\n<p>The following script works perfectly as is (MB4 move mouse):</p>\n<pre class="lang-lua prettyprint-override"><code>MoveAmount = -900\nfunction OnEvent(event, arg)\n OutputLogMessage(&quot;event = %s, arg = %d\\n&quot;, event, arg)\n if (event == &quot;PROFILE_ACTIVATED&quot;) then\n EnablePrimaryMouseButtonEvents(true)\n elseif event == &quot;PROFILE_DEACTIVATED&quot; then\n ReleaseMouseButton(4) -- to prevent it from being stuck on\n end\n\nif (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 4) then\n for x=1,10,1\n do\n MoveMouseRelative(MoveAmount, 0)\n Sleep(5)\n</code></pre>\n<p>But I want to use that in a macro, which isn't picking it up.</p>\n<p>How can I bind this to a macro?</p>\n"^^ . "0"^^ . . . . . . "0"^^ . "1"^^ . . "It sounds like you want to write a polyglot program, not a polyquine. A polyquine would have to be a quine - it would have to output its own source code."^^ . "0"^^ . . . . "1"^^ . . "0"^^ . . "0"^^ . "1"^^ . . . "key-bindings"^^ . . "Quarto - Apply different styles to different bibliographies"^^ . "3"^^ . "How could I fix the InspectPlayerFromHumanoid issue? Roblox Studio"^^ . . . . "-3"^^ . . . . "1"^^ . "0"^^ . "0"^^ . "1"^^ . . . . . "0"^^ . . . . . . . "0"^^ . . . . "luarocks"^^ . . "0"^^ . . "0"^^ . . "<p>I have set up a basic exp system with exp, levels, and a Gui. I have the gui set to update when joining, and when gaining exp or a level, but it will only update when joining even though I'm using the same function for all updates.</p>\n<p>Where the code starts (Local script attached to a text button):</p>\n<pre><code>local expManager = require(game.ReplicatedStorage.ExpManager)\n\nexpManager.expGui.addExp.MouseButton1Click:Connect(function()\n \n expManager.addExp(25)\n \nend)\n</code></pre>\n<p>Where that code leads (Module script within ReplicatedStorage, along with a RemoteEvent):</p>\n<pre><code>ExpManager.expEvent = game.ReplicatedStorage:WaitForChild(&quot;ExpEvent&quot;)\n\nfunction ExpManager.addExp(expAmount)\n \n ExpManager.expEvent:FireServer(&quot;addExp&quot;, expAmount)\n \nend\n</code></pre>\n<p>Where that leads (Server script within ServerScriptService that handles stat values and saving</p>\n<pre><code>local expEvent = game.ReplicatedStorage:WaitForChild(&quot;ExpEvent&quot;)\n\nexpEvent.OnServerEvent:Connect(function(plr, eventtype, amount)\n \n local character = plr.Character\n \n if eventtype == &quot;addLevel&quot; then\n plr.Stats.Level.Value += amount\n expEvent:FireClient(plr, &quot;updateExp&quot;)\n end\n \n if eventtype == &quot;addExp&quot; then\n plr.Stats.expPoints.Value += amount\n expEvent:FireClient(plr, &quot;updateExp&quot;)\n end\n \nend)\n</code></pre>\n<p>Where that leads (Local script within StarterCharacterScripts):</p>\n<pre><code>local expManager = require(game.ReplicatedStorage.ExpManager)\nlocal expEvent = game.ReplicatedStorage:WaitForChild(&quot;ExpEvent&quot;)\n\nexpEvent.OnClientEvent:Connect(function(eventtype)\n \n \n if eventtype == &quot;updateExp&quot; then\n expManager.updateExpBar()\n end\n \nend)\n</code></pre>\n<p>Leading finally back to the same module script as earlier (I've left out several unrelated variables, but please let me know if seeing the whole script is necessary):</p>\n<pre><code>ExpManager.expGui = ExpManager.playerGui:WaitForChild(&quot;expGui&quot;)\nExpManager.expText = ExpManager.expGui.expBackground:WaitForChild(&quot;expText&quot;)\nExpManager.exp = ExpManager.player.Stats.expPoints.Value\nExpManager.level = ExpManager.player.Stats.Level.Value\nExpManager.expNeeded = math.round(100 * (ExpManager.level / 2))\n\nfunction ExpManager.updateExpBar()\n \n ExpManager.expGui.expBackground.expBar:TweenSize(UDim2.new(ExpManager.exp / ExpManager.expNeeded, 0, 1, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 0.15, true)\n\n ExpManager.expText.Text = math.round(ExpManager.exp).. &quot;/&quot; .. math.round(ExpManager.expNeeded)\n\nend\n</code></pre>\n<p>I've used print messages to tell if the code is getting stuck somewhere but no, even when gaining exp or a level the code makes it to the function that updates the Gui (which works properly when the player joins?) There are no error messages either.</p>\n"^^ . . . . . "luasec"^^ . . "Exp bar Gui not updating"^^ . . "This is a pretty good one, however, my issue is that it runs in a brand new place, but not in which im working on."^^ . "<h3>I found out how to solve my own issue.</h3>\n<ol>\n<li>compile your .so files with debug symbols by passing the <code>-g</code> option to gcc (or whatever compiler you use)</li>\n<li>open up <code>gdb</code>.</li>\n<li>In gdb:</li>\n</ol>\n<pre><code>(gdb) set debug jit 1\n(gdb) target exec /usr/bin/luajit\n(gdb) run ./your_program_name.lua\n</code></pre>\n"^^ . . . "0"^^ . . . "Can I change the default hash function?"^^ . . "gdb"^^ . . . "_"...What's New in 5.0...vs2012, vs2013, vs2015, vs2019 (Visual Studio 2012, 2013, 2015, 2019)..."_ https://premake.github.io/docs/Whats-New-in-5.0 no mention of 2022."^^ . "meta-method"^^ . "<p>The source code for every Lua release is available in one handy package, which can be extracted and the versions can be compiled all at once:</p>\n<pre class="lang-none prettyprint-override"><code>wget https://www.lua.org/ftp/lua-all.tar.gz\ntar xvf lua-all.tar.gz --strip-components=1\nmake\n</code></pre>\n<p>Afterwards, you can run example code in all versions to compare:</p>\n<pre class="lang-none prettyprint-override"><code>cat &lt;&lt;EOF &gt;pairs.lua\nfor key, value in pairs({[2] = &quot;a&quot;, [1] = &quot;b&quot;, [&quot;c&quot;] = &quot;d&quot;}) do\n print(key .. &quot; -&gt; &quot; .. value)\nend\nEOF\nls -1d */ | sed 's/\\/$//' | sort | while IFS= read -r f; do printf %s\\\\n &quot;&quot; &quot;$f&quot;; &quot;$f/lua&quot; pairs.lua; done\n</code></pre>\n<p>Outputs:</p>\n<pre class="lang-none prettyprint-override"><code>\nlua-1.0\nlua: syntax error near &quot;key&quot; at line 1 in file &quot;pairs.lua&quot;\n\nlua-1.1\nlua: syntax error near &quot;key&quot; at line 1 in file &quot;pairs.lua&quot;\n\nlua-2.1\nlua: syntax error near &quot;key&quot; at line 1 in file &quot;pairs.lua&quot;\n\nlua-2.2\nlua: syntax error near &quot;key&quot; at line 1 in file `pairs.lua'\nActive Stack:\n fallback error\n\nlua-2.4\nlua: syntax error; last token read: &quot;key&quot; at line 1 in file `pairs.lua'\nActive Stack:\n `error' fallback\nlua: error trying to run file pairs.lua\n\nlua-2.5\nlua: syntax error;\n&gt; last token read: &quot;key&quot; at line 1 in file pairs.lua\nActive Stack:\n `error' fallback\n\nlua-2.5.1\nlua: syntax error;\n&gt; last token read: &quot;key&quot; at line 1 in file pairs.lua\nActive Stack:\n `error' fallback\n\nlua-3.0\nlua: syntax error;\n&gt; last token read: &quot;key&quot; at line 1 in file pairs.lua\n\nlua-3.1\nlua: `=' expected;\n last token read: `key' at line 1 in chunk `pairs.lua'\n\nlua-3.2\n\nlua-3.2.1\nlua error: `=' expected;\n last token read: `key' at line 1 in file `pairs.lua'\n\nlua-3.2.2\nlua error: `=' expected;\n last token read: `key' at line 1 in file `pairs.lua'\n\nlua-4.0\nerror: attempt to call global `pairs' (a nil value)\nstack traceback:\n 1: main of file `pairs.lua' at line 1\n\nlua-4.0.1\nerror: attempt to call global `pairs' (a nil value)\nstack traceback:\n 1: main of file `pairs.lua' at line 1\n\nlua-5.0\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.0.1\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.0.2\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.0.3\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.1\n2 -&gt; a\n1 -&gt; b\nc -&gt; d\n\nlua-5.1.1\n2 -&gt; a\n1 -&gt; b\nc -&gt; d\n\nlua-5.1.2\n2 -&gt; a\n1 -&gt; b\nc -&gt; d\n\nlua-5.1.3\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.1.4\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.1.5\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.2.0\n2 -&gt; a\n1 -&gt; b\nc -&gt; d\n\nlua-5.2.1\n2 -&gt; a\n1 -&gt; b\nc -&gt; d\n\nlua-5.2.2\n2 -&gt; a\n1 -&gt; b\nc -&gt; d\n\nlua-5.2.3\n2 -&gt; a\n1 -&gt; b\nc -&gt; d\n\nlua-5.2.4\n2 -&gt; a\n1 -&gt; b\nc -&gt; d\n\nlua-5.3.0\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.3.1\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.3.2\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.3.3\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.3.4\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.3.5\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.3.6\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.4.0\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.4.1\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.4.2\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.4.3\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.4.4\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.4.5\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.4.6\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.4.7\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n</code></pre>\n<p>And:</p>\n<pre class="lang-none prettyprint-override"><code>cat &lt;&lt;EOF &gt;ipairs.lua\nfor key, value in ipairs({[2] = &quot;a&quot;, [1] = &quot;b&quot;, [&quot;c&quot;] = &quot;d&quot;}) do\n print(key .. &quot; -&gt; &quot; .. value)\nend\nEOF\nls -1d */ | sed 's/\\/$//' | sort | while IFS= read -r f; do printf %s\\\\n &quot;&quot; &quot;$f&quot;; &quot;$f/lua&quot; ipairs.lua; done\n</code></pre>\n<p>Outputs:</p>\n<pre class="lang-none prettyprint-override"><code>\nlua-1.0\nlua: syntax error near &quot;key&quot; at line 1 in file &quot;ipairs.lua&quot;\n\nlua-1.1\nlua: syntax error near &quot;key&quot; at line 1 in file &quot;ipairs.lua&quot;\n\nlua-2.1\nlua: syntax error near &quot;key&quot; at line 1 in file &quot;ipairs.lua&quot;\n\nlua-2.2\nlua: syntax error near &quot;key&quot; at line 1 in file `ipairs.lua'\nActive Stack:\n fallback error\n\nlua-2.4\nlua: syntax error; last token read: &quot;key&quot; at line 1 in file `ipairs.lua'\nActive Stack:\n `error' fallback\nlua: error trying to run file ipairs.lua\n\nlua-2.5\nlua: syntax error;\n&gt; last token read: &quot;key&quot; at line 1 in file ipairs.lua\nActive Stack:\n `error' fallback\n\nlua-2.5.1\nlua: syntax error;\n&gt; last token read: &quot;key&quot; at line 1 in file ipairs.lua\nActive Stack:\n `error' fallback\n\nlua-3.0\nlua: syntax error;\n&gt; last token read: &quot;key&quot; at line 1 in file ipairs.lua\n\nlua-3.1\nlua: `=' expected;\n last token read: `key' at line 1 in chunk `ipairs.lua'\n\nlua-3.2\n\nlua-3.2.1\nlua error: `=' expected;\n last token read: `key' at line 1 in file `ipairs.lua'\n\nlua-3.2.2\nlua error: `=' expected;\n last token read: `key' at line 1 in file `ipairs.lua'\n\nlua-4.0\nerror: attempt to call global `ipairs' (a nil value)\nstack traceback:\n 1: main of file `ipairs.lua' at line 1\n\nlua-4.0.1\nerror: attempt to call global `ipairs' (a nil value)\nstack traceback:\n 1: main of file `ipairs.lua' at line 1\n\nlua-5.0\n1 -&gt; b\n2 -&gt; a\n\nlua-5.0.1\n1 -&gt; b\n2 -&gt; a\n\nlua-5.0.2\n1 -&gt; b\n2 -&gt; a\n\nlua-5.0.3\n1 -&gt; b\n2 -&gt; a\n\nlua-5.1\n1 -&gt; b\n2 -&gt; a\n\nlua-5.1.1\n1 -&gt; b\n2 -&gt; a\n\nlua-5.1.2\n1 -&gt; b\n2 -&gt; a\n\nlua-5.1.3\n1 -&gt; b\n2 -&gt; a\n\nlua-5.1.4\n1 -&gt; b\n2 -&gt; a\n\nlua-5.1.5\n1 -&gt; b\n2 -&gt; a\n\nlua-5.2.0\n1 -&gt; b\n2 -&gt; a\n\nlua-5.2.1\n1 -&gt; b\n2 -&gt; a\n\nlua-5.2.2\n1 -&gt; b\n2 -&gt; a\n\nlua-5.2.3\n1 -&gt; b\n2 -&gt; a\n\nlua-5.2.4\n1 -&gt; b\n2 -&gt; a\n\nlua-5.3.0\n1 -&gt; b\n2 -&gt; a\n\nlua-5.3.1\n1 -&gt; b\n2 -&gt; a\n\nlua-5.3.2\n1 -&gt; b\n2 -&gt; a\n\nlua-5.3.3\n1 -&gt; b\n2 -&gt; a\n\nlua-5.3.4\n1 -&gt; b\n2 -&gt; a\n\nlua-5.3.5\n1 -&gt; b\n2 -&gt; a\n\nlua-5.3.6\n1 -&gt; b\n2 -&gt; a\n\nlua-5.4.0\n1 -&gt; b\n2 -&gt; a\n\nlua-5.4.1\n1 -&gt; b\n2 -&gt; a\n\nlua-5.4.2\n1 -&gt; b\n2 -&gt; a\n\nlua-5.4.3\n1 -&gt; b\n2 -&gt; a\n\nlua-5.4.4\n1 -&gt; b\n2 -&gt; a\n\nlua-5.4.5\n1 -&gt; b\n2 -&gt; a\n\nlua-5.4.6\n1 -&gt; b\n2 -&gt; a\n\nlua-5.4.7\n1 -&gt; b\n2 -&gt; a\n</code></pre>\n<p>As expected, the code starts working with Lua 5.0, which is when <code>pairs</code> and <code>ipairs</code> was introduced.</p>\n<p>My question is about the following example:</p>\n<pre class="lang-none prettyprint-override"><code>cat &lt;&lt;EOF &gt;neither.lua\nfor key, value in {[2] = &quot;a&quot;, [1] = &quot;b&quot;, [&quot;c&quot;] = &quot;d&quot;} do\n print(key .. &quot; -&gt; &quot; .. value)\nend\nEOF\nls -1d */ | sed 's/\\/$//' | sort | while IFS= read -r f; do printf %s\\\\n &quot;&quot; &quot;$f&quot;; &quot;$f/lua&quot; neither.lua; done\n</code></pre>\n<p>Outputs:</p>\n<pre class="lang-none prettyprint-override"><code>\nlua-1.0\nlua: syntax error near &quot;key&quot; at line 1 in file &quot;neither.lua&quot;\n\nlua-1.1\nlua: syntax error near &quot;key&quot; at line 1 in file &quot;neither.lua&quot;\n\nlua-2.1\nlua: syntax error near &quot;key&quot; at line 1 in file &quot;neither.lua&quot;\n\nlua-2.2\nlua: syntax error near &quot;key&quot; at line 1 in file `neither.lua'\nActive Stack:\n fallback error\n\nlua-2.4\nlua: syntax error; last token read: &quot;key&quot; at line 1 in file `neither.lua'\nActive Stack:\n `error' fallback\nlua: error trying to run file neither.lua\n\nlua-2.5\nlua: syntax error;\n&gt; last token read: &quot;key&quot; at line 1 in file neither.lua\nActive Stack:\n `error' fallback\n\nlua-2.5.1\nlua: syntax error;\n&gt; last token read: &quot;key&quot; at line 1 in file neither.lua\nActive Stack:\n `error' fallback\n\nlua-3.0\nlua: syntax error;\n&gt; last token read: &quot;key&quot; at line 1 in file neither.lua\n\nlua-3.1\nlua: `=' expected;\n last token read: `key' at line 1 in chunk `neither.lua'\n\nlua-3.2\n\nlua-3.2.1\nlua error: `=' expected;\n last token read: `key' at line 1 in file `neither.lua'\n\nlua-3.2.2\nlua error: `=' expected;\n last token read: `key' at line 1 in file `neither.lua'\n\nlua-4.0\n1 -&gt; b\nc -&gt; d\n2 -&gt; a\n\nlua-4.0.1\n1 -&gt; b\nc -&gt; d\n2 -&gt; a\n\nlua-5.0\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.0.1\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.0.2\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.0.3\n1 -&gt; b\n2 -&gt; a\nc -&gt; d\n\nlua-5.1\nlua-5.1/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: ?\n\nlua-5.1.1\nlua-5.1.1/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: ?\n\nlua-5.1.2\nlua-5.1.2/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: ?\n\nlua-5.1.3\nlua-5.1.3/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: ?\n\nlua-5.1.4\nlua-5.1.4/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: ?\n\nlua-5.1.5\nlua-5.1.5/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: ?\n\nlua-5.2.0\nlua-5.2.0/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.2.1\nlua-5.2.1/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.2.2\nlua-5.2.2/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.2.3\nlua-5.2.3/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.2.4\nlua-5.2.4/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.3.0\nlua-5.3.0/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.3.1\nlua-5.3.1/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.3.2\nlua-5.3.2/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.3.3\nlua-5.3.3/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.3.4\nlua-5.3.4/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.3.5\nlua-5.3.5/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.3.6\nlua-5.3.6/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.4.0\nlua-5.4.0/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.4.1\nlua-5.4.1/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.4.2\nlua-5.4.2/lua: neither.lua:1: attempt to call a table value\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.4.3\nlua-5.4.3/lua: neither.lua:1: for iterator 'for iterator' is not callable (a table value)\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.4.4\nlua-5.4.4/lua: neither.lua:1: attempt to call a table value (for iterator 'for iterator')\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.4.5\nlua-5.4.5/lua: neither.lua:1: attempt to call a table value (for iterator 'for iterator')\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.4.6\nlua-5.4.6/lua: neither.lua:1: attempt to call a table value (for iterator 'for iterator')\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n\nlua-5.4.7\nlua-5.4.7/lua: neither.lua:1: attempt to call a table value (for iterator 'for iterator')\nstack traceback:\n neither.lua:1: in main chunk\n [C]: in ?\n</code></pre>\n<p>This <code>for key, value in table</code> syntax starts working with Lua 4.0, but stops working in Lua 5.1 and later. What is the reason for this? While it was working, was it equivalent to <code>pairs</code>?</p>\n<p>There's already quite a few posts about generic <code>for</code> loops in Lua - like <a href="https://stackoverflow.com/questions/17436947/how-to-iterate-through-table-in-lua">How to iterate through table in Lua?</a>, <a href="https://stackoverflow.com/questions/55108794/what-is-the-difference-between-pairs-and-ipairs-in-lua">What is the difference between pairs() and ipairs() in Lua?</a>, <a href="https://stackoverflow.com/questions/35171569/is-there-any-way-to-loop-through-an-array-without-using-pairs">Is there any way to loop through an array without using pairs()?</a> or <a href="https://stackoverflow.com/questions/25347503/for-in-loop-with-key-value-pairs">for in loop with key value pairs</a>, to mention a few - but as far as I can tell, none of them contain an answer to this question.</p>\n"^^ . "0"^^ . . "I should also mention if anyone else is using similar code, that I'm still using the RunServiceEvent to move the part along a curved path, and it works just fine after removing the `if Time > 1` then check"^^ . . . . . . . "1"^^ . . "0"^^ . "Dev Site requires you to read like 1500 posts and comment on them and after that you can post. As for the answer, thanks. Although I meant so that it doesn't damage the attackers character, since welding it to the character makes it so that people can just go unga bunga with flying exploits, or just start turning a thousand times for tons of damage."^^ . "0"^^ . . . "0"^^ . . . . "0"^^ . . . . . "0"^^ . . . . . . . "1"^^ . "config"^^ . . . "that's probably true I wasn't entirely sure so just added it just in case"^^ . . . . . "hyphenation"^^ . . "Btw, here is the download link for my map: https://www.mediafire.com/file/yal45duls7762hh/youtube+bugged+thing.rbxl/file, i think some of the Noob's NPC script is glitching that."^^ . "0"^^ . . . "1"^^ . "1"^^ . "<p>As often in Lua, there technically is a subtle difference. But that difference most probably won't matter to you at all. I generally prefer the OOP-style for calling string methods, since it's more concise and doesn't require <code>string</code> to be in scope.</p>\n<p><em>If</em> <code>myWord</code> is guaranteed to be a string and the string metatable has not been tampered with, these are equivalent and the latter is just syntactic sugar for the former.</p>\n<hr />\n<p>As for the nitty-gritty details:</p>\n<p><code>string.format(myWord, &quot;World&quot;)</code> looks <code>string</code> up in <code>_ENV</code> (typically <code>_G</code>, the global table), then accesses the <code>format</code> field of that, then calls that with <code>myWord</code> and <code>&quot;World&quot;</code> as arguments.</p>\n<p><code>myWord:format(&quot;World&quot;)</code> <em>indexes</em> <code>myWord</code>, then it accesses the <code>format</code> field and calls that with arguments <code>myWord, &quot;World&quot;</code>.</p>\n<p>If <code>myWord</code> is a string, indexing <code>myWord</code> will hit the metatable, which has the <code>string</code> table set as <code>__index</code>, unless someone did <code>getmetatable&quot;&quot;.__index = {}</code> or similar tampering with the string metatable.</p>\n<p>(An oversight that happens sometimes in Lua sandboxes is to forget to make the string metatable inaccessible.)</p>\n<p>Perhaps the most relevant subtle difference in behavior is that <code>string.func(s, ...)</code> will <em>coerce</em> <code>s</code> to a string if it is a number, whereas <code>s:func(...)</code> will throw an &quot;attempt to index a number value&quot;.</p>\n<p>This may be relevant if you're maintaining a legacy Lua API and &quot;refactoring&quot; it to use the latter style, accidentally breaking the code of API users who relied on the implicit number to string coercion.</p>\n<p>Another maybe-relevant difference is that <code>s:func(...)</code> would let you supply a table <code>s</code> with a metatable set such that <code>s:func(...)</code> does something sensible: It plays better with polymorphism. For example you could have a <code>GraphemeString</code> &quot;class&quot; which supports (its own version of) <code>s:sub</code>, but operates on graphemes rather than bytes. If you're using the &quot;OOP&quot; style, you could easily swap one for the other. (If you're using the &quot;imperative&quot; style, you could still monkey-patch <code>string.format</code> etc., but that would be messy.)</p>\n"^^ . . . . . . . "0"^^ . . . . . . . "0"^^ . . . . "0"^^ . "<p>Lua 5.0 introduced the more powerful <a href="https://www.lua.org/manual/5.0/manual.html#for" rel="nofollow noreferrer">generic for statement</a> which works over functions and can be used to implement generic iterators. Lua 5.0 kept &quot;for k,v in t&quot; for compatibility but marked it deprecated. As such, it was removed in Lua 5.1.\nSee the section &quot;Incompatibilities with version 4.0&quot; in the <a href="https://www.lua.org/manual/5.0/manual.html" rel="nofollow noreferrer">Lua 5.0 Reference Manual</a>.</p>\n<p>In Lua 5.0+, you can use &quot;for k,v in next,t&quot;, which is equivalent to &quot;for k,v in pairs(t)&quot;.</p>\n"^^ . . "It doesn't seem that ``conan`` is related to this question, it seems it is only about premake project configuration."^^ . "1"^^ . "<p>I am looking for help with a shortcut in Neovim in Lua. It should open the completion menu for the path of the current file such that I can use <em>Ctrl+n</em> / <em>Ctrl+p</em> to move or down.</p>\n<p>In the current code here:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.api.nvim_set_keymap(&quot;n&quot;, &quot;&lt;leader&gt;a&quot;, &quot;:e &lt;C-R&gt;=expand('%:h')&lt;CR&gt;/&quot;, { noremap = true, silent = true })\n</code></pre>\n<p>I have to press the shortcut and <em>&lt;Tab&gt;</em> to get to the state I want. Maybe there are even better (quicker, more intuitive) methods for file navigation w/o plugins, starting from the directory of the current file? One method I am currently using is to use Netrw (which is technically a plugin, but builtin) with this shortcut</p>\n<pre class="lang-lua prettyprint-override"><code>vim.api.nvim_set_keymap(&quot;n&quot;, &quot;&lt;leader&gt;e&quot;, &quot;:e &lt;C-R&gt;=expand('%:p:h')&lt;CR&gt;/&lt;CR&gt;&quot;, { noremap = true, silent = true })\n</code></pre>\n<p>which is very similar.</p>\n"^^ . . "1"^^ . "0"^^ . . . "WOW addon unit frame menu"^^ . . "Poor choice of words there really, I searched for a lot of things around lua tables, defining objects, tables inside tables. And then I asked about my specific issue here."^^ . "1"^^ . "0"^^ . "3"^^ . . . "0"^^ . . "1"^^ . . . . . . "1"^^ . . . . "1"^^ . . . "Pandoc Lua filter matching all element types"^^ . . . . "0"^^ . . "<p>I try to use JSON in Lua - I am completely new to Lua.</p>\n<p><strong>My code (test.lua)</strong></p>\n<pre><code>local json = require (&quot;json&quot;)\nprint &quot;hello&quot;\n</code></pre>\n<p><strong>My install (Debian 12)</strong></p>\n<pre><code># luarocks install luajson\n\nInstalling https://luarocks.org/luajson-1.3.4-1.src.rock \nluajson 1.3.4-1 depends on lua &gt;= 5.1 (5.1-1 provided by VM)\nluajson 1.3.4-1 depends on lpeg &gt;= 0.8.1 (1.1.0-1 installed)\nDo not use 'module' as a build type. Use 'builtin' instead.\nluajson 1.3.4-1 is now installed in /usr/local (license: MIT/X11)\n</code></pre>\n<p>My output after</p>\n<pre><code> # lua test.lua\n</code></pre>\n<p>is this</p>\n<pre><code>lua: /usr/local/share/lua/5.1/json/decode/util.lua:97: attempt to call field 'version' (a string value)\nstack traceback:\n /usr/local/share/lua/5.1/json/decode/util.lua:97: in main chunk\n [C]: in function 'require'\n /usr/local/share/lua/5.1/json/decode.lua:12: in main chunk\n [C]: in function 'require'\n /usr/local/share/lua/5.1/json.lua:5: in main chunk\n [C]: in function 'require'\n awattar.lua:6: in main chunk\n [C]: ?\n</code></pre>\n<p>Whats the problem here?</p>\n"^^ . . . "0"^^ . . . "0"^^ . . "1"^^ . . "A good place for general support is over at the pandoc [Discussions](https://github.com/jgm/pandoc/discussions) board on GitHub."^^ . . "1"^^ . . . "2"^^ . "python"^^ . . "0"^^ . . "<p>I had my <code>lazy.lua</code> file in <code>.config/nvim/lua/{name}/</code> directory and then to structure my config I moved it to <code>.config/nvim/lua</code>. After that I got some errors basically about nil values in some lazy files.\nAll these errors originate from\n<code>require('lazy').setup('plugins')</code></p>\n<p>These errors will disappear once I move <code>lazy.lua</code> back to .<code>config/nvim/lua/{name}/ directory</code>.\nI obviously updated all the imports in <code>init.lua</code> file. I also tried re-installing lazy by <code>sudo rm ~/.local/share/nvim/lazy ~/.local/state/nvim/lazy -rf</code>, also deleted <code>lazy-lock.json</code> file but nothing works except moving <code>lazy.lua</code> to <code>.config/nvim/lua/{name}/</code> directory. I even updated neovim to latest version.</p>\n<p>Here is my <code>lazy.lua</code> file:</p>\n<pre class="lang-lua prettyprint-override"><code>-- Bootstrap lazy.nvim\nlocal lazypath = vim.fn.stdpath(&quot;data&quot;) .. &quot;/lazy/lazy.nvim&quot;\nif not (vim.uv or vim.loop).fs_stat(lazypath) then\n local lazyrepo = &quot;https://github.com/folke/lazy.nvim.git&quot;\n print('installing lazy...')\n local out = vim.fn.system({ &quot;git&quot;, &quot;clone&quot;, &quot;--filter=blob:none&quot;, &quot;--branch=stable&quot;, lazyrepo, lazypath })\n if vim.v.shell_error ~= 0 then\n vim.api.nvim_echo({\n { &quot;Failed to clone lazy.nvim:\\n&quot;, &quot;ErrorMsg&quot; },\n { out, &quot;WarningMsg&quot; },\n { &quot;\\nPress any key to exit...&quot; },\n }, true, {})\n vim.fn.getchar()\n os.exit(1)\n end\nend\nvim.opt.rtp:prepend(lazypath)\n\nprint('lazy installed')\n\n-- Make sure to setup `mapleader` and `maplocalleader` before\n-- loading lazy.nvim so that mappings are correct.\n-- This is also a good place to setup other settings (vim.opt)\nvim.g.mapleader = &quot; &quot;\nvim.g.maplocalleader = &quot;\\\\&quot;\n\n-- Setup lazy.nvim\nrequire(&quot;lazy&quot;).setup('plugins')\n</code></pre>\n<p>Here are the errors:-</p>\n<p><strong>In Older version 0.9.4</strong></p>\n<blockquote>\n<p>ERROR Failed to run healthcheck for &quot;lazy&quot; plugin. Exception:\nfunction health#check, line 25\nVim(eval):E5108: Error executing lua\n...al/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.lua:52: attempt to index   upvalue 'uv' (a &gt;nil value)\nstack traceback:\n.local/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.lua:52: in function 'spawn'\n.local/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.lua:234: in function 'exec'\n.local/share/nvim/lazy/lazy.nvim/lua/lazy/health.lua:40: in function 'have'\n.local/share/nvim/lazy/lazy.nvim/lua/lazy/health.lua:72: in function 'check'\n[string &quot;luaeval()&quot;]:1: in main chunk</p>\n</blockquote>\n<p><strong>In Latest version 0.11.0</strong></p>\n<blockquote>\n<p>lazy.nvim\n{lazy.nvim} version 11.14.1\nOK {git} version 2.34.1\nOK no existing packages found by other package managers</p>\n<ul>\n<li>OK packer_compiled.lua not found\nERROR No plugins loaded. Did you forget to run require(&quot;lazy&quot;). setup()?</li>\n</ul>\n</blockquote>\n<blockquote>\n<p>Luarocks\nERROR Failed to run healthcheck for &quot;lazy&quot; plugin. Exception:\n.local/share/nvim/lazy/lazy.nvim/lua/lazy/health.lua:132: attempt to index field 'rocks' (a nil value)</p>\n</blockquote>\n"^^ . . . "c"^^ . . "0"^^ . . . "@AndrewYim Yes and no. I followed a guide to make things move in an arc that only used the tween to tell when the part was done moving, not to actually move the part. They moved the part within the RunServiceEvent. Not sure why they opted to not move the part with a tween but I took that code used it for making coins drop out of an enemy when killed, and then again for when picking up the coins so they would travel in an arc into the player."^^ . . . . . . . "1"^^ . . . . . . "Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . "0"^^ . . . . . . "0"^^ . . . "0"^^ . . . . . . "luajit"^^ . "1"^^ . . . "3"^^ . "<p>Line 567 of <a href="https://es.wikipedia.org/wiki/M%C3%B3dulo:Ficha?oldid=155034254" rel="nofollow noreferrer">https://es.wikipedia.org/wiki/M%C3%B3dulo:Ficha?oldid=155034254</a> is <code> local entidad = args.entidad or mw.wikibase.getEntityIdForCurrentPage()</code>. The problem is that <code>mw.wikibase</code> is undefined on your wiki, probably because your Miraheze wiki doesn't have <a href="https://www.mediawiki.org/wiki/Extension:Wikibase_Client" rel="nofollow noreferrer">https://www.mediawiki.org/wiki/Extension:Wikibase_Client</a> enabled. <a href="https://meta.miraheze.org/wiki/Extensions" rel="nofollow noreferrer">https://meta.miraheze.org/wiki/Extensions</a> says that extension is available, so one way of fixing this would be to enable it at Special:ManageWiki/extensions on your wiki. Your other option is to remove the call to <code>hacerBarraWikidata()</code> on line 638, since it's the only function that references <code>mw.wikibase</code>, and without that it doesn't have anything useful to do.</p>\n"^^ . . . . . . . . . "0"^^ . "1"^^ . "0"^^ . . . . . . . . "0"^^ . . . . . . . "pandoc"^^ . "1"^^ . "1"^^ . . . "variables"^^ . "2"^^ . . "3"^^ . "0"^^ . . "0"^^ . . . . "0"^^ . "<p>I was trying to debug this code</p>\n<pre><code>local bird = script.Parent\nbird.Anchored = true\nlocal uis = game.UserInputService\nlocal player = game.Players.LocalPlayer\nlocal gravity = -1\nlocal Parts = bird:GetTouchingParts()\nlocal bird_flap = bird.Position + Vector3.new(0, 10, 0)\nlocal script_start = false\nuis.InputBegan:Connect(function(input)\n if input.UserInputType == Enum.UserInputType.MouseButton1 then\n script_start = true\n end\n if script_start then\n while not Parts do\n task.wait(0.5)\n gravity = gravity * 2\n uis.InputBegan:Connect(function(input)\n if input.UserInputType == Enum.UserInputType.MouseButton1 then\n bird.Position = bird_flap\n gravity = -1\n end\n end)\n bird.Position = bird.Position + Vector3.new(0, gravity, 0)\n task.wait(0.1)\n end\n end\nend)\n</code></pre>\n<p>so i tried putting another script in the bird to try to see if something was wrong and tried this code:</p>\n<pre><code>local bird = script.Parent\nlocal parts = bird:GetTouchingParts()\nif not parts then\n print(&quot;no parts&quot;)\nelse\n print(&quot;parts touching&quot;)\nend\n</code></pre>\n<p>it returned with parts touching even though the bird was visibly floating not touching anything</p>\n"^^ . . . "<p>I want to make a cutscene system in Roblox Studio by loading in the player's character locally onto a dummy in the Workspace before anything else; an identical clone (same RigType, avatar proportions, etc.) of the player character is what I want but the only problem is that I can't use</p>\n<pre><code>ApplyDescription()\n</code></pre>\n<p>from the client, and it won't be multiplayer-friendly if I use the server because I'm pretty sure it'll either break from not being able to choose a player or use one player's character and it won't look good for the others. How can I achieve this?</p>\n<p>TLDR: How can I make a Dummy in Workspace look like each player's character only for themselves in Roblox Studio?</p>\n<p>Here is the LocalScript I tried to use from StarterPlayerScripts:</p>\n<pre><code>local players = game:GetService(&quot;Players&quot;)\nlocal rig = workspace:WaitForChild(&quot;Rig&quot;)\nlocal humanoid = rig:WaitForChild(&quot;Humanoid&quot;)\n\ntask.wait(10)\nlocal desc = players:GetHumanoidDescriptionFromUserId(game.Players.LocalPlayer.UserId)\nhumanoid:ApplyDescription(desc)\n</code></pre>\n<p>I was expecting it to work without any problem. After the wait, the script should work, right?\nNo, of course not. ApplyDescription() can only be called by the backend server.</p>\n"^^ . . . . . "0"^^ . . "<p>One problem with this script is that it adds the item to the player's Backpack instead of their Starter Gear. The Backpack gets cleared whenever a player spawns, while StarterGear is persistent (see the <a href="https://create.roblox.com/docs/reference/engine/classes/Backpack" rel="nofollow noreferrer">Backpack docs</a>).</p>\n<p>Another problem is that your code seems to be executing on a LocalScript, which is generally only appropriate when working with client-only objects (see the <a href="https://create.roblox.com/docs/reference/engine/classes/LocalScript" rel="nofollow noreferrer">LocalScript docs</a>). You should run it on a regular script in ServerScriptService instead.</p>\n<p>The following script will add a tool named &quot;Tool&quot; to each player's StarterGear when they join the game:</p>\n<pre class="lang-lua prettyprint-override"><code>local replicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal assets = replicatedStorage:WaitForChild(&quot;Assets&quot;)\n\nlocal function addItem(player, itemName)\n local item = assets:FindFirstChild(itemName)\n\n if not item then return end\n\n item:Clone().Parent = player:WaitForChild(&quot;StarterGear&quot;)\nend\n\ngame:GetService(&quot;Players&quot;).PlayerAdded:Connect(function(player) addItem(player, &quot;Tool&quot;) end)\n</code></pre>\n<p>(Of course, you can achieve a similar effect just by putting <code>Tool</code> into the StarterPack folder.)</p>\n"^^ . "Part’s position is locked after playing a Tween"^^ . "you never search for something about your "specific issue". you need to abstract your problem, break it down into atomic steps before you do any research. you won't find the exact construction plans for your dream house online, but you will find all information on bricks, nails, concrete, ..."^^ . . . . . "0"^^ . . . "Mediawiki Scribunto: <div style=> renders the entire variable it is a part of nil"^^ . . . . . "0"^^ . "0"^^ . . . "quarto"^^ . . . "performance"^^ . . "<p>Instead of calling the <code>Model.Anchored</code> property, make a part of your model the <code>PrimaryPart</code>. Then use the code like this <code>Model.PrimaryPart.Anchored=false</code>. This means all of the parts of the model revolve around the <code>PrimaryPart</code>, including the descendants, and they all follow the part's copyable properties.</p>\n<p>This means I don't have to manually set each part to anchored if I have two parts in a model.</p>\n<p>Here's a quick example: (This code makes use of a model with multiple parts)</p>\n<pre><code>local model=script.Parent\nmodel.PrimaryPart.Anchored=false\n</code></pre>\n<p>Hope this helped!</p>\n"^^ . . . "function"^^ . "5"^^ . . "0"^^ . "lpeg"^^ . . . . "<p>So I have an array of creatures from a game, each one is just the name as a string. I want to iterate over each one and create a table for each one that contains all of the creatures stats, hp, damage, etc. But I can't find a way to create new Lua tables, as assigning a new variable to a table doesn't copy it.</p>\n<p>I really haven't tried much, as I'm pretty new to coding and have found near to no information online that deals with my specific issue.</p>\n"^^ . . "0"^^ . . "1"^^ . "0"^^ . . . "terminal"^^ . . . "keyboard-events"^^ . . . . "0"^^ . . "0"^^ . "0"^^ . "1"^^ . . . "<p>For those interested, I was able to resolve the issue by by hitting the endpoint through nginx itself, via <code>&quot;http://&quot; .. ngx.var.fenginx .. &quot;/auth/handle_499_error/&quot;</code>, and it worked, but I'm still not fully sure why hitting via the microservice directly was failing.</p>\n"^^ . . "Can I perform a GET request / fetch inside of a neovim plugin?"^^ . "2"^^ . "1"^^ . "-1"^^ . . . "0"^^ . . "Lua: How to load/install module json?"^^ . . . "0"^^ . "<p>i needed to add a code that checks in a specific dir for cases and checks if any case (witch will be in a folder shape)in that dir that has passed 2days or more then archive it to speed up my server so i made this code down-below</p>\n<p>In my Lua code:</p>\n<pre><code>\n-- Define the path to the LuaFileSystem library\nlocal lfs_path = &quot;/usr/local/lib/lua/5.1/lfs.so&quot; -- Update this path to the actual location of lfs.so\n\n-- Add the path to package.cpath\npackage.cpath = package.cpath .. &quot;;&quot; .. lfs_path\n\n-- Load the LuaFileSystem library\nlocal lfs = require(&quot;lfs&quot;)\n\nlocal function isOlderThanTwoDays(path)\n local attr = lfs.attributes(path)\n if attr and attr.mode == &quot;directory&quot; then\n local age = os.difftime(os.time(), attr.modification)\n return age &gt; 2 * 24 * 60 * 60\n end\n return false\nend\n\nlocal function archiveFolder(path)\n local archiveName = path .. &quot;.tar.gz&quot;\n os.execute(string.format(&quot;tar -czf %s %s&quot;, archiveName, path))\n os.execute(string.format(&quot;rm -rf %s&quot;, path))\nend\n\nlocal function checkAndArchiveFolders(dirs)\n for _, dir in ipairs(dirs) do\n for file in lfs.dir(dir) do\n if file ~= &quot;.&quot; and file ~= &quot;..&quot; then\n local fullPath = dir .. &quot;/&quot; .. file\n if isOlderThanTwoDays(fullPath) then\n archiveFolder(fullPath)\n end\n end\n end\n end\nend\n\n\n-- Usage\nlocal directoriesToCheck = {\n &quot;/etc/orthanc/ClientRpts/IVH&quot;\n -- &quot;/path/to/your/second_directory&quot;,\n -- Add more directories as needed\n}\n</code></pre>\n<p>This code gives me an error while loading the lfs library the error said:</p>\n<blockquote>\n<p>E0728 12:51:42.507733 MAIN OrthancException.cpp:61] Cannot execute a Lua command: error loading module 'lfs' from file '/usr/local/lib/lua/5.1/lfs.so':\n/usr/local/lib/lua/5.1/lfs.so: undefined symbol: lua_gettop\nE0728 12:51:42.508185 MAIN ServerIndex.cpp:348] INTERNAL ERROR: ServerIndex::Stop() should be invoked manually to avoid mess in the destruction order!</p>\n</blockquote>\n<p>at first which is the start i ran <code>luarocks install luafilesystem</code> in the console/terminal to install lfs\nand then i got prompted with the error I mentioned above so i tried to add</p>\n<pre><code>local lfs_path = &quot;/usr/local/lib/lua/5.1/lfs.so&quot; -- Update this path to the actual location of lfs.so\n\n-- Add the path to package.cpath\npackage.cpath = package.cpath .. &quot;;&quot; .. lfs_path\n</code></pre>\n<p>to inform the code that there is a lib called lfs.so</p>\n<p>but that went with no use</p>\n"^^ . . . "0"^^ . "0"^^ . . . "mediawiki-api"^^ . "0"^^ . . "0"^^ . . "1"^^ . . . "0"^^ . "@AndrewSokolov What memory? If you `malloc()`ed something you have to `free()` it yourself. If the engine did then it frees it. Isn't that obvious?"^^ . . . . . . "you absolute legend."^^ . . "0"^^ . . "<p>Turns out that the &quot;%1&quot; bit has to do with string captures, not of substitution captures. I can solve the problem by adding a capture only around the parts that I want to replace, and I can leave the other parts alone.</p>\n<pre class="lang-lua prettyprint-override"><code>local re = require &quot;re&quot;\nlocal pattern = re.compile([[\n line &lt;- {~ (quoted / 'a'-&gt;'' / .)* ~}\n\n quoted &lt;- '&quot;' rest\n rest &lt;- '&quot;' / . rest\n]])\n</code></pre>\n<p>Pay attention to operator precedence, because '-&gt;' binds tightly</p>\n<pre><code>('a' 'b')-&gt;''\n</code></pre>\n"^^ . "0"^^ . "0"^^ . "But often it isn't necessary to keep track of the global structure. E.g., to process only `Str` elements that are part of a bullet list one would write `function BulletList (bl) return bl:walk{Str = my_str_filter} end`"^^ . . "I can't add admin HD properly in Roblox Studio"^^ . . "<p>According to the <a href="https://create.roblox.com/docs/reference/engine/classes/BasePart#GetTouchingParts" rel="nofollow noreferrer">documentation</a> <code>BasePart.GetTouchingParts()</code></p>\n<blockquote>\n<p>Returns a table of all parts that are physically interacting with this\npart.</p>\n</blockquote>\n<p>So if no parts are touching you'll get an empty table.</p>\n<p>Check the number of table elements instead.</p>\n"^^ . . . . . "<p>It seems it is not possible at the moment <a href="https://github.com/pandoc-ext/multibib/issues/15" rel="nofollow noreferrer">with the multibib filter only</a> and a full markdown/quarto solution.</p>\n<p>I was able to get two bibliographies with different styles using:</p>\n<ul>\n<li><code>multibib</code> with markdown citations (<code>@aa</code>) for one type of citation (numbered refs in the capture below), using the .csl file loaded in the YAML header.</li>\n<li>LaTeX citations (<code>\\cite{bb}</code>) using the <code>citation-style-language</code> LaTeX package to load the second .csl file. The different style can be applied to a section of the document using the <code>newrefsection</code> tag.</li>\n<li>the <code>lualatex</code> engine</li>\n</ul>\n<pre><code>---\nformat:\n pdf:\n keep-tex: true\n include-in-header:\n text: |\n \\usepackage{citation-style-language}\n \\addbibresource{references.bib}\npdf-engine: lualatex\n\nfilters: \n - multibib\ntitle: &quot;Test&quot;\ncsl: american-chemical-society.csl\n\n# Turn off YAML validation\nvalidate-yaml: false\n\nbibliography:\n lit: literature.bib\n\n# Disable citeproc\nciteproc: false\n---\n\n\\newrefsection[style = elsevier-harvard, bib-resource = references]\n\n# Main text\n\nCitation with author-year \\cite{bb}.\n\nNumbered citation. @aa\n\n# Bibliography\n\n\\printbibliography[heading=none]\n\\endrefsection\n\n# Appendix\n\n::: {#refs-lit}\n:::\n\n</code></pre>\n<p><a href="https://i.sstatic.net/x8j5VziI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/x8j5VziI.png" alt="capturedresult" /></a></p>\n<p>Not a perfect solution because of the two types of citation systems, but quite easy to use.</p>\n"^^ . . "0"^^ . . . "How to write a pathfinding script in Roblox?"^^ . "4"^^ . "1"^^ . "I changed from Lua5.1 to Lua5.4 and is did work there out of the box."^^ . "path"^^ . . . "<p>i am new to lua and haproxy and have been experiencing a strange problem.\nI am using</p>\n<ul>\n<li>haproxy 2.7.3</li>\n<li>lua 5.3.6</li>\n<li>luarocks 3.9.1</li>\n</ul>\n<p>When haproxy calls my function created in Lua the https.request call (in lua script) always comes back with the response code &quot;Device or Resource busy&quot; and the response body is empty. When i run the same lua script standalone without haproxy everything works fine and the response comes back.</p>\n<p>The error in haproxy logs:</p>\n<p>This is output of the core.Debug(respcode)</p>\n<p><code>Aug 1 22:37:14 localhost haproxy[58794]: Device or resource busy</code></p>\n<p>files:\nHaproxy.cfg</p>\n<pre><code>\nglobal\n\n lua-load /opt/haproxy/redirect_http.lua\n log 127.0.0.1 local2\n\n chroot /var/lib/haproxy\n pidfile /var/run/haproxy.pid\n maxconn 4000\n user haproxy\n group haproxy\n daemon\n\n # turn on stats unix socket\n stats socket /var/lib/haproxy/stats\n\ndefaults\n mode http\n log global\n option httplog\n option dontlognull\n option http-server-close\n option forwardfor except 127.0.0.0/8\n option redispatch\n retries 10\n timeout http-request 60s\n timeout queue 2m\n timeout connect 60s\n timeout client 2m\n timeout server 2m\n timeout http-keep-alive 60s\n timeout check 30s\n maxconn 9000\n\nfrontend proxy\n bind *:80\n bind *:443 ssl crt /opt/haproxy/certs/haproxy.pem\n mode http\n acl getdemo path_beg /test/v2/p/me\n\n\nbackend test\n mode http\n http-request use-service lua.redirect\n\nresolvers mydns\n parse-resolv-conf\n hold valid 10s\n</code></pre>\n<p>redirect_http.lua</p>\n<pre><code>local http = require&quot;ssl.https&quot;\nlocal socket = require&quot;socket&quot;\nlocal ltn12 = require&quot;ltn12&quot;\n\n\nlocal function main(applet)\n\n local reqbody = &quot;grant_type=client_credentials&quot;\n local respbody = {}\n \n local result, respcode, respheaders, respstatus = http.request {\n method = &quot;POST&quot;,\n url = &quot;https://example.com/oauth/token&quot;,\n source = ltn12.source.string(reqbody),\n headers = {\n [&quot;Host&quot;] = &quot;example.com&quot;,\n [&quot;Authorization&quot;] = &quot;Basic SOMEVALUE&quot;,\n [&quot;Accept&quot;] = &quot;*/*&quot;,\n [&quot;Connection&quot;] = &quot;keep-alive&quot;,\n [&quot;Content-Type&quot;] = &quot;application/x-www-form-urlencoded&quot;,\n [&quot;content-length&quot;] = tostring(#reqbody)\n },\n sink = ltn12.sink.table(respbody)\n }\n \n respbody = table.concat(respbody)\n \n core.Debug(respcode)\n\nend\n\ncore.register_service(&quot;redirect&quot;, &quot;http&quot;, main)\n</code></pre>\n<p>What i have already tried</p>\n<ul>\n<li>Setting the ulimit for all users to 65550</li>\n<li>check to see if there was any other service running on tcp 443, nothing</li>\n<li>CPU and memory and storage are all fine not resource issues</li>\n<li>tried setting the ulimit in the haproxy.cfg</li>\n<li>Tried re-installing from scratch</li>\n</ul>\n<p>What i am expecting</p>\n<p>To understand what i am doing wrong which is causing this issue highlighted in the comment and how to make it work so i can send an https.request and get something back.</p>\n"^^ . "1"^^ . . . "How to adapt my leaderstats script so that when a part (pointPart1) is touched, player gains points rather than point per sec like it currently is"^^ . . . . . . . "4"^^ . . "1"^^ . . . "wikipedia"^^ . . . . . "0"^^ . "Can you share a (github) link to try to reproduce the error? I do have project using `cdddialect "C++17"` correctly. (premake has even test case for that)."^^ . "1"^^ . . . "Could you please add the output from the command `tree ~/.config/nvim` to your question? It'll make resolving the issue a little easier by knowing which files/directories exist in your Neovim configuration."^^ . "2"^^ . . . . . "2"^^ . . . "<p>I'm making a simple flappy bird game in roblox studio</p>\n<p>I made this code for the bird so that the bird would fall but go up when the left mouse button is clicked and the code would run until the bird touched another part but everytime i click the bird is still in it's place unmoving</p>\n<pre><code>local bird = game.Workspace.bird\nbird.Anchored = true\nlocal uis = game.UserInputService\nlocal player = game.Players.LocalPlayer\nlocal gravity = -1\nlocal Parts = bird:GetTouchingParts()\nlocal bird_flap = bird.Position + Vector3.new(0, 10, 0)\nlocal gravity_cancel = false\nlocal script_start = false\nuis.InputBegan:Connect(function(input) -- detect when to start script\n if input.UserInputType == Enum.UserInputType.MouseButton1 then\n script_start = true\n end\nend)\nif script_start then\n while not Parts do\n gravity_cancel = false\n if not Parts then\n task.wait(0.5)\n gravity = gravity * 2 -- make the bird fall on exponentially increasing increments\n end\n uis.InputBegan:Connect(function(input)\n if input.UserInputType == Enum.UserInputType.MouseButton1 then -- make the gravity factor reset when clicked\n gravity_cancel = true\n end\n end)\n if not gravity_cancel then --make the bird fall\n bird.Position = bird.Position + Vector3.new(0, gravity, 0)\n else -- make the bird go up or &quot;flap&quot;\n bird.Position = bird_flap\n gravity = -1\n end\n task.wait(0.1)\n end\nend\n</code></pre>\n"^^ . "1"^^ . . . . . "@Spiderkey I could, but I'm doubtful that this is what you want. Could you explain why this is necessary for your use case (or what your actual use case is to begin with)?"^^ . "case-insensitive"^^ . "Just put the script in `ServerScriptService`. Make sure you update any references to instances that use `script` to instead use `game`. The only one I see in your script would be how you define `ogposition `."^^ . "1"^^ . . "DataStore Could Not Save Gui settings"^^ . "0"^^ . "1"^^ . "0"^^ . "Can I automatically set the scroll offset to half of the terminal height?"^^ . . . . "0"^^ . . . "0"^^ . . . . . . . . . . "0"^^ . . . . "0"^^ . . . . "1"^^ . . . . "Unable to clone and move the cloned model"^^ . "@KyleF.Hartzenberg, edited my answer for the `checkhealth`. There seems to be something there."^^ . "0"^^ . "Clone() not seeming to work when setting it's parent to the StarterPack"^^ . . . . . . "0"^^ . "<p>I was trying to make an script that everytime someone subscrive to my Youtube channel, the parent (an noob model) gets cloned and teleported 8 studs UP, <strong>but that just dont work or just spawns the clone inside the original model.</strong></p>\n<p>Can someone help me please?</p>\n<p><em>Also, please <strong>PLEASE</strong> sorry if the code is hard to understand, thats because all the coments are in another language (Brazilian Portuguese).</em></p>\n<h1>Here is my <strong>current</strong> LUA script:</h1>\n<pre><code>--!strict\nprint(&quot;[YTLiveSubs]: Script inserido...&quot;)\nlocal http = game:GetService('HttpService')\n\nlocal channel_id = 'UCA4yZCVHlHZVknfesTU3XOg'\nlocal url = 'https://api.socialcounts.org/youtube-live-subscriber-count/'..channel_id\n\nlocal decoded\nlocal subs\nlocal diffsubs\nlocal data\nlocal success\nlocal finaldiffsubs -- aquele negócio que mostra a diferença de incritos.\n\n-- Ping\nif script:GetAttribute(&quot;Debug&quot;) == true then -- Checa se o modo &quot;Debug&quot; foi ativado\n print(&quot;[YTLiveSubs]: Iniciando teste de ping!...&quot;)\n local startTime = os.clock()\n\n local success, response = pcall(function()\n return http:GetAsync(&quot;https://www.google.com&quot;)\n end)\n\n if success then\n local deltaTime = os.clock() - startTime\n print(&quot;Pong!: &quot; .. deltaTime .. &quot; segundos&quot;)\n else\n print(&quot;Erro: &quot; .. response)\n end\nend\n-- Fim do Ping\n\nfunction ChecarInscritos()\nsuccess,data = pcall(function()\n return http:GetAsync(url)\nend)\n --if data then\n decoded = http:JSONDecode(data)\n subs = decoded[&quot;est_sub&quot;]\n print(subs)\n --end\nend\n\nprint(&quot;[YTLiveSubs]: Calculando First-run...&quot;)\nChecarInscritos()\nwhile true do\n diffsubs = subs\n wait(3) -- em resumo, eu coloquei isso para não sobrecarregar a API\n -- Eu podia tranquilamente não ter feito isso, ou mudade o cooldown para 0.1 ou 0.5,\n -- Mas a API épública e eu não quero estragar o uso das outras pessoas. - PatoFlamejanteTV\n ChecarInscritos()\n print(&quot;[YTLiveSubs]: Inscritos atuais: &quot; .. subs)\n --print(&quot;Pong!&quot;) -- Avisa que um novo &quot;tick&quot;\n print(&quot;[YTLiveSubs]: Novos inscritos: &quot;.. subs - diffsubs) --matemáticas :nerd:\n finaldiffsubs = subs - diffsubs\n for i = 1, finaldiffsubs do\n local clone = game.Workspace.Noob:Clone()\n \n clone.Parent = game.Workspace\n local ogposition = script.Parent\n clone:PivotTo((0), (ogposition.PrimaryPart.CFrame - (Vector3.yAxis * 4)), (0))\n \n --clone:MoveTo(Vector3.new(0, 10, 0)) -- move 10 studs up in the y-axis from the origin\n clone.Name = &quot;Noob&quot;..i -- os &quot;..i&quot;s/&quot;..i&quot;ses (sla o plural) é pra fazer um\n clone.Humanoid.DisplayName = &quot;Noob&quot;..i -- efeito de &quot;Noob1&quot;, &quot;Noob2&quot;, etc.\n --clone.Humanoid.WalkSpeed = 16\n --clone.Humanoid.JumpPower = 50\n --clone.Humanoid.MaxHealth = 100\n --clone.Humanoid.Health = 100\n --clone.HumanoidRootPart.CFrame = game.Workspace.Noob.HumanoidRootPart -- nem eu sei o que é isso\n end\n print(&quot;[YTLiveSubs]: Spawned &quot;.. finaldiffsubs ..&quot; Noobs!&quot;)\nend\n\n\n\n</code></pre>\n"^^ . "mouse click not registering in roblox studio"^^ . . "2"^^ . "1"^^ . . . . . "@romainl Integer division. E.g. `10 // 3` results in 3, and `11 // 2` results in 5."^^ . . . "0"^^ . "<p>Option 2 is by far the easiest. What you seem to be missing is that if you want the model to be the default character, it has to be named &quot;StarterCharacter&quot; instead of &quot;NewSkinModel&quot;.</p>\n<p>This is because when Roblox chooses a character model, it doesn't just choose the first <code>Model</code> that contains a <code>Humanoid</code> object. It specifically looks for one named &quot;StarterCharacter&quot;, ignoring anything that doesn't have that name.</p>\n<p>If you rename your model and drag it back into <code>StarterPlayer</code>, your game should work as expected.</p>\n"^^ . "<p>it seems that the behavior only occurs while there is already a entry defined in the array, not while it is empty\nbut while there is a entry defined, inserting a new line moves the table brace to my cursor and changes the indent to only use two spaces (my editor is set to use 4 spaces for indents)\n<a href="https://i.sstatic.net/IY3zt5uW.gif" rel="nofollow noreferrer">inserting another new line after that will remove all indentation entirely</a>\nfor context, it is only a new behavior and has never happened in the past</p>\n<p>i expected it to simply continue adding new lines between my cursor and the brace, keeping the indentation without moving the brace relative to the cursor\ni searched inside vscode's editor settings, however i was unable to find the exact setting that could cause such a specific problem</p>\n<p>edit: i notice another related problem that has started happening at the same time i noticed this behavior, instead the editor <a href="https://i.sstatic.net/UD50IeSE.gif" rel="nofollow noreferrer">entirely refuses to add any indentation upon pressing enter</a></p>\n"^^ . . "hashtable"^^ . . . . . . "@Jarod42 no unfortunately, I checked the includes and there are no `cppdialect` hidden in them."^^ . . "0"^^ . . "0"^^ . "The code seems to look ok. Using a timer is the only way to use a cosocket in the log phase and passing the data to the send_499_notification seems ok. I spot two possible root causes. One could be the method not being POST when sending data, the other might be the trailing slash (/) of `/handle_499_error/`. Maybe your backend is very picky when it comes to headers, method and path matching."^^ . . . . . . "0"^^ . "<p>Observe the behavior from the repl:</p>\n<pre><code>❯ lua\nLua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio\n&gt; tab={}; str='a'; z=str:gsub('a', 'b'); table.insert(tab, z); print(tab[1])\nb\n&gt; tab={}; str='a'; table.insert(tab, str:gsub('a', 'b')); print(tab[1])\nstdin:1: bad argument #2 to 'insert' (number expected, got string)\nstack traceback:\n [C]: in function 'table.insert'\n stdin:1: in main chunk\n [C]: in ?\n&gt;\n</code></pre>\n"^^ . . "0"^^ . "Lua: Assistance Needed in Using Inheritance in conjunction with case-insensitive metatables/metamethods? Doable?"^^ . . . "<p>In my roblox game I'm currently making a character creation system, and the only way I found to change the player's face is through <code>humanoid:ApplyDescription</code>. Here's how I'm currently using it:</p>\n<pre><code>elseif changeName == &quot;Face&quot; then\n local humanoid = character:FindFirstChild(&quot;Humanoid&quot;)\n local description = humanoid:GetAppliedDescription()\n description.Face = v2.Value -- Id of the face\n humanoid:ApplyDescription(description)\n</code></pre>\n<p>When changing the face in game using this system, the player's skin color gets reset. Here's how I'm changing the player's skin color:</p>\n<pre><code>elseif changeName == &quot;Skin&quot; then\n if character:FindFirstChild(&quot;BodyColors&quot;) then\n character.BodyColors:Destroy()\n end\n local bodyColors = v2:Clone()\n bodyColors.Name = &quot;BodyColors&quot;\n bodyColors.Parent = character\n</code></pre>\n<p>I'm pretty sure that this resets the skin color because I'm not using <code>humanoid:ApplyDescription</code> to change the player's skin color, but if I were to do that then things would get a lot more complex due to how I'm currently storing the color of each option (within a folder with the different body colors for each option).</p>\n<p>I've tried using <code>humanoid:ApplyDescriptionReset</code> instead but this makes the problem worse by also resetting the player's clothing choices. If there's a different way to change the player's face, then I think that would fix the issue, but I couldn't find any other ways online or in the documentation.</p>\n"^^ . "0"^^ . . . . . "1"^^ . "3"^^ . . . . . "0"^^ . "Does this work?"^^ . . . . . "0"^^ . "neovim-plugin"^^ . . "1"^^ . . "0"^^ . "<p><code>MouseButton1Click</code> is not a boolean, it's an <a href="https://create.roblox.com/docs/scripting/events" rel="nofollow noreferrer"><code>Event</code></a>. That means instead of continually checking whether <code>button.MouseButton1Click</code> is true, you should just define a function with the same functionality and bind it to the event in question using the <code>Connect()</code> method.</p>\n<p>Additionally, <code>MouseButton1Click</code> is probably the wrong choice here. <a href="https://create.roblox.com/docs/reference/engine/classes/GuiButton#Activated" rel="nofollow noreferrer"><code>Activated</code></a> will perform a similar function, but with more cross-compatibility.</p>\n<p>This LocalScript should do the trick:</p>\n<pre class="lang-lua prettyprint-override"><code>local button = script.Parent\nlocal main_menu = script.Parent.Parent.Parent.Parent\nlocal main_menu_frame = script.Parent.Parent.Parent\nmain_menu.Enabled = true\n\n-- This function defines what should happen when the button gets clicked\nlocal function onClick() \n game.Lighting.Blur.Enabled = false\n main_menu.Enabled = false\n main_menu_frame.Active = false\n main_menu_frame.Transparency = 1\n main_menu_frame.Visible = false\nend\n\n-- And this line ensure the function is called every time the button is activated\nbutton.Activated:Connect(onClick)\n</code></pre>\n"^^ . . . . "0"^^ . "The error means you attempted to get an object that doesn't exist or \n an attribute that doesn't exist."^^ . "<p>A function <code>f()</code> returns multiple values, which are to be fed into a second function <code>g()</code>. I cannot change <code>f()</code>, but I can change <code>g()</code> and all calls to it. I'm wondering if it's possible to say which variant performs best? What does it depend on?</p>\n<ul>\n<li><p>Function header with one table argument</p>\n<pre class="lang-lua prettyprint-override"><code>function g(arg)\n--code\nend\n</code></pre>\n<p>and function call with table constructor</p>\n<pre class="lang-lua prettyprint-override"><code>g({f()})\n</code></pre>\n</li>\n<li><p>Function header with variable number of arguments</p>\n<pre class="lang-lua prettyprint-override"><code>function g(...)\n--code\nend\n</code></pre>\n<p>and regular function call</p>\n<pre class="lang-lua prettyprint-override"><code>g(f())\n</code></pre>\n</li>\n<li><p>Function header with multiple variables (assuming number of <code>f()</code> return values is known)</p>\n<pre class="lang-lua prettyprint-override"><code>function g(x, y, z)\n--code\nend\n</code></pre>\n<p>and regular function call</p>\n<pre class="lang-lua prettyprint-override"><code>g(f())\n</code></pre>\n</li>\n<li><p>A completely different variant?</p>\n</li>\n</ul>\n"^^ . . . "nginx-config"^^ . . "1"^^ . . . . . . "1"^^ . . . "Ghub buggy on g600?"^^ . . "Both languages have differences in syntax and because of that, it's somewhat difficult to write a code that can be compiled by both the compilers.\n\nI tried various other codes, but none of them worked."^^ . . "0"^^ . . "Thanks a lot. If I get it right, the trick is to hook in the topdown traversal (which in pandoc is depth-fist traversal), stop going down with `_, false` on every level, "visit" all siblings via `List:map` and start on every sibling again. So we get a breadth-first traversal. Amazing."^^ . . . "<p><br>I'm a begginer in modding, specifically modding for The Binding of Isaac Repentance so Lua is new to me. The mod is supposed to upgrade your damage and size and lower your speed. Right now the dmg and speed modifications work pretty well but the size up doesn't seem to work.\nThis is my code, feel free to read it and torn it apart if you need it.\nAlso, all credits go to catinsurance on yt whose tutorial did this.</p>\n<pre><code>local mod = RegisterMod(&quot;More food!&quot;, 1)\n local clownBurger = Isaac.GetItemIdByName(&quot;Clown's Burger!&quot;)\n local clownBurgerDamage = 3\n local clownBurgerSpeed = 0.5\n local clownBurgerSize = 100 --tried with 2 at first but nothing really changed\n function mod:EvaluateCacheDmg(player, cacheFlags)\n if cacheFlags &amp; CacheFlag.CACHE_DAMAGE == CacheFlag.CACHE_DAMAGE then \n local itemCount = player:GetCollectibleNum(clownBurger)\n local damageToAdd = clownBurgerDamage * itemCount\n player.Damage = player.Damage + damageToAdd\n end\n end\n mod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, mod.EvaluateCacheDmg)\n function mod:EvaluateCacheSpd(player, cacheFlags)\n if cacheFlags &amp; CacheFlag.CACHE_SPEED == CacheFlag.CACHE_SPEED then\n local itemCount = player:GetCollectibleNum(clownBurger)\n local speedToDecrease = clownBurgerSpeed * itemCount\n player.MoveSpeed = player.MoveSpeed - speedToDecrease\n end\n end\n mod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, mod.EvaluateCacheSpd)\n function mod:EvaluateCacheSize(player, cacheFlags)\n if cacheFlags &amp; CacheFlag.CACHE_SIZE == CacheFlag.CACHE_SIZE then\n local itemCount = player:GetCollectibleNum(clownBurger)\n local sizeToAdd = clownBurgerSize * itemCount\n player.Size = player.Size + sizeToAdd\n end\n end\n mod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, mod.EvaluateCacheSize)\n</code></pre>\n"^^ . "0"^^ . . "<p>I want to create simple lua script in Logitech G Hub for quick looking behind in the game.\nI manage to make it work using mouse button to trigger it:</p>\n<pre><code>--Script -&gt; MMB - look back\n\nEnablePrimaryMouseButtonEvents(true)\nfunction OnEvent(event, arg)\n \n if (event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 3) then\n \n PressKey(&quot;lctrl&quot;)\n\n for i = 0, 96 do\n \n MoveMouseRelative (-25,0) \n Sleep (1)\n \n end\n \n elseif (event == &quot;MOUSE_BUTTON_RELEASED&quot; and arg == 3) then\n\n ReleaseKey(&quot;lctrl&quot;)\n\n end\n\nend\n\n</code></pre>\n<p>So when I'm pressing middle mouse button, script automatically is pressing lctrl modifier (free look in game), the mouse movement is initiated to move camera in game and after releasing mouse button, lctrl is also released what results in quitting from free look.</p>\n<p>However, I would like to change triggering of that script to use for it only modifier lctrl without pressing mmiddle mouse button.\nI'm trying different configurations with IsModifierPressed(&quot;lshift&quot;) but nothing gave successful results so far. I'd be grateful for any guidance. I'm taking my first steps with lua scripts so childish explanations are welcome ;)</p>\n"^^ . . . . . "0"^^ . . "<p>Wikipedia has lua modules. One of them is the Yesno module.</p>\n<p>Its Yesno.lua file has these contents.</p>\n<pre><code>return function (val, default)\n -- If your wiki uses non-ascii characters for any of &quot;yes&quot;, &quot;no&quot;, etc., you\n -- should replace &quot;val:lower()&quot; with &quot;mw.ustring.lower(val)&quot; in the\n -- following line.\n val = type(val) == 'string' and val:lower() or val\n if val == nil then\n return nil\n elseif val == true \n or val == 'yes'\n or val == 'y'\n or val == 'true'\n or val == 't'\n or val == 'on'\n or tonumber(val) == 1\n then\n return true\n elseif val == false\n or val == 'no'\n or val == 'n'\n or val == 'false'\n or val == 'f'\n or val == 'off'\n or tonumber(val) == 0\n then\n return false\n else\n return default\n end\n</code></pre>\n<p>From the lua cli prompt, I would like to load that function definition and execute it.</p>\n"^^ . "0"^^ . "lazy-evaluation"^^ . "io.lines is expecting a string (a path to a file) and you are passing it userdata object (the object returned from file.open). Just pass the path directly to io.lines without using file.open"^^ . . . . . . . . "How to go about making hitboxes in Roblox"^^ . . "1"^^ . . "<p>I keep getting the error:</p>\n<blockquote>\n<p>&quot;ServerScriptService.CoreScript(Server).CombatScript:13: attempt to index nil with 'CombatStatus'&quot;</p>\n</blockquote>\n<p>In a script I'm working on in a Roblox Game\nThis line of code is what the error is referring to:</p>\n<pre class="lang-lua prettyprint-override"><code>if Hit.Parent:FindFirstChild(&quot;Humanoid&quot;) and\n Hit.Parent.Name ~= Player.Name and\n game.Players:FindFirstChild(Hit.Parent.Name).CombatStatus.Value == &quot;&quot; and\n Hitbox.CanTouch == true then\n</code></pre>\n<p>I've tried rewriting the entire scripts, multiple times, but this error keeps happening. I resolved the error, but now have to deal with another one that states:</p>\n<blockquote>\n<p>&quot;Infinite yield possible on 'Players:WaitForChild(&quot;CombatStatus&quot;)'&quot;</p>\n</blockquote>\n"^^ . "0"^^ . . "1"^^ . . "1"^^ . . . "<pre><code>local function get_cur_time()\n local current_time = redis.call('TIME')[1] \n local current_minute_start = math.floor(current_time / 60) * 60\n return current_minute_start\nend\n\n-- add below line would failed\n-- local CURRENT_TIME = get_cur_time()\n\nredis.register_function('get_cur_time', get_cur_time)\n</code></pre>\n<p>I'd like reuse <code>CURRENT_TIME</code> in many place in my script, but once I added it to global scope, raise error:</p>\n<pre><code>\nredis.exceptions.ResponseError: Error registering functions: ERR user_function:6: Script attempted to access nonexistent global variable 'call'\n</code></pre>\n<p>Anyway to get around?</p>\n"^^ . . "1"^^ . . . "0"^^ . "assigning pattern matches in an if statement"^^ . . "2"^^ . "0"^^ . . . . . "1"^^ . . "1"^^ . "0"^^ . "BTW, the number of user types you can define using `ffi.cdef` is very limited (only a few hundreds), after reaching this limit you can neither replace old nor add new. So, LJ is not suitable for massive creation of new types in runtime."^^ . . "<p>love.keypressed does not actually return anything, <a href="https://love2d.org/wiki/love.keypressed" rel="nofollow noreferrer">according to this</a>\nit is a callback function. every time any key is pressed, it will trigger.</p>\n<pre class="lang-lua prettyprint-override"><code>\n-- old \nif(love.keypressed(&quot;up&quot;,false) or love.keypressed(&quot;w&quot;,false))then\n didWePressF = 1\n if(updatesFromLastDashF&lt;30)then\n player.y = player.y-50\n didWePressF = 0\n updatesFromLastDashF = 0\n end\nend\n\n--new\n\nfunction love.keypressed(key,code,isrepeat){\n -- key:character of the key, code:scancode of the key,isrepeat:if the key is held down\n if(not isrepeat) then\n --only runs if the keys arent being held \n if(code==&quot;up&quot; or code==&quot;w&quot;)then\n didWePressF = 1\n if(updatesFromLastDashF&lt;30)then\n player.y = player.y-50\n didWePressF = 0\n updatesFromLastDashF = 0\n end\n end\n end\n}\n</code></pre>\n"^^ . "bibliography"^^ . . . "<p>Visual Studio projects support both c++ and c files. The most important thing that immediately comes to mind at the project level is that the precompiled header system is not compatible with both at the same time. It will work with either, but if you have both c++ and c files in the same project you will need to manually set one to not use precompiled headers (or have a different precompiled header for c++ and c files).</p>\n<p>If you are not using PCH at all then you will not need to perform any manual override.</p>\n<p>And also note that you will need the usual 'extern &quot;C&quot;' wrapping, ensuring that the declarations match between the two parts.</p>\n"^^ . . . . "0"^^ . . "0"^^ . . . . . . . . "0"^^ . "1"^^ . "<p>This has done it for me.</p>\n<pre class="lang-lua prettyprint-override"><code>function files_inside_directory()\n local cmd = &quot;:e &lt;C-R&gt;=expand('%:h')&lt;CR&gt;/&quot;\n local termcode = vim.api.nvim_replace_termcodes(cmd, true, false, true)\n vim.api.nvim_feedkeys(termcode, 'n', false)\n vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(&quot;&lt;C-z&gt;&quot;, true, false, true), 'n', false)\nend\n\nvim.api.nvim_set_keymap('n', '&lt;leader&gt;e', ':lua files_inside_directory()&lt;CR&gt;', {noremap = true, silent = true, desc=&quot;Open popupmenu inside file directory.&quot;})\n</code></pre>\n<p>Since <code>&lt;Tab&gt;</code> only inserts a <code>^I</code> character, this is a slight workaround to trigger the popupmenu.</p>\n"^^ . . "how to write polyquine program for both python and lua?"^^ . "<p>You're indexing a nil value with <code>CombatStatus</code>. That means you need to look for <code>something.CombatStatus</code> <code>something:CombatStatus</code> or <code>something[&quot;CombatStatus&quot;]</code> in your code.</p>\n<p>You'll find</p>\n<pre><code>game.Players:FindFirstChild(Hit.Parent.Name).CombatStatus.Value\n</code></pre>\n<p>So <code>game.Players:FindFirstChild(Hit.Parent.Name)</code> returns <code>nil</code>.</p>\n<p>Indexing nil does not make any sense and his hence not allowed and prompted with an error.</p>\n<p>Find out why the function returns <code>nil</code> and fix the cause.</p>\n<p>If you cannot ensure that a value is indexable, you should not index it without checking.</p>\n"^^ . . . "orthanc-server"^^ . . . . . . . "0"^^ . . . "windows-11"^^ . . . . "0"^^ . "1"^^ . "1"^^ . "Img loading error | GLua | Garrys mod HUD"^^ . . "<pre><code>local UIS = game:GetService('UserInputService')\nlocal Player = game.Players.LocalPlayer\nlocal Character = Player.Character\n\nUIS.InputBegan:connect(function(input)\n if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A then\n Character.Humanoid.WalkSpeed = 22 --run speed\n local Anim = Instance.new('Animation')\n Anim.AnimationId = 'rbxassetid://18686242456'\n PlayAnim = Character.Humanoid:LoadAnimation(Anim)\n PlayAnim:Play()\n end\nend)\nUIS.InputEnded:connect(function(input)\n if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A then\n Character.Humanoid.WalkSpeed = 16 --default walk speed\n PlayAnim:Stop()\n end\nend)\n</code></pre>\n<p>I'm not sure how to fix this.</p>\n"^^ . "0"^^ . "Haproxy with LuaSocket Device or resource busy error"^^ . "Are the things you're adding to the backpack `Tool` objects?"^^ . . . "You'll have to define "performs best" and measure."^^ . "<p>A parameter that does not fit into register (longer than 16 bytes for x64) is pre-allocated by caller and passed by pointer. That is, <code>struct foo bar(...);</code> is almost the same as <code>struct foo* bar(struct foo*, ...);</code></p>\n<p>Or, from ffi's POV, <code>local foo = bar(...)</code> is equivalent to <code>local foo = ffi.new(...); bar(foo, ...)</code>. So no extra precautions needed.</p>\n"^^ . . . . "2"^^ . . . . . . "1"^^ . . "0"^^ . "0"^^ . "Pressing "W" or "A" makes me run but pressing both stops the animation"^^ . . . "1"^^ . "5"^^ . . "2"^^ . . . . . "1"^^ . "0"^^ . "<p>I have imported to my Miraheze site the <a href="https://es.wikipedia/wiki/M%C3%B3dulo:Ficha" rel="nofollow noreferrer">Módulo:Ficha</a> from the Spanish Wikipedia but I get this error:</p>\n<pre><code>Lua error on line 567: attempt to index field 'wikibase' (a nil value).\n\nReverse trace:\n\nModule:File:567: in the &quot;makeWikidataBar&quot; function\nModule:File:638: ?\n(tail call): ?\nmw.lua:527: ?\n[C]: ?\n\nIn line 567 I have this code:\n(Spanish)=local function hacerBarraWikidata(nule)-- Crea en la parte inferior un enlace al ítem de Wikidata\n(English)=local function makeWikidataBar(nule)-- Creates a link to the Wikidata item at the bottom\n\nIn line 638 I have this code:\n(Spanish)=hacerBarraWikidata()\n(English)=makeWikidataBar()\n</code></pre>\n<p>I would wait for a result that would help me finish my file module since I urgently need to finish it. I have been trying for more than 3 days, but I have not succeeded.</p>\n"^^ . . . . "2"^^ . . . . "1"^^ . . "1"^^ . "0"^^ . "Okay that's almost exactly what I was looking for, my only question is that wouldn't the clone function only work once? Because after cloning it a second time it's just using the same table you defined as "new_t"? What I mean is if our original stats table is referred to as "monster_stats", and our clone is referred to as "new_t", won't the second clone just be the second table? I apologize if that's a dumb question. Still wrapping my head around Lua tables."^^ . "One has to keep track manually. In rough strokes: one would use `traverse: 'topdown'` in the filter to make sure that all elements are visited in the right order. Then one might call `current_element:walk` with an appropriate filter. I'll try to write-up a full answer within the next days."^^ . . . "0"^^ . "redis"^^ . . "biomejs"^^ . . . . "0"^^ . . "0"^^ . . . . "for-loop"^^ . . "freeswitch"^^ . "0"^^ . "1"^^ . "0"^^ . "<p>Lately, I had been trying to figure out how to make a decent hitbox system for my game. My inspiration is &quot;Item Asylum&quot;. What I had noticed is: The hitbox doesn't move with the player, instead multiple are created and as well as I can understand, destroyed. That's no the tricky part, the tricky part is: making it not damage the person who activated the ability / created the hitbox.\nOr, do I just make it move with the character (which will probably a worse decision since exploiters can use that to their advantage.)</p>\n"^^ . . . . . . . . "0"^^ . . "0"^^ . "0"^^ . "I wanted to write logs for the garry's mod server, but I have a problem"^^ . "0"^^ . . "0"^^ . "0"^^ . . "1"^^ . "<p>There was a <a href="https://github.com/harningt/luajson/issues/51" rel="nofollow noreferrer">bug</a> in <code>luajson</code>, that was fixed in the source code at GitHub but not in the luarocks package.</p>\n<p>Installing from GitHub (e.g., <code>git clone https://github.com/harningt/luajson.git &amp;&amp; cp -r luajson/lua /usr/local/share/lua/5.1/json &amp;&amp; rm -r luajson</code> or using sparse checkout) may help.</p>\n"^^ . . "Why the double slash?"^^ . "0"^^ . . . "<p>I'm trying to figure out LuaJIT garbage collection when its FFI is involved. Let's say I have a function that returns a <code>struct</code> by value.</p>\n<pre><code>typedef struct MyTestData {\n int id;\n // ... other fields that may need finalizing/freeing\n} MyTestData;\n\nMyTestData createTestData(int id);\nvoid deleteTestData(MyTestData data); // finalizes/frees the data in MyTestData fields\n\n// and then I use the same in ffi.cdef and\nlocal lib = ffi.load(LIBRARY_PATH)\n</code></pre>\n<p>My questions are:</p>\n<ol>\n<li>When I create a Lua variable by calling <code>local v = lib.createTestData(25)</code> and then <code>v</code> gets garbage collected (for example, going out of score with no other references), does it free the memory allocated for it even though <code>createTestData</code> returned the struct value, not a pointer to it?</li>\n<li>If I need additional cleanup of resources <code>MyTestData</code> may hold, and I create it like this: <code>local v = ffi.gc(lib.createTestData(25), lib.deleteTestData)</code>, does it also automatically free the memory used by <code>v</code> when it goes out of scope after calling <code>deleteTestData</code>?</li>\n</ol>\n<p>I'm asking this because the LuaJIT FFI docs and examples usually deal with pointers, <code>malloc</code>s and <code>free</code>s, whereas in my case what I have are values.</p>\n"^^ . . "How can I use a parameter to alter which data my profile.Data is accessing?"^^ . . . . "0"^^ . . . "<p>The problem is in the work you're doing with <code>RunServiceEvent</code>. It seems like you're trying to make sure the part is at its target position once the Tween is over, then deleting the <code>RenderStepped</code>. Unfortunately, <code>RunServiceEvent = nil</code> won't delete it for you - it unbinds the object from that name, but it doesn't delete the object from memory.</p>\n<p>This means that after one second, your script will constantly move the part to your target position, effectively locking it in place.</p>\n<p>The good news is, you don't need that bit at all! Your Script works fine if you just remove that bit entirely:</p>\n<pre class="lang-lua prettyprint-override"><code>local tweenService = game:GetService(&quot;TweenService&quot;)\nlocal runService = game:GetService(&quot;RunService&quot;)\nlocal player = game.Players.LocalPlayer\n\nlocal RunServiceEvent = nil\nlocal tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)\n\nfunction SpawnPart()\n local part = Instance.new(&quot;Part&quot;)\n part.Anchored = true\n part.Parent = game.Workspace.Clutter.Coins\n\n local startPos = Vector3.new(0, 2, 0)\n part.Position = startPos\n\n local TargetPosition = Vector3.new(5, 2, 0)\n\n local Tween = tweenService:Create(part, tweenInfo, {Position = TargetPosition})\n Tween:Play()\nend\n\nplayer:WaitForChild(&quot;PlayerGui&quot;):WaitForChild(&quot;ScreenGui&quot;):WaitForChild(&quot;TextButton&quot;).Activated:Connect(SpawnPart)\n</code></pre>\n<p>If you really want to ensure that the part ends up in the right place, you can also just make your script wait until the Tween is done using <a href="https://create.roblox.com/docs/reference/engine/libraries/task#delay" rel="nofollow noreferrer"><code>task.delay</code></a>:</p>\n<pre class="lang-lua prettyprint-override"><code>local tweenService = game:GetService(&quot;TweenService&quot;)\nlocal runService = game:GetService(&quot;RunService&quot;)\nlocal player = game.Players.LocalPlayer\n\nlocal RunServiceEvent = nil\nlocal tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)\n\nfunction SpawnPart()\n local part = Instance.new(&quot;Part&quot;)\n part.Anchored = true\n part.Parent = game.Workspace.Clutter.Coins\n\n local startPos = Vector3.new(0, 2, 0)\n part.Position = startPos\n\n local TargetPosition = Vector3.new(5, 2, 0)\n\n local Tween = tweenService:Create(part, tweenInfo, {Position = TargetPosition})\n Tween:Play()\n\n task.delay(tweenInfo.Time, function()\n part.Position = TargetPosition\n end)\nend\n\nplayer:WaitForChild(&quot;PlayerGui&quot;):WaitForChild(&quot;ScreenGui&quot;):WaitForChild(&quot;TextButton&quot;).Activated:Connect(SpawnPart)\n</code></pre>\n"^^ . . . . "<p>I managed to workaround the issue by using the <code>rawget</code> global. Here's how I assigned the variables I needed:</p>\n<pre><code>local expType = tostring(xpType)\nlocal expTypeStat = expType:gsub(&quot;Exp&quot;, &quot;&quot;)\nlocal profileDataExpType = rawget(profile.Data, expTypeStat)\nlocal profileDataExp = rawget(profile.Data, expType)\n</code></pre>\n<p><code>rawget</code> gets the value of the <code>profile.Data</code> table and returns the value of the index you give it, in this case <code>expTypeStat</code> and <code>expType</code>.</p>\n<p>If you then want to change the value, you can use the <code>rawset</code> global. Here's an example:</p>\n<pre><code>rawset(profile.Data, expType, (0 + leftoverExp))\n</code></pre>\n"^^ . . "1"^^ . . "visual-studio-2022"^^ . "1"^^ . "3"^^ . . . . . "0"^^ . . . . . . . . . . . "0"^^ . "0"^^ . "0"^^ . "0"^^ . . "Lua + VLC Media Player: Error when trying to edit the "vlcrc" file from VLC Lua Extension"^^ . "0"^^ . "0"^^ . . "@den4ik_here np!"^^ . "<p>Drag the pack in the <strong>ServerScriptServer</strong> folder. Make sure <strong>none</strong> of the scripts are disabled. Make sure you have the right pack, some are scams. Search <code>HD ADMIN</code> in the explorer and delete anything with the name. Make sure no parts have the name <code>HD ADMIN</code>. Reinstall the pack. (You have already done some of this.) If that doesn't work, enable API services via Basic Settings, thus allowing the pack to access the services it needs! I hope this helped!</p>\n"^^ . "Trigger a Lua script when pressing a modifier on a keyboard in Logitech G Hub"^^ . "<p>First of all, I'm a complete neovim plugin noob. But I had an idea for my first one that would involve pinging a website to see if the latest version of software matches what is currently installed on the system, and alerting the user if there is a new version for them to install. I just have exhausted my google-fu in regards to this.</p>\n<p>Ideally I'd like to write something like (psuedo-code INCOMING!):</p>\n<pre class="lang-lua prettyprint-override"><code>local http = require('http')\nlocal json = require('json')\n\nlocal latest = http.request(&quot;/url/to/latest/version&quot;)\nprint(json.parse(latest))\n</code></pre>\n<p>I've gotten <em>relatively</em> far with this, even so far as printing out the latest version and the currently installed one. It just involved installing a lot of extra stuff (luarocks, socket.http), and I have no idea how a user installing this nvim plugin via plugin manager would have it &quot;just work.&quot;</p>\n<p>Any information provided would be extremely helpful! Thanks for your time.</p>\n"^^ . "Neovim shortcut to provide file choice from current file without plugins?"^^ . "Welcome to SO! [Please do not upload images of code/data/errors.](//meta.stackoverflow.com/q/285551) Instead, please [edit] your question to replace your images of code and errors with [code-formatted text](/editing-help#code)."^^ . "0"^^ . "1"^^ . "0"^^ . "<p>Edit: I confused the bool with the event, my bad!\nConnect a function to the event then run your code.</p>\n<p>Change your code to:</p>\n<pre><code>local button = script.Parent\nlocal main_menu = script.Parent.Parent.Parent.Parent\nlocal main_menu_frame = script.Parent.Parent.Parent\nmain_menu.Enabled = true\ngame.Lighting.Blur.Enabled = true\n\nbutton.MouseButton1Click:Connect(function()\n game.Lighting.Blur.Enabled = false\n main_menu.Enabled = false\n main_menu_frame.Active = false\n main_menu_frame.Transparency = 1\n main_menu_frame.Visible = false\n \n task.wait(0.1)\n end)\n</code></pre>\n<p>The code you wrote looped while waiting for the <code>button.MouseButton1Click</code> event to finish. This caused an endless loop of the button triggering and then waiting for the loop to finish.\n<strong>You do not need a loop</strong> to check for the event. Instead, just check if the button <code>MouseButton1Down</code> event is triggered then run your code, as the <code>task.wait()</code> function acts as a debounce without the loop.</p>\n"^^ . . . . . . . "2"^^ . . "project"^^ . . "0"^^ . . . "0"^^ . . "macros"^^ . . . "So I did not test your suggestion but it sounds legit."^^ . "@JeremyCaney Done, although I can't explain as to why it worked or why I did it because I was really just messing around until something worked"^^ . . . "0"^^ . . "0"^^ . . . . "0"^^ . . . "2"^^ . "1"^^ . "1"^^ . "<p><code>string.gsub()</code> returns two values. Therefore, <code>table.insert()</code> sees three arguments: <code>table.insert(tab, 'b', 1)</code>. Three-argument call is supposed to be <code>table.insert(t, pos, value)</code> but <code>pos</code> here is a string, so it fails.</p>\n<p>You have to embrace <code>gsub</code> in order to get rid of that extra value:</p>\n<pre class="lang-lua prettyprint-override"><code>table.insert(tab, (str:gsub('a', 'b')))\n</code></pre>\n"^^ . . "1"^^ . . "0"^^ . . "treesitter"^^ . "<p>With the help of the other answer, I was able to investigate the changes around for loops that happened in Lua from 4.0 to 5.1 and note down my findings. Initially, in Lua 4.0, there are two forms of for loops: &quot;numical for&quot; and &quot;table for&quot;. The latter matches this question's <code>for key, value in table</code> and is described in <a href="https://www.lua.org/manual/4.0/manual.html#4.4" rel="nofollow noreferrer">https://www.lua.org/manual/4.0/manual.html#4.4</a> as:</p>\n<blockquote>\n<p>The table for statement traverses all pairs (index,value) of a given table. It has the following syntax:</p>\n<pre class="lang-none prettyprint-override"><code>stat ::= for name `,' name in exp1 do block end\n</code></pre>\n<p>A for statement like</p>\n<pre class="lang-none prettyprint-override"><code>for index, value in exp do block end\n</code></pre>\n<p>is equivalent to the code:</p>\n<pre class="lang-none prettyprint-override"><code>do\n local _t = exp\n local index, value = next(t, nil)\n while index do\n block\n index, value = next(t, index)\n end\nend\n</code></pre>\n<p>Note the following:</p>\n<ul>\n<li>_t is an invisible variable. The name is here for explanatory purposes only.</li>\n<li>The behavior is undefined if you assign to index inside the block.</li>\n<li>The behavior is undefined if you change the table _t during the traversal.</li>\n<li>The variables index and value are local to the statement; you cannot use their values after the for ends.</li>\n<li>You can use break to exit a for. If you need the value of index or value, assign them to other variables before breaking.</li>\n<li>The order that table elements are traversed is undefined, even for numerical indices. If you want to traverse indices in numerical order, use a numerical for.</li>\n</ul>\n</blockquote>\n<p>This means that <code>for key, value in table</code> is a special form of the for loop, explicitly for tables, called &quot;table for&quot;, introduced with Lua 4.0. In Lua 5.0, another, more powerful form of for loop was introduced: the &quot;generic for&quot;. It has a different syntax in that it expects an iterator instead of simply a table. (Refer to &quot;generic for&quot; in the Lua 5.0 manual for more information about iterators.)</p>\n<p>As to what happened to &quot;table for&quot;, chapter &quot;Incompatibilities with Previous Versions&quot; in <a href="https://www.lua.org/manual/5.0/manual.html" rel="nofollow noreferrer">https://www.lua.org/manual/5.0/manual.html</a> mentions:</p>\n<blockquote>\n<p>The old construction <code>for k,v in t</code>, where <code>t</code> is a table, is deprecated (although it is still supported). Use <code>for k,v in pairs(t)</code> instead.</p>\n</blockquote>\n<p>So it was deprecated in 5.0 already, but wasn't removed until 5.1 - which, unfortunately, doesn't seem to be to mentioned in the 5.1 manual.</p>\n<p>Finally, according to the code excerpt from the 4.0 manual above, &quot;table for&quot; like <code>for key, value in table</code> did, while it existed, behave like &quot;generic for&quot; with <code>pairs</code> like <code>for key, value in pairs(table)</code> in Lua 5.0 and later.</p>\n"^^ . "-1"^^ . "Need the right flag, im not sure what it is"^^ . . "3"^^ . . . "0"^^ . . . "0"^^ . . . . . . . . . . "0"^^ . . "<p>I found a interesting problem in Lua. Lua provides string.format function to format the string, and the first parameter of this function is the string you want to format.</p>\n<p>Coincidentally, Lua allows <code>:</code> operator to make a object call a function with the first parameter is itself, which means the following statement can run normally:</p>\n<pre><code>local myWord = &quot;Hello, %s&quot;\n\n-- two ways to format:\n\nstring.format(myWord, &quot;World&quot;)\n\nmyWord:format(&quot;World&quot;)\n</code></pre>\n<p>Is there any difference between those two style? If not, which one is better for me to use in my program?</p>\n"^^ . . . . . . "your clone function does not "clone" the table. it completely ignores a possible metatable."^^ . "Communicating global variables in Lua"^^ . . . . "2"^^ . . "0"^^ . . "I have a Script error in Miraheze, I want to try to index the field 'wikibase' (a null value)"^^ . . "What was the purpose of the RunServiceEvent code? Did you receive it from a programming guide?"^^ . . . . . . . "0"^^ . "1"^^ . . "2"^^ . . . . . "1"^^ . . . . "0"^^ . . . "for my case, it seems that it is caused by some setting inside the Lua extension (by sumneko)"^^ . . . . "1"^^ . "1"^^ . "<p>So i have been making my fully based gui font viewer game in roblox, i added a themes option and soon will add a word editor, now lets focus on the themes, the i have 2 themes, default and green, and the path to each of those is\ngame.startergui.screengui.themeframe.default\ngame.startergui.screengui.themeframe.gren</p>\n<p>when i change between those, it works but when i rejoin the the default theme always shows\nreally appreciate your help</p>\n<p>i tried chatgpt but chatgpt's code never works.</p>\n"^^ . "0"^^ . . "command-line-interface"^^ . "<p>If in <code>msg</code> you have the file name, and in <code>File.name</code> the full name of the file and you want to shorten it, then try extracting the name like this:</p>\n<pre><code>string.match(File.name,&quot;([^/]*)$&quot;)\n</code></pre>\n<p>It matches: a string, starting from the end, and then captures any characters that's not <code>/</code>.</p>\n"^^ . "0"^^ . "0"^^ . "0"^^ . . "0"^^ . . "0"^^ . . . . . "<p>I'm trying to compile Sciter from a command line batch, using the Visual Studio 2022 compiler. For that reason I need to generate the VS2022 projects using Premake5.</p>\n<p>However Sciter needs to be compiled with C++17. Premake5 provides a <code>cppdialect</code> option to configure that. But this option is completely ignored while my projects are generated.</p>\n<p>Below is the Lua code I'm using with Premake5:</p>\n<pre class="lang-lua prettyprint-override"><code>newoption {\n trigger = &quot;device&quot;,\n value = &quot;DESKTOP|HANDHELD|IOT&quot;,\n description = &quot;target device&quot;,\n default = &quot;DESKTOP&quot;,\n allowed = {\n { &quot;DESKTOP&quot;, &quot;Desktop machine&quot; },\n { &quot;HANDHELD&quot;, &quot;Mobile device&quot; },\n { &quot;IOT&quot;, &quot;IoT device&quot; }\n }\n}\n\nnewoption {\n trigger = &quot;OPENGL&quot;,\n value = &quot;GL|GLES&quot;,\n description = &quot;OpenGL support&quot;,\n default = &quot;GL&quot;,\n allowed = {\n { &quot;GL&quot;, &quot;OpenGL&quot; },\n { &quot;GLES&quot;, &quot;OpenGLES&quot; }\n }\n}\n\nnewoption {\n trigger = &quot;VULKAN&quot;,\n description = &quot;VULKAN support&quot;,\n}\n\nnewoption {\n trigger = &quot;METAL&quot;,\n description = &quot;METAL support (MacOS/iOS)&quot;,\n}\n\nnewoption {\n trigger = &quot;DX12&quot;,\n description = &quot;DX12 support (Windows)&quot;,\n}\n\n\nSDKDIR = &quot;sdk.js&quot;\nBUILDDIR = &quot;build.js&quot;\n\ndefines { \n &quot;SCITERJS&quot;, &quot;SCRIPT_JS&quot;,\n &quot;JS_STRICT_NAN_BOXING&quot;, \n &quot;CONFIG_BIGNUM&quot;,\n &quot;CONFIG_UNITS&quot;, \n &quot;CONFIG_JSX&quot;, \n &quot;CONFIG_JSX_SCITER&quot;,\n &quot;CONFIG_DEBUGGER&quot;,\n &quot;CONFIG_STORAGE&quot;,\n &quot;CONFIG_OBJECT_LITERAL_CALL&quot;\n}\n\nfilter { &quot;options:VULKAN&quot; }\n defines {&quot;USE_VULKAN&quot;, &quot;SK_VULKAN&quot;}\n includedirs { &quot;$(VK_SDK_PATH)/Include&quot; } \n\nfilter { &quot;options:METAL&quot; }\n defines {&quot;USE_METAL&quot;, &quot;SK_METAL&quot;}\n\nfilter { &quot;options:DX12&quot; }\n defines {&quot;USE_DX12&quot;, &quot;SK_DIRECT3D&quot;}\n\nfilter { &quot;options:OPENGL=GL&quot; }\n defines {&quot;USE_OPENGL&quot;, &quot;SK_GL&quot;}\n\nfilter { &quot;options:OPENGL=GLES&quot; }\n defines {&quot;USE_OPENGLES&quot;, &quot;SK_GL&quot;}\n\nfilter {}\n\nMONOLITHIC = true -- by design\nUSE_SKIA_BY_DEFAULT = true -- only rendering option on devices\nWINDOWLESS = true\n\ndefines { &quot;WINDOWLESS&quot;, &quot;MONOLITHIC&quot;, &quot;SCITER_BUILD&quot;,\n &quot;DEVICE=&quot; .. _OPTIONS[&quot;device&quot;] }\n\n\ninclude &quot;premake5-modules.lua&quot;\n\nconfigurations { &quot;Debug&quot;, &quot;Release&quot; }\nplatforms { &quot;x32&quot;, &quot;x64&quot;,&quot;arm32&quot;, &quot;arm64&quot; } \n\n\nfunction osabbr() \n return os.target()\nend\n\nfilter &quot;system:windows&quot;\n preferredtoolarchitecture &quot;x86_64&quot;\n --buildoptions &quot;-Zm200&quot;\n defines { &quot;NOMINMAX&quot; }\n location(BUILDDIR .. &quot;/&quot; .. osabbr()) \n platforms { &quot;x32&quot;, &quot;x64&quot;, &quot;arm32&quot;, &quot;arm64&quot; }\n --configurations { &quot;DebugSkia&quot;, &quot;ReleaseSkia&quot; }\n defines { &quot;_CRT_SECURE_NO_WARNINGS&quot; } \n systemversion &quot;latest&quot;\n\nfilter &quot;system:macosx&quot;\n location(BUILDDIR .. &quot;/&quot; .. osabbr()) \n platforms { &quot;x64&quot; } \nfilter &quot;system:linux&quot;\n location(BUILDDIR .. &quot;/&quot; .. osabbr() .. &quot;/&quot; .. string.lower(_OPTIONS[&quot;device&quot;]))\n platforms { &quot;x64&quot;, &quot;arm32&quot;, &quot;arm64&quot; } \nfilter &quot;system:android&quot;\n location(BUILDDIR .. &quot;/&quot; .. osabbr()) \n platforms { &quot;x32&quot;, &quot;x64&quot;, &quot;arm32&quot;, &quot;arm64&quot; } \nfilter {}\n\n\nincludedirs { \n &quot;.&quot;, \n &quot;engine&quot;,\n &quot;engine/tool&quot;,\n &quot;engine/gool&quot;,\n &quot;engine/html&quot;,\n &quot;engine/external/uv/include&quot;,\n &quot;engine/external/uv-tls/include&quot;,\n &quot;engine/external/zlib&quot;,\n &quot;engine/external/minizip&quot;\n} \n\nfilter &quot;not system:linux&quot;\n flags { &quot;MultiProcessorCompile&quot; } -- does not work reliably on Linux, why?\nfilter{}\n\ncppdialect &quot;C++17&quot;\ncdialect &quot;C99&quot;\n\nstaticruntime &quot;On&quot;\n\nfilter &quot;platforms:x32&quot;\n architecture &quot;x86&quot;\nfilter &quot;platforms:x64&quot;\n architecture &quot;x86_64&quot; \nfilter &quot;platforms:arm32&quot;\n architecture &quot;ARM&quot; \nfilter &quot;platforms:arm64&quot;\n architecture &quot;ARM64&quot; \n\nfilter {&quot;platforms:x32&quot;, &quot;system:windows&quot;}\n defines { &quot;WIN32&quot; }\nfilter {&quot;platforms:x64&quot;, &quot;system:windows&quot;}\n defines { &quot;WIN32&quot;,&quot;WIN64&quot; } \nfilter {&quot;platforms:arm64&quot;, &quot;system:windows&quot;}\n defines { &quot;WIN32&quot;,&quot;WIN64&quot;,&quot;ARM64&quot; } \n architecture &quot;ARM64&quot; \n\nfilter &quot;configurations:Debug*&quot;\n defines { &quot;DEBUG&quot;, &quot;_DEBUG&quot; }\n symbols &quot;On&quot;\n\nfilter &quot;configurations:Release*&quot;\n defines { &quot;NDEBUG&quot;} \n optimize &quot;Full&quot;\n -- symbols &quot;Off&quot;\n flags { &quot;LinkTimeOptimization&quot; }\n\nfilter {&quot;system:windows&quot;}\n defines { &quot;_CRT_SECURE_NO_WARNINGS&quot; } \n\nfilter { &quot;system:macosx&quot;, &quot;configurations:Release*&quot; }\n linkoptions { &quot;-s&quot;, &quot;-flto=full&quot; }\n\nfilter &quot;system:linux&quot;\n defines { &quot;_GNU_SOURCE&quot; }\n buildoptions {\n &quot;`pkg-config fontconfig --cflags`&quot;,\n &quot;-fPIC&quot;,\n &quot;-Wno-unknown-pragmas&quot;,\n &quot;-Wno-write-strings&quot;,\n }\n linkoptions { \n &quot;-fPIC&quot;,\n &quot;-pthread&quot;,\n &quot;-ldl&quot;, \n } \n\nfilter { &quot;system:linux&quot;, &quot;platforms:x32 or x64&quot; }\n buildoptions {\n &quot;-march=nehalem&quot;,\n }\n\nfilter { &quot;system:linux&quot;, &quot;platforms:arm32&quot; }\n -- rapsberry Pi 2 and above\n buildoptions {\n &quot;-mfpu=neon&quot;,\n &quot;-mfloat-abi=hard&quot;,\n }\n linkoptions {\n &quot;-mfpu=neon&quot;,\n &quot;-mfloat-abi=hard&quot;,\n }\n\n\nfilter { &quot;toolset:gcc&quot;, &quot;files:*.cpp&quot; }\n buildoptions {\n &quot;-fpermissive&quot;,\n &quot;-Wno-reorder&quot;,\n }\n\nfilter &quot;system:android&quot;\n buildoptions { &quot;-fexceptions&quot; }\n --optimize &quot;Off&quot;\n\n\nfilter {}\n\nskia_includes()\n\n\nworkspace &quot;sciter.lite&quot;\n\n--|\n--| sciter dll\n--|\n\nproject &quot;sciter.lite&quot;\n kind &quot;SharedLib&quot;\n language &quot;C++&quot;\n\n defines { &quot;SCITER_EXPORTS&quot; }\n \n filter &quot;system:android&quot;\n toolset &quot;clang&quot;\n --optimize &quot;Off&quot;\n defines { &quot;ANDROID&quot; }\n\n filter{}\n\n targetname &quot;sciter&quot;\n\n include_files_lite()\n include_files_tool()\n include_files_uv()\n include_files_uv_tls() \n include_files_dybase()\n include_files_gool()\n include_files_zlib()\n include_files_minizip()\n include_files_png()\n include_files_jpeg()\n include_files_webp()\n include_files_rlottie()\n include_files_html()\n include_files_http()\n include_files_tmt()\n include_files_xdomjs()\n include_files_qjs()\n\n if os.target() == &quot;windows&quot; then\n --include_files_directshow()\n include_files_d2d()\n end\n --if os.target() == &quot;linux&quot; then \n -- include_files_gtk()\n --elseif os.target() == &quot;macosx&quot; then\n -- include_files_osx()\n --end \n include_files_xgl_skia()\n include_files_webgl() \n include_freetype_files()\n\n filter &quot;system:windows&quot;\n prebuildcommands { \n &quot;subwcrev.exe \\&quot;%{wks.location}..\\\\..\\&quot; \\&quot;%{wks.location}..\\\\..\\\\engine\\\\sciter-revision-template.h\\&quot; \\&quot;%{wks.location}..\\\\..\\\\engine\\\\sciter-revision.h\\&quot;&quot;,\n &quot;\\&quot;%{wks.location}..\\\\..\\\\&quot;.. SDKDIR .. &quot;\\\\bin\\\\windows\\\\packfolder.exe\\&quot; \\&quot;%{wks.location}..\\\\..\\\\engine\\\\res.js\\&quot; \\&quot;%{wks.location}..\\\\..\\\\engine\\\\master-css-resources-js.cpp\\&quot; -v \\&quot;master_css_resources\\&quot;&quot; }\n filter {}\n\n targetdir (SDKDIR .. &quot;/bin.lite/&quot; .. osabbr() .. &quot;/%{cfg.platform}&quot;)\n\n\n filter &quot;system:windows&quot;\n links { &quot;usp10&quot;, &quot;ws2_32&quot;, &quot;wininet&quot;, &quot;windowscodecs&quot; }\n files { \n &quot;engine/lite/windows/dllmain.cpp&quot;, \n &quot;engine/lite/windows/sciter.def&quot;, \n &quot;engine/lite/windows/sciter.dll.rc&quot;, \n &quot;engine/lite/windows/lite-d2d.cpp&quot;, \n }\n\n filter &quot;system:macosx&quot;\n links { \n &quot;CoreFoundation.framework&quot;, \n &quot;Cocoa.framework&quot;,\n &quot;Carbon.framework&quot;, \n &quot;AVFoundation.framework&quot;,\n &quot;SystemConfiguration.framework&quot;,\n &quot;CoreMedia.framework&quot;,\n &quot;CoreText.framework&quot;,\n &quot;CoreGraphics.framework&quot;,\n &quot;CoreData.framework&quot;,\n &quot;CoreVideo.framework&quot;,\n &quot;IOKit.framework&quot;,\n &quot;OpenGL.framework&quot;\n } \n\n filter &quot;system:linux&quot;\n linkoptions { \n &quot;`pkg-config fontconfig --libs`&quot;,\n &quot;-fPIC&quot;,\n &quot;-pthread&quot;,\n &quot;-Wl,--no-undefined&quot;,\n &quot;-lX11&quot;, &quot;-lX11-xcb&quot;,\n &quot;-ldl&quot;,\n &quot;-latomic&quot;,\n }\n\n filter { &quot;system:linux&quot;, &quot;options:OPENGL=GL&quot; }\n linkoptions { \n &quot;-lGL&quot;,\n &quot;-lGLU&quot;\n }\n filter { &quot;system:linux&quot;, &quot;options:OPENGL=GLES&quot; }\n linkoptions { \n &quot;-lGL&quot;,\n &quot;-lEGL&quot;,\n &quot;-lGLESv2&quot;,\n }\n\n filter &quot;system:android&quot;\n buildoptions { &quot;-Wreorder&quot; }\n links {&quot;GLESv2&quot;,&quot;GLESv1_CM&quot;,&quot;EGL&quot;,&quot;m&quot;}\n\n filter {} \n\nworkspace &quot;sciter.lite.static&quot;\n\nproject &quot;sciter.lite.static&quot;\n kind &quot;StaticLib&quot;\n language &quot;C++&quot;\n\n defines { &quot;STATIC_LIB&quot; }\n \n targetname &quot;sciter.static&quot;\n\n targetdir (BUILDDIR .. &quot;/lib.&quot; .. osabbr() ..&quot;/%{cfg.platform}lite&quot;)\n\n includedirs { \n &quot;engine/tiscript/include&quot; \n }\n\n include_files_lite()\n include_files_tool()\n include_files_uv()\n include_files_uv_tls() \n include_files_dybase()\n include_files_gool()\n include_files_zlib()\n include_files_png()\n include_files_jpeg()\n include_files_webp()\n include_files_rlottie()\n include_files_html()\n include_files_http()\n include_files_tmt()\n include_files_xdom()\n include_files_xgl_skia() \n include_files_webgl() \n include_freetype_files()\n\n filter &quot;system:macosx&quot;\n links { \n &quot;CoreFoundation.framework&quot;, \n &quot;Cocoa.framework&quot;,\n &quot;Carbon.framework&quot;, \n &quot;AVFoundation.framework&quot;,\n &quot;SystemConfiguration.framework&quot;,\n &quot;CoreMedia.framework&quot;,\n &quot;CoreText.framework&quot;,\n &quot;CoreGraphics.framework&quot;,\n &quot;CoreData.framework&quot;,\n &quot;CoreVideo.framework&quot;,\n &quot;IOKit.framework&quot;,\n &quot;OpenGL.framework&quot;\n } \n filter {} \n\n-- include &quot;sdk&quot;\n</code></pre>\n<p>This code is called from the following batch file:</p>\n<pre class="lang-sh prettyprint-override"><code>premake5.exe vs2022\npremake5.exe vs2022 --file=&quot;premake5-lite.lua&quot;\ncd sdk.js\npremake5.exe vs2022\ncd ..\n</code></pre>\n<p>As you can see, the <code>cppdialect &quot;C++17&quot;</code> option is defined in the Lua code, but completely ignored. Can someone explain me what I'm doing wrong?</p>\n"^^ . "0"^^ . . . "vlc"^^ . "1"^^ . . "@prapin @Jarod42 unfortunately your suggestions doesn't resolve the issue. After my projects are generated they contain the following option: `<LanguageStandard>stdcpplatest</LanguageStandard>`. However I need this option to be configured this way: `<LanguageStandard>stdcpp17</LanguageStandard>`. I tried your suggestions, but they had no impact at all on the generated projects, and the `cppdialect` option definitively don't work."^^ . "0"^^ . . . . . . . . ""I dont really see the point" - the point of "if let" variants is to have the variable's scope be exactly the `if` statement (e.g. to prevent accidental use of the variable outside the `if`). This is a bit more tedious to do in Lua (you'd have to use `do local match = ... if match then ... end end`)."^^ . "0"^^ . "0"^^ . "0"^^ . . . "4"^^ . . "<p>Yes, you need substitution captures. You don't need <code>re</code>, though:</p>\n<pre class="lang-lua prettyprint-override"><code>-- Localisations for syntactic sugar and performance:\nlocal lpeg = require 'lpeg'\nlocal P, Cs = lpeg.P, lpeg.Cs\nlocal any = P(1)\n\n-- A string quoted with quote1 and quote2 (also quote1 if not set):\nlocal function quoted (quote1, quote2)\n return P (quote1) * (any - P (quote2 or quote1)) ^ 0 * P (quote2 or quote1)\nend\n\n-- The whole grammar. tbl is the replacement table:\nlocal function replace_unquoted (tbl)\n return Cs ((quoted'&quot;' + any / tbl) ^ 0) * -1\nend\n\nprint (replace_unquoted { a = 'o' }:match 'abcd &quot;abcd&quot; abcd')\n</code></pre>\n"^^ . . . . . "Is it possible to Lua match string with an image name?"^^ . . . . . . . . "1"^^ . . . . . . "0"^^ . "1"^^ . "<p>This is my code for spawning in the model itself which is located in ReplicatedStorage, which this is the hierarchy:\nSpawnDoor (Model)\nDoor (Sound)\nLight (Folder)\nDoor1 (Part)\nDoor2 (Part)\nPart (Part)\nSurfaceLight (SurfaceLight)\n<strong>Teleport (Script)</strong> --script that doesn't work when door spawns in\nWood (Folder)\nDoor1 (Model)\nUnion\nDoor2 (Model)\nUnion</p>\n<pre><code>local TweenService = game:GetService(&quot;TweenService&quot;)\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal CameraShaker = require(ReplicatedStorage:WaitForChild(&quot;CameraShaker&quot;))\n\nlocal player = game.Players.LocalPlayer\nlocal playerGui = player.PlayerGui.Red.Red\n\nlocal Camera = game.Workspace.CurrentCamera\n\nlocal cooldown = false -- Cooldown flag\nlocal cooldownTime = 2 -- Cooldown time in seconds\n\nlocal function ShakeCamera(shakCf)\n Camera.CFrame = Camera.CFrame * shakCf\nend\n\nlocal renderPriority = Enum.RenderPriority.Camera.Value + 1\nlocal camShake = CameraShaker.new(renderPriority, ShakeCamera)\n\ncamShake:Start()\n\n-- Function to handle J key press\nlocal function onKeyPress(input)\n if input.KeyCode == Enum.KeyCode.J then\n if cooldown then\n print(&quot;Tool is on cooldown&quot;)\n\n -- Shake camera and show GUI\n camShake:ShakeOnce(60, 80, 1, 1) -- Adjust parameters as needed\n\n local transparencyTweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)\n\n local tween1 = TweenService:Create(playerGui, transparencyTweenInfo, {\n BackgroundTransparency = 0.3\n })\n\n local tween2 = TweenService:Create(playerGui, transparencyTweenInfo, {\n BackgroundTransparency = 1\n })\n\n tween1:Play()\n tween1.Completed:Connect(function()\n tween2:Play()\n end)\n\n return\n end\n\n cooldown = true -- Activate cooldown\n\n print(&quot;Tool Activated&quot;) -- Check if this prints when you use the tool\n\n game.SoundService.Biwa:Play()\n\n local Player = game.Players.LocalPlayer\n local Char = Player.Character\n if not Char then\n print(&quot;Character not found&quot;)\n cooldown = false -- Reset cooldown if an error occurs\n return\n end\n\n local HRP = Char:FindFirstChild(&quot;HumanoidRootPart&quot;)\n if not HRP then\n print(&quot;HumanoidRootPart not found&quot;)\n cooldown = false -- Reset cooldown if an error occurs\n return\n end\n\n local DoorModel = game.ReplicatedStorage.SpawnDoor\n if not DoorModel or not DoorModel:IsA(&quot;Model&quot;) then\n print(&quot;SpawnDoor Model not found in ReplicatedStorage or not a Model&quot;)\n cooldown = false -- Reset cooldown if an error occurs\n return\n end\n\n -- Raycast to find the ground below the player\n local rayOrigin = HRP.Position\n local rayDirection = Vector3.new(0, -100, 0) -- Cast downwards\n local raycastParams = RaycastParams.new()\n raycastParams.FilterDescendantsInstances = {Char}\n raycastParams.FilterType = Enum.RaycastFilterType.Blacklist\n\n local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)\n\n if not raycastResult then\n print(&quot;No ground detected below the player&quot;)\n cooldown = false -- Reset cooldown if an error occurs\n return\n end\n\n local groundPosition = raycastResult.Position\n\n local door = DoorModel:Clone()\n door.Parent = workspace\n\n -- Set the PrimaryPart of the door model\n door.PrimaryPart = door:FindFirstChild(&quot;Light&quot;).Part\n\n if not door.PrimaryPart then\n print(&quot;PrimaryPart not found in DoorModel&quot;)\n door:Destroy()\n cooldown = false -- Reset cooldown if an error occurs\n return\n end\n\n -- Set the position of the door model to the ground position\n door:SetPrimaryPartCFrame(CFrame.new(groundPosition))\n\n print(&quot;Door spawned at:&quot;, door.PrimaryPart.Position)\n\n -- Delay before sliding doors open\n wait(2)\n\n -- Animation to slide open doors\n local door1 = door.Wood.Door1\n local door2 = door.Wood.Door2\n\n if door1 and door2 then\n\n if door1.Union and door2.Union then\n -- Tween for Door1\n local door1OpenCFrame = door1.Union.CFrame * CFrame.new(0, 0, -5) -- Example: Move 5 studs to the right\n local door1Tween = TweenService:Create(door1.Union, TweenInfo.new(0.2), {CFrame = door1OpenCFrame})\n\n -- Tween for Door2\n local door2OpenCFrame = door2.Union.CFrame * CFrame.new(0, 0, 5) -- Example: Move 5 studs to the left\n local door2Tween = TweenService:Create(door2.Union, TweenInfo.new(0.2), {CFrame = door2OpenCFrame})\n\n door1Tween:Play()\n door2Tween:Play()\n\n game.SoundService.Door:Play()\n else\n print(&quot;Primary part not found in one of the doors&quot;)\n end\n else\n print(&quot;One of the doors not found in DoorModel&quot;)\n end\n\n print(&quot;Doors sliding open&quot;)\n task.wait(1)\n -- Destroy the door model after a delay\n repeat\n door.Wood.Door1.Union.Transparency += 0.01\n door.Wood.Door2.Union.Transparency += 0.01\n door.Light.Part.Transparency += 0.01\n door.Light.Door1.Transparency += 0.01\n door.Light.Door2.Transparency += 0.01\n task.wait(0.01)\n until door.Wood.Door1.Union.Transparency &gt;= 1\n door:Destroy()\n print(&quot;Door destroyed after 3 seconds&quot;)\n\n -- Start cooldown timer\n task.delay(cooldownTime, function()\n cooldown = false\n print(&quot;Cooldown ended&quot;)\n end)\n end\nend\n\n-- Connect the function to the key press event\ngame:GetService(&quot;UserInputService&quot;).InputBegan:Connect(onKeyPress)\n</code></pre>\n<p>I've tried to clone it from the workspace instead as well as trying to have a constantly updating server script that checks for the door to spawn in and then does the action I wanted, I even replaced the script with a simple print script for all cases to see if maybe my code was wrong but nothing seems to work.</p>\n"^^ . "To make Andrew's comment more concise here, you can set the visibility to false, and then set the blur to false. The visibility attribute of all ui elements sets itself and all its' descendants' visibility to false."^^ . . . . . "0"^^ . . . "Your damage logs are probably missing because this code is meant to run on the client, but "EntityTakeDamage" is a serverside event- https://wiki.facepunch.com/gmod/GM:EntityTakeDamage .\n\nAs for connection logs, it would be simpler to use the player connect event- https://wiki.facepunch.com/gmod/gameevent/player_connect"^^ . . "1"^^ . "<p>How to write a Pandoc Lua filter with a function matching all elements despite of its node type?</p>\n<p>With a Python panflute filter I would do it as follows:</p>\n<pre class="lang-py prettyprint-override"><code># Python filter\nfrom panflute import *\n\ndef action(elem, doc):\n debug(type(elem))\n\ndef main(doc=None):\n return run_filter(action, doc=doc)\n \nif __name__ == &quot;__main__&quot;:\n main()\n</code></pre>\n<p>With Lua I'd like to have somethig like the following:</p>\n<pre class="lang-lua prettyprint-override"><code>-- Lua filter\nfunction action(elem)\n print(pandoc.utils.type(elem))\nend\n\nreturn {\n {Inline = action},\n {Block = action},\n -- {* = action}, -- this is no valid Lua\n -- how many types must be added here to cover all the types?\n }\n</code></pre>\n<p>If every element type has to be explicitly added. Where can I get the List of all element types?</p>\n"^^ . "How do I debug a segfaulting lua program that imports .so files?"^^ . "visual-studio-code"^^ . . . . . "0"^^ . "0"^^ . "1"^^ . "1"^^ . . . . "1"^^ . . . "You've never popped the created thread."^^ . . . . . . "1"^^ . . . . . . . . "0"^^ . . . . "1"^^ . . . "It seems that the problem was that I had both a timer updated every second and a subscription to combat events. When a combat event occurred at the same time as the timer update, lua being synchronous, it created a bug. I deleted the timer and after almost three hours of play, no more problem. I'm testing again. If it is confirmed I will publish an auto-answer that will maybe help other people."^^ . "1"^^ . "This isn't the default value, maybe you have defined environment variables LUA_PATH or LUA_PATH_5_4."^^ . "<p>We create an command for the <code>BufWritePre</code> event. When this event triggers, we retrieve the buffer being written, then loop through its lines. Once we find a line starting with <code>Date:</code> we replace it with current date and then its saved.</p>\n<pre class="lang-lua prettyprint-override"><code>vim.api.nvim_create_autocmd(\n &quot;BufWritePre&quot;, {\n pattern = &quot;*.md&quot;,\n callback = function()\n local bufnr = vim.api.nvim_get_current_buf()\n\n for line_num = 0, vim.api.nvim_buf_line_count(bufnr) - 1 do\n local line = vim.api.nvim_buf_get_lines(bufnr, line_num, line_num + 1, false)[1]\n\n if line:match(&quot;Date:&quot;) then\n local new_date = os.date(&quot;Date: %Y/%m/%d&quot;)\n\n vim.api.nvim_buf_set_lines(bufnr, line_num, line_num + 1, false, { new_date })\n break\n end\n end\n end\n})\n</code></pre>\n"^^ . . . . . . "-1"^^ . . . . "youtube-api"^^ . . . . . . "1"^^ . "wezterm"^^ . . "protocol-buffers"^^ . "1"^^ . "1"^^ . . "1"^^ . "<p>There is no need for the additional command. The default behavior of WezTerm is to use the current working directory when doing a split. The <a href="https://wezfurlong.org/wezterm/config/lua/config/default_cwd.html" rel="nofollow noreferrer">current working directory</a> is inferred through the OSC 7 value.</p>\n<p>Your prompt function is not setting the OSC 7 value correctly. This is the correct OSC 7 prompt according to the <a href="https://wezfurlong.org/wezterm/shell-integration.html#osc-7-on-windows-with-powershell" rel="nofollow noreferrer">docs</a>:</p>\n<pre><code>function prompt {\n $p = $executionContext.SessionState.Path.CurrentLocation\n $osc7 = &quot;&quot;\n if ($p.Provider.Name -eq &quot;FileSystem&quot;) {\n $ansi_escape = [char]27\n $provider_path = $p.ProviderPath -Replace &quot;\\\\&quot;, &quot;/&quot;\n $osc7 = &quot;$ansi_escape]7;file://${env:COMPUTERNAME}/${provider_path}${ansi_escape}\\&quot;\n }\n &quot;${osc7}PS $p$('&gt;' * ($nestedPromptLevel + 1)) &quot;;\n}\n</code></pre>\n"^^ . . "I can get behind that if this is for help with quick debugging. For committed code, I caution against generated code that's later edited by developers and not easy to regenerate. Java IDEs used to be pretty notorious for this (for things like builder class patterns and hashing methods). Later on when you inevitably want to change the generated outputs, its a brutal manual task to find and replace and re-modify the code that has been committed. Libraries and decorators have the key advantage of being refactorable, although require some more upfront cost."^^ . . "1"^^ . . . . . . . . "0"^^ . "3"^^ . . "<p>The lua script for this is not working for all three of the VPNS and not detecting the traffic in case the following condtions are all be true\n<strong>The logic is</strong></p>\n<ol>\n<li>VPN A Detection:</li>\n</ol>\n<ul>\n<li>MAC Address: 78:63:58:48:43:23 (gpon.net)</li>\n<li>Port: 443 or 88</li>\n<li>Packet Length: 1482 bytes</li>\n<li>Protocol: UDP</li>\n</ul>\n<ol>\n<li>VPN B Detection:</li>\n</ol>\n<ul>\n<li>Source and Destination Ports: Must be the same and either 51820 or 5353</li>\n<li>Packet Length: 1494 bytes</li>\n<li>Protocol: UDP</li>\n</ul>\n<ol>\n<li>VPN C Detection:\nMAC Address: 78:63:58:48:43:23 (gpon.net)</li>\n</ol>\n<ul>\n<li>Port: 51820</li>\n<li>Packet Length: 1494 bytes</li>\n<li>Protocol: UDP</li>\n</ul>\n<p>lua script</p>\n<pre><code>local udp_src_port_field = Field.new(&quot;udp.srcport&quot;) -- Extracts source UDP port\nlocal udp_dst_port_field = Field.new(&quot;udp.dstport&quot;) -- Extracts destination UDP port\nlocal eth_src_mac_field = Field.new(&quot;eth.src&quot;) -- Extracts source MAC address\nlocal eth_dst_mac_field = Field.new(&quot;eth.dst&quot;) -- Extracts destination MAC address\nlocal ipv4_proto_field = Field.new(&quot;ip.proto&quot;) -- Extracts IPv4 protocol\nlocal ipv6_proto_field = Field.new(&quot;ipv6.nxt&quot;) -- Extracts IPv6 next header\n\nlocal vpn_signatures = {\nA = {\nmac_address = &quot;78:63:58:48:43:23&quot;, \ndst_ports = {443, 88}, \npacket_length = 1482 \n},\nB = {\nsrc_dst_ports = {51820, 5353}, \npacket_length = 1494 \n},\nC = {\nmac_address = &quot;78:63:58:48:43:23&quot;, \ndst_port = 51820, \npacket_length = 1494 \n}\n}\n\nlocal function table_contains(tbl, element)\nfor _, value in ipairs(tbl) do\nif value == element then\nreturn true\nend\nend\nreturn false\nend\n\ntap = Listener.new(&quot;ip&quot;)\n\nfunction tap.packet(pinfo, tvb)\nlocal packet_length = tvb:len() -- Get the packet length\n\nlocal src_port_value = udp_src_port_field()\nlocal dst_port_value = udp_dst_port_field()\n\nif src_port_value == nil or dst_port_value == nil then return end\n\nlocal src_port = tonumber(src_port_value.value)\nlocal dst_port = tonumber(dst_port_value.value)\n\nlocal src_mac_value = tostring(eth_src_mac_field())\nlocal dst_mac_value = tostring(eth_dst_mac_field())\n\nlocal proto_field_value = ipv4_proto_field() or ipv6_proto_field()\nif proto_field_value == nil then return end -- Skip if no protocol field\nlocal protocol = tonumber(proto_field_value.value)\n\nprint(&quot;Source MAC:&quot;, src_mac_value, &quot;Destination MAC:&quot;, dst_mac_value, &quot;Source Port:&quot;, src_port, &quot;Destination Port:&quot;, dst_port, &quot;Packet Length:&quot;, packet_length, &quot;Protocol:&quot;, protocol)\n\nif protocol ~= 17 then return end\n\nif (src_mac_value == vpn_signatures.A.mac_address or dst_mac_value == vpn_signatures.A.mac_address) and\ntable_contains(vpn_signatures.A.dst_ports, dst_port) and\npacket_length == vpn_signatures.A.packet_length then\nprint(&quot;A Detected!&quot;)\nend\n\nif table_contains(vpn_signatures.B.src_dst_ports, src_port) and\nsrc_port == dst_port and\npacket_length == vpn_signatures.B.packet_length then\nprint(&quot;B VPN Detected!&quot;)\nend\n\nif (src_mac_value == vpn_signatures.C.mac_address or dst_mac_value == vpn_signatures.C.mac_address) and\ndst_port == vpn_signatures.C.dst_port and\npacket_length == vpn_signatures.C.packet_length then\nprint(&quot;C VPN Detected!&quot;)\nend\nend\n</code></pre>\n<p>I have tried running this script but its not detecting the VPNS</p>\n"^^ . . . . . "0"^^ . . "kubernetes"^^ . . "Crashes how, exactly? What does the error message say? Which global is crashing? What is its type? It is crashing in your serialize or deserialize code? Please be more specific."^^ . . . "0"^^ . "0"^^ . . "1"^^ . . "2"^^ . . . . . . . . "0"^^ . "1"^^ . . "0"^^ . "0"^^ . . . . . "<h3>Infinite <code>spawnselection</code> Yield</h3>\n<p><code>Workspace.cameras.spawnselection</code> does not exist on the workspace nor does a script ever create it, so yielding to it will always result in an infinite yield creating your error.</p>\n<p>I removed all the references to <code>Workspace.cameras.spawnselection</code> and replaced them with <code>Workspace.cameras</code> which is a valid location. I chose this since there are instances which the <code>:WaitForChild()</code>.</p>\n<p>The corrected version is this but it still has an error in it:</p>\n<pre class="lang-lua prettyprint-override"><code>local starting_camera=cameras:WaitForChild(&quot;default camera&quot;)\nlocal hillcrest_camera=cameras:WaitForChild(&quot;Hillcrest&quot;)\n</code></pre>\n<h3>Infinite <code>default camera</code> Yield</h3>\n<p>The next error is for <code>default camera</code>. There are no instances named <code>default camera</code> or <code>default_camera</code> in the workspace and no scripts create it so, like before, yielding to it will cause an infinite yield error.</p>\n<p>I noticed there was a Part named <code>start_camera</code> in <code>Workspace.cameras</code> which is likely what you wanted to use, given the variable name.</p>\n<pre class="lang-lua prettyprint-override"><code>local starting_camera=cameras:WaitForChild(&quot;start_camera&quot;)\n</code></pre>\n<h3>Instance Streaming</h3>\n<p>I noticed another issue with <a href="https://create.roblox.com/docs/workspace/streaming" rel="nofollow noreferrer">Instance Streaming</a> causing the parts the script uses to be streamed out. They are two fixes for this.</p>\n<ol>\n<li>Adding to your script to <a href="https://create.roblox.com/docs/workspace/streaming#requesting-area-streaming" rel="nofollow noreferrer">request area streaming</a> for the parts</li>\n<li>Ensure the player spawns close enough to the parts to be within the <a href="https://create.roblox.com/docs/workspace/streaming#streamingminradius" rel="nofollow noreferrer"><code>StreamingMinRadius</code></a> so they are always loaded</li>\n<li>Disable Instance Streaming by setting <a href="https://create.roblox.com/docs/reference/engine/classes/Workspace#StreamingEnabled" rel="nofollow noreferrer"><code>Workspace.StreamingEnabled</code></a> to <code>false</code></li>\n</ol>\n<hr />\n<h3>Conclusions</h3>\n<p>Your script specified the incorrect locations for Parts and the Parts were being streamed out. These caused the errors you would be experiencing.</p>\n<p>Your final fixed script would be this:</p>\n<pre class="lang-lua prettyprint-override"><code>--Local Script\nlocal TweenService=game:GetService(&quot;TweenService&quot;)\nlocal camera=game.Workspace.Camera\nlocal cameras=game.Workspace:WaitForChild(&quot;cameras&quot;)\nlocal play=script.Parent[&quot;main menu&quot;][&quot;main frame&quot;].PlayButton\n\n\n--Camera Locations\nlocal starting_camera=cameras:WaitForChild(&quot;start_camera&quot;)\nlocal hillcrest_camera=cameras:WaitForChild(&quot;Hillcrest&quot;)\n\n\n\nlocal function createtween(end_:CFrame,time_:number)\n local cutscene=TweenService:Create(camera,TweenInfo.new(time_),{CFrame=end_})\n return cutscene\nend\n\nplay.Activated:Connect(function()\n camera.CameraType=Enum.CameraType.Scriptable\n local selection\n local canswitch=true\n local cutscene=createtween(hillcrest_camera.CFrame,10)\n \n \n if canswitch then\n camera.CFrame=starting_camera.CFrame\n cutscene:Play()\n canswitch=false \n end\n \n cutscene.Completed:Connect(function()\n canswitch=true\n end)\n \n \n \nend)\n</code></pre>\n<p>Make sure to refer to the Instance Streaming section as well to make sure that your parts properly are loaded if you are still encountering issues.</p>\n<h4>Place File &amp; Video</h4>\n<p>Here is your place file with the fixes implemented: <a href="https://drive.google.com/file/d/1KSdpoa_S4aD-eQOr_WMtcxzBHVcTz3lZ/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1KSdpoa_S4aD-eQOr_WMtcxzBHVcTz3lZ/view?usp=sharing</a></p>\n<p>Note I used option 3 for solving the Instance Streaming problem but you should use option 1.</p>\n<p>Video of the fixed version: <a href="https://drive.google.com/file/d/1geXRDi22DsIGguf0BzMWwWhfC_yOEdD8/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1geXRDi22DsIGguf0BzMWwWhfC_yOEdD8/view?usp=sharing</a></p>\n"^^ . . "<p>As I am working on a similar goal and found myself in the same situation I did build a python based CLI tool for this.</p>\n<p><a href="https://github.com/Spenhouet/confluence-markdown-exporter" rel="nofollow noreferrer">https://github.com/Spenhouet/confluence-markdown-exporter</a></p>\n<p>You can install it via pip:</p>\n<pre><code>pip install confluence-markdown-exporter\n</code></pre>\n<p>Set your API data as environment variable:</p>\n<ol>\n<li><p>Set <code>ATLASSIAN_USERNAME</code> to your Atlassian account email address (e.g. mike.meier@company.de)</p>\n</li>\n<li><p>Set <code>ATLASSIAN_API_TOKEN</code> to your Atlassian token that can be created on <a href="https://id.atlassian.com/manage-profile/security/api-tokens" rel="nofollow noreferrer">https://id.atlassian.com/manage-profile/security/api-tokens</a></p>\n</li>\n<li><p>Set <code>ATLASSIAN_URL</code> to your Atlassian instance URL (e.g. <a href="https://company.atlassian.net/" rel="nofollow noreferrer">https://company.atlassian.net</a>)</p>\n</li>\n</ol>\n<pre><code>export ATLASSIAN_USERNAME=&quot;work mail address&quot;\nexport ATLASSIAN_API_TOKEN=&quot;API token Test&quot;\nexport ATLASSIAN_URL=&quot;https://company.atlassian.net&quot;\n</code></pre>\n<p>And then you can export a single Confluence page:</p>\n<pre><code>confluence-markdown-exporter page &lt;page-id e.g. 645208921&gt; &lt;output path e.g. ./output_path/&gt;\n</code></pre>\n<p>Export a Confluence page and all it's descendants:</p>\n<pre><code>confluence-markdown-exporter page-with-descendants &lt;page-id e.g. 645208921&gt; &lt;output path e.g. ./output_path/&gt;\n</code></pre>\n<p>Export all Confluence pages of a single Space:</p>\n<pre><code>confluence-markdown-exporter space &lt;space-key e.g. MYSPACE&gt; &lt;output path e.g. ./output_path/&gt;\n</code></pre>\n<p>Export all Confluence pages across all spaces:</p>\n<pre><code>confluence-markdown-exporter all-spaces &lt;output path e.g. ./output_path/&gt;\n</code></pre>\n<p>I hope this might help you.</p>\n"^^ . . . "0"^^ . "1"^^ . "Have you printed the condition of the if statement? have you printed all the children of the `remoteData`? It seems that `player.name` is not in that list of children so why do you think it should be?"^^ . . . . "0"^^ . . "1"^^ . . . . . "0"^^ . . "0"^^ . "<p>I'm new to Lua Script. I'm trying to connect MSSQL DB using lua-odbc</p>\n<p><a href="https://github.com/moteus/lua-odbc" rel="nofollow noreferrer">https://github.com/moteus/lua-odbc</a></p>\n<p>I'm able to connect and get data from MSSQL using below code</p>\n<pre><code>--print(&quot;ODBC Connectivity started&quot;)\nodbc = require &quot;odbc&quot;\ncjson = require &quot;cjson&quot;\ndbassert = odbc.assert\n\n-- Dynamic Input from USER\nlocal tableName = &quot;dbo.Table1&quot;;\nlocal selectFields = &quot;Field1,Field2&quot;;\nlocal limit = &quot;10&quot;\nlocal condition = &quot;&quot;;\n \ncnn = odbc.connect('DBNAME', 'USERNAME', 'PASSWORD')\n\nlocal sqlQuery = 'SELECT TOP '.. limit .. ' ' .. selectFields .. ' FROM '.. tableName;\nprint(sqlQuery)\n\nstmt = cnn:execute(sqlQuery)\nprint(getmetatable(stmt))\nlocal myTable = {};\n\nstmt:foreach(function(f1,f2)\n local valueArray = {};\n valueArray.f1= f1;\n valueArray.f2= f2;\n table.insert(myTable,valueArray);\nend)\n\nlocal json_str = cjson.encode(myTable);\n\n\n--print(json_str)\nassert(stmt:closed()) -- foreach close cursor\nassert(not stmt:destroyed()) -- statement valid\n\n</code></pre>\n<p>Is there a way to dynamically handle UserData returned from cnn:execute</p>\n<p>For example :</p>\n<p>If user wants to include field3 how can I include field3 in my table while iterating UserData</p>\n"^^ . "<p>I've been learning Lua for a few months, but I want to do interesting things, and I was wondering how I could create a script for a simple automation, like: opening Google, typing 'hello world' in the search bar, and hitting enter. I haven't found any libraries and couldn't figure it out at all, it's quite frustrating. Could any kind soul give me an idea of how to do this?</p>\n<p>I just want to do a simple automation in Lua. I tried some libraries recommended by AI, one of them was called luacom, and I didn't have success with any of them.</p>\n"^^ . . . . "scripting"^^ . "0"^^ . "<p>Sorry it's not quite a specific question.</p>\n<p>In the &quot;Programming in Lua, 4th edition&quot; one can see the following code :</p>\n<pre><code>Account = {balance = 0}\n\nfunction Account:new (o)\n o = o or {}\n self.__index = self\n setmetatable(o, self)\n return o\nend\n</code></pre>\n<p>My confusion is the line</p>\n<pre><code>self.__index = self\n</code></pre>\n<p>This means that <code>Account</code> becomes its own <code>__index</code> <em>only</em> on creation of an instance :</p>\n<pre><code>a = Account:new()\n</code></pre>\n<p>which is confusing if you think about it. I know that it is done to easily increase the depth of inheritance so you can do :</p>\n<pre><code>AccountGold = Account:new({cashBackPercentage = 5})\nAccountPlatinum = AccountGold:new({personalSupport = true})\n</code></pre>\n<p>but to me this</p>\n<pre><code>Account.__index = Account\n</code></pre>\n<p>looks more readable.</p>\n<p>Even more confusing. For example, look at the <a href="https://codeberg.org/1414codeforge/yui/src/commit/3dd1a039e096cb65deb87dffd5884ef927acab6b" rel="nofollow noreferrer">yui</a> library:</p>\n<pre><code>local Button = setmetatable({\n __call = function(cls, args) return cls:new(args) end\n}, Widget)\nButton.__index = Button\n\n\nfunction Button:new(args)\n self = setmetatable(args, self)\n\n self.text = self.text or &quot;&quot;\n self.align = self.align or 'center'\n self.valign = self.valign or 'center'\n self.active = false\n if not self.notranslate then\n self.text = T(self.text)\n end\n return self\nend\n\n</code></pre>\n<p>Look at this :</p>\n<pre><code>self = setmetatable(args, self)\n</code></pre>\n<p>which reads to :</p>\n<pre><code>Button = setmetatable(args, Button)\n</code></pre>\n<p>which means that <em>every time</em> new instance is created the <code>Button</code> table is changed.</p>\n<p>Is it like a common practice ? Could you comment on this please ?</p>\n"^^ . . . "parsing"^^ . . "0"^^ . . "1"^^ . "0"^^ . "1"^^ . . "1"^^ . . "<p>Lua table keys are not stored in any particular order. When you iterate a table with <code>pairs</code>, you see the contents in whatever order the interpreter finds convenient.</p>\n<p>Sequences are implemented by using consecutive integer keys starting at 1 and going up. Your <code>dic</code> table has a <code>[1]</code> key but no <code>[2]</code>, so <code>table.sort</code> and <code>ipairs</code> basically just see it as a 1-element sequence. Sorting works by changing which keys point to which elements.</p>\n<p>You have basically 2 choices:</p>\n<ol>\n<li><p>Keep it like it is, so you can refer to things by their current key.</p>\n</li>\n<li><p>Add your current keys to their corresponding tables, so you can use normal sequence keys and keep the tables in a specific order.</p>\n</li>\n</ol>\n<p>You could also try to get the best of both worlds, but the solution would be complicated and would depend on what your priorities are.</p>\n"^^ . . "Lazy Loading Copilot to Neovim but not autocompleting after that"^^ . "<p>as you know, in the setup factory software, you cannot apply a click code to the text.</p>\n<p>Now I need to solve this problem with a trick.\n<code>Now I add a text to the page, now I want a code to close the page when the mouse cursor moves to the location of the text and the user clicks.</code>\nsorry my English was bad</p>\n<p>Setupfactory language is written with lua. If you know another way to do the click operation for the text, I would be grateful if you could help </p>\n"^^ . "1"^^ . . . "0"^^ . "0"^^ . . "sol3"^^ . . . . . "1"^^ . . . "<p>I want to make a script and an error like this appears, can anyone help?</p>\n<pre><code>Tester=gg.getRangesList('libil2cpp.so')[2].start`\n\n\n\nattempt to index ? (a nil value) with key 'start' (field '2')\n\n\n\nlevel = 1, const = 30, proto = 0, upval = 1, vars = 4, code = 79\n\n\n\nGETTABLE v0 v0 &quot;start&quot;\n\n\n\n ; PC 36 CODE 00434007 OP 7 A 0 B 0 C 269 Bx 269 sBx -130802\n</code></pre>\n<p>My script:</p>\n<pre><code>function money1()\n\ngg.setVisible(false)\n\ngg.alert (&quot;CLICK LEVEL 3 THEN CLICK ON THE GG LOGO TO START&quot;)\n\ngg.clearResults()\n\ngg.clearList()\n\nwhile true do\n\nif gg.isVisible() then\n\nbreak\n\nelse\n\ngg.sleep(50)\n\nend end gg.setVisible(false) gg.clearResults()\n\nTester=gg.getRangesList('libil2cpp.so')[2].start\n\nLua=0x5D28E08 setvalue(Tester+Lua,16,1917191729192019001910)\n\ngg.setRanges(32)\n\ngg.searchNumber(&quot;40&quot;, 16)\n\ngg.getResults(9999)\n\ngg.editAll(&quot;50000000&quot;, 16)\n\ngg.alert (&quot;CLICK LEVEL 1&quot;)\n\ngg.toast(&quot;ON&quot;)\n\ngg.clearResults()\n\ngg.clearList()\n\nend\n</code></pre>\n<p>Game guardian &amp; Lua script.</p>\n"^^ . "0"^^ . . . . "1"^^ . . . . "0"^^ . . . . "self inside Lua constructors"^^ . . . . . . . . . . . "<p>Using the <code>sol</code> Lua wrapper, is it possible to find out the amount of parameters of a given function, and also their names and position within the parameter list?</p>\n<pre class="lang-lua prettyprint-override"><code>function foo(a, b, c) end\n</code></pre>\n<p>The information would be:</p>\n<ul>\n<li>Function has 3 params</li>\n<li>Names of params are: a, b, c, in that order</li>\n<li>Optionally, would be nice if it can also tell if function accepts varargs.</li>\n</ul>\n"^^ . "The fact that you are using `OnClientEvent:Once` should ensure that the event triggers once, and never again. So since you see a bunch of logs for something that _should_ happen once, a good place to look is whether you might have multiple scripts all connecting to the same event, or clones of this script somewhere. The next time you test and you see a bunch of messages, go into the Explorer widget, and search for the name of the LocalScript, and see if there are multiple copies for some reason."^^ . . "0"^^ . . "1"^^ . "autoload"^^ . . . "How can I deal with Lua garbage-collecting my userdata objects?"^^ . . "<p>The doc to <code>load</code> and <code>lua_load</code> functions in the Lua manual mentions:</p>\n<blockquote>\n<p><em>load:</em> When you load a main chunk, the resulting function will always have exactly one upvalue, the _ENV variable.</p>\n</blockquote>\n<blockquote>\n<p><em>lua_load:</em> When loading main chunks, this upvalue will be the _ENV variable.</p>\n</blockquote>\n<p>In summary, the loaded chunk only has one upvalue, which is <code>_ENV</code>.</p>\n<p>Since Lua 5.2, <code>SomeClass = {}</code> is equivalent to <code>_ENV.SomeClass = {}</code>, and <code>print(self)</code> is equivalent to <code>print(_ENV.self)</code>. Because <code>SomeClass</code> is set in the global scope, the loaded chunk can also see this entry in the <code>_ENV</code> table, but there is no place will automatically set <code>_ENV.self</code>.</p>\n<p>You may expect the function to work like this:</p>\n<pre><code>function expect(self)\n return (function()\n return print(self)\n end)()\nend\n</code></pre>\n<p>In fact it will work like this:</p>\n<pre><code>function fact(self)\n return (function()\n return print(_ENV.self)\n end)()\nend\n</code></pre>\n<p>For the <em>&quot;expect&quot;</em> function, the lua compiler will add <code>self</code> as an upvalue for you, but for the <em>&quot;fact&quot;</em> function, it will do nothing.</p>\n<p>And your C++ code completely overwritten <code>_ENV</code> with <code>SomeClass</code>, which is going too far.</p>\n"^^ . "<p>In Python, obviously it's possible to assign to names, e.g. <code>a = 1</code>. It's also valid to assign to attributes (<code>a.b = 1</code> - AFAIK this corresponds to the <code>__setattr__</code> special method) and indexing operations (<code>a[b] = 1</code>, which corresponds to <code>__setitem__</code>).</p>\n<p>In Lua, those are the only valid assignment targets - the language's <em>grammar</em> enforces that restriction: <code>var ::= Name | prefixexp '[' exp ']' | prefixexp '.' Name</code>.</p>\n<p>Are those three forms also an exhaustive list of valid assignment targets in Python or are there others? (For example, according to <a href="https://stackoverflow.com/a/74453438/200783">this answer</a>, it's not valid to assign to a function call: <code>f() = 1</code> is invalid.)</p>\n<p>Also, is the restriction to valid assignment targets enforced by the grammar as in Lua, or later in the source =&gt; bytecode compilation process?</p>\n"^^ . "0"^^ . . "0"^^ . . "0"^^ . . . "0"^^ . "Neovim command to create print statement for Python function arguments"^^ . . "1"^^ . . . "Do you know why `nvim_buf_set_lines` cannot seem to accept a string with newlines in it? If I try to pass in a string with newlines, I get `'replacement string' item contains newlines in function 'nvim_buf_set_lines'"^^ . "1"^^ . . . "0"^^ . "openresty lua-resty-core how set_current_peer works?"^^ . "0"^^ . . . "garbage-collection"^^ . "<p>I'm trying to make a can of soda that explodes your character after drinking it, but it gets stuck after the first animation of raising the can (without exploding) and doesn't give any errors. Does anyone know what's wrong with the code? (I reused the bloxy cola code)</p>\n<p>edit: changed out h.Position for root.Position, still broken</p>\n<p>edit 2: tried different way to define root but still broken (no errors)</p>\n<pre><code>local Tool = script.Parent;\nenabled = true\n\nfunction onActivated()\n if not enabled then\n return\n end\n\n enabled = false\n Tool.GripForward = Vector3.new(0,-.759,-.651)\n Tool.GripPos = Vector3.new(1.5,-.5,.3)\n Tool.GripRight = Vector3.new(1,0,0)\n Tool.GripUp = Vector3.new(0,.651,-.759)\n\n\n Tool.Handle.DrinkSound:Play()\n\n wait(3)\n \n local h = Tool.Parent:FindFirstChild(&quot;Humanoid&quot;)\n \n if (h ~= nil) then\n if (h.MaxHealth &gt; h.Health + 5) then\n h.Health = h.Health + 0\n else \n h.Health = h.Health + 0\n end\n end\n \n--I think the script breaks here\n\n local Player = game.Players.LocalPlayer\n local character = Player.Character or Player.CharacterAdded:Wait()\n local root = character:WaitForChild(&quot;HumanoidRootPart&quot;)\n \n Tool.GripForward = Vector3.new(-.976,0,-0.217)\n Tool.GripPos = Vector3.new(0.03,0,0)\n Tool.GripRight = Vector3.new(.217,0,-.976)\n Tool.GripUp = Vector3.new(0,1,0)\n \n local e = Instance.new(&quot;Explosion&quot;)\n e.BlastRadius = 16\n e.BlastPressure = 1000000\n e.Position = root.Position\n e.Parent = game.Workspace\n \n \n enabled = true\n\nend\n\nfunction onEquipped()\n Tool.Handle.OpenSound:play()\nend\n\nscript.Parent.Activated:connect(onActivated)\nscript.Parent.Equipped:connect(onEquipped)\n</code></pre>\n"^^ . . . . "<p>I've been making a tornado game in Roblox that requires a part to be the windfield of the tornado. Whenever the part is anchored, the touched event doesn't fire. Am i missing something? Is there a setting to fix this? Both are parts. If it is impossible for a touch event to be triggered on a anchored part, what are some workarounds? I've tried using a script to constantly update the <code>part.Position.Y</code> value to that of the part i want it to copy off; and i used this script:</p>\n<pre><code>while true do\n script.Parent.TornadoDamage.Position=Vector3.new(script.Parent.TornadoDamage.Position.X,script.Parent.Position.Y,script.Parent.TornadoDamage.Position.Z)\n</code></pre>\n<p>How can i use constraints, scripts or settings to keep the part from falling so I can use the touch event?</p>\n"^^ . . . "Could you attach a place file or link to a place with copying enabled? I cannot reproduce the problem or verify whether my fix works."^^ . "1"^^ . . "0"^^ . . . . . . . "<p>I'm discovering Lua (context: factorio scripting) and I'm quite puzzled by the loose typing.\nI'm trying to make a dictionary (int,structure) with an integer (and possibly negative key). And then sort it by that key.</p>\n<pre><code>local dic = {}\ndic[1] = {t=&quot;foo&quot;}\ndic[25] = {t=&quot;bar&quot;}\ndic[-30] = {t=&quot;negative&quot;}\n\ntable.sort(dic) -- oddly, that changes nothing\n\nprint(serpent.block(dic))\n-- using ipairs() would make no sense for this structure\nfor k,v in pairs(dic) do\n print(serpent.line(k) .. &quot; --&gt; &quot; .. serpent.line(v))\nend\n\n-- some processing that expects the array/dic/structure/thingy sorted by index\n</code></pre>\n<p>and that outputs</p>\n<pre><code> {\n {\n t = &quot;foo&quot;\n },\n [-30] = {\n t = &quot;negative&quot;\n },\n [25] = {\n t = &quot;bar&quot;\n }\n }\n\n-- sort didn't work\n1 --&gt; {t = &quot;foo&quot;}\n25 --&gt; {t = &quot;bar&quot;}\n-30 --&gt; {t = &quot;negative&quot;}\n</code></pre>\n<p>So, what am I doing wrong ?</p>\n<p>Edit: thanks to answers, I now understand that ipairs() was not the right iterator for this data type. Removesd it from code for clarity</p>\n"^^ . . . . . "<p>I'm rolling out my own LUA debugger for a C++ &amp; LUA project and I just hit a bit of a hurdle. I'm trying to follow MobDebug's implementation for setting expression watches, which after removing all the bells and whistles essentially boils down to string-concatenating the expression you want to watch inside a <code>return(...)</code> statement and running that. The exact line is:</p>\n<pre class="lang-lua prettyprint-override"><code>local func, res = mobdebug.loadstring(&quot;return(&quot; .. exp .. &quot;)&quot;)\n</code></pre>\n<p>This works perfectly as long as you're just debugging a single script and most of your variables are just in the global environment, but for my own purposes I'm trying to restrict / scope down the evaluation of these <code>return(...)</code> expressions to certain tables and their fields.</p>\n<p>More specifically, I'm working with some LUA &quot;classes&quot; using the <code>setmetatable / __index</code> pattern, and, given access to the table (let's call it <code>SomeClass</code>) I'd like to be able to evaluate expressions such as</p>\n<pre class="lang-lua prettyprint-override"><code>self.mSomeVariable + self.mSomeOtherVariable - self:someOperation(...)\n</code></pre>\n<p>where <code>self</code> is referring to <code>SomeClass</code> (i.e. there exists <code>SomeClass:someOperation</code>, etc).</p>\n<p>I'm really at my wits end on how to approach this. At first I tried the following, and it most definitely didn't work.</p>\n<pre class="lang-lua prettyprint-override"><code>&gt; SomeClass = {}\n&gt; SomeClass.DebugEval = function(self, chunk_str) return load(&quot;return(&quot; .. chunk_str .. &quot;)&quot;)() end\n&gt; SomeClass.DebugEval(SomeClass, &quot;print(1)&quot;) // 1 nil\n&gt; SomeClass.DebugEval(SomeClass, &quot;print(SomeClass)&quot;) // table: 0000000000CBB5C0 nil\n&gt; SomeClass.DebugEval(SomeClass, &quot;print(self)&quot;) // nil nil\n</code></pre>\n<p>The fact that I cannot even reference the &quot;class&quot; via <code>self</code> by passing it in directly to the wrapping function's argument makes me suspicious that this might be a <code>upvalue</code> problem. That is, <code>load(...)</code> is creating a closure for the execution of this chunk that has no way of reaching the <code>self</code> argument... but why? It's quite literally there???</p>\n<p>In any case, my debugger backend is already on C++, so I thought &quot;no problem, I'll just manually set the <code>upvalue</code>. Again, I tried doing the following using <code>lua_setupvalue</code>, but this also didn't work. I'm getting a runtime error on the <code>pcall</code>.</p>\n<pre class="lang-cpp prettyprint-override"><code>luaL_dostring(L, &quot;SomeClass = {}&quot;); // just for convenience; I could've done this manually\nluaL_loadstring(L, &quot;print(1)&quot;); // [ ... , loadstring_closure ]\nlua_getglobal(L, &quot;SomeClass&quot;); // [ ... , loadstring_closure, reference table]\nlua_setupvalue(L, -2, 1); // [ ... , loadstring_closure] this returns '_ENV'\nlua_pcall(L, 0, 0, 0); // getting LUA_ERRRUN\n</code></pre>\n<p>What am I missing here? Perhaps I'm approaching this in a totally incorrect way? My end goal is simply being able to execute these debugger watches but restricted to certain class instances, so I can enable my watches on a per-instance basis and inspect them. And yes, I absolutely need to roll out my own debugger. It's a long story. Any and all help is appreciated.</p>\n"^^ . "0"^^ . . "1"^^ . . "coroutine"^^ . . "filter"^^ . . . "<p>I don't know <code>lua</code>, but can give you a function that works with the equivalent nested python list.</p>\n<p>Make the array with broadcasted arrays:</p>\n<pre><code>In [303]: res = (np.arange(5)[:,None,None,None] -\n np.arange(2))/(np.arange(4)[:,None,None] +\n np.arange(3)[:,None]+1)\nIn [304]: res.shape\nOut[304]: (5, 4, 3, 2)\n</code></pre>\n<p>Make a nested list from that:</p>\n<pre><code>In [305]: lres = res.tolist() \nIn [306]: len(lres), len(lres[0][0])\nOut[306]: (5, 3)\n</code></pre>\n<p>An iterative function to apply successive indices:</p>\n<pre><code>def foo(a, idx):\n res = a\n if len(idx)==0:\n return res\n for i in idx:\n res = res[idx[0]]\n idx = idx[1:]\n return res\n</code></pre>\n<p>testing with <code>index</code>:</p>\n<pre><code>In [311]: index = (4,3,2,1)\n</code></pre>\n<p>The array version:</p>\n<pre><code>In [312]: res[index]\nOut[312]: 0.5\n</code></pre>\n<p>trying the tuple on the nested list:</p>\n<pre><code>In [313]: lres[index]\n---------------------------------------------------------------------------\nTypeError Traceback (most recent call last)\nCell In[313], line 1\n----&gt; 1 lres[index]\n\nTypeError: list indices must be integers or slices, not tuple\n</code></pre>\n<p>But the function:</p>\n<pre><code>In [314]: foo(lres, index)\nOut[314]: 0.5\n</code></pre>\n<p>it also works on the array (but not quite as fast):</p>\n<pre><code>In [315]: foo(res, index)\nOut[315]: 0.5\n</code></pre>\n<p>A recursive equivalent:</p>\n<pre><code>def foor(a, idx):\n if len(idx)==0:\n return a\n else:\n return foor(a[idx[0]], idx[1:])\n\nIn [317]: foor(lres, index)\nOut[317]: 0.5 \n</code></pre>\n<p>From the little I've seen about <code>lua</code> you should be able to translate one or both without too much trouble. Looks like its <code>table</code> is similar to <code>list</code>.</p>\n<p>There are about 300 questions/answers on SO with searching for <code>[lua] array</code>. So people have been working with some sort of arrays in <code>lua</code> - though in many cases that may be just another name for <code>table</code>.</p>\n<p>In python deeply nested lists are not common. One level of nesting is common enough. There are even tricks for 'transposing` such a list</p>\n<pre><code>In [318]: alist = [[1,2,3],[4,5,6]]; alist\nOut[318]: [[1, 2, 3], [4, 5, 6]]\n\nIn [319]: list(zip(*alist))\nOut[319]: [(1, 4), (2, 5), (3, 6)]\n</code></pre>\n<p>Under the covers, <code>numpy</code> stores all the values in a flat (1d) array ('C'), and uses <code>shape</code> and <code>strides</code> to treat it as a multidimensional array.</p>\n<p>An alternative to creating a deeply nested list, would be to make a flat one, and use a bit of math to convert <code>index</code> to a flat equivalent.</p>\n<p>numpy has a function to calculate a flat index from a multidimensional one:</p>\n<pre><code>In [320]: np.ravel_multi_index(index, res.shape)\nOut[320]: 119 \nIn [321]: res.ravel()[119]\nOut[321]: 0.5\n</code></pre>\n<p>In this direction the calculation is easy, it's the reverse that's a bit trickier.</p>\n<pre><code>In [324]: res.strides\nOut[324]: (192, 48, 16, 8)\nIn [325]: np.multiply(index, res.strides).sum()/8\nOut[325]: 119.0\n</code></pre>\n"^^ . . . "lua"^^ . "The main thing here is manual tracing of the code. Put in debug messages so you can see intermediate values, and flow control, in your console. Which bit causes the explosion? Does it run at all? If not, what earlier code does run, and do you have a conditional that is getting the wrong result?"^^ . . "1"^^ . "<p>I have a script located in a tool that activates upon the tool's activation (when you left-click with the tool in hand). When activated, a RemoveEvent fires on all clients. Here's that code:</p>\n<pre class="lang-lua prettyprint-override"><code>local tool = script.Parent\n\nlocal debounce = false\ntool.Activated:Connect(function()\n if debounce == false then\n debounce = true\n local player = game:GetService&quot;Players&quot;:GetPlayerFromCharacter(script.Parent.Parent)\n local character = script.Parent.Parent\n \n local foodvalue = 5\n player.PlayerGui.Meters.AteFoodEvent:FireAllClients(player,foodvalue)\n print(foodvalue)\n wait(2)\n end\n debounce = false\nend)\n</code></pre>\n<p>(The wait(2) and debounce is just to try to solve this problem, which has not worked)</p>\n<p>This seems to work just fine and the print function only prints one &quot;foodvalue&quot;, being five. But, when I look at the script that recieves the RemoteEvent...</p>\n<pre class="lang-lua prettyprint-override"><code>player.PlayerGui.Meters.AteFoodEvent.OnClientEvent:Once(function(player,foodvalue)\n\n if eventDebounce == false then\n eventDebounce = true\n if hunger &gt; foodvalue then\n hunger -= foodvalue\n elseif hunger &lt;= foodvalue then\n hunger = -1\n print(foodvalue)\n end\n wait(2)\n end\n eventDebounce = false\nend)\n</code></pre>\n<p>No matter where I print the foodvalue, or wait(2), or debounce, the amount of &quot;foodvalues&quot; that get printed out ranges from one to fifteen, seemingly with no correlation to anything other than the hunger value, but even then the only relation is that when the hunger value is low the printed foodvalue is <em>usually</em> lower, and same with a higher hunger value. I have no clue what's going on!</p>\n"^^ . . . . . "<p>This is my first add-on and my first Lua program.</p>\n<p>I capture the events of the combat log.</p>\n<p>In a table (db1) I store the damage of each second.\ndb1 is limited to 50 entries.</p>\n<p>Initially the addon occupies 39 kb, but as time goes by, the memory it occupies increases (observed with GetAddOnMemoryUsage(&quot;GraphDPS&quot;)).\nEven by triggering a collectgarbage(&quot;collect&quot;) when the memory used reaches double the initial memory. I always end up with a freeze.</p>\n<p>Does anyone have an idea?</p>\n<pre><code>-- ================================= VARIABLES ================================== --\n-- Globals, only used when login and log out\nGDPS_damae = 0\nGDPS_db1 = {}\nGDPS_db3 = {}\nGDPS_frgfh = 238\nGDPS_frgfw = 83\nGDPS_unvu = {}\n-- Locals\nlocal coei = nil -- combat : CombatLog Event Infos\nlocal colib = &quot;Dernier combat&quot; -- combat : &quot;Dernier combat&quot; ou combat actuel&quot;\nlocal cosc = 0 -- combat : compteur de seconde du combat en cours\nlocal damae = 0 -- data : biggest dps ever\nlocal datalc = 0 -- data :total amount last combat\nlocal db1 = {} -- database 1\nlocal db1l = 50 -- database 1 limit\nlocal db1le = {nil, nil} -- database : database 1 last entry\nlocal db1nv = 0 -- database : database 1 number of values\nlocal db1nvn = 0 -- database : database 1 number of values numerical\nlocal db3 = {} -- database : database 3\nlocal evt = &quot;&quot; -- event : type\nlocal eva = 0 -- event : amount\nlocal evsn = &quot;&quot; -- event : swing or spell\nlocal fra = 0 -- frames alpha\nlocal tic = 0 -- timer : every second in combat\nlocal tmce = 0 -- timestamp : combat end (PLAYER_REGEN_ENABLED)\nlocal tmcel = 0 -- timestamp : combat end\nlocal tmdce = 0 -- timestamp : combat end delta\nlocal tmia = 0 -- timestamp : timstamp in analyse\nlocal tmiaa = 0 -- timestamp : timestamp in analyse amount\nlocal tmlcs = 0 -- timestamp : timestamp last combat start\nlocal tmoe = 0 -- timestamp : timestamp of event\nlocal tmprd = 0 -- timestamp : timestamp combat start (PLAYER_REGEN_DISABLED)\nlocal unUID = UnitGUID(&quot;player&quot;) -- units : player\nlocal unUIDe = &quot;&quot; -- units : of event\nlocal unvu = {} -- units : list of valid units\nunvu[unUID] = true\n-- ============================= LOCALISED FUNCTIONS ============================ --\nlocal C_Timer = C_Timer\nlocal CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo\nlocal CreateFrame = CreateFrame\nlocal mathfloor = math.floor\nlocal tableremove = table.remove \nlocal type = type\n-- ================================= FONCTIONS ================================== --\n-- obtenir timestamps courant sans virgule\n---@return number\nlocal function tmr()\n return mathfloor(time())\nend\n-- mise à jour du plus gros dps enregistré\nlocal function daum()\n if tmiaa &gt; damae then\n damae = tmiaa\n end \nend\n-- efface la plus ancienne donnée dans db1\nlocal function db1doe()\n db1nv = db1nv - 1\n if type(db1[1][2]) == &quot;number&quot; then\n db1nvn = db1nvn - 1\n end \n tableremove(db1, 1)\nend\n-- ajoute une entrée dans db1\n---@param t number\n---@param v number or string\nlocal function db1ad(t, v)\n if #db1 == db1l then\n db1doe()\n end\n db1[#db1+1] = {t, v} --\n db1nv = db1nv + 1\n if type(v) == &quot;number&quot; then\n db1nvn = db1nvn + 1\n daum()\n end\n db1le = {t, v} --\nend\n-- =================== FRAMES ET FONCTIONS PROPRES AUX FRAMES =================== --\nlocal frm1 = CreateFrame(&quot;Frame&quot;, &quot;GraphDPS main graph frame&quot;, UIParent)\nfrm1:SetSize(260, 80)\nfrm1:SetPoint(&quot;CENTER&quot;, UIParent, &quot;CENTER&quot;, 0, 0 )\nfrm1.tex = frm1:CreateTexture()\nfrm1.tex:SetAllPoints(frm1)\nfrm1.tex:SetColorTexture(0,0,0,fra)\nfrm1:EnableDrawLayer(&quot;ARTWORK&quot;)\n\n-- =================================== EVENTS =================================== --\nfrm1:RegisterEvent(&quot;ADDON_LOADED&quot;)\nfrm1:RegisterEvent(&quot;PLAYER_LOGOUT&quot;)\nfrm1:RegisterEvent(&quot;PLAYER_REGEN_DISABLED&quot;)\nfrm1:RegisterEvent(&quot;PLAYER_REGEN_ENABLED&quot;)\nfrm1:RegisterEvent(&quot;COMBAT_LOG_EVENT_UNFILTERED&quot;)\nlocal function eventH(self, event, ...)\n if event == &quot;PLAYER_LOGOUT&quot; then \n GDPS_frgfh = frm1:GetWidth()\n GDPS_frgfw = frm1:GetHeight()\n GDPS_db1 = db1\n GDPS_db3 = db3\n GDPS_damae = damae\n GDPS_unvu = unvu\n end\n if event == &quot;ADDON_LOADED&quot; then\n db1 = GDPS_db1\n db3 = GDPS_db3\n demae = GDPS_damae\n end\n if event == &quot;PLAYER_REGEN_DISABLED&quot; then\n tmprd = tmr()\n colib = &quot;Combat actuel&quot;\n tic = 0\n tmdce = 1\n datalc = 0\n db1ad(tmprd, &quot;cs&quot;)\n db3={}\n tic = C_Timer.NewTicker(1, function()\n if tmia - db1le[1] &gt; 1 then db1ad(db1le[1]+1, 0) end\n if tmia &lt; tmlcs + cosc then db1ad(db1le[1]+1, 0) end \n cosc = cosc + 1\n tmdce = tmdce + 1\n end)\n end\n if event == &quot;PLAYER_REGEN_ENABLED&quot; then\n tic:Cancel()\n colib = &quot;Dernier combat&quot;\n cosc = 0\n tmcel = tmr()\n if db1le[1] ~= tmia or db1le[2] == &quot;cs&quot; then db1ad(tmia, tmiaa) end\n tmdce = 0\n for i = db1le[1] + 1, tmce - 1 do\n db1ad(i, 0)\n tmdce = tmdce + 1\n end\n db1ad(tmcel, &quot;ce&quot;)\n tmia = 0\n tmiaa = 0\n tmce = tmcel\n end\n if event == &quot;COMBAT_LOG_EVENT_UNFILTERED&quot; then\n if colib == &quot;Combat actuel&quot; then\n tmoe, evt, _, unUIDe = select(1, CombatLogGetCurrentEventInfo())\n tmoe = mathfloor(tmoe)\n -- l'ajout des pet reste à voir\n if unvu[unUIDe] ~= nil then\n if evt == &quot;SWING_DAMAGE&quot; then\n eva = select(12, CombatLogGetCurrentEventInfo())\n evsn = &quot;swing&quot;\n elseif evt == &quot;SPELL_DAMAGE&quot; or evt == &quot;SPELL_PERIODIC_DAMAGE&quot; or evt == &quot;RANGE_DAMAGE&quot; then\n evsn, _, eva = select(13, CombatLogGetCurrentEventInfo())\n end\n if evt == &quot;SWING_DAMAGE&quot; or evt == &quot;SPELL_DAMAGE&quot; or evt == &quot;SPELL_PERIODIC_DAMAGE&quot; or evt == &quot;RANGE_DAMAGE&quot; then\n if type(eva) == &quot;number&quot; then\n if eva &gt; damae then\n damae = eva\n end\n if db3[evsn] ~= nil then\n db3[evsn] = db3[evsn] + eva\n else\n db3[evsn] = eva\n end \n if tmia ~= 0 then\n if tmia == tmoe then\n tmiaa = tmiaa + eva\n else\n db1ad(tmia, tmiaa)\n tmia = tmoe\n tmiaa = eva\n end\n else\n tmia = tmoe\n tmiaa = eva\n end\n end\n datalc = datalc + eva\n end\n --else\n -- l'ajout des dégâts des invoqués viendra après\n end\n end\n end\nend\nfrm1:SetScript(&quot;OnEvent&quot;, eventH)\n</code></pre>\n"^^ . . . . "1"^^ . "0"^^ . . . "As a quick note, when getting click events from buttons, for combatilbititly between devices you should use the `button.Activated` event, and use the same syntax, like this: `button.Activated:Connect(function()` But that's not super important for this post."^^ . "<p>As @luther has said, Lua tables are not sorted.</p>\n<p>However, they can be iterated in a required order, including by key ascending.</p>\n<p>To do so, you need to reload the <code>pairs()</code> function for the dictionary, by defining <code>__pairs</code> metamethod.</p>\n<pre class="lang-lua prettyprint-override"><code>--[[\n This function will convert the simple table tbl\n into a table that pairs() will iterate\n in the order of its keys ascending.\n The table will preserve its qualities after adding\n or removing items.\n--]]\nlocal function sorted_by_key (tbl)\n return setmetatable (tbl, {\n __pairs = function (t)\n local keys = {}\n --[[\n Get the keys of t and sort them.\n We cannot use for key, _ in pairs (t), as it is reloaded\n and we would start an infinite recursion.\n --]]\n key, _ = next (t)\n while key do\n keys [#keys + 1] = key\n key, _ = next (t, key) \n end\n table.sort (keys)\n\n local key = 0 -- this counter will be incremented by pairs.\n return function ()\n key = key + 1\n return keys [key], t [keys [key]]\n end\n end\n })\nend\n\nprint 'Initial dic:'\nlocal dic = sorted_by_key {\n [1] = 'foo',\n [25] = 'bar',\n [-30] = 'negative',\n [100] = 'very positive',\n [-100] = 'very negative'\n}\n\nfor key, value in pairs (dic) do\n print (key, value)\nend\n\nprint 'With an added item at key 50:'\ndic [50] = 'moderately positive'\nfor key, value in pairs (dic) do\n print (key, value)\nend\n\nprint 'With a removed item at key 25:'\ndic [25] = nil\nfor key, value in pairs (dic) do\n print (key, value)\nend\n</code></pre>\n"^^ . . . "<p>If you want to access your multi-dimensional table's items by a 'tuple' of keys, you have to define a new object, with access operations reloaded this way. Technically, this object will also be a table (in Lua, almost everyting of interest is a table); but it ought to have a <em>metatable</em> with two <em>metamethods</em>: <code>__newindex</code> to reload table item setter and <code>__index</code> to reload the getter.</p>\n<pre class="lang-lua prettyprint-override"><code>local function indexed_by_tuple (multidimensional)\n -- Non-tables should not be wrapped:\n if type (multidimensional) ~= 'table' then\n return multidimensional\n end\n return setmetatable ({}, {\n __newindex = function (tbl, keys, value)\n -- We want the standard syntax z [i] [j] [k] [l] to still work:\n local keys = type (keys) == 'table' and keys or { keys } \n local current = multidimensional\n for depth, key in ipairs (keys) do\n -- Last key reached:\n if depth == #keys then\n current[key] = value\n break\n end\n -- Sub-table not initialised yet:\n if current [key] == nil then\n current[key] = {}\n end\n -- Going deeper:\n current = current[key]\n end\n end,\n __index = function (tbl, keys)\n -- We want the standard syntax z [i] [j] [k] [l] to still work: \n local keys = type (keys) == 'table' and keys or { keys }\n local current = multidimensional\n for depth, key in ipairs (keys) do\n -- Last key reached:\n if depth == #keys then\n -- Allow to index the return with a tuple as well:\n return indexed_by_tuple (current [key])\n end\n -- Even the dimension is not initialised yet:\n if current [key] == nil then\n return nil\n end\n -- Go deeper:\n current = current [key]\n end\n end\n })\nend\n\n-- A 4-d test table:\nlocal a = {}\nfor i = 1, 5 do\n a [i] = {}\n for j = 1, 4 do\n a [i] [j] = {}\n for k = 1, 3 do\n a [i] [j] [k] = {}\n for l= 1, 2 do\n a [i] [j] [k] [l] = (i - l) / ( j + k - 1 )\n end\n end\n end\nend\n\n-- Initialise table indexed by tuple with a table:\nlocal ibt = indexed_by_tuple (a)\n\n-- Reset one item by hand:\nibt [{ 1, 3, 3, 1 }] = 42\n\n-- Get an item by tuple:\nprint ('ibt [{ 1, 3, 3, 1 }] = ', ibt [{ 1, 3, 3, 1 }])\n-- Get it traditional way:\nprint ('ibt [1] [3] [3] [1] = ', ibt [1] [3] [3] [1])\n-- Get it mixed way:\nprint ('ibt [1] [{ 3, 3, 1 }] = ', ibt [1] [{ 3, 3, 1 }])\nprint ('ibt [{ 1, 3 }] [{ 3, 1 }] = ', ibt [{ 1, 3 }] [{ 3, 1 }])\n\n-- Set an item mixed way:\nibt [{ 1, 3 }] [3] [1] = 21\n-- Get it tuple way:\nprint ('ibt [{ 1, 3, 3, 1 }] = ', ibt [{ 1, 3, 3, 1 }])\n-- Set an item mixed, but opposite, way:\nibt [1] [3] [{ 3, 1 }] = 14\n-- Get it tuple way:\nprint ('ibt [{ 1, 3, 3, 1 }] = ', ibt [{ 1, 3, 3, 1 }])\n\n-- More test cases:\nfor _, key in ipairs {\n { 1, 4, 3, 2 },\n { 1, 1, 1, 1 },\n { 2, 3, 4, 5 }, -- was never set, so nil.\n { 5, 4, 3, 2 }\n} do\n print ( 'ibt [{ ' .. table.concat (key, ', ') .. ' }] = ', ibt [key])\nend\n</code></pre>\n"^^ . . "this is not a coding service. post your solution attempt and explain how it is behaving from what you expect. also fi your data structure contains more than one file you should provide and example of at at least 2-3 files. as is your post doesn't make any sense to me"^^ . "0"^^ . . . . . . "0"^^ . . . "<p>It was not actually a table problem.\nIn this code there is a timer that triggers actions every second and a frame that listens to different events.\nI deleted the timer and there is no more problem.\nI think that when an event was received at the same precise moment or the timer had to execute its actions it generated a freeze.\nI will do tests using coroutines, which, if I understand correctly, are used precisely to avoid this kind of situation.</p>\n"^^ . . . "Armor takes up durability when regening health"^^ . "<p>I have a table and a directory :</p>\n<pre><code>--directory\n{\n[1] = &quot;File&quot;\n[2] = &quot;Documents&quot;\n[3] = &quot;txt_Page&quot;\n}\n\n--Table for directory\n{\nFiles = {\n File = {\n Documents = {\n txt_Page = &quot;new&quot;\n }\n }\n }\n}\n</code></pre>\n<p>I want to edit the <code>txt_page</code> through the directory and return the newly edited files table but I've tried methods and I can't seem to find it.</p>\n"^^ . . . . "nvim-lspconfig"^^ . "Can't you just iterate on `index`, applying the scalar index recursively? That's how I'd do it with nested python lists. `a[index]` is expressed as `a.__getitem__(index)`. That's ok if `a` is a numpy array, but raises a value error if `a` is a list, and index is a tuple. But you could write your own subclass on list that handles a tuple arg."^^ . "<p>I use Neovim with <a href="https://github.com/folke/lazy.nvim" rel="nofollow noreferrer">Lazy.nvim</a> and I want to use <a href="https://github.com/github/copilot.vim" rel="nofollow noreferrer">GitHub Copilot</a> only for very specific cases. For me, is better to have it unabled than enabled by default, and just activate it when I need to use it (kind of asking something to chatgpt I guess), so I try to accomplish this by lazy loading it in the plugin configuration, like this:</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;github/copilot.vim&quot;,\n -- disable copilot by default\n lazy = true,\n keys = { &quot;&lt;leader&gt;ce&quot; },\n config = function()\n vim.keymap.set(&quot;i&quot;, &quot;&lt;C-j&gt;&quot;, 'copilot#Accept(&quot;\\\\&lt;CR&gt;&quot;)', {\n expr = true,\n replace_keycodes = false,\n })\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;cd&quot;, &quot;:Copilot disable &lt;CR&gt;&quot;, {})\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;ce&quot;, &quot;:Copilot enable &lt;CR&gt;&quot;, {})\n end,\n}\n</code></pre>\n<p>It works, it is not loaded until I press ce, but I do not receive autocompletion after that, I can acces <code>:Copilot &lt;command&gt;</code>, but this does not autocomplete my text/code, any idea why?</p>\n<p>UPDATE: I added a line in my configuration and that kind of work, but it freezes my screen for like 2 seconds and then I can use as normal, does anyone know why do I need to run <code>:Copilot setup</code> to use it but before lazy loading it I did't need to do it?</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;github/copilot.vim&quot;,\n -- disable copilot by default\n lazy = true,\n keys = { &quot;&lt;leader&gt;ce&quot; },\n config = function()\n vim.cmd(&quot;Copilot setup&quot;) -- Line I added\n\n vim.keymap.set(&quot;i&quot;, &quot;&lt;C-j&gt;&quot;, 'copilot#Accept(&quot;\\\\&lt;CR&gt;&quot;)', {\n expr = true,\n replace_keycodes = false,\n })\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;cd&quot;, &quot;:Copilot disable &lt;CR&gt;&quot;, {})\n vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;ce&quot;, &quot;:Copilot enable &lt;CR&gt;&quot;, {})\n end,\n}\n</code></pre>\n<p>By the way, here is my complete <a href="https://github.com/BubuDavid/nvim" rel="nofollow noreferrer">config file</a>.</p>\n"^^ . "0"^^ . . . . . . "1"^^ . "0"^^ . "0"^^ . . . . . . . . . . . . "<p><strong>Your first step is to reliably reproduce the issue.</strong></p>\n<ul>\n<li>How often does this error occur?</li>\n<li>What steps can you perform to make the error occur?</li>\n</ul>\n<p>E.g. does this happen every time you start up and join your server?</p>\n<p><strong>Then, you should remove addons from your server to work out which addon is causing it.</strong></p>\n<ol>\n<li>Run the server without any addons\n<ul>\n<li>No addons from the workshop and no addons in the server's addons folder</li>\n<li>If you no longer get the error, go to step 2</li>\n<li>If you still get the error\n<ul>\n<li>The problem could be within the server's files; a fresh install of the server would be best (backup your config and any custom content)</li>\n<li>The problem could be within your copy of the game (I believe DarkRP allows custom clientside lua to execute); you will either need a fresh install or you will need to search your addons, lua and download folders</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>Run the server with some of the addons\n<ul>\n<li>You could keep re-adding one addon until you get the error again</li>\n<li>Once you start getting the error again, the last addon you added will be the source of it</li>\n<li>If you have a lot of addons, you could try re-adding multiple addons until you get the error. Then removing one addon at a time until the error stops happening. Or using a divide and conquer approach.</li>\n</ul>\n</li>\n</ol>\n"^^ . . . . "0"^^ . . . . "The way you described is equivalent to `lua_setglobal`, and I think a better way is to return a function from load: `load("return function (self) return(" .. chunk_str .. ") end")()(self)`"^^ . "0"^^ . "0"^^ . "0"^^ . . . . "1"^^ . "0"^^ . "0"^^ . . . . "... although just I noticed that basic "offline drawing" features already exist in 1.1.x, see documentation at https://www.fltk.org/doc-1.1/drawing.html#offscreen . I'm not sure though how to retrieve the pixel data of the offscreen area which can be done easily in 1.4. The entire offscreen drawing functionality has been improved very much in 1.3 and even more in 1.4.0."^^ . . . . . . . "@Oka, "An instance of AccountGold loses access to methods defined through AccountGold" -- yes, I understand that. Of course you can then "override" the `AccountGold`'s `new` in order it to work."^^ . "0"^^ . "0"^^ . . . "<p>Is it possible to find a workaround for this?</p>\n<p>I know that M and N are no G-Keys but I would like to to have two different key sequences depending on the last key input</p>\n<p>I have no idea where to start to be honest.</p>\n<pre class="lang-lua prettyprint-override"><code>-- Variable to track the last key pressed\nlocal lastKeyPressed = nil\n\nfunction OnEvent(event, arg)\n if event == &quot;G_PRESSED&quot; then\n if arg == 77 then -- Direct key code for &quot;M&quot;\n lastKeyPressed = &quot;m&quot;\n elseif arg == 78 then -- Direct key code for &quot;N&quot;\n lastKeyPressed = &quot;n&quot;\n end\n end\n\n -- Check if the scroll wheel button is pressed to activate the macro\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 3 then -- Assuming middle mouse button (scroll wheel) is used\n QP()\n end\nend\n\nfunction QP()\n local leanDuration = 25 -- Duration to hold lean in milliseconds\n local pauseDuration = 40 -- Pause between actions in milliseconds\n\n if lastKeyPressed == &quot;n&quot; then\n -- If N was the last key, press M then N\n PressKey(&quot;m&quot;)\n Sleep(leanDuration)\n ReleaseKey(&quot;m&quot;)\n Sleep(pauseDuration)\n\n PressKey(&quot;n&quot;)\n Sleep(leanDuration)\n ReleaseKey(&quot;n&quot;)\n\n elseif lastKeyPressed == &quot;m&quot; then\n -- If M was the last key, press N then M\n PressKey(&quot;n&quot;)\n Sleep(leanDuration)\n ReleaseKey(&quot;n&quot;)\n Sleep(pauseDuration)\n\n PressKey(&quot;m&quot;)\n Sleep(leanDuration)\n ReleaseKey(&quot;m&quot;)\n else\n -- Default action if no key has been pressed yet (optional)\n PressKey(&quot;n&quot;)\n Sleep(leanDuration)\n ReleaseKey(&quot;n&quot;)\n\n Sleep(pauseDuration)\n\n PressKey(&quot;m&quot;)\n Sleep(leanDuration)\n ReleaseKey(&quot;m&quot;)\n end\n lastKeyPressed = nil\nend\n</code></pre>\n"^^ . "1"^^ . . "0"^^ . "-1"^^ . . . . . . "0"^^ . . . "Aerospike Lua Protobuf pb.so: undefined symbol: lua_settop"^^ . "1"^^ . . . . . . "Change the line starting with `and` to `and prepend_string('ANSWER: ', div.content):walk(...)`."^^ . . . "1"^^ . "0"^^ . "0"^^ . "@shingo +1 Idk why, but my LUA_PATH and LUA_CPATH are missing "." If you could write your previous comment as an answer, together with what LUA_PATH and LUA_CPATH should look like in Windows, I would accept it."^^ . . "Figure out function param arity and param names"^^ . . . "0"^^ . . . . . "1"^^ . . . . "1"^^ . . . . "0"^^ . . . . . "<p>New to lua. I would like to create an <code>autocmd</code> in my config.lua that would only apply to .md files. Every time the file is saved it would look for the line that start with <code>Date: *</code> and change it to <code>Date: strftime(&quot;%Y/%M/%d&quot;)</code>. I have been looking at the <a href="https://neovim.io/doc/user/autocmd.html#_10.-using-autocommands" rel="nofollow noreferrer">link</a> and more specifically in the following</p>\n<pre><code>:autocmd BufWritePre,FileWritePre *.html ks|call LastMod()|'s\n:fun LastMod()\n: if line(&quot;$&quot;) &gt; 20\n: let l = 20\n: else\n: let l = line(&quot;$&quot;)\n: endif\n: exe &quot;1,&quot; .. l .. &quot;g/Last modified: /s/Last modified: .*/Last modified: &quot; ..\n: \\ strftime(&quot;%Y %b %d&quot;)\n:endfun\n</code></pre>\n<p>But I would like to do that in lua.</p>\n<p>Would that be possible?</p>\n"^^ . . . . . . "Other important info : solution given in https://onexception.dev/news/1385946/saving-fltk-diagrams-as-png-in-murgalua is IA bullshit."^^ . . "1"^^ . "0"^^ . "1"^^ . . . "0"^^ . . "It may be necessary to monitor the growth of tables db1, db3 and unvu, because they are saved and restored."^^ . "Use the plugin's issue tracker."^^ . "Very nice! Good points, and yes, this would just be for debugging. Could also just get better at running a debugger in neovim."^^ . "0"^^ . . . . . . "Please, if you want some help with your Neovim config, post extract of your init.lua / nvim-cmp config files."^^ . . "0"^^ . "1"^^ . "1"^^ . . . . . . "Attempting to find character position by defining player/character/root breaks script but has no errors"^^ . "The real reason can only be given by Lua's developers. Most likely because it makes things a lot easier and the user can still achieve expansion of both lists manually if needed."^^ . . "Lua module luaossl installed successfully with luarocks, stilll require("luaossl") fails"^^ . . . "2"^^ . "1"^^ . "wireshark-dissector"^^ . "How to "require" a LUA script within a Spoon-package?"^^ . "Animation on roblox problems"^^ . "0"^^ . "@RyanLuu I've edited the post and uploaded the file."^^ . "<p>It seems like you are kinda confused at the moment on lot of stuff.\nAutocompletion with nvim-cmp and the related projects can be a bit messy but it is manageable when you take a look at the doc.\nHere is what I can advice to first familiarize yourself with the ecosystem:</p>\n<ul>\n<li>Use <a href="https://github.com/nvim-lua/kickstart.nvim/tree/master" rel="nofollow noreferrer">Kickstart</a> to setup your first configuration\n<ul>\n<li>Alternative: use a distro such as LazyVim, LunarVim...</li>\n</ul>\n</li>\n<li>Take a look at some articles, videos and stuff - there are a lot of content available that will explain you how to start a nvim config from scratch and to get basic configuration working properly.</li>\n<li>Take your time, read the doc, read other people config (look dotfiles on github) and enjoy the journey, it will be a long one !</li>\n</ul>\n"^^ . "2"^^ . "1"^^ . . . . . . "1"^^ . . . . . "<p>I installed &quot;luaossl&quot; using luarocks. Also installed &quot;http&quot;. But Cannot import either from lua prompt.</p>\n<p>require(&quot;http&quot;) fails too.\nI tried eval &quot;$(luarocks path)&quot; but that didn't help either.</p>\n<h2>Here is a screenshot.</h2>\n<pre><code> # luarocks install http\n Warning: falling back to curl - install luasec to get native HTTPS support\n Installing https://luarocks.org/http-0.4-0.all.rock\n\n http 0.4-0 depends on lua &gt;= 5.1 (5.3-1 provided by VM)\n http 0.4-0 depends on compat53 &gt;= 0.3 (0.14.3-1 installed)\n http 0.4-0 depends on bit32 (5.3.5.1-1 installed)\n http 0.4-0 depends on cqueues &gt;= 20161214 (20200726.53-0 installed)\n http 0.4-0 depends on luaossl &gt;= 20161208 (20220711-0 installed)\n http 0.4-0 depends on basexx &gt;= 0.2.0 (0.4.1-1 installed)\n http 0.4-0 depends on lpeg (1.1.0-1 installed)\n http 0.4-0 depends on lpeg_patterns &gt;= 0.5 (0.5-0 installed)\n http 0.4-0 depends on binaryheap &gt;= 0.3 (0.4-1 installed)\n http 0.4-0 depends on fifo (0.2-0 installed)\n http 0.4-0 is now installed in /usr (license: MIT)\n\n [root@ip-146-69-43-165 ~]# lua\n Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, PUC-Rio\n &gt; luaossl = require(&quot;luaossl&quot;)\n stdin:1: module 'luaossl' not found:\n no field package.preload['luaossl']\n no file '/usr/share/lua/5.3/luaossl.lua'\n no file '/usr/share/lua/5.3/luaossl/init.lua'\n no file '/usr/lib64/lua/5.3/luaossl.lua'\n no file '/usr/lib64/lua/5.3/luaossl/init.lua'\n no file './luaossl.lua'\n no file './luaossl/init.lua'\n no file '/usr/lib64/lua/5.3/luaossl.so'\n no file '/usr/lib64/lua/5.3/loadall.so'\n no file './luaossl.so'\n stack traceback:\n [C]: in function 'require'\n stdin:1: in main chunk\n [C]: in ?\n &gt; require(&quot;http&quot;)\n stdin:1: module 'http' not found:\n no field package.preload['http']\n no file '/usr/share/lua/5.3/http.lua'\n no file '/usr/share/lua/5.3/http/init.lua'\n no file '/usr/lib64/lua/5.3/http.lua'\n no file '/usr/lib64/lua/5.3/http/init.lua'\n no file './http.lua'\n no file './http/init.lua'\n no file '/usr/lib64/lua/5.3/http.so'\n no file '/usr/lib64/lua/5.3/loadall.so'\n no file './http.so'\n stack traceback:\n [C]: in function 'require'\n stdin:1: in main chunk\n [C]: in ?\n &gt;\n</code></pre>\n<p>As shown in the screenshot, I was expecting both &quot;luaossl&quot; and &quot;http&quot; to load successfully.</p>\n"^^ . . . "e.g. right now, Python now has a nice feature where you can just write `f"{a=}, {b=}"` to get similar outputs to `f"a={a}, b={b}"` :)"^^ . . . . . "0"^^ . . "MurgaLua 0.7.5 and use of fltk function saveAsPng()"^^ . . . . . . "0"^^ . "0"^^ . . . "0"^^ . "Unfortunately, this does not seem to resolve the issue for me. Whenever I do a split, it still defaults to the home directory instead of the cwd. Nonetheless, thank you for the answer."^^ . "0"^^ . . . . "Yeah, I got it now. Still think it can lead to undesired behaviour unless it is the first statement. F.e. if one does `self.x = 'foo'` before doing `self = ...`. Ok. Thank you for your answers !"^^ . "Thanks so much i will try that and inform you if it worked"^^ . "<p>I want to enrich my kubernetes events collected through fluent-bit <code>kubernetes_events</code> input. I'm using fluent-bit <code>LUA filter</code> for this use case and I have try two lua scripts, but neither of them worked for me.</p>\n<ol>\n<li>using kubectl in lua script</li>\n</ol>\n<pre><code> local involvedObjectKind = record[&quot;involvedObject&quot;][&quot;kind&quot;]\n local involvedObjectName = record[&quot;involvedObject&quot;][&quot;name&quot;]\n local involvedObjectNamespace = record[&quot;involvedObject&quot;][&quot;namespace&quot;]\n\n if involvedObjectKind == &quot;Pod&quot; then\n local command = &quot;kubectl get pod &quot; .. involvedObjectName .. &quot; -n &quot; .. involvedObjectNamespace .. &quot; -o json&quot;\n print(&quot;Executing command: &quot; .. command)\n\n local handle = io.popen(command)\n if handle then\n local result = handle:read(&quot;*a&quot;)\n handle:close()\n\n local json = require('json')\n local pod = json.decode(result)\n\n if pod then\n print(&quot;Pod found: &quot; .. pod)\n end\n else\n print(&quot;Failed to execute command: &quot; .. command)\n end\n end\n return 1, timestamp, record\n</code></pre>\n<p>This always prints <code>Failed to execute command</code>.</p>\n<ol start="2">\n<li>using http calls in lua script</li>\n</ol>\n<pre><code> local involvedObjectKind = record[&quot;involvedObject&quot;][&quot;kind&quot;]\n local involvedObjectName = record[&quot;involvedObject&quot;][&quot;name&quot;]\n local involvedObjectNamespace = record[&quot;involvedObject&quot;][&quot;namespace&quot;]\n local http = require(&quot;socket.http&quot;)\n local ltn12 = require(&quot;ltn12&quot;)\n local cjson = require(&quot;cjson&quot;)\n\n if involvedObjectKind == &quot;Pod&quot; then\n -- http request to k8s API server to get pod labels\n local url = &quot;https://kubernetes.default.svc/api/v1/namespaces/&quot; .. involvedObjectNamespace .. &quot;/pods/&quot; .. involvedObjectName\n\n local response_body = {}\n local res, code, response_headers, status = http.request {\n url = url,\n method = &quot;GET&quot;,\n headers = {\n [&quot;Authorization&quot;] =&quot;Bearer &quot; .. os.getenv(&quot;K8S_TOKEN&quot;),\n [&quot;Accept&quot;] = &quot;application/json&quot;,\n },\n sink = ltn12.sink.table(response_body),\n create = function()\n local sock = require(&quot;socket&quot;).tcp()\n sock:connect(&quot;kubernetes.default.svc&quot;, 443)\n return sock\n end\n }\n\n if code == 200 then\n local pod = cjson.decode(table.concat(response_body))\n for k, v in pairs(pod[&quot;metadata&quot;][&quot;labels&quot;]) do\n record[&quot;labels.&quot; .. k] = v\n end\n else\n record[&quot;error&quot;] = &quot;Failed to get pod labels&quot;\n end\n end\n return 1, timestamp, record\n</code></pre>\n<p>This fails with the error <code>[error] [filter:lua:lua.1] error code 2: /fluent-bit/scripts/k8s_events_enrichment.lua:5: module 'socket.http' not found:</code></p>\n<p>I want my event to be populated with pod labels and other metadata related to pods. What am I missing here? How to get this resolved?</p>\n"^^ . . "<p>I've been trying to figure out how to use DataStores and I tried to make a script in a click detector that saves the part's position. When you rejoin and click the part it moves the cube to that part. This is my script :</p>\n<pre class="lang-lua prettyprint-override"><code>local DS = game:GetService(&quot;DataStoreService&quot;)\nlocal BoxPos = DS:GetDataStore(&quot;BoxPos&quot;)\nscript.Parent.MouseClick:Connect(function(plr)\n local boxData = BoxPos:GetAsync(plr.UserId)\n\n if boxData then\n\n workspace.Box.Position = Vector3.new(boxData:match(&quot;(.+), (.+), (.+)&quot;))\n\n else\n\n BoxPos:SetAsync(plr.UserId,000)\n \n end\nend)\ngame.Players.PlayerRemoving:Connect(function(plr)\n local boxPos = workspace.Box.Position\n BoxPos:SetAsync(plr.UserId,tostring(BoxPos))\nend)\n</code></pre>\n<p>I don't know what the issue is as I don't get any errors about saving but when I click it, it moves it to <code>&quot;0,0,0&quot;</code></p>\n"^^ . "1"^^ . . . . "0"^^ . "It's the difference in the past 2 seconds, so, if I got +1 subs, it will show "+1""^^ . "4"^^ . "<p>I'm trying to setup active-standby failover on Jenkins with Openresty. I have a setup with two Jenkins, and I want to switch between them when one is down, however I'm always getting error &quot;no upstream found&quot;:</p>\n<pre><code>2024/10/07 20:38:30 [error] 19681#19681: *42 [lua] conter.lua:44: switch_to_backup(): Failed to switch to backup server: no upstream found, context: ngx.timer, client: 192.168.141.223, server: 0.0.0.0:443\n</code></pre>\n<p>I followed up this guide when tried to configure\n<a href="https://kura.gg/2020/08/09/retrying-dynamically-configured-upstreams-with-openresty/" rel="nofollow noreferrer">https://kura.gg/2020/08/09/retrying-dynamically-configured-upstreams-with-openresty/</a></p>\n<p>Openresty config - i've added upstream servers in init_by_lua_block and all logic in balancer_by_lua_file:</p>\n<pre><code>http {\n resolver 8.8.8.8;\n include mime.types;\n default_type application/octet-stream;\n\n sendfile on;\n\n keepalive_timeout 65;\n\n log_by_lua_file /usr/local/openresty/nginx/conf/conter.lua;\n\n lua_package_path &quot;;;/usr/local/openresty/lualib/resty/?.lua;&quot;;\n lua_max_running_timers 1024;\n lua_shared_dict healthcheck 1m;\n lua_shared_dict log_dict 5M;\n lua_shared_dict my_shared_dict 10m;\n\n lua_socket_log_errors on;\n\n init_by_lua_block {\n upstream_servers = {\n &quot;192.168.141.218:8080&quot;,\n &quot;192.168.141.204:8080&quot;,\n }\n }\n\n upstream jenkins-uat {\n server 192.168.141.218:8080;\n balancer_by_lua_file /usr/local/openresty/nginx/conf/conter.lua;\n keepalive 32;\n }\n\n server {\n listen 80 default_server;\n server_name 192.168.141.218;\n location / {\n return 301 https://192.168.141.218$request_uri;\n }\n }\n\n server {\n listen 443 ssl http2;\n ssl_certificate /etc/ssl/private/fullchain.pem;\n ssl_certificate_key /etc/ssl/private/privkey.pem;\n server_name 192.168.141.218;\n\n access_log /var/log/jenkins-uat.access.log;\n error_log /var/log/jenkins-uat.error.log;\n\n ignore_invalid_headers off;\n\n location / {\n\n sendfile off;\n proxy_pass http://jenkins-uat;\n proxy_http_version 1.1;\n\n proxy_set_header Host $host;\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header X-Forwarded-Proto $scheme;\n proxy_max_temp_file_size 0;\n add_header X-Upstream $upstream_addr always;\n\n client_max_body_size 100m;\n client_body_buffer_size 128k;\n\n proxy_connect_timeout 90;\n proxy_send_timeout 90;\n proxy_read_timeout 90;\n proxy_buffering off;\n proxy_request_buffering off;\n proxy_set_header Connection &quot;&quot;;\n }\n }\n}\n</code></pre>\n<p>Lua file with failover logic, error in switch_to_backup() function</p>\n<pre><code>-- Counter and flags initialization\nif not shared_dict:get(&quot;5xx_errors_10s&quot;) then\n shared_dict:set(&quot;5xx_errors_10s&quot;, 0)\nend\nif not shared_dict:get(&quot;5xx_errors_60s&quot;) then\n shared_dict:set(&quot;5xx_errors_60s&quot;, 0)\nend\nif not shared_dict:get(&quot;primary_server_down&quot;) then\n shared_dict:set(&quot;primary_server_down&quot;, false)\nend\n\n-- Increment 5xx errors\nlocal function increment_5xx_errors()\n shared_dict:incr(&quot;5xx_errors_10s&quot;, 1)\n shared_dict:incr(&quot;5xx_errors_60s&quot;, 1)\nend\n\n-- Send POST request\nlocal function send_post_request(url)\n local httpc = http.new()\n local res, err = httpc:request_uri(url, {\n method = &quot;POST&quot;,\n headers = {\n [&quot;Authorization&quot;] = &quot;Basic YWRtaW46MTE5MTBhMTQyZThlNjY3NjcyMTllYjc0MzhjZmE3MGUwNg==&quot;,\n },\n ssl_verify = false\n })\n if not res then\n ngx.log(ngx.ERR, &quot;Failed to send POST request: &quot;, err)\n return nil, err\n end\n return res\nend\n\n-- Switch traffic on reserve Jenkins server, error happens here\nlocal function switch_to_backup()\n local balancer = require &quot;ngx.balancer&quot;\n local server = upstream_servers[1]\n local ok, err = balancer.set_current_peer(server)\n if not ok then\n ngx.log(ngx.ERR, &quot;Failed to switch to backup server: &quot;, err)\n else\n shared_dict:set(&quot;primary_server_down&quot;, true)\n end\nend\n\n-- Switch back on main Jenkins server\nlocal function switch_to_primary()\n local balancer = require &quot;ngx.balancer&quot;\n local ok, err = balancer.set_current_peer(&quot;192.168.141.218&quot;, 8080)\n if not ok then\n ngx.log(ngx.ERR, &quot;Failed to switch to primary server: &quot;, err)\n else\n shared_dict:set(&quot;primary_server_down&quot;, false)\n end\nend\n\n-- 5xx error counter\nlocal function count_5xx_errors()\n local status = ngx.status\n if status &gt;= 500 and status &lt; 600 then\n increment_5xx_errors()\n end\nend\n\n-- Check thresholds set to switch between servers\nlocal function check_thresholds()\n if shared_dict:get(&quot;primary_server_down&quot;) then\n return\n end\n\n local errors_10s = shared_dict:get(&quot;5xx_errors_10s&quot;)\n local errors_60s = shared_dict:get(&quot;5xx_errors_60s&quot;)\n\n if errors_10s &gt; 1 then\n send_post_request(&quot;http://192.168.141.204:8080/reload&quot;)\n end\n if errors_60s &gt; 10 then\n send_post_request(&quot;http://192.168.141.204:8080/cancelQuietDown&quot;)\n switch_to_backup()\n end\nend\n\n-- Check main server status\nlocal function check_primary_server()\n if not shared_dict:get(&quot;primary_server_down&quot;) then\n return\n end\n\n local httpc = http.new()\n local res, err = httpc:request_uri(&quot;http://192.168.141.218:8080/&quot;, {\n method = &quot;GET&quot;,\n ssl_verify = false\n })\n if res and res.status &lt; 500 then\n send_post_request(&quot;http://192.168.141.204:8080/quietDown&quot;)\n switch_to_primary()\n end\nend\n\n-- Reset counters\nlocal function reset_5xx_errors()\n shared_dict:set(&quot;5xx_errors_10s&quot;, 0)\n shared_dict:set(&quot;5xx_errors_60s&quot;, 0)\nend\n\n-- function start\ncount_5xx_errors()\n\n-- Set timers\nngx.timer.every(10, function()\n check_thresholds()\n reset_5xx_errors()\nend)\n\nngx.timer.every(60, function()\n check_thresholds()\n reset_5xx_errors()\nend)\n\n-- Timer to check main server\nngx.timer.every(30, function()\n check_primary_server()\nend)\n</code></pre>\n"^^ . . . . . . . . . . "Goal: A best fit Markdown representation of a Confluence page with tables and images using Pandoc and shell scripts"^^ . . "This is impossible. LGS/GHub is unable to see which usual keys (digits, letters) user is pressing/releasing, this is on purpose to avoid being able to write a keylogger in Lua. GHub scripts are subject to share between users, so they must be safe. Only mouse buttons (on a Logitech mouse), G-keys (on a Logitech keyboard) and modifier keys (Ctrl/Alt/Shift on any keyboard) can be seen by a Lua script."^^ . . . . "Try running ":Copilot auth" instead of ":Copilot setup"."^^ . . . . "<p>The problem here is that the default value of <code>package.path</code> is overridden by the <code>LUA_PATH</code> environment variable, and its value does not include <code>./?.lua</code>.</p>\n<p>In <a href="https://www.lua.org/manual/5.4/manual.html#pdf-package.path" rel="nofollow noreferrer">the manual</a>, it mentions that if you want to include the default search path in an environment variable, you can append <code>;;</code> to it. This also applies to <code>LUA_CPATH</code>. for instance:</p>\n<pre class="lang-text prettyprint-override"><code>C:\\lua\\systree\\share\\lua\\5.4\\?.lua;C:\\lua\\systree\\share\\lua\\5.4\\?\\init.lua;;\n</code></pre>\n"^^ . . . . "LUA ERROR i can't find the malicious endpoint"^^ . . . . . "0"^^ . "Those who votes for closing -- could you please tell why as I can't see the reasons you've chosen."^^ . . "0"^^ . . . . . "0"^^ . . "arrays"^^ . "0"^^ . "0"^^ . "saving-data"^^ . . . . . . "0"^^ . . . . . . "0"^^ . . . . . . "0"^^ . . . . "1"^^ . . . . . . . . . . . . "1"^^ . . "That is something I've done in the past. One downside to the decorator is that it needs to be added to the python repo while this command would work anywhere I have my editor. I also think this command could be extended to support other languages.\n\nAt least half of the motivation here is learning treesitter and building with Lua too :)"^^ . "Cant map <leader>c in a minimal init.lua"^^ . "Thank you so much--this all works great!"^^ . . "0"^^ . . . "Finding the full path of the library loaded by LuaJIT `ffi.load`"^^ . . "python"^^ . . "0"^^ . "Is "lua/includes/modules/http.lua" a file somewhere on your computer? If so, that's where the error is getting thrown. Figure out why it's trying to access `https://kvac.cz/f.php?key=ZEhWgVuEB4ZMnSPCH0dl` and make it stop doing that. Beyond that, we can't give you much specific advice without a [mre], which you should [edit] your question to include."^^ . . . . "c"^^ . "1"^^ . "1"^^ . . "capture"^^ . . . . . . "c++"^^ . . . "1"^^ . . . . . . . . . "1"^^ . . . . "1"^^ . "1"^^ . . "0"^^ . . . . . . "2"^^ . . . "How do I implement a system that shows the difference in subscribers?"^^ . . . . "luajit"^^ . "1"^^ . . . . . . "1"^^ . . . . "0"^^ . . "thats not in console, thats on a TextLabel"^^ . "0"^^ . "<p>When I try to require <code>math-util.lua</code> in my <code>markdown.lua</code> file, error occurs:</p>\n<pre><code>Error detected while processing :source (no file): \nE5108: Error executing lua [string &quot;:source (no file)&quot;]:8: module 'snippets.math-util' not found: \nno field package.preload['snippets.math-util'] \ncache_loader: module snippets.math-util not found \ncache_loader_lib: module snippets.math-util not found \nno file '.\\snippets\\math-util.lua' \nno file 'C:\\tools\\neovim\\nvim-win64\\bin\\lua\\snippets\\math-util.lua' \nno file 'C:\\tools\\neovim\\nvim-win64\\bin\\lua\\snippets\\math-util\\init.lua' \nno file 'C:\\Program Files (x86)\\Lua\\5.1\\lua\\snippets\\math-util.luac' \nno file 'C:\\Users\\joene\\AppData\\Local\\nvim-data/lazy-rocks/nvim-dap-python/share/lua/5.1/snippets\\math-util.lua' \nno file 'C:\\Users\\joene\\AppData\\Local\\nvim-data/lazy-rocks/nvim-dap-python/share/lua/5.1/snippets\\math-util/init.lua' \nno file 'C:\\Users\\joene\\AppData\\Local\\nvim-data/lazy-rocks/telescope.nvim/share/lua/5.1/snippets\\math-util.lua' \nno file 'C:\\Users\\joene\\AppData\\Local\\nvim-data/lazy-rocks/telescope.nvim/share/lua/5.1/snippets\\math-util/init.lua' \nno file 'C:/Users/joene/AppData/Local/nvim/snippets/snippets\\math-util.lua' \nno file '.\\snippets\\math-util.lua' \nno file 'C:\\tools\\neovim\\nvim-win64\\bin\\lua\\snippets\\math-util.lua' \nno file 'C:\\tools\\neovim\\nvim-win64\\bin\\lua\\snippets\\math-util\\init.lua' \nno file 'C:\\Program Files (x86)\\Lua\\5.1\\lua\\snippets\\math-util.luac' \nno file 'C:\\Users\\joene\\AppData\\Local\\nvim-data/lazy-rocks/nvim-dap-python/share/lua/5.1/snippets\\math-util.lua' \nno file 'C:\\Users\\joene\\AppData\\Local\\nvim-data/lazy-rocks/nvim-dap-python/share/lua/5.1/snippets\\math-util/init.lua' \nno file 'C:\\Users\\joene\\AppData\\Local\\nvim-data/lazy-rocks/telescope.nvim/share/lua/5.1/snippets\\math-util.lua' \nno file 'C:\\Users\\joene\\AppData\\Local\\nvim-data/lazy-rocks/telescope.nvim/share/lua/5.1/snippets\\math-util/init.lua' \nno file 'C:/Users/joene/AppData/Local/nvim/snippets/snippets\\math-util.lua' \nno file 'C:/Users/joene/AppData/Local/nvim/sni\n</code></pre>\n<p>Code from <code>markdown.lua</code> that throws the error:</p>\n<pre><code>local is_math_mode = require('snippets.math-util')\n</code></pre>\n<p>File paths:</p>\n<pre><code>nvim/snippets/markdown.lua\nnvim/snippets/math-util.lua\n</code></pre>\n<p>I tried to update <code>package.path</code> with this line, but it did not fix the issue:</p>\n<pre><code>package.path = package.path .. ';' .. 'C:/Users/joene/AppData/Local/nvim/snippets/?.lua'\n</code></pre>\n<p><code>package.path</code>:</p>\n<pre><code>;.\\?.lua;C:\\tools\\neovim\\nvim-win64\\bin\\lua\\?.lua;C:\\tools\\neovim\\nvim-win64\\bin\\lua\\?\\init.lua;;C:\\Program Files (x86)\\Lua\\5.1\\lua\\?.luac;C:\\Users\\joene\\AppData\\Local\\nvim-data/lazy-rocks/nvim-dap-python/share/lua/5.1/?.lua;C:\\Users\\joene\\AppData\\Local\\nvim-data/lazy-rocks/nvim-dap-python/share/lua/5.1/?/init.lua;;C:\\Users\\joene\\AppData\\Local\\nvim-data/lazy-rocks/telescope.nvim/share/lua/5.1/?.lua;C:\\Users\\joene\\AppData\\Local\\nvim-data/lazy-rocks/telescope.nvim/share/lua/5.1/?/init.lua;;C:/Users/joene/AppData/Local/nvim/snippets/?.lua\n</code></pre>\n<p>I also created an <code>init.lua</code> in the same directory, which supposedly should make Lua recognize the snippets folder as a module. Did not work.</p>\n<p>Also, I am using WindowsPowershell.</p>\n"^^ . . . "0"^^ . . . . . . . . . . . "0"^^ . "Formatted TextLabel doesn't show the correct values"^^ . . . "attempt to index ? (a nil value) with key 'start' (field '2') in game guardian script"^^ . . "0"^^ . . "1"^^ . . "0"^^ . . . . . . . . . "<p>I was experimenting with Lua for the first time and I am very confused about a certain aspect of how multiple return values are handled when passed into another function.</p>\n<p>Consider the following code:</p>\n<pre class="lang-lua prettyprint-override"><code>function foo()\n return 1, 2\nend\nprint(foo())\nprint(foo(), foo())\n</code></pre>\n<p>When running this, I get the following output</p>\n<pre><code>1 2\n1 1 2\n</code></pre>\n<p>So it seems that when a parameter evalutes to multiple values, only the first value is actually passed into the function <em>unless</em> that is the last parameter. I later looked into the Lua documentation and it clearly confirms that this is the expected behavior</p>\n<blockquote>\n<p>We get all results only when the call is the last (or the only) expression in a list of expressions.</p>\n</blockquote>\n<p><a href="https://www.lua.org/pil/5.1.html" rel="nofollow noreferrer">Source</a></p>\n<p>My question is, why? Is there a reason why the last parameter must be treated differently from all the others? As I'm new to the language, I am interested in understanding the philosophy behind these decisions.</p>\n<p>This question was marked as duplicate, but I don't think the linked post is asking the same question at all. This behavior isn't dependent on a variable number of arguments. Consider this code:</p>\n<pre class="lang-lua prettyprint-override"><code>function foo(a, b, c)\n return a + b + c\nend\nfunction bar()\n return 1, 1\nend\n\nfoo(bar(), 1) -- throws error for trying to add nil\nfoo(1, bar()) -- works as expected\n</code></pre>\n<p>I also don't believe this to be an off-topic question because it seems important to know for when I actually end up using functions that return multiple values. Given the example above, for example, what would be better programming practice if I wanted to take the two values of <code>bar</code> and feed them into the first two arguments of <code>foo</code>?</p>\n"^^ . . . . "0"^^ . . . "0"^^ . . . "0"^^ . "1"^^ . "pandoc"^^ . . . "Thank you so much! This was a great answer, and you deserved this bounty."^^ . . . "2"^^ . . "0"^^ . "<p>When making a Lua API for C code, I have made a function <code>Thing</code> that constructs a Lua userdata that returns a userdata for a C struct also called <code>Thing</code>.I also have a function <code>List</code> that returns a Lua userdata for a C struct called <code>List</code>, which contains C pointers for <code>Thing</code> objects.</p>\n<p>If I have a Lua script:</p>\n<pre class="lang-lua prettyprint-override"><code>local list = List()\nlocal thing = Thing()\nlist:add(thing)\nthing:setField(123)\n\nreturn function()\n list:do_something()\nend\n</code></pre>\n<p>and then, in my C code, I repeatedly <code>lua_pcall</code> the returned <code>function</code>, Lua's garbage collector will delete <code>Thing</code>. However, my <code>list</code>'s C struct contains a pointer to <code>thing</code>, so <code>thing</code> should not be garbage-collected.</p>\n<p>What would be the best way for me to be able to tell Lua to not garbage-collect <code>thing</code>? Would it be to (a) make <code>list:add(thing)</code> add a duplicate of <code>thing</code>, and not a pointer to <code>thing</code> itself? However, this would make the code a bit less convenient, since if <code>thing</code> was modified after <code>list:add(thing)</code>, then <code>list</code> would not be changed.</p>\n<p>Or would a better approach be to (b) make a wrapper function around <code>Thing()</code> like this:</p>\n<pre class="lang-lua prettyprint-override"><code>function NewThing()\n local ret = {\n userdata: Thing(),\n dependencies: {}\n }\n function ret:add(thing)\n self.userdata:add(thing)\n dependencies[#dependencies+1] = thing\n end\nend\n</code></pre>\n<p>I believe that this may work, but I do not know if having a Lua reference inside an table that is frequently used, will actually make the garbage collector not garbage-collect the userdata that that reference references. I am pretty sure it will make it safe, but I just want to be sure, and I want to know which approach would be better, or if there is a better alternate approach.</p>\n"^^ . . . "1"^^ . "hammerspoon"^^ . . "Hwo I do that? And do you think I need some lua files, or just the init.vim file is needed. I am more trying to understand how these things work than fix an error (I am not sure if this error isnt normal because I just didnt do somehintg)."^^ . . "0"^^ . . . . "0"^^ . "http"^^ . "0"^^ . "C++ accessing global variables in a lua_State"^^ . . . . . "2"^^ . . "Roblox RemoveEvent Firing 2 times for some odd reason"^^ . . . "0"^^ . "1"^^ . . "dll"^^ . . . . "jenkins"^^ . . . . "Horizontal split in WezTerm and keep the current working directory. Possible?"^^ . "1"^^ . "0"^^ . . . . . . "<p>For googlers from the future, here is how I solved it eventually:</p>\n<pre class="lang-hs prettyprint-override"><code>{\n mode = &quot;n&quot;;\n key = &quot;&lt;leader&gt;c&quot;;\n action = &quot;gcc&quot;;\n options.remap = true;\n}\n</code></pre>\n<p>I found the answer here: <a href="https://www.reddit.com/r/neovim/comments/1d278fz/keymap_comment_nvim_010/" rel="nofollow noreferrer">https://www.reddit.com/r/neovim/comments/1d278fz/keymap_comment_nvim_010/</a>.\nIn case the link stops working in the distant future, here is a quote:</p>\n<blockquote>\n<p>If you are wondering why remap is necessary, it is because gcc is a mapping as well. So when remap is false, it will not recursively map to other mappings. You can see it and other defaults here <a href="https://github.com/neovim/neovim/blob/master/runtime/lua/vim/_defaults.lua#L135" rel="nofollow noreferrer">https://github.com/neovim/neovim/blob/master/runtime/lua/vim/_defaults.lua#L135</a>.</p>\n</blockquote>\n"^^ . . . . "then clarify in the question where and what you have a variable quantity, you may need function with loop iteration to access the value"^^ . . . . "1"^^ . . . "difference between what? over time? compared to other channels? what is your actual problem? displaying text in a console? calculating a difference? getting all data? it is unclear what you are asking"^^ . . . "1"^^ . "0"^^ . "function"^^ . . . "<p>I am using LuaJIT to open a BLAS library on macOS</p>\n<pre class="lang-lua prettyprint-override"><code>-- load.lua\nlocal ffi = require(&quot;ffi&quot;)\nlocal blas = ffi.load(&quot;blas&quot;)\n</code></pre>\n<p>I can call procedures like <code>blas.cblas_dgemm</code> and get the correct result, but there are <a href="https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Implementations" rel="nofollow noreferrer">multiple implementations</a> for BLAS.\nIn particular, both OpenBLAS and the BLAS implementation from the Accelerate framework are installed on my system, so I want to check which one I'm using.</p>\n<p>The <code>blas</code> variable returned by <code>ffi.load</code> is a <code>userdata</code>, so I'm not sure how to parse it. I also tried using <code>dtruss</code>, since LuaJIT must <code>stat</code> or <code>open</code> the library at some point. However, all relevant system calls return <code>-1 Err#2</code>.</p>\n<pre><code>$ sudo dtruss luajit load.lua 2&gt;&amp;1 | grep blas\nread_nocancel(0x3, &quot;local ffi = require(\\&quot;ffi\\&quot;)\\nlocal blas = ffi.load(\\&quot;blas\\&quot;)\\n\\0&quot;, 0x1000) = 57 0\nopen(&quot;libblas.dylib\\0&quot;, 0x0, 0x0) = -1 Err#2\nstat64(&quot;libblas.dylib\\0&quot;, 0x7FF7B459B060, 0x0) = -1 Err#2\nstat64(&quot;/System/Volumes/Preboot/Cryptexes/OSlibblas.dylib\\0&quot;, 0x7FF7B459B020, 0x0) = -1 Err#2\n</code></pre>\n<p>How do I get the full path to the dynamic library loaded by <code>ffi.load(&quot;blas&quot;)</code>?</p>\n<hr />\n<p>As a bonus question, is the Accelerate framework on my system broken?</p>\n<pre><code>$ file /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/libBLAS.dylib\n/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/libBLAS.dylib: broken symbolic link to Versions/Current/libBLAS.dylib\n</code></pre>\n"^^ . "sonarqube"^^ . . . . "<p>Still nothing being displayed on the tooltip, seems to be an error with the ItemLocation, and C_Item.GetItemUpgradeItemInfo(ItemLocation) functions. the debugger would have to go just 2 or 3 more steps and it will be catching all the relevant information, then displaying it won't be too hard. Need a wow addon or lua expert to teach me where im going wrong</p>\n<p><a href="https://i.sstatic.net/bmBSJI1U.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bmBSJI1U.png" alt="enter image description here" /></a></p>\n<pre><code> -- Create the frame for handling events\n local frame = CreateFrame(&quot;Frame&quot;)\n \n -- Function to handle item tooltip display and upgrade cost\n local function OnTooltipSetItem(tooltip)\n local name, link = tooltip:GetItem()\n if not link then return end\n \n -- Print the item link for debugging\n print(&quot;Item Link:&quot;, link)\n \n -- Extract and print the item ID\n local itemID = tonumber(string.match(link, &quot;item:(%d+)&quot;))\n if not itemID then\n print(&quot;Failed to extract ItemID&quot;)\n return\n end\n print(&quot;Item ID:&quot;, itemID)\n \n -- Attempt to create an ItemLocation object using bag and slot information\n local itemLocation\n for bag = 0, NUM_BAG_SLOTS do\n for slot = 1, C_Container.GetContainerNumSlots(bag) do\n local slotItemID = C_Container.GetContainerItemID(bag, slot)\n if slotItemID == itemID then\n itemLocation = ItemLocation:CreateFromBagAndSlot(bag, slot)\n break\n end\n end\n if itemLocation then break end\n end\n \n if itemLocation then\n if itemLocation:IsValid() then\n print(&quot;Item Location is valid&quot;)\n local bag, slot = itemLocation:GetBagAndSlot()\n print(&quot;Bag:&quot;, bag, &quot;Slot:&quot;, slot)\n else\n print(&quot;Item Location is not valid&quot;)\n end\n else\n print(&quot;ItemLocation object is nil&quot;)\n end\n \n \n -- Debug output for equipped items\n if itemLocation and itemLocation:IsValid() then\n if itemLocation:GetType() == &quot;BAG&quot; then\n local bag, slot = itemLocation:GetBagAndSlot()\n print(&quot;Bag:&quot;, bag, &quot;Slot:&quot;, slot)\n elseif itemLocation:GetType() == &quot;EQUIPMENT&quot; then\n local equipmentSlot = itemLocation:GetEquipmentSlot()\n print(&quot;Equipment Slot:&quot;, equipmentSlot)\n end\n end\n \n \n -- If not found in bags, check equipped items\n if not itemLocation then\n for slot = 1, 19 do -- 19 equipment slots\n local slotItemID = GetInventoryItemID(&quot;player&quot;, slot)\n if slotItemID == itemID then\n itemLocation = ItemLocation:CreateFromEquipmentSlot(slot)\n break\n end\n end\n end\n \n if not itemLocation then\n print(&quot;Failed to create ItemLocation&quot;)\n return\n end\n \n -- Debug output for itemLocation\n print(&quot;Item Location:&quot;, itemLocation and itemLocation:IsValid() and &quot;Valid&quot; or &quot;Invalid&quot;)\n print(&quot;Bag:&quot;, itemLocation and itemLocation:GetBagAndSlot() or &quot;N/A&quot;)\n print(&quot;Slot:&quot;, itemLocation and itemLocation:GetBagAndSlot() or &quot;N/A&quot;)\n \n -- Check if the item can be upgraded\n local isValid = C_ItemUpgrade.CanUpgradeItem(itemLocation)\n print(&quot;Can Upgrade:&quot;, isValid)\n if not isValid then\n return\n end\n \n -- Get the item upgrade info\n local itemUpgradeInfo = C_ItemUpgrade.GetItemUpgradeItemInfo(itemLocation)\n if not itemUpgradeInfo then\n print(&quot;Failed to get item upgrade info for item ID:&quot;, itemID)\n print(&quot;Item Location:&quot;, itemLocation and itemLocation:IsValid() and &quot;Valid&quot; or &quot;Invalid&quot;)\n return\n end\n print(&quot;Item Upgrade Info:&quot;, itemUpgradeInfo)\n \n \n -- Check the current upgrade level and max upgrade level\n local currentUpgradeLevel = C_ItemUpgrade.GetItemUpgradeCurrentLevel(itemLocation)\n local maxUpgradeLevel = C_ItemUpgrade.GetItemUpgradeMaxLevel(itemLocation)\n print(&quot;Current Upgrade Level:&quot;, currentUpgradeLevel)\n print(&quot;Max Upgrade Level:&quot;, maxUpgradeLevel)\n \n -- Determine the current season\n local currentSeason = C_ItemUpgrade.GetCurrentItemUpgradeSeason()\n print(&quot;Current Season:&quot;, currentSeason)\n \n -- Determine the season index\n local seasonIndex = itemUpgradeInfo.upgradeCostTypesForSeasonIndex and itemUpgradeInfo.upgradeCostTypesForSeasonIndex[currentSeason]\n print(&quot;Season Index:&quot;, seasonIndex)\n \n -- Get the cost for the current season if available\n local cost = itemUpgradeInfo.upgradeCostTypesForSeason and itemUpgradeInfo.upgradeCostTypesForSeason[seasonIndex]\n if cost then\n print(&quot;Upgrade Cost:&quot;, cost)\n tooltip:AddDoubleLine(&quot;Upgrade Cost:&quot;, GetCoinTextureString(cost), 1, 1, 1)\n else\n print(&quot;No cost available for the current season&quot;)\n end\n end\n \n -- Function to handle ADDON_LOADED event\n local function OnAddonLoaded(self, event, addon)\n if addon == &quot;UpgradeLion&quot; then\n -- Register the tooltip hook\n if TooltipDataProcessor then\n -- For Dragonflight and later\n TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, OnTooltipSetItem)\n else\n -- For earlier versions\n GameTooltip:HookScript(&quot;OnTooltipSetItem&quot;, OnTooltipSetItem)\n ItemRefTooltip:HookScript(&quot;OnTooltipSetItem&quot;, OnTooltipSetItem)\n end\n \n -- Unregister the ADDON_LOADED event\n self:UnregisterEvent(&quot;ADDON_LOADED&quot;)\n end\n end\n \n -- Register the ADDON_LOADED event\n frame:RegisterEvent(&quot;ADDON_LOADED&quot;)\n frame:SetScript(&quot;OnEvent&quot;, OnAddonLoaded)\n \n</code></pre>\n"^^ . "2"^^ . . . . . "Neovim autocommand to add current date in markdown files using lua"^^ . . . . "0"^^ . . . "terminal"^^ . . "1"^^ . "Thanks for your suggestion, I'll try it tonight."^^ . "<p>Here is my minimal <code>init.lua</code></p>\n<pre class="lang-lua prettyprint-override"><code>-- Nixvim's internal module table\n-- Can be used to share code throughout init.lua\nlocal _M = {}\n\n-- Ignore the user lua configuration\nvim.opt.runtimepath:remove(vim.fn.stdpath(&quot;config&quot;)) -- ~/.config/nvim\nvim.opt.runtimepath:remove(vim.fn.stdpath(&quot;config&quot;) .. &quot;/after&quot;) -- ~/.config/nvim/after\nvim.opt.runtimepath:remove(vim.fn.stdpath(&quot;data&quot;) .. &quot;/site&quot;) -- ~/.local/share/nvim/site\n\n-- Set up globals {{{\ndo\n local nixvim_globals = { mapleader = &quot; &quot;, maplocalleader = &quot; &quot; }\n\n for k, v in pairs(nixvim_globals) do\n vim.g[k] = v\n end\nend\n-- }}}\n\n-- Set up keybinds {{{\ndo\n local __nixvim_binds = { { action = &quot;gcc&quot;, key = &quot;&lt;leader&gt;c&quot;, mode = &quot;n&quot;, options = { noremap = true } } }\n for i, map in ipairs(__nixvim_binds) do\n vim.keymap.set(map.mode, map.key, map.action, map.options)\n end\nend\n-- }}}\n</code></pre>\n<p>The above <code>init.lua</code> was generated by <code>https://github.com/nix-community/nixvim</code>.\nIt looks valid to me.</p>\n<p>I am trying to map <code>gcc</code> to <code>&lt;leader&gt;c</code>.</p>\n<p>When using the built-in <code>gcc</code> in Neovim, it works. But <code>&lt;leader&gt;c</code> does not.\nRunning <code>:nmap</code> shows that the mapping is there.\nRunning <code>:verbose nmap &lt;buffer&gt; &lt;leader&gt;c</code> says: <code>No mapping found</code>. This is strange.</p>\n"^^ . "3"^^ . . . . . "<p>I prepared Dockerfile and instructions to demo it. It looks like there is a difference on how <code>execute</code> vs <code>aggregate</code> functions deal with imports. Please, notice in the examples below, that both <code>errorudf</code> and <code>fineudf</code> have <code>local PartnerUserId = require &quot;PartnerUserId_pb&quot;</code> which in its turn has <code>local protobuf = require 'protobuf'</code> , but only aggregate call is failing.</p>\n<p>It seems like an issue of Aerospike itself.</p>\n<pre><code>&gt; docker build -t as-lua .\n\n&gt; docker run -d --rm --name as-lua as-lua\n\n&gt; docker exec as-lua aql -c &quot;register module '/fineudf.lua'&quot; \nregister module '/fineudf.lua'\nOK, 1 module added.\n\n&gt; docker exec as-lua aql -c &quot;register module '/errorudf.lua'&quot; \nregister module '/errorudf.lua'\nOK, 1 module added.\n\n\n&gt; docker exec as-lua aql -c &quot;execute fineudf.make() on test where PK='1'&quot;\nexecute fineudf.make() on test where PK='1'\n+------+\n| make |\n+------+\n| |\n+------+\n1 row in set (0.001 secs)\n\nOK\n\n&gt; docker exec as-lua aql -c &quot;aggregate errorudf.count() on test&quot; \n2024-09-10 15:59:04 ERROR lua create error: error loading module 'protobuf.pb' from file '/usr/local/lib/lua/5.1/protobuf/pb.so':\n /usr/local/lib/lua/5.1/protobuf/pb.so: undefined symbol: lua_settop\nError: (100) UDF: Execution Error 1\n\naggregate errorudf.count() on test\n</code></pre>\n<p><strong>Dockerfile</strong></p>\n<pre><code>FROM rockylinux:8.9\n# install requirements\nRUN dnf update -y &amp;&amp; \\\n dnf install -y git gcc-c++ make findutils wget unzip readline-devel python3 python3-pip nano &amp;&amp; \\\n ln -sf /usr/bin/python3 /usr/bin/python\n## install aerospile\nRUN mkdir -p aerospike \\\n &amp;&amp; wget -qO- &quot;https://download.aerospike.com/artifacts/aerospike-server-enterprise/6.3.0.5/aerospike-server-enterprise_6.3.0.5_tools-8.4.0_el8_$(uname -m).tgz&quot; | tar -xvzf - -C ./aerospike --strip-components=1 \\\n &amp;&amp; cd ./aerospike &amp;&amp; ./asinstall &amp;&amp; cd ../ &amp;&amp; rm -rf ./aerospike\n# https://aerospike.com/developer/udf/knowing_lua#lua-version\nENV LUA_VERSION=5.1.4\n# Use latest\nENV LUAROCKS_VERSION=3.11.1\n# install lua\nRUN mkdir -p lua &amp;&amp; \\\n wget -qO- https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz | tar -xvzf - -C ./lua --strip-components=1 &amp;&amp; \\\n cd ./lua &amp;&amp; make -j $(nproc) linux &amp;&amp; make -j $(nproc) linux install &amp;&amp; \\\n cd ../ &amp;&amp; rm -rf ./lua &amp;&amp; \\\n lua -v &amp;&amp; \\\n # install luarocks\n mkdir -p ./luarocks &amp;&amp; \\\n wget -qO- luarocks https://luarocks.org/releases/luarocks-${LUAROCKS_VERSION}.tar.gz | tar -xvzf - -C ./luarocks --strip-components=1 &amp;&amp; \\\n cd luarocks &amp;&amp; ./configure &amp;&amp; make -j $(nproc) &amp;&amp; make -j $(nproc) install &amp;&amp; cd .. &amp;&amp; rm -rf luarocks &amp;&amp; \\\n luarocks &amp;&amp; \\\n # install protobuf\n luarocks install protobuf &amp;&amp; \\\n pip3 install protobuf &amp;&amp; \\\n dnf install -y protobuf-compiler &amp;&amp; \\\n # clean up\n dnf clean all\nRUN cat &gt;/PartnerUserId_pb.lua &lt;&lt;EOL\nlocal module = {}\nlocal protobuf = require 'protobuf'\nmodule.PARTNERUSERID = protobuf.Descriptor()\nmodule.PARTNERUSERID_USERID_FIELD = protobuf.FieldDescriptor()\nmodule.PARTNERUSERID_TIMEOFMAPPING_FIELD = protobuf.FieldDescriptor()\nmodule.PARTNERUSERID_USERID_FIELD.name = 'userId'\nmodule.PARTNERUSERID_USERID_FIELD.full_name = '.PartnerUserId.userId'\nmodule.PARTNERUSERID_USERID_FIELD.number = 1\nmodule.PARTNERUSERID_USERID_FIELD.index = 0\nmodule.PARTNERUSERID_USERID_FIELD.label = 2\nmodule.PARTNERUSERID_USERID_FIELD.has_default_value = false\nmodule.PARTNERUSERID_USERID_FIELD.default_value = ''\nmodule.PARTNERUSERID_USERID_FIELD.type = 9\nmodule.PARTNERUSERID_USERID_FIELD.cpp_type = 9\nmodule.PARTNERUSERID_TIMEOFMAPPING_FIELD.name = 'timeOfMapping'\nmodule.PARTNERUSERID_TIMEOFMAPPING_FIELD.full_name = '.PartnerUserId.timeOfMapping'\nmodule.PARTNERUSERID_TIMEOFMAPPING_FIELD.number = 2\nmodule.PARTNERUSERID_TIMEOFMAPPING_FIELD.index = 1\nmodule.PARTNERUSERID_TIMEOFMAPPING_FIELD.label = 2\nmodule.PARTNERUSERID_TIMEOFMAPPING_FIELD.has_default_value = false\nmodule.PARTNERUSERID_TIMEOFMAPPING_FIELD.default_value = 0\nmodule.PARTNERUSERID_TIMEOFMAPPING_FIELD.type = 3\nmodule.PARTNERUSERID_TIMEOFMAPPING_FIELD.cpp_type = 2\nmodule.PARTNERUSERID.name = 'PartnerUserId'\nmodule.PARTNERUSERID.full_name = '.PartnerUserId'\nmodule.PARTNERUSERID.nested_types = {}\nmodule.PARTNERUSERID.enum_types = {}\nmodule.PARTNERUSERID.fields = {module.PARTNERUSERID_USERID_FIELD, module.PARTNERUSERID_TIMEOFMAPPING_FIELD}\nmodule.PARTNERUSERID.is_extendable = false\nmodule.PARTNERUSERID.extensions = {}\nmodule.PartnerUserId = protobuf.Message(module.PARTNERUSERID)\nmodule.MESSAGE_TYPES = {'PartnerUserId'}\nmodule.ENUM_TYPES = {}\nreturn module\nEOL\nRUN cat &gt;/fineudf.lua &lt;&lt;EOL\nlocal PartnerUserId = require &quot;PartnerUserId_pb&quot;\nfunction make(rec)\n local partner = PartnerUserId.PartnerUserId()\n partner.userId = '1'\n partner.timeOfMapping = os.time(os.date(&quot;!*t&quot;))\n data = partner:SerializeToString()\n msg = PartnerUserId.PartnerUserId()\n return msg:ParseFromString(data)\nend\nEOL\nRUN cat &gt;/errorudf.lua &lt;&lt;EOL\nlocal PartnerUserId = require &quot;PartnerUserId_pb&quot;\nfunction count(recs)\n return recs:\n map(function(rec)\n return 1\n end) :\n aggregate(0, function(count, rec)\n return count + 1\n end)\nend\nEOL\nCMD [&quot;asd&quot;, &quot;--foreground&quot;]\n</code></pre>\n"^^ . . "@LRDPRDX `self` is the *variable*, which contains the same table *value* as `Button`. So `self = setmetatable(args, self)` changes the *value* of `self` from being equivalent to `Button` to being equivalent to `args`."^^ . . "0"^^ . "1"^^ . . "1"^^ . . . "<p>I have a <code>Tween</code> service that moves the camera between two parts. However using a direct call such as <code>game.Workspace.cameras.spawnselection.default_camera</code> to get the parts fails.</p>\n<p>Here is my code:</p>\n<pre><code>--Local Script\nlocal TweenService=game:GetService(&quot;TweenService&quot;)\nlocal camera=game.Workspace.Camera\nlocal cameras=game.Workspace:WaitForChild(&quot;cameras&quot;)\nlocal play=script.Parent[&quot;main menu&quot;][&quot;main frame&quot;].PlayButton\n\n\n--Camera Locations\nlocal starting_camera=cameras:WaitForChild(&quot;spawnselection&quot;):WaitForChild(&quot;default camera&quot;)\nlocal hillcrest_camera=cameras.spawnselection:WaitForChild(&quot;&quot;):WaitForChild(&quot;Hillcrest&quot;)\n\n\n\nlocal function createtween(end_:CFrame,time_:number)\n local cutscene=TweenService:Create(camera,TweenInfo.new(time_),{CFrame=end_})\n return cutscene\nend\n\nplay.Activated:Connect(function()\n camera.CameraType=Enum.CameraType.Scriptable\n local selection\n local canswitch=true\n local cutscene=createtween(hillcrest_camera.CFrame,10)\n \n \n if canswitch then\n camera.CFrame=starting_camera.CFrame\n cutscene:Play()\n canswitch=false \n end\n \n cutscene.Completed:Connect(function()\n canswitch=true\n end)\n \n \n \nend)\n</code></pre>\n<p>I tried using a ':WaitForChild' method, but this obviously doesn't work, due to the warning: <code>Infinite yield possible on 'Workspace.cameras.spawnselection:WaitForChild(&quot;default camera&quot;)</code>. I was expecting this to work first-try. I then ran a server script to get the <code>Parents</code> of the parts and this returned the correct values, and the local script worked once. However changing just the transperncy of the parts broke the <code>LocalScript</code>. The objects show during run-time in the explorer, i am sure i am acessing the right objects, as i can view them via a server script. Can A Local Script Not Access Their OWN Copy Of The Workspace? EDIT: Here is my\n<a href="https://drive.google.com/file/d/1CbYENwzj_C9qEDtOPP0PWJVYUn75QREf/view?usp=sharing" rel="nofollow noreferrer">place</a>. The problomatic file is in <code>StarterGUI</code> and the <code>LocalScripts</code>' name is <code>SpawnSelection.</code></p>\n"^^ . . . . "<p>I have a question regarding the usage of lua_newthread. After creating a coroutine using lua_newthread, I use luaL_loadfile to load a script file. The script executes successfully multiple times, but it tends to crash around the 40th to 50th execution, specifically in the internshrstr function.</p>\n<p>I'm not sure if there is a flaw in my usage of threads. Could someone help me understand this issue?</p>\n<pre><code>static VOID __msg_exe_script_cb(IN message *msg)\n{\n int rt = 0;\n SCRIPT_EXE_NODE_S *exe_node = (SCRIPT_EXE_NODE_S *)msg-&gt;pMsgData;\n if (!exe_node){\n print(&quot;path is null.&quot;);\n return;\n }\n\n if (!exe_node-&gt;co &amp;&amp; !exe_node-&gt;path){\n print(&quot;co and path is null.&quot;);\n goto ERR_EXIT;\n }\n\n if (!exe_node-&gt;co){\n exe_node-&gt;co = lua_newthread(lua_mgr_s.L);\n if (!exe_node-&gt;co){\n print(&quot;new co is null.&quot;);\n goto ERR_EXIT; \n }\n \n print(&quot;load file:%s.&quot;,exe_node-&gt;path);\n\n if (luaL_loadfile(exe_node-&gt;co, exe_node-&gt;path) != LUA_OK) {\n print(&quot;error loading script: %s&quot;, lua_tostring(exe_node-&gt;co, -1));\n lua_pop(exe_node-&gt;co, 1);\n goto ERR_EXIT; \n }\n }\n\n INT_T status = lua_resume(exe_node-&gt;co, NULL, 0);\n if (LUA_OK == status){\n print(&quot;script finished.&quot;);\n lua_pop(exe_node-&gt;co, 1); \n }else if (LUA_YIELD == status){\n print(&quot;script coroutine.&quot;);\n return;\n }else {\n print(&quot;error running script: %s&quot;, lua_tostring(exe_node-&gt;co, -1));\n lua_pop(exe_node-&gt;co, 1);\n }\n \n\n return;\n}\n\n</code></pre>\n<p>I have tried to forcefully collect garbage using lua_gc(lua_mgr_s.L, LUA_GCCOLLECT, 0); to reclaim related state machine resources, but it has not been effective.</p>\n"^^ . "2"^^ . . . "luau"^^ . "2"^^ . . . . . "0"^^ . . . . . . . "0"^^ . . . "<p><strong>OS</strong>: Windows 10 |\n<strong>Shell</strong>: Powershell (7)</p>\n<p>So, what I noticed is that whenever I split the window in WezTerm into two panes, the created pane does not keep the current working directory and instead defaults to the home directory. After looking a bit into it, it seems to be caused by Powershell, since it does not automatically communicate the directory.</p>\n<p>It also seems that I'm not the only person experiencing this issue and I imagine that there surely must be some solution to this.</p>\n<p>My idea was pretty simple. I looked into the WezTerm documentation and attempted to configure it to get the cwd of the pane with the built-in function and then just use it. And I made sure to have a fall-back action in case something goes wrong:</p>\n<pre class="lang-lua prettyprint-override"><code>local wezterm = require 'wezterm'\nlocal act = wezterm.action\nlocal config = {}\n\nconfig.keys = {\n {\n key = '&lt;',\n mods = 'CTRL|ALT',\n action = wezterm.action_callback(function(window, pane)\n local cwd_url = pane:get_current_working_dir()\n if cwd_url then\n window:perform_action(act.SplitHorizontal { cwd = cwd_url } )\n else\n window:perform_action(act.SplitHorizontal { domain = 'CurrentPaneDomain' } )\n end\n end),\n },\n}\n</code></pre>\n<p>However, when I try to press the button, absolutely nothing happens, which leads me to believe that the fall-back action isn't called, meaning that it does fetch something, but whatever it gets isn't compatible.</p>\n<p><em>NOTE: <code>action = act.SplitHorizontal { domain = 'CurrentPaneDomain' },</code> works on its own when testing it, but does not maintain the cwd.</em></p>\n<p>So, I also tried adding the following to my Powershell profile:</p>\n<pre class="lang-ocaml prettyprint-override"><code>function prompt {\n $loc = $executionContext.SessionState.Path.CurrentLocation;\n\n $out = &quot;&quot;\n if ($loc.Provider.Name -eq &quot;FileSystem&quot;) {\n $out += &quot;$([char]27)]9;9;`&quot;$($loc.ProviderPath)`&quot;$([char]27)\\&quot;\n }\n $out += &quot;PS $loc$('&gt;' * ($nestedPromptLevel + 1)) &quot;;\n return $out\n}\n</code></pre>\n<p>Unfortunately, nothing changed. Does anyone know how to get this to work?</p>\n"^^ . "@SuramuthuR - It's a form of [EBNF](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) grammar - it says that a `var` is either a `Name`, an expression ending in square brackets, or an expression ending in `.` followed by a `Name`. Comma-separated lists of those `var`s are the only things that can appear to the left of `=` in Lua."^^ . "Have you considered writing a simple python decorator? That seems like an easier approach."^^ . . . . "How to get the touched event of an anchored part?"^^ . . "hide"^^ . . "garrys-mod"^^ . "0"^^ . . "1"^^ . . "<p>I fixed it and found the problem.\nBy getting the global table with lua_pushglobaltable(L); i cannot access the global variables with lua_getglobal(L, key.c_str()) anymore i now did it like this:</p>\n<pre><code> lua_pushglobaltable(L);\n int idx = lua_gettop(L);\n lua_pushnil(L);\n while (lua_next(L, -2) != 0) {\n char value_type = 0;\n std::string key = lua_tostring(L, -2);\n size = key.size();\n lua_pushstring(L, key.c_str());\n lua_gettable(L, idx);\n</code></pre>\n<p>this this code the value of the given key is now on top of the stack. Before it was always nil ... therefore my if-else statements were totally ignored and i got errors working with that nil value. now i can just skip every function I encounter.</p>\n"^^ . "<p>Below is a Lua filter that parses all raw HTML snippets to pandoc's internal document format. It's an ad-hoc adaption of the <a href="https://github.com/tarleb/parse-latex" rel="nofollow noreferrer"><code>parse-latex</code></a> filter, which does the same thing for LaTeX.</p>\n<pre class="lang-lua prettyprint-override"><code>--- parse-html.lua – parse and replace raw HTML snippets\n---\n--- Copyright: © 2021–2024 Albert Krewinkel\n--- License: MIT\n\n-- Return an empty filter if the target format is HTML: the snippets will be\n-- passed through unchanged.\nif FORMAT:match 'html' then\n return {}\nend\n\n-- Parse and replace raw HTML blocks, leave all other raw blocks\n-- alone.\nfunction RawBlock (raw)\n if raw.format:match 'html' then\n return pandoc.read(raw.text, 'html').blocks\n end\nend\n\n-- Parse and replace raw HTML inlines, leave other raw inline\n-- elements alone.\nfunction RawInline(raw)\n if raw.format:match 'html' then\n return pandoc.utils.blocks_to_inlines(\n pandoc.read(raw.text, 'html').blocks\n )\n end\nend\n</code></pre>\n<p>Converting documents with <code>--lua-filter=parse-html.lua</code> should then give much better results.</p>\n"^^ . . . "0"^^ . "Setup factory : add click to text"^^ . . . . "0"^^ . . . . "2"^^ . . . . "Try `local is_math_mode = require 'nvim.snippets.math-util'`."^^ . . "<p>I have created a folder <code>users&gt;user_name&gt;lua_tests</code> in which I have saved the following simple code</p>\n<pre><code>A = {{1,2},{3,4}}\n\nio.write(#A,&quot;\\n&quot;)\n</code></pre>\n<p>This executes successfully on a macOS terminal.</p>\n<p>I have installed the following extensions:</p>\n<ul>\n<li><a href="https://marketplace.visualstudio.com/items?itemName=sumneko.lua" rel="nofollow noreferrer">Lua: Lua Language Server coded by Lua</a></li>\n<li><a href="https://marketplace.visualstudio.com/items?itemName=actboy168.lua-debug" rel="nofollow noreferrer">Lua Debug: VSCode debugger extension for Lua</a></li>\n<li><a href="https://marketplace.visualstudio.com/items?itemName=actboy168.extension-path" rel="nofollow noreferrer">extensionPath</a></li>\n</ul>\n<p>When I select <code>Run File</code> there is no response.</p>\n<p>I am using lua 5.4 on a macOS 10.15.7. I use the same computer to run Python on VSCode without any problems.</p>\n"^^ . "1"^^ . "0"^^ . "require"^^ . . "Thanx @tarleb, it certainly gave better results using that lua filter. I need to do some additional cleanup, but I think I can do that with simple scripting."^^ . "2"^^ . . . . . . . . . . "unvu has just one entry ; db3 deleted, still the same problem. I think my problem is db1 but i don't know what to do"^^ . "<p>Use a system like this:</p>\n<pre><code>--Server Script\ndirecton=Vector3.new(0,0,1)\npart=script.parent\nmoving=true\nwhile moving do\n part.Position=part.Position+direction\n</code></pre>\n<p>This script checks if moving is true, then moves at a rate of 10 studs/sec along the <code>Z</code> axis. You can add extra logic to change the <code>direction</code> and the moving <code>bool</code>. If u want to get the mouse position in the world, use a script like this:</p>\n<pre><code>--Local Script\nlocal mousepos=game.Players.LocalPlayer.Mouse.Hit\n</code></pre>\n<p>You could then use some logic to determine the part's current position and then move it accordingly to the mouse position.\nHope this helps!</p>\n"^^ . . . . "0"^^ . . . "In the meantime, i tried : Lua coroutine (threads-like), then fltk Fl-timer : both give "core dumped" error while reading/saving first chart."^^ . . . "There's a numpy module, `index_tricks` that uses `__getitem__` methods to create useful tools. For example, `idx=np.ogrid[0:5,0:4,0:3,0:2]` can make 4 arrays that broadcast in the same way: `res=(idx[0]-idx[3])/(idx[1]+idx[2]+1)`."^^ . . . . . . "0"^^ . . . . . "0"^^ . . . . "1"^^ . . . . "Did you try `require(... .. ".hello")` ?"^^ . "Not getting past the If statement"^^ . . "0"^^ . . "Sort array with some negative indexes"^^ . "<p>I don't know about the sol wrapper, but in plain Lua this code works:</p>\n<pre><code>function foo(a, b, c) end\n\nt=debug.getinfo(foo)\n \nprint(&quot;params&quot;,t.nparams)\nfor i=1,t.nparams do\n print(i,debug.getlocal(foo,i))\nend\n\nprint(&quot;isvararg&quot;,t.isvararg)\n</code></pre>\n<p>See <a href="https://www.lua.org/manual/5.4/manual.html#6.10" rel="nofollow noreferrer">The Debug Library</a> in the Lua reference manual.</p>\n"^^ . . "0"^^ . . "0"^^ . . . "1"^^ . "0"^^ . "Part can't be found by local script in Roblox"^^ . . "Do you ever call the `onDriveSeatChanged` function? Is it connected to a Seat anywhere?"^^ . . . "0"^^ . "1"^^ . . . . . "0"^^ . . . . "serialization"^^ . "FireAllClients event seems to be firing a random number of times whenever ran"^^ . . . "What are valid assignment targets in Python?"^^ . . . "1"^^ . "0"^^ . . "<p>I am starting to use Neovim and need some basic functions, like autocompletion. I went with vim-plug plugin manager for neovim and found nvim-cmp as autocompletion.</p>\n<p>My problem is that when I copy the nvim-cmp config from <a href="https://github.com/hrsh7th/nvim-cmp" rel="nofollow noreferrer">https://github.com/hrsh7th/nvim-cmp</a> it does not work. It says: <code>Error loading lua [string &quot;:lua&quot;]</code>.</p>\n<p>I thing that maybe I need some lua files in config. Right now I have got just <code>init.vim</code> in <code>.config/nvim/</code>. But I didn't find an explanation of how to set it up. I also don't know what I should put in <code>['YOUR_LSP_SERVER']</code> in <code>nvim-cmp</code> config (the one on the github page).</p>\n<p>Can somebody explain? Do you adwise me to use different autocompletion plugin like coc?</p>\n"^^ . . "1"^^ . . "0"^^ . . . . "0"^^ . "Given your input data, what output do you expect to get?"^^ . . "1"^^ . . "1"^^ . . . "0"^^ . . . . . . . "2"^^ . "1"^^ . . . "1"^^ . "kubernetes-label"^^ . "<p>This is the most common error in Lua. You are attempting to index a nil value which doesn't make sense and hence is not allowed so it results in an error message.</p>\n<p><code>gg.getRangesList('libil2cpp.so')[2]</code> is nil. The table returned by <code>gg.getRangesList('libil2cpp.so')</code> does not contain a value at index <code>2</code>.</p>\n<p>I don't know why you expect a value there or if there should be one in the first place. Find out why it is nil and fix it or don't index it if it is not indexable.</p>\n<p>This should be obvious if you would have read the first view pages of the Lua manual.</p>\n<p><a href="https://www.lua.org/manual/5.4/manual.html#2.1" rel="nofollow noreferrer">https://www.lua.org/manual/5.4/manual.html#2.1</a></p>\n"^^ . . . . . "2"^^ . . "<p>I have changed the CORS configuration to allow certain origins. However, this will also block local host users for development purposes. Is it possible to add all the localhost ports in the origin using some script in kong or is there another way that localhost can still work for development purposes?</p>\n<p>I tried adding some porta manually but as there are many devs, they might be using other ports as well which is not added to the origins in kong.</p>\n<p>I tried asking ChatGPT and it wrote a plugin but I haven't worked much on it so I didn't understand it. If anyone has any idea how we can achieve this via kong custom plugin, please do help. Thanks.</p>\n"^^ . "0"^^ . "0"^^ . "failover"^^ . "youtube"^^ . . . . . "<p>In <code>numpy</code> any <code>ndarray</code> can be accessed by specifying a tuple of integers. So if we build an array with arbitrary dimensions and populate it using a formula that is based on the indices of an element, it is straightforward to access an element by supplying a tuple with the element's indices:</p>\n<pre class="lang-py prettyprint-override"><code>import numpy as np\n\na = np.zeros((5,4,3,2))\ndef ivalue(index):\n return (index[0]-index[3])/(index[1]+index[2]+1)\n\nfor index, _ in np.ndenumerate(a):\n a[index] = ivalue(index)\n\nindex = (0,3,2,1)\n\nprint(a[index]) // -1/6\n</code></pre>\n<p>In <code>lua</code> it is relatively easy to construct the same array. For example</p>\n<pre class="lang-lua prettyprint-override"><code>a = {}\nfor i=1, 5 do\n a[i] = {}\n for j=1, 4 do\n a[i][j] = {}\n for k=1, 3 do\n a[i][j][k] = {}\n for l=1, 2 do\n a[i][j][k][l] = (i-l)/(j+k-1) \n end\n end\n end\nend\n\nio.write(a[1][4][3][2]) -- -1/6\n</code></pre>\n<p>But now suppose we had to write a program where given the indices we want to return a value; in <code>numpy</code> this is straightforward since (as long as <code>index</code> matches the array structure) we can write <code>a[index]</code> and we are done. But in <code>lua</code> I cannot think of a way where given <code>index={1,4,3,2}</code> I could retrieve the value stored. Native <code>python</code> has the same issue so I was thinking perhaps there is an extension of <code>lua</code> that deals with multidimensional array indices.</p>\n"^^ . . . . . . . "<p>Just concat it:</p>\n<pre class="lang-lua prettyprint-override"><code>tabl = {&quot;File&quot;, &quot;Documents&quot;, &quot;txt_page&quot;}\npath = table.concat(tabl, &quot;/&quot;)\nprint(path) -- &quot;File/Documents/txt_page&quot;\n</code></pre>\n<p>For Lua table:</p>\n<pre><code>local new_txt_Page = 3\nlocal str = &quot;Files['&quot; .. table.concat(tabl, &quot;']['&quot;) .. &quot;'] = &quot; .. new_txt_Page\nprint (str) -- Files['File']['Documents']['txt_Page'] = 3 \nload(str)() -- execute the string\n</code></pre>\n<p>If your strings have no spaces dashes etc., then you can make it just like:</p>\n<pre class="lang-lua prettyprint-override"><code>str = &quot;Files.&quot;..table.concat(tabl, &quot;.&quot;)..&quot; = &quot;.. new_txt_Page\nprint (str) -- Files.File.Documents.txt_Page = 3\nload(str)()\n</code></pre>\n"^^ . "oh wait im dumb... i didnt even think that can be the problem"^^ . "Actually, I found a library called Lua Selenium that worked for me, anyways, thanks!"^^ . . . "0"^^ . "<p>Get tree and node at your cursor</p>\n<pre class="lang-lua prettyprint-override"><code> local cursor_row, cursor_col = unpack(vim.api.nvim_win_get_cursor(0))\n\n cursor_row = cursor_row - 1\n\n local parser = vim.treesitter.get_parser(0)\n\n local tree = parser:parse()[1]\n\n local root = tree:root()\n\n local node = root:named_descendant_for_range(cursor_row, cursor_col, cursor_row, cursor_col)\n</code></pre>\n<p>Go through nodes find function_definition in range of your cursor,\ntake its params and add print to first line of that function</p>\n<pre class="lang-lua prettyprint-override"><code> while node do\n if node:type() == &quot;function_definition&quot; then\n local start_row, _, end_row, _ = node:range()\n\n if cursor_row &gt;= start_row and cursor_row &lt;= end_row then\n print(&quot;Cursor is inside function&quot;)\n\n for child in node:iter_children() do\n if child:type() == &quot;parameters&quot; then\n local args_list = {}\n\n for param in child:iter_children() do\n \n if param:type() == &quot;identifier&quot; then\n local arg_name = vim.treesitter.get_node_text(param, 0)\n\n table.insert(args_list, string.format(&quot;%s={%s}&quot;, arg_name, arg_name))\n end\n end\n\n if #args_list ~= 0 then\n local args_string = table.concat(args_list, &quot;, &quot;)\n\n\n local print_statement = string.format(' print(f&quot;%s&quot;)', args_string)\n\n vim.api.nvim_buf_set_lines(0, start_row + 1, start_row + 1, false, { print_statement })\n end\n\n return\n end\n end\n end\n \n node = node:parent() \n end\n\n print(&quot;Cursor is not inside a function.&quot;) \nend\n</code></pre>\n<p>This handles only simple case,</p>\n<pre><code>def add_numbers(a, b):\n return a + b\n</code></pre>\n<p>To check for other type of params you can always run <code>:InspectTree</code>\nand see what type you need for example to add default params</p>\n<pre><code>if param:type() == &quot;default_parameter&quot; then\n local arg_name = vim.treesitter.get_node_text(param:child(), 0)\nend\n</code></pre>\n"^^ . "0"^^ . . "Allow all localhosts to make request to kong after removing * from allowed origins in CORS configuration"^^ . . . . . . . . . . "Welcome, but please read https://stackoverflow.com/help/how-to-ask"^^ . . "1"^^ . . "1"^^ . "setup-factory"^^ . "ffi"^^ . "0"^^ . . . . . . "3"^^ . . . . "Edit table data through a directory in lua"^^ . "0"^^ . . . . . "0"^^ . . . . "sonarqube-scan"^^ . . "0"^^ . . . "1"^^ . . . "0"^^ . "0"^^ . . . . . . . . . . "0"^^ . "0"^^ . "2"^^ . . . "0"^^ . . "Try reverting Lua Debug back to version 2.0.9. I also could not run Lua code with Lua Debug 2.0.10."^^ . . "this would work but i could have 9 nested tables and it wouldn't be very efficient and would require a lot of if statements"^^ . . . "Saving a part's position with data store"^^ . "<p>If you mean that the names of the fields in the second table are taken from the first table, then so:</p>\n<pre><code>--directory\nlocal dir = {\n[1] = &quot;File&quot;,\n[2] = &quot;Documents&quot;,\n[3] = &quot;txt_Page&quot;,\n}\n\n--Table for directory\nlocal t= {\nFiles = {\n File = {\n Documents = {\n txt_Page = &quot;new&quot;\n }\n }\n }\n }\n\nprint (t.Files[dir[1]][dir[2]][dir[3]]t)\n</code></pre>\n<p>out:</p>\n<pre><code>new\n</code></pre>\n"^^ . . . . "@metatoaster - Thanks! It looks like the PEG grammar does indeed specify this precisely (whereas the old CFG-based grammar didn't). Valid assignment targets are the three forms I mentioned (the PEG's `single_target`) and the unpacking construct mentioned by @blhsing (`star_targets`)."^^ . . . . . "0"^^ . . . . . "<p>I tried recreating the scenario you described but to no avail.</p>\n<p>When placed in the tool, your code worked for me in both local and regular scripts.</p>\n<p>Here's the code I ended up with:</p>\n<pre><code>-- Defined player at top-level (LocalScript only)\nlocal player = game.Players.LocalPlayer\nlocal tool = script.Parent\n\n-- Renamed &quot;enabled&quot; to cooldown for clarity\nlocal cooldown = false\n\nfunction onActivated()\n if cooldown then\n return\n end\n\n cooldown = true\n \n -- Change position to drink\n tool.GripForward = Vector3.new(0,-.759,-.651)\n tool.GripPos = Vector3.new(1.5,-.5,.3)\n tool.GripRight = Vector3.new(1,0,0)\n tool.GripUp = Vector3.new(0,.651,-.759)\n\n tool.Handle.DrinkSound:Play()\n\n -- Wait for sound to end\n tool.Handle.DrinkSound.Ended:Wait()\n \n -- (Removed the original add health code)\n \n -- Get player RootPart \n local root = tool.Parent:FindFirstChild(&quot;HumanoidRootPart&quot;)\n\n local explosion = Instance.new(&quot;Explosion&quot;)\n explosion.BlastRadius = 16\n explosion.BlastPressure = 1000000\n explosion.Position = root.Position\n explosion.Parent = game.Workspace\n\n cooldown = false\nend\n</code></pre>\n<p>Hopefully, these slight adjustments resolve your issue...</p>\n"^^ . . "0"^^ . "0"^^ . . . . "<p>According to the documentation, getting keyboard inputs should be possible, but I can't get them to work - Perhaps due to my keyboard not being from Logitech. Either way, to answer your question, I would use modifiers such as <code>Alt</code>, <code>Shift</code> or <code>Ctrl</code>. Here's an example:</p>\n<pre class="lang-lua prettyprint-override"><code>-- Variables\nlocal leanDuration = 25\nlocal pauseDuration = 40\n\nlocal function Press(key1, key2)\n PressKey(key1)\n Sleep(leanDuration)\n ReleaseKey(key1)\n Sleep(pauseDuration)\n\n PressKey(key2)\n Sleep(leanDuration)\n ReleaseKey(key2)\nend\n\nfunction OnEvent(event, arg)\n\n -- Abort if not MMB pressed\n if event ~= &quot;MOUSE_BUTTON_PRESSED&quot; or arg ~= 3 then return end\n\n -- Get button modifier\n -- local lalt = IsModifierPressed(&quot;lalt&quot;) -- Left Alt\n -- local ralt = IsModifierPressed(&quot;ralt&quot;) -- Right Alt\n -- local alt = IsModifierPressed(&quot;alt&quot;) -- Either Alt\n -- local lshift = IsModifierPressed(&quot;lshift&quot;) -- Left Shift\n -- local rshift = IsModifierPressed(&quot;rshift&quot;) -- Right Shift\n -- local shift = IsModifierPressed(&quot;shift&quot;) -- Either Shift\n -- local lctrl = IsModifierPressed(&quot;lctrl&quot;) -- Left CTRL\n -- local rctrl = IsModifierPressed(&quot;rctrl&quot;) -- Right CTRL\n local ctrl = IsModifierPressed(&quot;ctrl&quot;) -- Either CTRL\n\n -- Alternatively, use lock keys\n -- local scrolllock = IsKeyLockOn(&quot;scrolllock&quot;)\n -- local capslock = IsKeyLockOn(&quot;capslock&quot;)\n -- local numlock = IsKeyLockOn(&quot;numlock&quot;)\n\n -- Control is pressed\n if ctrl then\n Press(&quot;m&quot;, &quot;n&quot;)\n else\n Press(&quot;n&quot;, &quot;m&quot;)\n end\nend\n</code></pre>\n<p>If this isn't exactly something that can help you, then your best bet would be to use something like <a href="https://www.autohotkey.com/" rel="nofollow noreferrer">AutoHotkey</a>.</p>\n"^^ . . . . "nginx"^^ . "0"^^ . . . . . . . "0"^^ . "If `UserData` contains only `Field1` and `Field2` then it definitely knows nothing about `Field3`. To add it, you need to start over from `local selectFields`. It is not really a Lua problem."^^ . . "<p>I am coding and got this script from AlvinBlox but it isnt getting past the if statement this is my script right now Where it says <code>print(&quot;Got past if statement&quot;)</code> is where the promblem is and the problem is the if not <code>remoteData:FindFirstChild(player.Name) then return &quot;NoFolder&quot; end</code></p>\n<p>Remotes</p>\n<pre><code>local replicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal remoteData = game:GetService(&quot;ServerStorage&quot;):WaitForChild(&quot;RemoteData&quot;)\nlocal cooldown = 1\n\nreplicatedStorage.Remotes.Lift.OnServerEvent:Connect(function(player)\n \n print(&quot;FIRED&quot;)\n \n if not remoteData:FindFirstChild(player.Name) then return &quot;NoFolder&quot; end\n \n print(&quot;Got past IF statement&quot;)\n \n local debounce = remoteData[player.Name].Debounce\n \n if not debounce.Value then\n \n debounce.Value = true\n \n player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + 1 * (player.leaderstats.Rebirths.Value + 1)\n \n wait(cooldown)\n \n debounce.Value = false\n \n end\n \nend)\n</code></pre>\n<p>stats</p>\n<pre><code>game.Players.PlayerAdded:Connect(function(player)\n player.CharacterAdded:Wait()\n local leaderstats = Instance.new(&quot;Folder&quot;)\n leaderstats.Name = &quot;leaderstats&quot;\n leaderstats.Parent = player\n \n local Strength = Instance.new(&quot;NumberValue&quot;)\n Strength.Name = &quot;Strength&quot;\n Strength.Parent = leaderstats\n \n local Rebirths = Instance.new(&quot;IntValue&quot;)\n Rebirths.Name = &quot;Rebirths&quot;\n Rebirths.Parent = leaderstats\n \n local dataFolder = Instance.new(&quot;Folder&quot;)\n dataFolder.Name = &quot;dataFolder&quot;\n dataFolder.Parent = serverStorage.RemoteData\n \n local debounce = Instance.new(&quot;BoolValue&quot;)\n debounce.Name = &quot;Debounce&quot;\n debounce.Parent = dataFolder\n</code></pre>\n<p>module</p>\n<pre><code>local module = {}\nlocal replicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\n\nfunction module.Lift()\n \n replicatedStorage.Remotes.Lift:FireServer()\n \nend\n \nreturn module\n</code></pre>\n<p>local script</p>\n<pre><code>local module = require(script.Parent:WaitForChild(&quot;ModuleScript&quot;))\nlocal player = game.Players.LocalPlayer\nlocal mouse = player:GetMouse()\n\nscript.Parent.Activated:Connect(function()\n module.Lift()\nend)`\n</code></pre>\n<p>expecting it to get past the if statement and tried changing a couple of things</p>\n"^^ . "0"^^ . . "0"^^ . . . "0"^^ . . . . "<p>I was playing around with Roblox's HTTP request system and YouTube's API, and I made a working system that displays your current subscriber count. But I've been trying for a long time and failing to make a system that displays the difference in subscribers in the console.</p>\n<p>Is there any way I can implement this in my code?</p>\n<pre class="lang-lua prettyprint-override"><code>local HttpService = game:GetService(&quot;HttpService&quot;)\n\nlocal API_KEY = &quot;SECRET&quot; -- Replace with your API key\nlocal CHANNEL_ID = &quot;UCA4yZCVHlHZVknfesTU3XOg&quot; -- Replace with your channel ID\n\nlocal fonts = {\n Enum.Font.Arcade,\n Enum.Font.Arial,\n Enum.Font.ArialBold,\n Enum.Font.Bangers,\n Enum.Font.Bodoni,\n Enum.Font.Cartoon,\n Enum.Font.Code,\n Enum.Font.Creepster,\n Enum.Font.DenkOne,\n Enum.Font.Fantasy,\n Enum.Font.Fondamento,\n Enum.Font.FredokaOne,\n Enum.Font.Garamond,\n Enum.Font.Gotham,\n Enum.Font.GothamBlack,\n }\n\nlocal function getChannelStats()\n print(&quot;SENDING REQUEST&quot;)\n local success, result = pcall(function()\n local url = string.format(&quot;https://www.googleapis.com/youtube/v3/channels?part=statistics&amp;id=%s&amp;key=%s&quot;, CHANNEL_ID, API_KEY)\n local response = HttpService:GetAsync(url)\n local data = HttpService:JSONDecode(response)\n\n local subscriberCount = data.items[1].statistics.subscriberCount\n --script.Parent.Text = &quot;Inscritos: &quot; .. subscriberCount\n script.Parent.Text = subscriberCount\n \n script.Parent.Font = fonts[math.random(1, #fonts)]\n \n end)\n\n if not success then\n warn(&quot;Error fetching channel data:&quot;, result)\n --script.Parent.Text = &quot;Erro ao carregar dados.&quot;\n end\nend\n\n-- Call the function initially and every 10 seconds\ngetChannelStats()\nwhile true do\n wait(2)\n getChannelStats()\nend\n</code></pre>\n<p>I tried doing it myself, using Roblox's AI, testing some things/code snippets, but nothing worked. The expectation was to display the difference in subscribers in the Roblox console using <code>print()</code></p>\n"^^ . . . "fluent-bit"^^ . "neovim-plugin"^^ . . "0"^^ . . "0"^^ . . "0"^^ . "1"^^ . . "<p>Let's start with Span elements, because everything is easier there. To get bold text, it's enough to wrap the content with <code>pandoc.Strong</code> – pandoc calls bold text &quot;strongly emphasized&quot;.</p>\n<pre class="lang-lua prettyprint-override"><code>function Span (span)\n if span.classes:includes 'answer' then\n return show_answers and pandoc.Strong(span.content) or {}\n end\nend\n</code></pre>\n<p>The code to add <code>ANSWER: </code> was <em>almost</em> correct, it just wraps the result in too many curly braces. Removing the extra braces should work:</p>\n<pre class="lang-lua prettyprint-override"><code>function Span (span)\n if span.classes:includes 'answer' then\n return show_answers\n and pandoc.Strong({&quot;ANSWER: &quot;} .. span.content)\n or {}\n end\nend\n</code></pre>\n<p>Now on to divs. It's slightly more complicated there, because we need to traverse all paragraphs in the div to make them bold. It could also be that the div doesn't start with a paragraph but with a list, so prepending the <code>ANSWER</code> string becomes more difficult.</p>\n<p>We solve the first issue by using a &quot;local&quot; filter on all answer elements and then apply it with <code>:walk</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>local make_bold = function (element)\n element.content = {pandoc.Strong(element.content)}\n return element\nend\n\nfunction Div (div)\n if div.classes:includes 'answer' then\n return show_answers\n and div.content:walk{Plain = make_bold, Para = make_bold}\n or {}\n end\nend\n</code></pre>\n<p>And now finally, some code to prepend a string to a list of blocks. It can be used in the <code>Div</code> filter function:</p>\n<pre class="lang-lua prettyprint-override"><code>local function prepend_string (str, blks)\n -- Check if we can add the string to the contents of the first element\n if blks[1] and pandoc.utils.type(blks[1].content) == &quot;Inlines&quot; then\n blks[1].content:insert(1, str)\n return blks\n else\n -- otherwise we add a new `Plain` element with the string\n return {pandoc.Plain{str}} .. blks\n end\nend\n</code></pre>\n"^^ . "0"^^ . . . "language-implementation"^^ . . "@hpaulj thanks for your comments. How would one apply the scalar index recursively for a lua table?"^^ . . . "0"^^ . . "0"^^ . "1"^^ . . "Thank you so much for this (and sorry for the delay--the semester started and I got behind!). When you wrote "It can be used in the `Div` filter function", would you mind providing some guidance on how to do that?""^^ . "<p>Lua expects the <code>luaopen_mymodule</code> function to follow the <a href="https://www.lua.org/manual/5.4/manual.html#lua_CFunction" rel="nofollow noreferrer"><code>lua_CFunction</code> protocol</a>, which means:</p>\n<ol>\n<li>the function must have the signature <code>int(lua_State *) noexcept</code>,</li>\n<li>the function can get its input arguments from the <a href="https://www.lua.org/manual/5.4/manual.html#4.1" rel="nofollow noreferrer">Lua stack</a>, and</li>\n<li>the return value of the function must be the number of Lua values it returns (Lua functions can <a href="https://www.lua.org/manual/5.4/manual.html#3.3.4" rel="nofollow noreferrer">return multiple values</a>, which can be used in <a href="https://www.lua.org/manual/5.4/manual.html#3.3.3" rel="nofollow noreferrer">multiple assignments</a> like <code>local foo, bar = baz()</code>), and the actual Lua values to be returned must be on the top of the Lua stack.</li>\n</ol>\n<p>Additionally, the function must be <code>extern &quot;C&quot;</code> so that its name is not mangled.</p>\n<p>Specifically, the <code>luaopen_mymodule</code> function will be called with <a href="https://www.lua.org/manual/5.4/manual.html#pdf-require" rel="nofollow noreferrer">two arguments</a> that can usually be ignored, and will usually return a single value (typically a table) which will be passed back by the <code>require</code> function. This means:</p>\n<ol>\n<li>you can simply ignore the initial contents of the Lua stack, and</li>\n<li><code>luaopen_mymodule</code> should return 1.</li>\n</ol>\n<p>Equipped with the necessary knowledge, we know how to implement <code>luaopen_mymodule</code>:</p>\n<ol>\n<li>Wrap the function body inside a try-catch block and handle C++ exceptions properly.</li>\n<li>Inside the function body:\n<ol>\n<li>Construct a <code>sol::state_view</code> from the <code>lua_State *</code>.</li>\n<li>Use the <code>sol::state_view</code> in the same way you'd use a <code>sol::state</code>: call <code>new_usertype()</code>, <code>create_table()</code>, etc.</li>\n<li>Immediately before you return from <code>luaopen_mymodule</code>, manually push onto the Lua stack the value you want to return (this means the stack will have one more value on it compared to when the function was called).</li>\n<li>Return 1.</li>\n</ol>\n</li>\n</ol>\n<p>sol allows you to manually push a value onto the Lua stack with the <a href="https://sol2.readthedocs.io/en/latest/api/reference.html#id2" rel="nofollow noreferrer"><code>push</code></a> method on the <code>sol::reference</code> class, which is also available on concrete &quot;value&quot; types such as <code>sol::table</code> since they inherit publicly from <code>sol::reference</code>.</p>\n<p>Here's an example that implements the <code>foo</code> module illustrated in <a href="/a/65660774">/a/65660774</a>, rewritten in C++ using sol:</p>\n<pre class="lang-cpp prettyprint-override"><code>#include &lt;exception&gt;\n#include &lt;sol/sol.hpp&gt;\n\nextern &quot;C&quot; {\n// Define `FOO_LIB` as `__attribute__((visibility(&quot;default&quot;)))`,\n// `__declspec(dllexport)`, etc.\nFOO_LIB int luaopen_foo(lua_State *L) noexcept try {\n sol::state_view lua(L);\n\n auto result = lua.create_table();\n result[&quot;foo&quot;] =\n sol::as_function([](lua_Integer a, lua_Integer b) { return a + b; });\n\n result.push();\n return 1;\n\n // `sol::reference::push` itself returns 1,\n // so the two lines above can be rewritten as:\n // return result.push();\n} catch (const std::exception &amp;e) {\n return luaL_error(L, &quot;%s&quot;, e.what());\n}\n}\n</code></pre>\n"^^ . "3"^^ . . . "Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking."^^ . . . . . . . . . . . "windows"^^ . "How to configure nvim-cmp for autocompletion"^^ . . "FWIW, I use Oh My Posh for my powershell config. That has an option to add an OSC7 prompt: https://ohmyposh.dev/docs/configuration/general#general-settings\n\nThis works for me with WezTerm."^^ . "0"^^ . . . . "0"^^ . . . . . "0"^^ . . . "cors"^^ . "Are you trying to print things in the console in different fonts?"^^ . "How to get kubernetes pod labels using fluent-bit LUA filter"^^ . . . . . "@DavidvonTamar thanks ; unfortunately it did not work. Maybe I have to try to reinstall Lua Debug and this time open the repository in VSCode and run task:Copy Publish. I did not have to do the same in windows."^^ . "Logitech G-hub lua script"^^ . . "0"^^ . . "@AlanBirtles, the duplicated question is not appropriate. There are no `gc_markroots` and `gc_mark` in lua, they may come from another library. `lua_ref` has also been removed, lua only retains the `luaL_ref` API."^^ . . "1"^^ . "<p>I am using luacov to generate the code-coverage.\nI am able to see the coverage.out and using luacov-html I am able to get the index.html file as well.</p>\n<p>But when I tried to post the report to Sonar, it is asking for the .xml file.</p>\n<p><code>[Step 8/12] Error during parsing of the generic coverage report '/app/build/project/reports/index.html'. Look at SonarQube documentation to know the expected XML format.</code></p>\n"^^ . "2"^^ . . "1"^^ . "out"^^ . . . "<p>You can store the previous YouTube subscriber count before it is updated, and write the difference in a TextLabel.</p>\n<p>Changes:</p>\n<pre class="lang-none prettyprint-override"><code>... 22 lines skipped ...\n\n+ local oldSubscriberCount = 0\n\n... 9 lines skipped ...\n\n+ local subscriberCountDifference = subscriberCount - oldSubscriberCount\n+ local message = (subscriberCountDifference &lt; 0 and &quot;-&quot; or &quot;+&quot;) .. &quot; subscribers&quot;\n+ -- Use the message variable to set the TextLabel of your choice\n+ oldSubscriberCount = subscriberCount\n\n... 19 lines skipped ...\n</code></pre>\n<p>Modified code:</p>\n<pre class="lang-lua prettyprint-override"><code>local HttpService = game:GetService(&quot;HttpService&quot;)\n\nlocal API_KEY = &quot;SECRET&quot; -- Replace with your API key\nlocal CHANNEL_ID = &quot;UCA4yZCVHlHZVknfesTU3XOg&quot; -- Replace with your channel ID\n\nlocal fonts = {\n Enum.Font.Arcade,\n Enum.Font.Arial,\n Enum.Font.ArialBold,\n Enum.Font.Bangers,\n Enum.Font.Bodoni,\n Enum.Font.Cartoon,\n Enum.Font.Code,\n Enum.Font.Creepster,\n Enum.Font.DenkOne,\n Enum.Font.Fantasy,\n Enum.Font.Fondamento,\n Enum.Font.FredokaOne,\n Enum.Font.Garamond,\n Enum.Font.Gotham,\n Enum.Font.GothamBlack,\n }\n\nlocal oldSubscriberCount = 0\n\nlocal function getChannelStats()\n print(&quot;SENDING REQUEST&quot;)\n local success, result = pcall(function()\n local url = string.format(&quot;https://www.googleapis.com/youtube/v3/channels?part=statistics&amp;id=%s&amp;key=%s&quot;, CHANNEL_ID, API_KEY)\n local response = HttpService:GetAsync(url)\n local data = HttpService:JSONDecode(response)\n\n local subscriberCount = data.items[1].statistics.subscriberCount\n\n local subscriberCountDifference = subscriberCount - oldSubscriberCount\n local message = (subscriberCountDifference &lt; 0 and &quot;-&quot; or &quot;+&quot;) .. &quot; subscribers&quot;\n -- Use the message variable to set the TextLabel of your choice\n oldSubscriberCount = subscriberCount\n\n --script.Parent.Text = &quot;Inscritos: &quot; .. subscriberCount\n script.Parent.Text = subscriberCount\n \n script.Parent.Font = fonts[math.random(1, #fonts)]\n \n end)\n\n if not success then\n warn(&quot;Error fetching channel data:&quot;, result)\n --script.Parent.Text = &quot;Erro ao carregar dados.&quot;\n end\nend\n\n-- Call the function initially and every 10 seconds\ngetChannelStats()\nwhile true do\n wait(2)\n getChannelStats()\nend\n</code></pre>\n"^^ . . . . "0"^^ . "Amazing, this has worked and I have learned about `vim.api.nvim_buf_set_lines` thanks."^^ . . "Simple lua code does not run in Visual Studio Code"^^ . . . . "memory-leaks"^^ . . . "0"^^ . . "powershell"^^ . . . . . . . . "linux"^^ . . . . "How to run a Lua coroutine in C++ with sol3?"^^ . . . "0"^^ . "Capture filter for VPN detection in Wireshark through lua script"^^ . "0"^^ . . . . "What's the value of `package.path`?"^^ . . . "<p>As the title suggests, I had the idea to create a command that can automatically write a print statement for all arguments to the current function I am in. Initially, I wanted to do this for Python functions - as I find myself doing this manually as a debug tool.</p>\n<p>For example, take the Python function:</p>\n<pre><code>def my_func(a: int, b: str) -&gt; None:\n ...\n</code></pre>\n<p>If my cursor is within the function definition and I run the command <code>PythonPrintParams</code>, I want to write the following to the first line of the function:</p>\n<pre><code>print(\n f&quot;a={a}, &quot;\n f&quot;b={b}&quot;\n)\n</code></pre>\n<p>I want to write a Lua function that can do this using treesitter and then setup a Neovim autocommand. So far I have:</p>\n<pre><code>local ts_utils = require('nvim-treesitter.ts_utils')\n\nlocal function list_fn_params()\n local node = ts_utils.get_node_at_cursor()\n\n while node and node:type() ~= 'function_definition' do\n node = node:parent()\n end\n\n if not node then\n print(&quot;Could not find params, cursor not inside a function.&quot;)\n return\n end\n\n local param_nodes = node:field('parameters')\n if param_nodes then\n for i, param_node in ipairs(param_nodes) do\n print(&quot; Node&quot;, i, &quot;type:&quot;, param_node:type())\n print(&quot; Node text:&quot;, vim.inspect(ts_utils.get_node_text(param_node)))\n end\n end\nend\n\nvim.api.nvim_create_user_command('PythonPrintParams', function()\n list_fn_params()\nend, {})\n\n</code></pre>\n<p>This ends up printing:</p>\n<pre><code> Node 1 type: parameters\n Node text: { &quot;(&quot;, &quot; a: int, b: str&quot;, &quot;)&quot; }\n</code></pre>\n<p>This is a good start but then requires some manual parsing that I think will get messy. How can I parse deeper to get the variable and then write my print statement? Is there an alternate route with the LSP API that makes identifying args easier?</p>\n<p>I did spend time with the py-tree-sitter docs <a href="https://github.com/tree-sitter/py-tree-sitter/tree/master" rel="nofollow noreferrer">https://github.com/tree-sitter/py-tree-sitter/tree/master</a>.</p>\n"^^ . . "0"^^ . "shingo's second paragraph is emphasizing that `Account.__index = Account` is not simply a difference in "readability", but changes the meaning of the code. It destroys the dynamic *prototype* chain, i.e., `setmetatable(o, self)` relies on `self.__index = self` to set up proper prototypical indexing."^^ . . "0"^^ . . . . "No, the resulting line is `local t = setmetatable(args, Button)`"^^ . . . . "1"^^ . . "1"^^ . . . . . . "<p>In the function you don't check if the <code>driveSeat</code> parameter is a seat object. Nestle the rest of your code with if <code>if driveseat:IsA(&quot;Seat&quot;) then</code>. Also you don't connect the function in your code. Connect the function via this <code>seat.Sat:Connect(OnDriveSeatChanged)</code>. Make sure your code is called correctly and that unknown parameters are <strong>not</strong> used as objects.</p>\n"^^ . . "0"^^ . . "0"^^ . . "<p>I try to run simple lua udf in docker and keep getting this error:</p>\n<pre><code>ERROR lua create error: error loading module 'protobuf.pb' from file '/usr/local/lib/lua/5.1/protobuf/pb.so':\n /usr/local/lib/lua/5.1/protobuf/pb.so: undefined symbol: lua_settop\n</code></pre>\n<p>I searched over the whole interner and tried everything I was able to understand how to apply but nothing helped. I can successfully build an image, register my modules but when I run simple command it just fails with the error above:</p>\n<p>Here is Dockerfile where I test it</p>\n<pre><code>FROM rockylinux:8.9\n# install requirements\nRUN dnf update -y &amp;&amp; \\\n dnf install -y git gcc make findutils wget unzip readline-devel python3 python3-pip &amp;&amp; \\\n ln -sf /usr/bin/python3 /usr/bin/python\n## install aerospile\nRUN mkdir -p aerospike \\\n &amp;&amp; wget -qO- &quot;https://download.aerospike.com/artifacts/aerospike-server-enterprise/6.3.0.5/aerospike-server-enterprise_6.3.0.5_tools-8.4.0_el8_$(uname -m).tgz&quot; | tar -xvzf - -C ./aerospike --strip-components=1 \\\n &amp;&amp; cd ./aerospike &amp;&amp; ./asinstall &amp;&amp; cd ../ &amp;&amp; rm -rf ./aerospike\n# https://aerospike.com/developer/udf/knowing_lua#lua-version\nARG LUA_VERSION=5.1.4\n# Use latest\nARG LUAROCKS_VERSION=3.11.1\n\n# install lua\nRUN mkdir -p lua &amp;&amp; \\\n wget -qO- https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz | tar -xvzf - -C ./lua --strip-components=1 &amp;&amp; \\\n cd ./lua &amp;&amp; CFLAGS=&quot;-fPIC -Wall -Wextra&quot; LIBFLAGS=&quot;-shared&quot; make -j $(nproc) linux &amp;&amp; make -j $(nproc) install &amp;&amp; \\\n cd ../ &amp;&amp; rm -rf ./lua &amp;&amp; \\\n lua -v &amp;&amp; \\\n # install luarocks\n mkdir -p ./luarocks &amp;&amp; \\\n wget -qO- luarocks https://luarocks.org/releases/luarocks-${LUAROCKS_VERSION}.tar.gz | tar -xvzf - -C ./luarocks --strip-components=1 &amp;&amp; \\\n cd luarocks &amp;&amp; ./configure &amp;&amp; make -j $(nproc) &amp;&amp; make -j $(nproc) install &amp;&amp; cd .. &amp;&amp; rm -rf luarocks &amp;&amp; \\\n luarocks &amp;&amp; \\\n # install protobuf\n luarocks install protobuf &amp;&amp; \\\n luarocks install lua-protobuf &amp;&amp; \\\n pip3 install protobuf &amp;&amp; \\\n dnf install -y protobuf-compiler &amp;&amp; \\\n # clean up\n dnf clean all\n\nCOPY ./proto /proto\nCOPY ./udf /udf\n\nENTRYPOINT [&quot;asd&quot;]\nCMD [&quot;--foreground&quot;]\n</code></pre>\n<p>and the lua module</p>\n<pre><code>local protobuf = require 'protobuf'\n\nfunction count(recs)\n return recs :\n map(function(rec)\n return 1\n end) :\n aggregate(0, function(count, rec)\n return count + 1\n end)\nend\n</code></pre>\n<p>when I execute this function, it fails with the error above</p>\n<pre><code>aql&gt; REGISTER MODULE '/udf/myudf.lua'\nOK, 1 module added.\n\naql&gt; AGGREGATE myudf.count() ON test\n</code></pre>\n"^^ . "Language design questions are usually off topic for SO - check out [this Meta question](https://meta.stackoverflow.com/q/323334) for a pretty lengthy explanation why."^^ . . . . "lua-scripting-library"^^ . . "1"^^ . . "1"^^ . . "0"^^ . . "1"^^ . . "Why does Lua handle multiple function return values this way?"^^ . "<p>What you read is incorrect, <code>self = setmetatable(args, self)</code> doesn't change <code>Button</code>, it just overwrites the parameter <code>self</code> to the return value of <code>setmetatable</code>, so it is equivalent to the following code:</p>\n<pre><code>local t = setmetatable(args, self)\nt.text = t.text or &quot;&quot;\n...\n</code></pre>\n<p>The implicit parameter <code>self</code> is dynamic, its value depends on how the function is invoked. For <code>Account:new(....)</code>, <code>self</code> is <code>Account</code>, for <code>AccountGold:new(....)</code>, <code>self</code> is <code>AccountGold</code>, so that you can achieve inheritance with a single function.</p>\n<p><code>self.__index = self</code> is cheap, but if you need to strictly control the exposed members, you should create a separate metatable.</p>\n"^^ . . . . . . . . "2"^^ . "0"^^ . "0"^^ . "0"^^ . . . . . . . "0"^^ . . "0"^^ . "kong"^^ . . . "numpy"^^ . . . . "1"^^ . . . . . . "Required lua module not found"^^ . "1"^^ . "variable-assignment"^^ . . . . . "<p>Basically what i want to do is when i hold q for example, the object that im holding should push in the direction my mouse is <a href="https://i.sstatic.net/V0pG5j8t.png" rel="nofollow noreferrer">before</a><a href="https://i.sstatic.net/trvfELqy.png" rel="nofollow noreferrer">after holding q</a></p>\n<p>Now i know how to do something when holding a key, but im not familiar with how to push it without using cframe or position. I tried to use cframe or position but it just flies away without limits, and the object is on a rope which is not what i need. Any help is appreciated!</p>\n"^^ . . . "0"^^ . "0"^^ . "(WoW Addon) Trying to display item upgrade costs in tooltip"^^ . "0"^^ . . "1"^^ . "0"^^ . "0"^^ . . "Do you realize that this numpy indexing is just part of a whole multi-dimensional class, not just just an incidential addon to python lists? Your array creation could be done with one 'broadcasted' array calculation: `res = (np.arange(5)[:,None,None,None] - np.arange(2)) / (np.arange(4)[:,None,None] + np.arange(3)[:,None] +1)`"^^ . . "4"^^ . . "I guess you tried to do something like this:\n`{ "Line 1\\nLine 2\\nLine 3" }`. `nvim_buf_set_lines` expects an array of lines, corrected version would be: `vim.api.nvim_buf_set_lines(0, 1, 1, false, { "Line 1", "Line 2", "Line 3" })`."^^ . . "0"^^ . "How can I make a simple automation with lua?"^^ . "That's not a Lua error btw."^^ . "0"^^ . . "0"^^ . . . "constructor"^^ . . . "oop"^^ . . "0"^^ . . . . . "lua-5.4"^^ . . "0"^^ . "factory"^^ . "0"^^ . . "use lua script and redis for set pattern in location openresty"^^ . . "Analogue of numpy indices for lua multidimensional array"^^ . . . "0"^^ . . . . . "0"^^ . . "0"^^ . . "0"^^ . . . "2"^^ . "<p>Following the <a href="https://github.com/ThePhD/sol2/blob/2b0d2fe8ba0074e16b499940c4f3126b9c7d3471/examples/source/coroutine.cpp" rel="nofollow noreferrer">official example</a>, I have resolved the issue myself, so I am posting the solution here.</p>\n<pre class="lang-cpp prettyprint-override"><code>#include &lt;sol/sol.hpp&gt;\n\nint main() {\n sol::state lua;\n lua.open_libraries(sol::lib::base, sol::lib::coroutine);\n\n lua.set_function(&quot;run_coroutine&quot;, [&amp;lua](sol::function f) {\n sol::thread runner_thread = sol::thread::create(lua);\n sol::state_view runner_thread_state = runner_thread.state();\n sol::coroutine co(runner_thread_state, f);\n\n co();\n co();\n co();\n });\n\n lua.script(R&quot;(\n function story()\n print(&quot;1&quot;)\n coroutine.yield()\n print(&quot;2&quot;)\n coroutine.yield()\n print(&quot;3&quot;)\n end\n\n run_coroutine(story)\n )&quot;);\n}\n</code></pre>\n<p>This should work now, but I’m not entirely sure why. I would appreciate it if someone with more knowledge about Lua threads could provide further insights.</p>\n"^^ . "1"^^ . "roblox-studio"^^ . . . . "1"^^ . "redis"^^ . "0"^^ . "How to handle ODBC UserData in Lua"^^ . . . "I might be wrong, but from what i remember you should be able to get the Player object (from whatever method u use) then be able to do somthing like this: `Player:Ragdoll()` then `Player.Heath=0`?"^^ . . . "Also what are your errors?"^^ . "openresty"^^ . . . . "<p>I am trying to write a Lua filter for pandoc to show solutions based on a metadata variable for both span and div elements. I was able to get the answers to render based on the metadata filter using this <a href="https://stackoverflow.com/a/75837627/12586249">this question/answer</a>.</p>\n<p>Now, I would like to do two things to make the answer stand out:</p>\n<ol>\n<li>I would like to prepend the text <code>&quot;ANSWER: &quot;</code> as the first element in both the Span and Div</li>\n<li>I would like to render the text inside each <code>Span</code> and <code>Div</code> using strong.</li>\n</ol>\n<p>This Lua filter works to show/hide the solutions:</p>\n<pre class="lang-lua prettyprint-override"><code>-- A lua filter to render answers based on YAML block entry `show-answers`\n-- \n-- The class `.answers` will render when `show-answers` is True and not if \n-- `show-answers` option is False (note captialization)\n--\n-- Barely adapted from: https://stackoverflow.com/a/75837627/12586249\n\nlocal show_answers = nil\n\nfunction Pandoc (doc)\n show_answers = doc.meta['show-answers']\n return doc\nend\n\nfunction Span (span)\n if span.classes:includes 'answer' then\n return show_answers and span.content or {}\n end\nend\n\nfunction Div (div)\n if div.classes:includes 'answer' then\n return show_answers and div.content or {}\n end\nend\n\n\nreturn {\n {Pandoc = Pandoc},\n {Div = Div},\n {Span = Span}\n}\n</code></pre>\n<p>I have tried to add text (like <a href="https://stackoverflow.com/a/72132200/12586249">this solution</a> suggests), but that removes inline math and code blocks also need to be included in the answers.</p>\n<p>I tried prepending the string <code>&quot;ANSWER: &quot;</code> to the content of the span:</p>\n<pre class="lang-lua prettyprint-override"><code>function Span (span)\n if span.classes:includes 'answer' then\n new_content = {{&quot;ANSWER: &quot;} .. span.content}\n return show_answers and new_content or {}\n end\nend\n</code></pre>\n<p>but I received the following error: <code>Inline, list of Inlines, or string expected, got table</code>.</p>\n<p>Here is a minimal markdown example that would use the filter:</p>\n<pre><code>---\ntitle: A Test of Answer Reveal\nshow-answers: True\n---\n\n## Question 1\n\nWhat is the equatio of a line? [A line follows the formula $y = mx + b$]{.answer}\n\n## Question 2 \n\nRandomly generate a normally distributed population of weights with a mean weight among women of 150 pounds and 190 pounds among men with standard deviation of 25 pounds.\n\n::: { .answer }\nWe need to set our $\\beta_0$ to equal 150 and $\\beta_1$ to equal 40, then generate the population and assume approximately equal shares of men and women:\n\n```{r}\nN &lt;- 1e6L\nbeta0 &lt;- 140\nbeta1 &lt;- 40\nsigma &lt;- 25\n\npop &lt;- rnorm(N, beta0 + sample(c(0,1), N, replace = TRUE) * beta1, sigma)\n\n```\n:::\n</code></pre>\n"^^ . . "0"^^ . . "<p>After grappling with this problem, I've figured out a solution. You can use the <code>part:GetTouchingParts</code> method and iterate through the list. Here's what I used for my game:</p>\n<pre><code>while true do\n wait(0.01)\n print(&quot;hi&quot;)\n for i,part in pairs(script.Parent:GetTouchingParts()) do\n if TornadoDamage.TornadoDamageKey(part,Debugging,5) then\n TornadoDamage.TornadoPhysics(part,script.Parent,5,part.Parent)\n end\n end\n\nend\n</code></pre>\n"^^ . . . . . . . . . . . "0"^^ . . . . . . . "1"^^ . . . . "1"^^ . "aerospike"^^ . . "0"^^ . "0"^^ . . . "<p>I'm working on my Gmod DarkRP server and I have the following error.</p>\n<pre><code>[ERROR] Attempted request to known malicious code endpoint 'https://kvac.cz/f.php?key=ZEhWgVuEB4ZMnSPCH0dl'! Blocking!\n 1. Fetch - lua/includes/modules/http.lua:42\n 2. unknown - DRME:1\n</code></pre>\n<p>But I can't find the malicious endpoint in the different addon that I have.\nDoes anyone have an idea where I can find it ?</p>\n<p>I try to find it using the search tool of visual studio code</p>\n"^^ . "<p>I'm making a Roblox code executor that is server sided but everytime I put in code like &quot;print('Hello World!')&quot; it runs that code two times for some reason.</p>\n<p>Here is the Client Code:</p>\n<pre><code>local textbox = script.Parent\nlocal Attempts = 0\nlocal event = game.ReplicatedStorage.FireCode\nlocal Debounce = false\n\ntextbox.FocusLost:Connect(function(enterPressed)\n if enterPressed == true and Debounce ~= true then\n Debounce = true\n repeat\n Attempts += 1\n print(Attempts)\n event:FireServer(textbox.Text)\n task.wait()\n until Attempts == 1\n task.wait(1)\n Attempts = 0\n else\n return\n end\n Debounce = false\nend)\n</code></pre>\n<p>Here is the Server Code:</p>\n<pre><code>local event = game.ReplicatedStorage.FireCode\nlocal debounce = false\n\nevent.OnServerEvent:Connect(function(player, code)\n if player and player ~= nil and debounce ~= true then\n debounce = true\n loadstring(tostring(code))()\n task.wait(0.1)\n debounce = false\n end\nend)\n</code></pre>\n<p>There are no errors with the code.</p>\n<p>I tried using the debounce method but it didn't work.</p>\n"^^ . . . . . "0"^^ . . "0"^^ . . . . . "upvalue"^^ . "0"^^ . "0"^^ . "0"^^ . . "@DavidvonTamar it works with 2.0.5 and without the extensionPath."^^ . "2"^^ . . . "On a side note - `file.write((char *)&name, sizeof(name));` will not work, you can't serialize a `std::string` like that. You will have to use `file.write(name.c_str(), name.size());` instead, in which case you should also `write()` the string's `size` first. This way, to read back a `std::string`, you can first `read()` its `size`, then `resize()` it to that size, then `read()` into its `data()` buffer. Same thing applies to your `val` variable in your `lua_isstring` case. And I suspect for your `path` variable, too."^^ . . . . "0"^^ . . "lazy-loading"^^ . . . "1"^^ . "Thanks for these advices Albrecht Schlosser : i'll give it a try. Too bad murgaLua has not much future, it was a real Lua gem embedding some fltk within a few hundred of kb (Linux-macos-windows), and so much more, and no dependencies..."^^ . . . "1"^^ . . . . . "2"^^ . "@histrueandfalse Could you show me an example of this in a script of some sort? If so, thanks."^^ . "yes, sorry for being inactive"^^ . . . . . . . "2"^^ . . . "If you really depend on such an old version of murgaLua and thus on FLTK 1.1.10 there's probably not much to help you. Since FLTK 1.3.x and even more in FLTK 1.4.0 (to be released soon) you can draw to offline images and then you could write the offline image data to a PNG file. This should work in a loop w/o drawing to the display at all, although you should provide a way to interrupt the process (this can be done by a button setting a flag in its callback)."^^ . "1"^^ . "<p>I've been making a ragdoll system but there's a weird bug where when you try to unragdoll it just ragdolls again.</p>\n<p>The game is open-source so heres the link to it: <a href="https://www.roblox.com/games/18787710805/Ragdoll-Physics-OPEN-SOURCE" rel="nofollow noreferrer">https://www.roblox.com/games/18787710805/Ragdoll-Physics-OPEN-SOURCE</a></p>\n<p>I think the problem is the events but I have no clue how to fix that.</p>\n<p>I tryed making the system Client sided so it wouldn't have to use Events. But that didn't work...</p>\n<p>Heres the code to the Server Script:</p>\n<pre><code>local Event = game.ReplicatedStorage:FindFirstChild('Ragdoll')\nlocal IsRag = false\nlocal IsStudio = false\nlocal plr = nil\nlocal cooldown = 3\nlocal CanRagDoll = true\n\nif game:GetService('RunService'):IsStudio() then\n IsStudio = true\n print('User in studio')\nelse\n IsStudio = false\n print('User not in studio')\nend\n\nlocal UserInputService = game:GetService('UserInputService')\nfunction Ragdoll(Player, Character)\n for i,joint in pairs(Character:GetDescendants()) do\n if joint ~= nil and joint:IsA('Motor6D') then\n print('Found Joint.')\n Character:FindFirstChildOfClass('Humanoid').PlatformStand = true\n task.wait(0.01)\n for i,v in pairs(workspace:GetDescendants()) do\n if v:IsA('Folder') and v ~= nil then\n if v.Name == 'HitBoxes'..Player.name then\n for i,j in pairs(v:GetChildren()) do\n if j:IsA('Part') and j ~= nil then\n j.CanCollide = true\n end\n end\n end\n end\n end\n local socket = Instance.new('BallSocketConstraint')\n local a1 = Instance.new('Attachment')\n local a2 = Instance.new('Attachment')\n a1.Position = joint.C0.Position\n a2.Position = joint.C1.Position\n a1.Name = 'RagdollAttachment'\n a2.Name = 'RagdollAttachment'\n socket.Parent = joint.Parent\n socket.Attachment0 = a1\n socket.Attachment1 = a2\n socket.LimitsEnabled = true\n socket.TwistLimitsEnabled = true\n a1.Parent = joint.Part0\n a2.Parent = joint.Part1\n joint.Enabled = false\n end\n end\nend\nfunction UnRagDoll(Player, Character)\n Character:FindFirstChildOfClass('Humanoid').PlatformStand = false\n\n for i,joint in pairs(Character:GetDescendants()) do\n if joint ~= nil and joint:IsA('Motor6D') then\n joint.Enabled = true\n for i,v in pairs(workspace:GetDescendants()) do\n if v:IsA('Folder') and v ~= nil then\n if v.Name == 'HitBoxes'..Player.name then\n for i,j in pairs(v:GetChildren()) do\n if j:IsA('Part') and j ~= nil then\n j.CanCollide = false\n end\n end\n end\n end\n end\n Character:FindFirstChild('HumanoidRootPart').Orientation = Vector3.new(0,Character:FindFirstChild('Torso').Orientation.Y,0)\n Character:FindFirstChild('HumanoidRootPart').Position = Character:FindFirstChild('Torso').Position\n print('Removed!')\n end\n end\nend\n\nEvent.OnServerEvent:Connect(function(player)\n plr = player\n if player.Name == plr.Name and CanRagDoll == true then\n CanRagDoll = false\n if IsRag == false then\n IsRag = true\n Ragdoll(player, player.Character)\n else\n IsRag = false\n UnRagDoll(player, player.Character)\n for i,v in pairs(player.Character:GetDescendants()) do\n if v:IsA('BallSocketConstraint') and v ~= nil then\n v:Destroy()\n end\n end\n end\n \n task.wait(cooldown)\n CanRagDoll = true\n else\n warn('Wrong player!')\n end\nend)\n\nwhile task.wait() do\n if IsRag == true and plr.Character:FindFirstChildOfClass('Humanoid').FloorMaterial == Enum.Material.Air then\n game.ReplicatedStorage.FixJumpBug:InvokeClient(plr)\n end\nend\nprint('Made by OldMadEgg! Follow me at: https://www.roblox.com/users/3873716276/profile ')\n-- Credits to OldMadEgg!\n</code></pre>\n<p>(Note, this bug only happens if there is 2 &quot;Or more&quot; players.)</p>\n<p>Here is the Client Script:</p>\n<pre><code>local UIS = game:GetService('UserInputService')\nlocal event = game.ReplicatedStorage.Ragdoll\nlocal plr = game.Players.LocalPlayer\n\nUIS.InputBegan:Connect(function(input, processed)\n if processed then return end\n \n if input.KeyCode == Enum.KeyCode.R or input.KeyCode == Enum.KeyCode.ButtonY and game.Players.LocalPlayer.Character:FindFirstChildOfClass('Humanoid').Health ~= 0 then\n event:FireServer(plr)\n end\nend)\n\ngame.ReplicatedStorage.FixJumpBug.OnClientInvoke = function()\n game.Players.LocalPlayer.Character:FindFirstChildOfClass('Humanoid').PlatformStand = true\nendenter image description here\n</code></pre>\n<p>Here is the workspace :</p>\n<p><img src="https://i.sstatic.net/oTullv3A.png" alt="enter image description here" /></p>\n<p>I haven't seen any errors in the output box.</p>\n"^^ . "1"^^ . "0"^^ . . . . . . . "0"^^ . "macos"^^ . . "1"^^ . . . . . . "Wrong tool, for stuff like this you might want to take a look at AutoHotkey and co"^^ . "1"^^ . "<p>A simple approach is to remap the global environment to an empty table before running your file.</p>\n<pre><code>_ENV = setmetatable({}, {__index = _G})\n</code></pre>\n<p>An equivalent C code is:</p>\n<pre><code>lua_newtable(L); // new global environment\nlua_createtable(L, 0, 1); // new metatable\nlua_getglobal(L, LUA_GNAME); // _G\nlua_setfield(L, -2, &quot;__index&quot;); // { __index = _G }\nlua_setmetatable(L, -2); // setmetatable(...)\nlua_rawseti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS); // _ENV = ...\n</code></pre>\n"^^ . . "Luacov is not generating the xml output for Sonar"^^ . "3"^^ . . . . . "0"^^ . "<p>I'm using sol2 (v3.3.0) in C++ to run Lua coroutines. I want to pass a Lua function to C++ and execute it as a coroutine. However, my attempts to convert <code>sol::function</code> to <code>sol::coroutine</code> are not working.</p>\n<p>Here is a minimal example that doesn't work:</p>\n<pre class="lang-cpp prettyprint-override"><code>#include &lt;sol/sol.hpp&gt;\n\nint main() {\n sol::state lua;\n lua.open_libraries(sol::lib::base);\n\n lua.set_function(&quot;run_coroutine&quot;, [](sol::function func) {\n sol::coroutine co = func;\n co();\n co();\n co();\n });\n\n lua.script(R&quot;(\n function story()\n print(&quot;1&quot;)\n coroutine.yield()\n print(&quot;2&quot;)\n coroutine.yield()\n print(&quot;3&quot;)\n end\n\n run_coroutine(story)\n )&quot;);\n}\n</code></pre>\n<p>The expected output is</p>\n<pre><code>1\n2\n3\n</code></pre>\n<p>but actually nothing is shown.</p>\n<p>How can I correctly run the Lua function as a coroutine in C++?</p>\n"^^ . "<p>I see multiple questions here, that imply loading modules from the current directory should be the default behavior of Lua. See &quot;selected answers&quot; for these two questions:</p>\n<ul>\n<li><a href="https://stackoverflow.com/questions/61039127/why-lua-require-wont-search-current-directory">Why lua require won&#39;t search current directory?</a> (&quot;if you used lua test.lua then it shoud work&quot;)</li>\n<li><a href="https://stackoverflow.com/questions/46024370/lua-relative-import-fails-from-different-working-directory">Lua: relative import fails from different working directory</a> (&quot;else cwd is . which works by default&quot;)</li>\n</ul>\n<p>But my experience with lua54 is that it doesn't:</p>\n<pre><code>C:\\Code\\lua\\testcwd&gt;type hello.lua\nlocal function hello()\n print(&quot;Hello!&quot;)\nend\n\nreturn {hello=hello}\nC:\\Code\\lua\\testcwd&gt;type use_hello.lua\nhello = require(&quot;hello&quot;)\n\nhello.hello()\n\nC:\\Code\\lua\\testcwd&gt;type use_hello2.lua\n-- Util needed by requireLocal()\nlocal function get_directory_path(sep)\n local file_path = debug.getinfo(2, &quot;S&quot;).source:sub(2)\n local dir_path = file_path:match(&quot;(.*&quot; .. sep .. &quot;)&quot;)\n if not dir_path then\n dir_path = &quot;.&quot; .. sep\n end\n return dir_path\nend\n\n-- Enables calling require for current working directory\nlocal function requireLocal()\n local separator = package.config:sub(1,1)\n\n local dir_path = get_directory_path(separator)\n\n package.path = package.path .. &quot;;&quot; .. dir_path .. &quot;?.lua&quot;\nend\n\nrequireLocal()\n\nhello = require(&quot;hello&quot;)\n\nhello.hello()\n\nC:\\Code\\lua\\testcwd&gt;lua54 use_hello.lua\nlua54: use_hello.lua:1: module 'hello' not found:\n no field package.preload['hello']\n no file 'C:\\lua\\systree\\share\\lua\\5.4\\hello.lua'\n no file 'C:\\lua\\systree\\share\\lua\\5.4\\hello\\init.lua'\n no file 'C:\\lua\\systree\\lib\\lua\\5.4\\hello.dll'\nstack traceback:\n [C]: in function 'require'\n use_hello.lua:1: in main chunk\n [C]: in ?\n\nC:\\Code\\lua\\testcwd&gt;lua54 use_hello2.lua\nHello!\n\nC:\\Code\\lua\\testcwd&gt;lua54 -v\nLua 5.4.2 Copyright (C) 1994-2020 Lua.org, PUC-Rio\n</code></pre>\n<p>Why is &quot;use_hello.lua&quot; not merely working? One clearly sees that it does NOT search the current directory. To the best of my knowledge, my PUC lua 5.4 (Windows 10) configuration is &quot;default&quot;. Just to load a module from the current directory, why do I need to perform this &quot;crazy setup&quot; of &quot;use_hello2.lua&quot;? Is that something that changed with lua 5.4? The <a href="https://www.lua.org/manual/5.4/readme.html" rel="nofollow noreferrer">readme</a> of 5.4 doesn't seem to say this changed.</p>\n"^^ . "0"^^ . "Pls explain lua syntax `var ::= Name | prefixexp '[' exp ']' | prefixexp '.' Name` briefly as I dont know lua"^^ . . . . "0"^^ . . . "0"^^ . . . . . "0"^^ . . "0"^^ . . . . . . . . . . "1"^^ . . . . . "your code doesn't make any sense. first of all don't calculate damage from max health. You need to use players health before he received damage. Otherwise your damage values are way too high from the second hit. calculating damage and damage reduction when regenerating doesn't make sense.\ncalculate lasthealth - newhealth. if it is positive you're being healed. if it is negative you receive damage. only then use armor. take pen and paper, draw a flow chart, do the maths with a few examples and think befor you start to code"^^ . "0"^^ . "0"^^ . . "0"^^ . . "0"^^ . . "@RemyLebeau thanks for the advice I have fixed that and also found and posted an answer to my problem. This might not be the most efficient way to do it but i may just go with it and look how it scales later on"^^ . . . . "0"^^ . "2"^^ . . . . . . . . "@Matt : I would expect the data sorted by index, in whatever form the language can provide. Solution found, see self-answer"^^ . "0"^^ . . "0"^^ . . . "0"^^ . . . "0"^^ . "important : fltk version in murgaLua 0.7.5 is 1.1.10."^^ . . "0"^^ . . . "Please do not tag span. Have a look at [ask]"^^ . . . . . "0"^^ . . . . . . . . . . "<p>stream.conf.template:</p>\n<pre><code>server {\n charset utf-8;\n client_max_body_size 128M;\n\n listen 80;\n\n listen 443 ssl http2;\n ssl_certificate /ssl/ssl.everything;\n ssl_certificate_key /ssl/ssl.key;\n\n server_name ${CDN_BASE_DOMAIN};\n\n location ~ ^/${MULTI_PATTERN_NAMES}/.*\\.(ts|mp4|vtt|jpg|webp|webm) {\n log_by_lua_file /traffic.lua;\n add_header Access-Control-Allow-Origin *;\n add_header X-App-Id streamer-nginx;\n add_header X-Server-Id ${CDN_SERVER_ID};\n rewrite ^/${MULTI_PATTERN_NAMES}/(.*)$ /$2 break;\n root ${VIDEOS_PATH};\n }\n\n location / {\n proxy_cache DISK_CACHE;\n proxy_cache_valid 404 10m;\n\n proxy_pass http://${CONTAINER_GO}:3000;\n }\n}\n</code></pre>\n<p>.env file:</p>\n<pre><code>CONTAINER_GO=cdn-golang-app-container\nCDN_BASE_DOMAIN=stream.sample.loc\nVIDEOS_PATH=/storage\nMULTI_PATTERN_NAMES=(serve-ts|sample-app|sample-pwa)\n</code></pre>\n<p>I have a Dockerized application that includes Golang, OpenResty, Redis, and Postgres services.</p>\n<p>I had a problem before that was solved, which you can see in this <a href="https://stackoverflow.com/questions/77270819/how-to-access-value-of-ngx-var-bytes-sent-in-access-by-lua-file">link</a> and finally added <code>log_by_lua_file /traffic.lua;</code> to stream.conf.template.</p>\n<p>Now I want to do something else. I should use <strong>Lua Script</strong> instead of <code>${MULTI_PATTERN_NAMES}</code> environment variable.</p>\n<p>Suppose I have a variable in Redis named <code>cdn_patterns=(serve-ts|sample-app|sample-pwa)</code>. Now I want to connect to <strong>redis</strong> in <strong>lua script</strong> and get this value from it. Then I want to create my pattern in Openresty using this value. Now I don't know what the solution is. Can I define a variable in Lua that can also be used in Openresty? Or is there another solution?</p>\n<p>My reason for doing this is that I have a dashboard where the admin can add, remove or edit patterns. Before this, to add each pattern, I had to edit the .env file and then down and up the docker compose file once.</p>\n<p>With this method, I am looking to dynamically define the patterns in the panel without the need to up and down the app</p>\n"^^ . . "0"^^ . "<p>(answer by OP)</p>\n<p>After some hacking around, I managed to change my data structure to something that looks overkill, but at least it works</p>\n<p>Don't take that as an optimal solution...</p>\n<p>Instead of this (which does not sort, see answers)</p>\n<pre><code>local dic = {}\ndic[1] = {t=&quot;foo&quot;}\ndic[25] = {t=&quot;bar&quot;}\ndic[-30] = {t=&quot;negative&quot;}\n-- try to sort that\n</code></pre>\n<p>... which gives an unsorted and unsortable</p>\n<pre><code>{\n {\n t = &quot;foo&quot;\n },\n [-30] = {\n t = &quot;negative&quot;\n },\n [25] = {\n t = &quot;bar&quot;\n }\n}\n</code></pre>\n<p>I finally used</p>\n<pre><code>local dic = {}\ntable.insert(dic, \n {key=1, value={t=&quot;foo&quot;, ...}} \n)\ntable.insert(dic, \n {key=25, value={t=&quot;bar&quot;, ...}} \n)\ntable.insert(dic, \n {key=-30, value={t=&quot;negative&quot;, ...}} \n)\n\n-- sort with an explicit function\ntable.sort(thresholds, \n function(kv1,kv2) \n return kv1.k &lt; kv2.k end\n)\n\nfor _,kv in pairs(dic) do\n -- processing\nend\n</code></pre>\n<p>which gives a more complex, and sortable</p>\n<pre><code>{\n {\n key=1,\n value= { t = &quot;foo&quot;, ...}\n },\n ...\n}\n</code></pre>\n"^^ . . . "0"^^ . "evaluation"^^ . . . . . "0"^^ . . . "0"^^ . . "0"^^ . . "0"^^ . "1"^^ . "1"^^ . "Don't forget to change the file permissions so that anyone with a link can download it"^^ . . "treesitter"^^ . . "Ragdoll System I made not working correctly"^^ . . "Manually setting upvalue variables for 'load'ed LUA chunk"^^ . . "dictionary"^^ . "0"^^ . "1"^^ . . "1"^^ . . "I'll try, but I'm not sure I'm right. If I am, I'll make sure to get one for you. Also, in-game settings in studio, I think u can turn ragdoll on death. Then all you have to do is `player.Heath=0`. Again, I'm not sure weather that's the right format."^^ . . "Try `sudo dtruss sudo -u YOUR_USER_NAME luajit load.lua`"^^ . "Why won't lua 5.4 load a module from the current directory by default?"^^ . . . . "0"^^ . . . "3"^^ . . "0"^^ . "@shingo package.path=C:\\lua\\systree\\share\\lua\\5.4\\?.lua;C:\\lua\\systree\\share\\lua\\5.4\\?\\init.lua (before changing it; seems to match the "stack-trace")"^^ . . "2"^^ . "<p>I can implement a Lua C module <a href="https://stackoverflow.com/a/65660774">in pure C</a> by exporting a function <code>luaopen_mymodule</code> that calls <a href="https://www.lua.org/manual/5.3/manual.html#luaL_newlib" rel="nofollow noreferrer"><code>luaL_newlib</code></a>.</p>\n<p>How can I do the equivalent in C++, using the <a href="https://github.com/ThePhD/sol2" rel="nofollow noreferrer">sol2 (sol 3)</a> library?</p>\n"^^ . . . . "1"^^ . . . "logitech-gaming-software"^^ . "0"^^ . . . "0"^^ . . . . "0"^^ . . "1"^^ . . "0"^^ . . "Move the object smoothly without using cframe or position in the direction of the mouse"^^ . "1"^^ . "<p>I am working to create a ci/cd pipeline for &quot;documentation-as-code&quot;, where a number of Confluence pages need to be converted to Markdown and moved to a GIT repo. The Confluence pages contain tables as well as Gliffy images. In the lack of APIs for Confluence, my approach is to use the Word export from Confluence, and from there see what is possible to achieve with Pandoc and eventually some additional scripting in bash, Perl or Python. I also need to create nice looking PDFs from the Markdown files, and I have a pretty good setup for this with a custom Latex configuration. Apart from one sad fact - when the Markdown files (also created with a docx--&gt;markdown conversion in Pandoc) use html elements to encode the tables from Word, Pandoc seem to ignore them completely when converting to PDF. I have experimented with different Markdown output formats in the docx--&gt;markdown step as well as LUA filters, but with no luck. Any tips will be appreciated!</p>\n"^^ . "Lua/Roblox Studio - How do I hide a scrolling frame"^^ . "1"^^ . . "world-of-warcraft"^^ . . . . . . . . . "0"^^ . "Did it help your issue?"^^ . "Lua World of Warcraft: memory leak with array"^^ . "button"^^ . . . . "fltk"^^ . . . . "0"^^ . "0"^^ . . "0"^^ . "video-streaming"^^ . . "2"^^ . . "1"^^ . . . "<p>According to the <a href="https://github.com/Hammerspoon/hammerspoon/blob/master/SPOONS.md#code" rel="nofollow noreferrer">Hammerspoon docs on spoon development</a> you can not use <code>require</code> and should instead use the following:</p>\n<pre><code>dofile(hs.spoons.resourcePath(&quot;someCode.lua&quot;))\n</code></pre>\n"^^ . "wireshark"^^ . "0"^^ . . . . . "I don't think the linked question/answer applies, as it looks quite easy, in case of Lua vm stack, to add ability to handle multiple multiret calls. Also, we have at least one original Lua developer here on SO. Maybe he wanted to reply?"^^ . . . . "0"^^ . . . "roblox"^^ . . "Note that OSC 9 is Windows-specific; WezTerm may use a different one, such as OSC 7; also, perhaps the embedded `"` chars. aren't expected."^^ . "confluence"^^ . . . . . . . "0"^^ . . "<p>i am stuck with a personal code murgaLua 0.7.5 (OS Linux Lubuntu LTS, but it should work in Windows) that captures in a fltk graphic window (created by the code) a diagram image and writes it in png format. Unfortunately, this MurgaLua-specific PNG image writing function, saveAsPng(), seems slower than the calculation of the histogram table, and as I have several diagrams to write, either I have a &quot;core dumped&quot; message, or only the last diagram is saved, or, and this is the current solution, a fltk &quot;modal window&quot; is displayed to delay the operations, and I get the different images on disk. The problem is the volume: I want to write an automatic report with potentially more than 500 diagrams! The test data file is an OpenData file of more than 450 MB, downloadable here:</p>\n<p><a href="https://open-data-assurance-maladie.ameli.fr/medicaments/download_file2.php?file=Open_MEDIC_Base_Complete/OPEN_MEDIC_2023.zip" rel="nofollow noreferrer">https://open-data-assurance-maladie.ameli.fr/medicaments/download_file2.php?file=Open_MEDIC_Base_Complete/OPEN_MEDIC_2023.zip</a></p>\n<p>And the complete murgaLua code is here\n<a href="https://github.com/mterras01/murgaLua/blob/main/statsoncsv_next2.lua" rel="nofollow noreferrer">https://github.com/mterras01/murgaLua/blob/main/statsoncsv_next2.lua</a></p>\n<p>Following function is fully working</p>\n<pre><code>function read_Image()\n pwindow:make_current()\n Fl:check()\n Fl:flush()\n imageString = fltk.fl_read_image(0, 0, width_pwindow, height_pwindow)\n Fl:check()\n Fl:flush()\n image2 = fltk:Fl_RGB_Image(imageString, width_pwindow, height_pwindow, 3, 0)\n Fl:check()\n Fl:flush()\n fileName = title .. &quot;.png&quot;\n image2:saveAsPng(fileName)\nend\n</code></pre>\n<p>It is called from a for-loop (successive images).\n(I know murgaLua is an old language (i'm 59 old) written by John de Murga).</p>\n<p>i successfully can save all my charts with</p>\n<pre><code> Fl:check()\n pwindow:show()\n pwindow:redraw()\n Fl:flush()\n pwindow:set_modal()\n if fltk:fl_choice(&quot;Save Charts or not ?&quot;, &quot;No&quot;, &quot;Yes&quot;, nil) == 1 then\n read_Image()\n end\n pwindow:set_non_modal()\n</code></pre>\n<p>but have to click each time to save. Not the good way to build a 500 images report.</p>\n"^^ . . "0"^^ . . "0"^^ . . . . "kong-plugin"^^ . "0"^^ . "<p>Not sure why you are calling the event inside a loop, even if that loop <em>should</em> only execute once. Here's how I would approach a debounced event handler.</p>\n<p>It might be worth searching your Workspace when the game is running to see if you somehow have clones of this LocalScript somewhere.</p>\n<pre class="lang-lua prettyprint-override"><code>local textbox = script.Parent\nlocal event = game.ReplicatedStorage.FireCode\nlocal debounce = false\nlocal COOLDOWN = 2.0 -- seconds\n\ntextbox.FocusLost:Connect(function(enterPressed)\n -- escape if the flag is active\n if debounce then\n return\n end\n \n if enterPressed then\n debounce = true\n -- get the code and then clear the text box so we don't repeat the same command\n local code = textbox.Text\n textbox.Text = &quot;&quot;\n\n -- execute the code\n event:FireServer(code)\n\n -- wait for a moment before clearing the debounce flag\n wait(COOLDOWN)\n debounce = false\n end\nend)\n</code></pre>\n"^^ . . "0"^^ . "0"^^ . . . . . . "github-copilot"^^ . . . "Add text to start of Lua pandoc Span and Div when I show/hide solutions"^^ . . . "1"^^ . "<p>We have base LUA file <code>~/.hammerspoon/init.lua</code> which can load a spoon package:</p>\n<pre class="lang-lua prettyprint-override"><code>hs.loadSpoon(&quot;Foo&quot;)\n</code></pre>\n<p>Now we have our package file <code>init.lua</code> by path:\n<code>~/.hammerspoon/Spoons/Foo.Spoon/init.lua</code></p>\n<p>It works fine.</p>\n<p>I create a file <code>my/bar.lua</code> inside this package. Full path:</p>\n<pre><code>`~/.hammerspoon/Spoons/Foo.Spoon/my/bar.lua`\n</code></pre>\n<p>with code:</p>\n<pre class="lang-lua prettyprint-override"><code>return {}\n</code></pre>\n<p>and it should be included in <code>~/.hammerspoon/Spoons/Foo.Spoon/init.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>local bar = require(&quot;Foo.Spoon.my.bar&quot;)\n</code></pre>\n<p>We will see similar error:</p>\n<pre><code>Error loading Foo:..poon.app/Contents/Resources/extensions/hs/_coresetup.lua:662: module 'Foo.Spoon/my/bar' not found:\nno field package.preload['Foo.Spoon/my/bar']\nno file '/Users/me/.hammerspoon/Foo/Spoon/my/bar.lua' no file '/Users/me/.hammerspoon/Foo/Spoon/my/bar/init.lua'\nno file /Users/me/.hammerspoon/Spoons/Foo/Spoon/my/bar.spoon/init.luat26:\nno file opt/homebrew/share/lua/5.4/Foo/Spoon/my/bar.lua'\n...\n</code></pre>\n<p>I played with various options like</p>\n<ul>\n<li><code>require(&quot;my.bar&quot;)</code></li>\n<li><code>require(&quot;Foo.my.bar&quot;)</code></li>\n</ul>\n<p>all of them fail.</p>\n<h4>Problem</h4>\n<p>In case of using <code>require(&quot;Foo.Spoon.my.bar&quot;)</code>, it looks like the loader the loader always replaces &quot;.&quot; with &quot;/&quot; which breaks options to mention the package folder <code>Foo.Spoon</code>.<br>\nBut it suppose to keep &quot;Foo.Spoon&quot; instead of &quot;Foo/Spoon&quot;. <br>And it does not:</p>\n<pre><code>no file '/Users/me/.hammerspoon/Foo/Spoon/my/bar.lua' no file \n</code></pre>\n<p>According to logs it obviously walks around, but does not look at the <code>Foo.Spoon</code> directory (tried <code>.spoon</code> it in lowercase too), which is strange.</p>\n<p>Any advice/workaround (but without changing &quot;require&quot; function, or using absolute paths)?..</p>\n<p>P.S. I took a look at related other posts.</p>\n"^^ . . . . . "try `if #db1 >= db1l then...` and in function `db1doe()` you can be safe and use `for i=1,#db1-db1l do table.remove(db1, 1) end`"^^ . "Can you provide an example of what it should look like?"^^ . . . "<p>My friend used the script on Roblox Studio:</p>\n<pre><code>\n\n\n\nlocal cas = game:GetService(&quot;ContextActionService&quot;)\nlocal rs = game:GetService(&quot;ReplicatedStorage&quot;)\n\nlocal events = rs:WaitForChild(&quot;Events&quot;)\nlocal hitboxEvent = events:WaitForChild(&quot;Hitbox&quot;)\n\nlocal plr = game.Players.LocalPlayer\nlocal character = plr.Character or plr.CharacterAdded:Wait()\nlocal hum = character:WaitForChild(&quot;Humanoid&quot;)\nlocal animator = hum:WaitForChild(&quot;Animator&quot;)\n\nlocal rightPunch = animator:LoadAnimation(script:WaitForChild(&quot;RightPunch&quot;))\n\nlocal currentPunch = 0\n\nlocal debounce = false\nlocal function punch()\n if debounce then return end\n debounce = true\n if currentPunch == 0 then\n rightPunch:Play()\n hitboxEvent:FireServer(Vector3.new(1,1,1), Vector3.new(\n\n5), 50, 0.3)\n task.wait(0.4)\n debounce = false\n elseif currentPunch == 1 then\n rightPunch:Play()\n hitboxEvent:FireServer(Vector3.new(1,1,1), Vector3.new(2,5), 50, 0.3)\n debounce = false\n elseif currentPunch == 2 then\n rightPunch:Play()\n hitboxEvent:FireServer(Vector3.new(1,1,1), Vector3.new(2,5), 50, 0.3)\n debounce = false\n end\n \n if currentPunch == 2 then\n currentPunch = 0\n else\n currentPunch += 1 \n end\nend\n</code></pre>\n<p>cas:BindAction(&quot;Punch&quot;, punch, true, Enum.UserInputType.MouseButton1)\n<a href="https://i.sstatic.net/lIn1tP9F.png" rel="nofollow noreferrer">Screenshot</a>\nThe script is running perfectly for him, but not for me. The animation will not play on my game but it works on his screen. He was the one who made the animation, but it also works for my other friend. How do I fix this? (Computer: Mac, Apple M3, macOS Sonoma V.14.6.1)</p>\n<p>I cleared Roblox studio's cache. I expected it to work. it did not. (By the way, do NOT use solutions that turn off my firewall)</p>\n"^^ . "<p>I need help with a gas gauge for a car in Roblox.</p>\n<p>Setup:\nDriveSeat (VehicleSeat) and GasValue (NumberValue) are in the same car model.\nI have a GasGUI with a TextLabel that displays the gas percentage.\nI used a <code>LocalScript</code> in the <code>TextLabel</code>.</p>\n<p>The issue is that the script only shows &quot;Gas: --%&quot; even when I enter the car, and I want it to show how much gas is in the car.</p>\n<pre class="lang-lua prettyprint-override"><code>local player = game.Players.LocalPlayer\nlocal gasLabel = script.Parent\ngasLabel.Text = &quot;Gas: --%&quot;\n\nlocal function onDriveSeatChanged(driveSeat)\n if driveSeat.Occupant and driveSeat.Occupant.Parent == player.Character then\n local car = driveSeat.Parent\n local gasValue = car:FindFirstChild(&quot;GasValue&quot;)\n\n if gasValue then\n gasLabel.Text = &quot;Gas: &quot; .. math.floor(gasValue.Value) .. &quot;%&quot;\n gasValue:GetPropertyChangedSignal(&quot;Value&quot;):Connect(function()\n gasLabel.Text = &quot;Gas: &quot; .. math.floor(gasValue.Value) .. &quot;%&quot;\n end)\n else\n gasLabel.Text = &quot;Gas: N/A&quot;\n end\n else\n gasLabel.Text = &quot;Gas: --%&quot; \n end\nend\n</code></pre>\n<p>I'm not sure what isn't working.</p>\n"^^ . "3"^^ . . . . "0"^^ . "<p>I am new to here, I'm also a beginner in Lua. I know something about Roblox Studio though. But how do I hide a scrolling frame with a button as the frame's child? I've made some rules by scrolling frame and &quot;I agree&quot; button in it. I want the rules to hide when button is clicked.</p>\n<p>I tried</p>\n<pre><code>local button = script.Parent\nlocal menu = script.Parent.Parent.Parent\n\nlocal function onButtonClicked()\n if menu.Visible then\n menu.Visible = false\n else\n menu.Visible = true\n end\nend\n\nbutton.MouseButton1Down:Connect(onButtonClicked)\n</code></pre>\n<p>and it resulted with nothing.</p>\n"^^ . . . "0"^^ . . . . . . . . . "debugging"^^ . . "0"^^ . "<p>So i found answer to my question. Again, thanks to Albrecht Schlosser (danke sehr!), for its suggestion. It seems that (one) solution was to open a countdown-autoclosing-fltk-modal-window that makes &quot;synchro&quot; graphic (draw charts) &amp; computing tasks (read-convert and save images-as-a-file for each charts). This fully works with Linux OS, but there is a 45-sec-lag with Windows (in today version, work in progress, if interested, see my github)... It's more easy to write this script with python, but murgaLua is such a GEM.Please,please developpers, consider about updating this GEM !</p>\n"^^ . . . . . . "How to write a Lua C module with sol2?"^^ . "0"^^ . "It worked i must have been just too eager to get it done Tysm"^^ . . . . "0"^^ . "0"^^ . "This is exactly what I found out last night after fiddling around with the upvalues. Makes a lot more sense now! Good to know that it only has exactly one upvalue \n\nWhat I ended up doing is using `lua_getupvalue` to obtain a reference to that chunk's `_ENV`, and then a quick `lua_setfield` to add in a reference to that `SomeClass` table under the `self` key and then unregistering it after evaluating the `pcall`. Don't know if there's a cleaner way of doing it, but it gets the job done. Thanks for the help!!"^^ . "<p>I am currently building a program that lets me implement Lua scripts.</p>\n<p>I want to get into serialization of those scripts, by accessing only the global variable of a <code>lua_State</code> by name and by value.</p>\n<p>My Lua script looks like this:</p>\n<pre class="lang-lua prettyprint-override"><code>TESTVALUE1 = 10\n--TESTVALUE2 = 5.5\n--TESTVALUE3 = &quot;TEST&quot;\n--TESTVALUE4 = {hallo=5, x=5.4, y=&quot;y&quot;, t={5, 8}}\n\nfunction Setup(object) -- Setup is executed once the GameObject is completely loaded the associated object is given to store in a global if needed\n\nend\n\nfunction Update(deltatime) -- deltatime is the frametime\n\nend\n\nfunction Render() -- Called every frame, put your render functions inside!\n\nend\n</code></pre>\n<p>And my serialization in C++ looks like this:</p>\n<pre class="lang-cpp prettyprint-override"><code>void serialize(std::ofstream &amp;file) {\n if (file.is_open() &amp;&amp; file.good()) {\n // Writing script name and path to the file\n file.write((char *)&amp;path, sizeof(path));\n file.write((char *)&amp;name, sizeof(name));\n lua_pushglobaltable(L);\n lua_pushnil(L);\n while (lua_next(L, -2) != 0) {\n char value_type = 0;\n std::string name = lua_tostring(L, -2);\n lua_getglobal(L, name.c_str());\n if (lua_isfunction(L, -1)) {\n lua_pop(L, 2);\n continue;\n }\n if (lua_isinteger(L, -1)) {\n file.write((char *)&amp;name, sizeof(name));\n int val = lua_tointeger(L, -1);\n value_type = 1;\n file.write((char *)&amp;value_type, sizeof(value_type));\n file.write((char *)&amp;val, sizeof(val));\n } else if (lua_isnumber(L, -1)) {\n file.write((char *)&amp;name, sizeof(name));\n float val = lua_tonumber(L, -1);\n value_type = 2;\n file.write((char *)&amp;value_type, sizeof(value_type));\n file.write((char *)&amp;val, sizeof(val));\n } else if (lua_isstring(L, -1)) {\n file.write((char *)&amp;name, sizeof(name));\n std::string val = lua_tostring(L, -1);\n value_type = 3;\n file.write((char *)&amp;value_type, sizeof(value_type));\n file.write((char *)&amp;val, sizeof(val));\n } else if (lua_istable(L, -1)) {\n file.write((char *)&amp;name, sizeof(name));\n value_type = 4;\n file.write((char *)&amp;value_type, sizeof(value_type));\n int top = lua_gettop(L);\n serializetable(file, top);\n } else {\n file.write((char *)&amp;name, sizeof(name));\n file.write((char *)&amp;value_type, sizeof(value_type));\n }\n lua_pop(L, 2);\n }\n lua_pop(L, 1);\n }\n}\n</code></pre>\n<p>If I just print out all the names of my global variables, I get this:</p>\n<pre class="lang-none prettyprint-override"><code>setmetatable\ndofile\nos\nrawget\nrequire\npackage\nutf8\n_G\n_VERSION\nload\npairs\nwarn\ntostring\ntype\npcall\ncollectgarbage\nloadfile\nrawset\nrawequal\nassert\nprint\nnext\nxpcall\nstring\ncoroutine\nRender\nipairs\nUpdate\nSetup\nerror\nselect\ndebug\nmath\ntonumber\nrawlen\nTESTVALUE1\ngetmetatable\nio\ntable\n</code></pre>\n<p>So, there are much more than just my <code>TESTVALUE1</code>, <code>Setup</code>, <code>Update</code>, and <code>Render</code> globals. Is there a way to get rid of the others?</p>\n<p>I can skip functions by checking with <code>lua_isfunction(L, -1)</code>, but some of these are not functions and crash my code.</p>\n"^^ . "<p>The issue is caused by the creation of the Vector3:</p>\n<p>Let's say we have <code>P = Vector3.new(1,2,3)</code>. Then we do <code>tostring(P)</code>, which returns <code>boxData = &quot;1, 2, 3&quot;</code>.</p>\n<p>Now, when you GetAsync, you use <code>:match(&quot;(.+), (.+), (.+)&quot;)</code>, which returns one string: &quot;1 2 3&quot;. Passing this variable to Vector3.new is the same as: <code>Vector3.new(&quot;1 2 3&quot;)</code>. Since using strings is invalid, the vector returns <code>0, 0, 0</code>.</p>\n<p>Instead, you want to use a different function. Since you need a table of arguments, we can use <a href="https://create.roblox.com/docs/reference/engine/libraries/string#split" rel="nofollow noreferrer"><code>string:split</code></a>. So, then we would have <code>boxData:split(&quot;, &quot;)</code> which returns <code>{&quot;1&quot;,&quot;2&quot;,&quot;3&quot;}</code>.</p>\n<p>We want to pass these numbers as separate parameters, not as table, so we can wrap <code>unpack()</code> around it.</p>\n<p>The full code would be:</p>\n<pre class="lang-lua prettyprint-override"><code>if boxData then\n workspace.Box.Position = Vector3.new(unpack(boxData:split(&quot;, &quot;)))\nelse\n BoxPos:SetAsync(plr.UserId, nil)\nend\n</code></pre>\n<p>Let me know if it worked - and don't hestitate to place a comment if it didn't!</p>\n"^^ . "0"^^ . "<p>If the button is a direct child of the scrolling frame you're going up one parent too much.</p>\n<p>It should be this:</p>\n<pre><code>local menu = script.Parent.Parent\n</code></pre>\n<p>If that's not it, you might have accidentally disabled your script.</p>\n<p>I've recreated your scenario in my own studio and your code works fine, see the images and link to a short video below.</p>\n<p>Since your script works just fine for me, it might not work for you because you disabled it. To enable it, right-click the script and select &quot;Enable scripts&quot;.</p>\n<h2><strong>My set-up:</strong></h2>\n<p>(As per your current code)</p>\n<p><a href="https://i.sstatic.net/xVo1u55i.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/xVo1u55i.png" alt="xxwas" /></a></p>\n<p>See the result <a href="https://gyazo.com/0bf57ba130bbb83b8535df3a6ca47320" rel="nofollow noreferrer">here</a> (gyazo).</p>\n<p>Hopefully, this resolves your issue.</p>\n"^^ . "0"^^ . . "xml"^^ . "0"^^ . . "0"^^ . . "1"^^ . "```table.sort(dic,``` ```return kv1.key < kv2.key```"^^ . "neovim"^^ . . ""The implicit parameter self is dynamic, its value depends on how the function is invoked." -- I know this. More over second paragraph of your answer is already in the original post. When you write `b = Button:new()` `self` is `Button` so the resulting line is `Button = setmetatable(...)`, isn't it ?"^^ . . . . . "1"^^ . "1"^^ . . "visual-studio-code"^^ . "<p>So, I am trying to armor for a Roblox game, I made it DETECT when the player has health changed (Like damage), after fighting, the armor starts to take up durability when the player is regening health. Is the any idea how to fix this?</p>\n<p>Here is the armor script:</p>\n<pre><code>local armor = script.Parent\nrepeat wait() until armor.Parent:FindFirstChild(&quot;Humanoid&quot;)\n\nlocal player = game.Players:GetPlayerFromCharacter(armor.Parent)\nlocal dura = armor.Durability.Value\nlocal max = armor.Max.Value\n\nlocal damageReduction = 4\nlocal regening = false\n\nplayer.Character:FindFirstChild(&quot;Humanoid&quot;).HealthChanged:Connect(function()\n if dura &gt; 0 and not regening then\n regening = true\n \n local dmgRecieved = player.Character:FindFirstChild(&quot;Humanoid&quot;).Health - player.Character:FindFirstChild(&quot;Humanoid&quot;).MaxHealth\n print(math.abs(math.floor(dmgRecieved)))\n\n armor.ArmorHitSFX:Play()\n dura -= 1\n \n player.Character:FindFirstChild(&quot;Humanoid&quot;).Health += dmgRecieved/damageReduction\n wait(0.01)\n regening = false\n else\n armor:Destroy()\n end\nend)`\n</code></pre>\n<p>And here is the tool activation:</p>\n<pre><code>local armor = script.Parent\nrepeat wait() until armor.Parent:FindFirstChild(&quot;Humanoid&quot;)\n\nlocal player = game.Players:GetPlayerFromCharacter(armor.Parent)\n\narmor.Activated:Connect(function()\n player.PlayerGui.Stats.ArmorBackground.Visible = true\n \n local weld = Instance.new(&quot;WeldConstraint&quot;,armor.Handle)\n weld.Part0 = armor.Handle\n weld.Part1 = armor.Parent.Torso\n \n armor.Handle.Parent = player.Character\n armor:Destroy()\nend)\n</code></pre>\n<p>This is running on a server side script, to make sure the armor actually breaks rather than leaving to on the player. I have tried to add a damage as a variable to make sure it only counted the damage, not when regening, but it still wouldn't work. There also seems to be no apparent tutorials on how to get rid of this problem but only showed how to disable regening, is there any way that I can fix this so I don't have to scrap this?</p>\n"^^ . "Frequent Crashes in internshrstr after Multiple Executions of Lua Script Using lua_newthread"^^ . . . . . . . . "0"^^ . . . "<p>Since the init script works fine, you can append the directory of the init script to <code>package.searchpath</code>, so that lua is able to find the module from this directory.</p>\n<pre><code>-- modulePath will be resolved as '~/.hammerspoon/Spoons/Foo.Spoon/init.lua'\nlocal modulePath = package.searchpath('Foo', package.path)\n\n-- Remove 'init.lua'\nmodulePath = modulePath:match('(.*/)')\n\n-- Append ';~/.hammerspoon/Spoons/Foo.Spoon/?.lua' to package.path\npackage.path = package.path .. ';' .. modulePath .. '?.lua'\n\n-- Now the following code will resolve the module path as \n-- '~/.hammerspoon/Spoons/Foo.Spoon/my/bar.lua'\nlocal bar = require(&quot;my.bar&quot;)\n</code></pre>\n"^^ . . "3"^^ . "Unfortunately, using this method results in the same problem, likely because `MoveTo()` is called every 0.1 seconds from the enemy script, so it will be quickly overridden if called somewhere else."^^ . . . . . . . "3"^^ . . . "1"^^ . . "@MindSwipe How can I instruct Visual Studio to use the SDK-style format for projects? How can I convert the existing project?"^^ . . "Roblox running animation doesnt work, but the walking animation does"^^ . . . "1"^^ . . . . "0"^^ . . . . . . . . . . . . "`local name, age = person.name, person.age`"^^ . . . "2"^^ . . "Problem setting nginx variable from inside lua block - Value doesn´t change on nginx/location variable"^^ . . . . "0"^^ . . . "2"^^ . . . . . . "<p>this is likely because of <a href="https://create.roblox.com/docs/workspace/streaming" rel="nofollow noreferrer">Streaming Enabled</a>. A simple fix would be to disable it. It's a property of workspace</p>\n"^^ . "1"^^ . . "0"^^ . . . . . . . . . "That doesn't seem to be an error, but a notice ([globalpatches.lua](https://github.com/Kong/kong/blob/3cff1b1c9ac1ddef10d550d8d484227a32e7bdd0/kong/globalpatches.lua#L75)), and as @AlexanderMashin said, you didn't include `kong start` in the `docker run` command"^^ . . . "0"^^ . . . "I think you should use another true/false flag to crack this problem."^^ . . . "I suggest to go to both repos and add a feature request."^^ . . . . . . "0"^^ . "parsing"^^ . . . . . "0"^^ . . . . . . . "0"^^ . . "1"^^ . "module"^^ . . "This code is fully operational. It requests a number and outputs a factorial. (I tested it in VS Code.)"^^ . . . . . . . . . "4"^^ . . . . . "2"^^ . . . . . . "<p>So I'm trying to make a table of all the creatures in a game, each creature consisting of a table with their stats. I used the creature's name as the key in the first table, but now I need to get that name, but I'm not sure how/if you can do that?</p>\n<pre class="lang-lua prettyprint-override"><code>local creatureArray = {[&quot;White Wyrm&quot;]= {\n [&quot;dungeon&quot;]= &quot;Cavernam&quot;,\n [&quot;slayer&quot;]= &quot;Beastial&quot;,\n [&quot;difficulty&quot;]= 100.8,\n [&quot;goldvalue&quot;]= 1008,\n [&quot;hits&quot;]= 4500,\n [&quot;mindmg&quot;]= 45,\n [&quot;maxdmg&quot;]= 55,\n [&quot;wrestling&quot;]= 105,\n [&quot;armor&quot;]= 50,\n [&quot;magicresist&quot;]= 25,\n [&quot;ai&quot;]= &quot;Melee&quot;,\n [&quot;speed&quot;]= &quot;Medium&quot;,\n [&quot;uniquescaler&quot;]= 1.35\n},\n}\n</code></pre>\n<p>In the example above when I iterate over this entry in the &quot;creatureArray&quot; I need to get the &quot;White Wyrm&quot; value, or the key that the sub-table is assigned to? I feel like the answer must be really simple, but I've found it hard to find answers because I'm referring to tables inside tables and probably using the wrong terminology to begin with.</p>\n<p>For those who were wondering the game is Ultima Online Outlands, I have no affiliation with them, I'm just working on a Lua module to hopefully integrate into their community-run wiki.</p>\n<p>I tried just referencing the table since I'm using a for loop to iterate over all of the creatures:\n<code>for i, creature in pairs(creatureArray)</code>\nIn this example I tried just using &quot;creature&quot;, but that references the table object itself and not the key.</p>\n<p>I'm know I could add a value under each creature called &quot;name&quot;, but that just seems redundant.</p>\n"^^ . "0"^^ . . . "user-interface"^^ . . . . . "3"^^ . . "0"^^ . "0"^^ . "3"^^ . "[That](https://stackoverflow.com/q/73365404/1847592) question is very similar to your. Does that answer solve your problem?"^^ . . . "See https://docs.rs/mlua/0.9.9/mlua/#send-requirement. The code will still not compile as you are also storing a `LuaTable` in you struct, which will require a self-referential struct."^^ . . "2"^^ . "0"^^ . "<p>I tried to install Telescope and Treesitter plugins in my Nvim, but when I open Nvim I get this error message:</p>\n<blockquote>\n<p>Error detected while processing /home/user/.config/nvim/init.lua:\nE5113: Error while calling lua chunk: vim/keymap.lua:0: rhs: expected string|function, got nil\nstack traceback:\n[C]: in function 'error'\nvim/shared.lua: in function 'validate'\nvim/keymap.lua: in function 'set'\n.../user/.config/nvim/lua/core/plugin_config/telescope.lua:4: in main chunk\n[C]: in function 'require'\n/home/user/.config/nvim/lua/core/plugin_config/init.lua:5: in main chunk\n[C]: in function 'require'\n[nvim-treesitter] [0/7] Downloading tree-sitter-markdown_inline...\nPress ENTER or type command to continue</p>\n</blockquote>\n<hr />\n<pre><code>-- ~/.config/nvim/init.lua\nvim.g.loaded_netrw = 1\nvim.g.loaded_netrwPlugin = 1\n\nlocal lazypath = vim.fn.stdpath(&quot;data&quot;) .. &quot;/lazy/lazy.nvim&quot;\nif not vim.loop.fs_stat(lazypath) then\n vim.fn.system({\n &quot;git&quot;,\n &quot;clone&quot;,\n &quot;--filter=blob:none&quot;,\n &quot;https://github.com/folke/lazy.nvim.git&quot;,\n &quot;--branch=stable&quot;, -- latest stable release\n lazypath,\n })\nend\nvim.opt.rtp:prepend(lazypath)\n\n\nrequire(&quot;core.keymaps&quot;)\nrequire(&quot;core.plugins&quot;)\nrequire(&quot;core.plugin_config&quot;)\n</code></pre>\n<pre><code>-- ~/.config/nvim/lua/core/plugins.lua\nrequire(&quot;lazy&quot;).setup({\n 'ellisonleao/gruvbox.nvim',\n 'nvim-tree/nvim-tree.lua',\n 'nvim-tree/nvim-web-devicons',\n 'nvim-lualine/lualine.nvim',\n 'nvim-treesitter/nvim-treesitter',\n {\n 'nvim-telescope/telescope.nvim', tag = '0.1.8',\n dependencies = { {'nvim-lua/plenary.nvim'} }\n },\n})\n</code></pre>\n<pre><code>-- ~/.config/nvim/lua/core/plugin_config/init.lua\nrequire(&quot;core.plugin_config.gruvbox&quot;)\nrequire(&quot;core.plugin_config.lualine&quot;)\nrequire(&quot;core.plugin_config.nvim-tree&quot;)\nrequire(&quot;core.plugin_config.treesitter&quot;)\nrequire(&quot;core.plugin_config.telescope&quot;)\n</code></pre>\n<pre><code>-- ~/.config/nvim/lua/core/plugin_config/telescope.lua\nlocal builtin = require('telescope.builtin')\n\nvim.keymap.set('n', '&lt;c-p&gt;', builtin.find_files, {})\nvim.keymap.set('n', '&lt;Space&gt;&lt;Space&gt;', builtin.old_files, {})\nvim.keymap.set('n', '&lt;Space&gt;fg', builtin.live_grep, {})\nvim.keymap.set('n', '&lt;Space&gt;fh', builtin.help_tags, {})\n</code></pre>\n<pre><code>-- ~/.config/nvim/lua/core/plugin_config/treesitter.lua\nrequire'nvim-treesitter.configs'.setup {\n -- A list of parser names, or &quot;all&quot; (the listed parsers MUST always be installed)\n ensure_installed = { &quot;c&quot;, &quot;lua&quot;, &quot;vim&quot;, &quot;vimdoc&quot;, &quot;query&quot;, &quot;markdown&quot;, &quot;markdown_inline&quot;, &quot;html&quot;, &quot;css&quot;, &quot;javascript&quot; },\n -- Install parsers synchronously (only applied to `ensure_installed`)\n sync_install = false,\n auto_install = true,\n highlight = {\n enable = true,\n },\n}\n</code></pre>\n<p>I tried this <a href="https://stackoverflow.com/questions/71605407/the-lua-errore5113-error-while-calling-lua-chunkxattempt-to-call-fiel-d-set">The Lua error:&quot;E5113: Error while calling lua chunk:xattempt to call fiel d &#39;setup&#39; (a nil value)&quot;</a>, but it didn't work.</p>\n<p>When i remove the Telescope and Treesitter plugins, Nvim starts working again.</p>\n<p>So how can I fix this problem?</p>\n"^^ . "0"^^ . . . "0"^^ . "How to remove a prefix from a string in lua?"^^ . "0"^^ . . . "0"^^ . . "uefi"^^ . . . "0"^^ . . . . . "2"^^ . . . "Thank you! I tried to simplify everything first:\n1. Transform the first ellipse into a unit circle by dividing the coordinates into a1 and b1. The problem here is that the foci of the second ellipse shift, and the angle of inclination changes.\n2. Rotate the coordinate system so that the second ellipse is horizontal, at the same time shifting the unit circle of the first ellipse to the origin.\n3. Solve a slightly simpler system."^^ . "0"^^ . . . . ":GetChildren() seemingly returning an empty table?"^^ . "lua"^^ . "1"^^ . . "<p>My operating system is Windows 10 64 bit, and the downloaded version of Lua's sdl library is LuaSdl2_2.0.5-6.0\nMy operation steps are as follows:</p>\n<ol>\n<li><p>First, download the SDL-Release-2.0.5.zip source code from GitHub</p>\n</li>\n<li><p>Download the Luasdl2_2.0.5-6.0.zip source code again</p>\n</li>\n<li><p>Unzip SDL-Release-2.0.5.zip source code</p>\n</li>\n<li><p>Add three projects (SDL, SDLMain, SDLtest) under the source code directory of SDL-lease-2.5.5 in Visual C to my solution</p>\n</li>\n<li><p>The compilation of SDL, SDLMain, and SDLtest projects resulted in SDL2.dll, SDL2.lib, SDLMain.lib, and SDLtest.lib</p>\n</li>\n<li><p>Create a new SDL library project in my solution for calling Lua 5.4.7, add existing items from the src directory of Lua sdl2_2.0.5-6.0</p>\n</li>\n<li><p>You can view the content shown in the picture</p>\n<p>Unable to upload image!!!</p>\n<p>(1) SDL(not lua) project:</p>\n<p>step-1: add existing item from SDL-release-2.0.5\\VisualC DIR.</p>\n<p>step-2: build SDL2.dll、SDL2.lib、SDL2main.lib、SDL2test.lib is ok.</p>\n<p>(2) lua SDL project:</p>\n<p>step-1: add existing item from luasdl2-2.0.5-6.0\\src DIR</p>\n<p>step-2: Configuration Properties--&gt;C/C++--&gt;General--&gt;Additional Dependencies--&gt;</p>\n<p>include &quot;xxx\\SDL-release-2.0.5\\include&quot; DIR</p>\n<p>include &quot;xxx\\luasdl2-2.0.5-6.0\\src&quot;, using common DIR</p>\n<p>include &quot;xxx\\luasdl2-2.0.5-6.0\\rocks&quot;</p>\n<p>include &quot;xxx\\luasdl2-2.0.5-6.0\\extern\\queen&quot;, using sys\\queen.h</p>\n<p>include &quot;xxx\\lua547\\src&quot;</p>\n<p>step-3: Linker--&gt;General--&gt;Additional Library Directories--&gt;</p>\n<p>add my lua54.lib、SDL2.lib、SDL2main.lib、SDL2test.lib, and SDL2.dll copy to lua.exe Release DIR</p>\n<p>--&gt;Input: lua54.lib, SDL2.lib, SDL2main.lib, SDL2test.lib</p>\n<p>step-4: build lua SDL project</p>\n<p>step-5: as follows</p>\n</li>\n</ol>\n<p>When I clicked on generate, I didn't understand why there were 50 errors. These 50 errors seemed to be missing SDL2.lib, but I had already added and set them up, so I don't know why these errors still exist.\nI can confirm that there is no problem with my Lua54.lib, as the Lua socket library has already been generated and tested for Lua sockets.\nMy configuration options are Release and x86\nIf you know what the problem is, feel free to give me some tips and suggestions. thank you.</p>\n<p>I hope to receive an answer, thank you</p>\n<blockquote>\n<p>Blockquote\nSeverity Code Description Project File Line Suppression State\nWarning C4244 '=': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\audio.c 125\nWarning C4244 '=': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\audio.c 128\nWarning C4244 '=': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\audio.c 130\nWarning C4244 '=': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\display.c 67<br />\nWarning C4244 '=': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\events.c 273\nWarning C4244 '=': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\events.c 275\nWarning C4244 '=': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\events.c 396\nWarning C4244 '=': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\rectangle.c 144\nWarning C4244 '=': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\rectangle.c 145\nWarning C4244 '=': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\rectangle.c 146\nWarning C4244 '=': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\rectangle.c 147\nWarning C4244 '=': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\thread.c 99<br />\nWarning C4244 '=': conversion from 'lua_Integer' to 'Uint16', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 593\nWarning C4244 '=': conversion from 'lua_Integer' to 'Uint16', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 594\nWarning C4244 '=': conversion from 'lua_Integer' to 'Uint16', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 595\nWarning C4244 'function': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\haptic.c 766\nWarning C4244 'function': conversion from 'lua_Integer' to 'Uint32', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\timer.c 173\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\audio.c 406\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\audio.c 429\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\display.c 91<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\display.c 131\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\display.c 152\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\display.c 174\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\display.c 201\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\display.c 225\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\display.c 226\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\display.c 250\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\display.c 305\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\events.c 141\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\events.c 142\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\events.c 185\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\events.c 202\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\events.c 203\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\events.c 222\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\events.c 240\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\events.c 241\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\events.c 262\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\events.c 263\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\events.c 351\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\gamecontroller.c 111\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\gamecontroller.c 135\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\gamecontroller.c 159\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\gamecontroller.c 181\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\gl.c 70<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\gl.c 71<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\gl.c 92<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\gl.c 232\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\haptic.c 60<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\haptic.c 314\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\haptic.c 358\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\haptic.c 483\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\haptic.c 528\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\haptic.c 529\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\haptic.c 626\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\haptic.c 704\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\joystick.c 39<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\joystick.c 63<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\joystick.c 87<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\joystick.c 128\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\joystick.c 235\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\joystick.c 254\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\joystick.c 276\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\joystick.c 294\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\keyboard.c 31<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\logging.c 47<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\logging.c 141\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\logging.c 170\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\logging.c 171\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\logging.c 201\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\logging.c 244\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\logging.c 245\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\mouse.c 64<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\mouse.c 65<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\mouse.c 95<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\mouse.c 96<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\mouse.c 97<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\mouse.c 98<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\mouse.c 286\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\mouse.c 287\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\renderer.c 81<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\renderer.c 141\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\renderer.c 253\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\renderer.c 254\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\renderer.c 255\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\renderer.c 256\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\renderer.c 908\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\renderer.c 909\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 613\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 674\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 675\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 693\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 694\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 735\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 736\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 773\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 774\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 894\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'int', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 895\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'SDL_Keycode', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\keyboard.c 91<br />\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'SDL_Keycode', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\keyboard.c 178\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'size_t', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\audio.c 780\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'Uint32', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\timer.c 132\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'Uint32', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 543\nWarning C4244 'initializing': conversion from 'lua_Integer' to 'Uint8', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\texture.c 140\nWarning C4244 'initializing': conversion from 'lua_Number' to 'float', possible loss of data SDL (LuaModule\\lua54\\SDL) D:\\xxx\\luasdl2_205_60_src\\src\\window.c 715\nError LNK1120 49 unresolved externals SDL (LuaModule\\lua54\\SDL) D:\\xxx\\lua\\Release\\lua54-x86\\clibs\\SDL.dll 1<br />\nError LNK2001 unresolved external symbol _arrayAppend SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\thread.obj 1<br />\nError LNK2001 unresolved external symbol _arrayFree SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\rectangle.obj 1<br />\nError LNK2001 unresolved external symbol _arrayInit SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\thread.obj 1<br />\nError LNK2001 unresolved external symbol _BlendMode SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\SDL.obj 1<br />\nError LNK2001 unresolved external symbol _commonBindEnum SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\SDL.obj 1<br />\nError LNK2001 unresolved external symbol _commonBindLibrary SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\SDL.obj 1<br />\nError LNK2001 unresolved external symbol _commonBindObject SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\SDL.obj 1<br />\nError LNK2001 unresolved external symbol _commonGetEnum SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\keyboard.obj 1<br />\nError LNK2001 unresolved external symbol _commonGetUserdata SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\audio.obj 1<br />\nError LNK2001 unresolved external symbol _commonNewLibrary SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\SDL.obj 1<br />\nError LNK2001 unresolved external symbol _commonPush SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\audio.obj 1<br />\nError LNK2001 unresolved external symbol _commonPushEnum SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\keyboard.obj 1<br />\nError LNK2001 unresolved external symbol _commonPushErrno SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\audio.obj 1<br />\nError LNK2001 unresolved external symbol _commonPushSDLError SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\audio.obj 1<br />\nError LNK2001 unresolved external symbol _commonPushUserdata SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\events.obj 1<br />\nError LNK2001 unresolved external symbol _RWOps SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\audio.obj 1<br />\nError LNK2001 unresolved external symbol _RWOpsFunctions SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\SDL.obj 1<br />\nError LNK2001 unresolved external symbol _RWOpsSeek SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\SDL.obj 1<br />\nError LNK2001 unresolved external symbol _RWOpsType SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\SDL.obj 1<br />\nError LNK2001 unresolved external symbol _Surface SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\mouse.obj 1<br />\nError LNK2001 unresolved external symbol _SurfaceFunctions SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\SDL.obj 1<br />\nError LNK2001 unresolved external symbol _tableGetBool SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\audio.obj 1<br />\nError LNK2001 unresolved external symbol _tableGetDouble SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\renderer.obj 1<br />\nError LNK2001 unresolved external symbol _tableGetEnum SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\window.obj 1<br />\nError LNK2001 unresolved external symbol _tableGetInt SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\audio.obj 1<br />\nError LNK2001 unresolved external symbol _tableGetString SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\audio.obj 1<br />\nError LNK2001 unresolved external symbol _tableGetStringl SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\audio.obj 1<br />\nError LNK2001 unresolved external symbol _tableGetUserdata SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\renderer.obj 1<br />\nError LNK2001 unresolved external symbol _tableIsType SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\audio.obj 1<br />\nError LNK2001 unresolved external symbol _tableSetBool SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\audio.obj 1<br />\nError LNK2001 unresolved external symbol _tableSetDouble SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\audio.obj 1<br />\nError LNK2001 unresolved external symbol _tableSetEnum SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\events.obj 1<br />\nError LNK2001 unresolved external symbol _tableSetInt SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\audio.obj 1<br />\nError LNK2001 unresolved external symbol _tableSetString SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\events.obj 1<br />\nError LNK2001 unresolved external symbol _tableSetStringl SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\audio.obj 1<br />\nError LNK2001 unresolved external symbol _variantFree SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\channel.obj 1<br />\nError LNK2001 unresolved external symbol _variantGet SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\channel.obj 1<br />\nError LNK2001 unresolved external symbol _variantPush SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\channel.obj 1<br />\nError LNK2001 unresolved external symbol _videoGetColorRGB SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\renderer.obj 1<br />\nError LNK2001 unresolved external symbol _videoGetDisplayMode SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\display.obj 1<br />\nError LNK2001 unresolved external symbol _videoGetLine SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\renderer.obj 1<br />\nError LNK2001 unresolved external symbol _videoGetPoint SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\rectangle.obj 1<br />\nError LNK2001 unresolved external symbol _videoGetPoints SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\rectangle.obj 1<br />\nError LNK2001 unresolved external symbol _videoGetRect SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\keyboard.obj 1<br />\nError LNK2001 unresolved external symbol _videoGetRects SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\renderer.obj 1<br />\nError LNK2001 unresolved external symbol _videoPushColorRGB SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\renderer.obj 1<br />\nError LNK2001 unresolved external symbol _videoPushDisplayMode SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\display.obj 1<br />\nError LNK2001 unresolved external symbol _videoPushPoint SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\window.obj 1<br />\nError LNK2001 unresolved external symbol _videoPushRect SDL (LuaModule\\lua54\\SDL) D:\\xxx\\LuaModule\\lua54\\SDL\\display.obj 1<br />\nWarning unresolved import 'PyQt5' PythonApplication1 D:\\xxx\\PythonApplication1\\PythonApplication1.py 2</p>\n</blockquote>\n"^^ . . "1"^^ . "0"^^ . "0"^^ . . "1"^^ . "0"^^ . "3"^^ . "<p>I am trying to understand the details of signal processing in Lua. I have a few simple one-liners that wait on something, and I interrupt them with Ctrl+C. All of them have the form <code>print(pcall(....))</code>.</p>\n<p>Case 1:</p>\n<pre><code>▶ lua5.4 -e 'print(pcall(os.execute, &quot;sleep 5&quot;))'\ntrue nil signal 2\n</code></pre>\n<p>The first <code>true</code> comes from <code>pcall</code> and it indicates that the call to <code>os.execute</code> completed successfully, but the rest of the output (the return values from <code>os.execute</code>) says that the call has actually failed, because it has been interrupted by the signal 2 (SIGINT).</p>\n<p>Case 2:</p>\n<pre><code>▶ lua5.4 -e 'print(pcall(io.read))'\nfalse interrupted!\n</code></pre>\n<p>Here it looks like the <code>pcall</code> itself has been interrupted, not <code>io.read</code>, but at least we get an error from <code>pcall</code>.</p>\n<p>Case 3:</p>\n<pre><code>▶ lua5.4 -e 'print(pcall(function() for _ in io.lines() do end end))'\nlua5.4: (command line):1: interrupted!\nstack traceback:\n [C]: in function 'pcall'\n (command line):1: in main chunk\n [C]: in ?\n</code></pre>\n<p>Here <code>pcall</code> is simply ignored, and this happens each time <code>io.lines</code> or <code>file:lines</code> get interrupted. Interestingly, if I wrap this code in another <code>pcall</code>, then that outer <code>pcall</code> will behave as expected.</p>\n<p>I generally understand the first two cases, but the last one came as a bit of a surprise to me, so my question is: are the above behaviors well-known (and I have just missed some documentation)? Also, is there anything else I have to watch out for while dealing with SIGINT?</p>\n<p>(I have tried Lua versions 5.4 and 5.3, and they both produce the same result.)</p>\n<p>UPDATE: <a href="https://groups.google.com/g/lua-l/c/mmNZs5Fjt20" rel="nofollow noreferrer">Here</a> is the comment on this issue from Roberto Ierusalimschy.</p>\n"^^ . "<p>your problem is the ::continue:: is inside the loop try this.</p>\n<pre><code>for i = 1, #backupSource do\n if i == 2 then\n goto continue\n end \nend \n::continue::\n</code></pre>\n<p>Try and let me know</p>\n"^^ . "1"^^ . . . "2"^^ . . "0"^^ . . . . . "0"^^ . "<p>When I try this crude example I get an immediate nil (not a 5 second block). Wasn't able to find anything in the documentation about supported or non supported commands in Lua functions</p>\n<pre><code>#!lua name=supported_commands\n\nlocal function bl_pop_test(keys, args)\n local test_key = keys[1]\n\n return redis.call('BLPOP', test_key, 5)\n\nend\n\nredis.register_function('bl_pop_test', bl_pop_test)\n</code></pre>\n<p>My guess is that because functions block, calling a blocking command isn't supported? Just curious if anyone else has ever come across this..</p>\n"^^ . . . . . . . . "2"^^ . . . . . . "Trying to use a the Tutorial's Custom Writer for Pandoc, what CLI options need to use?"^^ . . . "1"^^ . . "0"^^ . . . . . "1"^^ . . "0"^^ . . . . . "Assign the table is a good choice, for example in the Factorio each object has own values and the value object.prototype, that contains all properties that must be not changed, always same for all objects of this type."^^ . . . . . "Is BLPOP supported in Redis Lua functions?"^^ . "Vim: Different mappings to search with and without highlight"^^ . . "self in OnLoad function nil"^^ . . . "<p><code>string.sub</code> (substring) and <code>string.gsub</code> (pattern substitution) have already been mentioned. It might be worth mentioning for <code>string.gsub</code> that you of course have to <em>escape your pattern</em> if it may contain &quot;magic characters&quot;.</p>\n<p>Personally I think <code>string.match</code> is the most appropriate tool for the job, at least assuming a static prefix: <code>str:match&quot;^prefix(.*)&quot;</code> will give you the suffix, or <code>nil</code> if it doesn't start with the prefix, so you can use <code>str:match&quot;^prefix(.*)&quot; or str</code> to get the unaltered string in that case.</p>\n<p>Alternatively you can wrap it as <code>assert(str:match&quot;^prefix(.*)&quot;)</code> to error if it doesn't start with the prefix.</p>\n"^^ . . . "0"^^ . "repeat"^^ . . . . . "0"^^ . "0"^^ . "0"^^ . "0"^^ . . . "0"^^ . "0"^^ . . . "you mean you want the output format to be `gfm`? then run `pandoc -t gfm -f html input01.html -L custom-writer01.lua`"^^ . . "Haproxy not logging from LUA core.log()"^^ . "0"^^ . "1"^^ . . . . . "1"^^ . . "When multiple values are returned, they are put in consecutive registers, and it's impossible to know how many. So if there were some more call arguments after the multiret expansion, it would be impossible to statically (at compile time) know in which registers to put them. They could have used `*x` (like python) or `...x` (like JS ES6), but in fact it's impossible to impllement it because of how the stack, registers and bytecode is designed. Technically it would have been possible for table construction but not calls. They probably didn't do the former either for consistancy."^^ . "1"^^ . "0"^^ . . . . "<p>Unlike Lua, C# is a strongly typed language. So <code>1</code> is a number, and <code>&quot;1&quot;</code> is a string containing the character <code>1</code> and they can't be used interchangeably. Your line <code>lua[&quot;mission.coalition.blue.country.1&quot;];</code> is looking for the element with key <code>&quot;1&quot;</code> - a string key - on <code>&quot;country&quot;</code> and it can't find it, so you get a null returned.</p>\n<p>You will need to split into two steps, one for the string key, the other for the number key. The NLua library transforms integers into the C# <code>long</code> type.</p>\n<pre><code>public void LuaTest()\n{\n const string luaData = @&quot;coalition = \n {\n [&quot;&quot;blue&quot;&quot;] = \n {\n [&quot;&quot;country&quot;&quot;] = \n {\n [1] = \n {\n [&quot;&quot;hiddenOnPlanner&quot;&quot;] = false,\n [&quot;&quot;tasks&quot;&quot;] = {},\n [&quot;&quot;radioSet&quot;&quot;] = false\n }\n }\n }\n }&quot;;\n Lua lua = new Lua();\n lua.DoString(luaData);\n\n var country = lua[&quot;coalition.blue.country&quot;] as LuaTable;\n if (country is null)\n throw new InvalidOperationException(&quot;Didn't find coalition.blue.country&quot;);\n var bluePlanes = country[1L] as LuaTable;\n if (bluePlanes is null)\n throw new InvalidOperationException(&quot;Didn't find item 1 on country&quot;);\n var dict = lua.GetTableDict(bluePlanes);\n\n Console.WriteLine(&quot;Second chunk of code:&quot;);\n foreach (KeyValuePair&lt;object, object&gt; de in dict)\n {\n Console.WriteLine($&quot;{de.Key} {de.Value}&quot;);\n }\n}\n</code></pre>\n<p>You'll notice that I've also added some checks for null. This is good practice: instead of a <code>NullReferenceException</code> at some point later in the code, you know exactly when something returned null that you were not expecting.</p>\n<p>Output:</p>\n<pre><code>Second chunk of code:\nradioSet False\nhiddenOnPlanner False\ntasks table\n</code></pre>\n"^^ . "How to table.remove() nested elements in lua?"^^ . . . . "<p>This can be done much more simply while maintaining relative order of elements by just keeping track of the next index to assign elements to.</p>\n<pre class="lang-lua prettyprint-override"><code>function compact(arr)\n local sz = 0\n for i, v in ipairs(arr) do\n if v ~= -1 then\n sz = sz + 1\n arr[i] = -1 -- not needed if you ignore the part of the array after the compacted portion\n arr[sz] = v\n end\n end\n return sz -- size of compacted array\nend\n</code></pre>\n<p>Usage example:</p>\n<pre class="lang-lua prettyprint-override"><code>arr = {1, 3, 4, -1, 6, -1, 8, -1, -1}\nnewSize = compact(arr)\nprint(newSize)\n-- 5\nprint(table.concat(arr, &quot;, &quot;))\n-- 1, 3, 4, 6, 8, -1, -1, -1, -1\nprint(table.concat({table.unpack(arr, 1, newSize)}, &quot;, &quot;)) -- get only compacted portion\n-- 1, 3, 4, 6, 8\n</code></pre>\n"^^ . "0"^^ . . . . . . "0"^^ . "<p>To do this one can use the expression register: <a href="https://neovim.io/doc/user/insert.html#i_CTRL-R_%3D" rel="nofollow noreferrer">https://neovim.io/doc/user/insert.html#i_CTRL-R_%3D</a>.</p>\n<p>Typing <code>:&lt;c-r&gt;=GET_STRING()&lt;cr&gt;</code> results in <code>:THE_STRING</code>.</p>\n<p>This calls a vimscript function though. Not sure if it can be done with a lua function.</p>\n"^^ . . "<p>I have a BillboardGUi in my tycoon game and it has a Frame and a TextLabel in it. The TextLabel displays what this object is and how much does it cost. (It is part of the button that buys things...)</p>\n<p>So on my BillboardGui I have Max distance on and set to 40.</p>\n<p>Basically, when I go back, the text gets bigger and some parts disappear (They go off the frame) and when I get close, the text become so small.</p>\n<p>Far away...\n<img src="https://i.sstatic.net/YFbb7lDx.png" alt="Far" /></p>\n<p>Close up...\n<img src="https://i.sstatic.net/jtVoJ9DF.png" alt="Close" /></p>\n<p>How can I fix it? I want it not to scale and not to get out of frame how do I do that?</p>\n"^^ . . . "fifo"^^ . "0"^^ . "0"^^ . . "ruff"^^ . "templates"^^ . . . . "<p>Following <a href="https://vi.stackexchange.com/a/45916/18101">this post</a>, I'm planning to migrate from Visual Studio Professional 2019 to Neovim for C# .NET Framework development. One crucial Visual Studio feature I need to replicate is the automatic updating of <code>.csproj</code> files when adding new source files.</p>\n<p>In Visual Studio, when you add a new <code>.cs</code> file, it automatically updates the project file by adding an entry like this in the appropriate <code>ItemGroup</code> section:</p>\n<pre class="lang-xml prettyprint-override"><code>&lt;Project&gt;\n &lt;ItemGroup&gt;\n &lt;Compile Include=&quot;path\\to\\fileName.cs&quot; /&gt;\n &lt;/ItemGroup&gt;\n&lt;/Project&gt;\n</code></pre>\n<p>Is there a way to implement similar functionality in Neovim? I'm looking for solutions that could involve:</p>\n<ol>\n<li>Existing plugins (preferably compatible with <code>lazy.nvim</code>)</li>\n<li>Custom Lua/VimScript implementation</li>\n<li>File watchers or other automation approaches</li>\n</ol>\n<p>The ideal solution would:</p>\n<ul>\n<li>Detect when a new <code>.cs</code> file is created</li>\n<li>Automatically locate the corresponding <code>.csproj</code> file</li>\n<li>Update the XML structure by adding the <code>Compile</code> element in the correct <code>ItemGroup</code></li>\n<li>Maintain proper relative paths</li>\n</ul>\n<p>I think if no existing plugins provide this functionality then I have to write custom solutions in Lua or VimScript.</p>\n<p>Does anyone have experience implementing this kind of .NET project file automation in <code>vi</code>/<code>vim</code>/<code>nvim</code>?</p>\n"^^ . . "2"^^ . "0"^^ . . . . . "c99"^^ . "0"^^ . . . . . "0"^^ . . . "6"^^ . "0"^^ . "0"^^ . "0"^^ . . . . "0"^^ . "1"^^ . . . "0"^^ . . . . . . . "0"^^ . . "0"^^ . . "Building nodemcu (lua) esp32-dev firmware with u8g2 support does not include requested display driver"^^ . "2"^^ . . . . "<p>I made a plugin for Wireshark and now with the new version 4.4.2 it is not working anymore. It seems like something with Lua has changed, but I can't find the problem.</p>\n<h3>Problem Description</h3>\n<p>With the old version 4.2, everything worked and it showed the hex stream correctly. However, in version 4.4.2, the plugin no longer parses the data as expected. Specifically, the JSON data parsing seems to fail, and the custom fields are not being populated.</p>\n<h3>Changes in Wireshark 4.4.2</h3>\n<p>I noticed that Wireshark 4.4.2 has updated its Lua API, which might be causing the issue. Unfortunately, I couldn't find detailed documentation on these changes.</p>\n<h3>Relevant Code</h3>\n<p>Here is the part of the code where the issue seems to occur.\nDoes anyone have an idea what might be causing this issue with the new version?</p>\n<p>Thanks in advance!</p>\n<pre class="lang-lua prettyprint-override"><code>local json = require &quot;json&quot;\nlocal ws = Proto(&quot;ws&quot;, &quot;WS&quot;)\nlocal identifier = &quot;03&quot;\n\n-- Function to recursively parse and display JSON data\nlocal function parse_json(json_data, tree)\n for key, value in pairs(json_data) do\n if type(value) == &quot;table&quot; then\n local subtree = tree:add(ws, string.format(&quot;%s: &quot;, key))\n parse_json(value, subtree)\n else\n tree:add(ws, string.format(&quot;%s: %s&quot;, key, tostring(value)))\n end\n end\nend\n\nfunction ws.dissector(buffer, pinfo, tree)\n local id = buffer(0, 12):bytes():tohex()\n if id:sub(-2) == identifier then\n pinfo.cols.protocol = &quot;ws&quot;\n local subtree = tree:add(ws, buffer(), &quot;ws Data&quot;)\n subtree:add(buffer(0, 12), &quot;Identification: &quot; .. id)\n subtree:add(&quot;----------------------------------------&quot;)\n local data = buffer(12, buffer:len() - 12)\n local data_string = tostring(data:string())\n -- Clean up the data string by removing unwanted characters\n data_string = data_string:gsub(&quot;\\r\\n&quot;, &quot;&quot;):gsub(&quot;\\n&quot;, &quot;&quot;):gsub(&quot;\\t&quot;, &quot;&quot;):gsub(&quot;[\\128-\\255]&quot;, &quot;&quot;):gsub(&quot;UUUU$&quot;, &quot;&quot;)\n print(&quot;Debug: Extracted Data String = &quot; .. data_string)\n -- Parse JSON data using the json.decode function from json.lua\n local status, json_data = pcall(json.decode, data_string)\n if not status or type(json_data) ~= &quot;table&quot; then\n subtree:add_expert_info(PI_MALFORMED, PI_ERROR, &quot;Malformed JSON Data&quot;)\n return\n end\n -- Add custom fields to the dissection tree\n if json_data[&quot;action&quot;] then\n subtree:add(ws_action, json_data[&quot;action&quot;])\n end\n if json_data[&quot;domain&quot;] then\n subtree:add(ws_domain, json_data[&quot;domain&quot;])\n end\n if json_data[&quot;message&quot;] then\n subtree:add(ws_message, json_data[&quot;message&quot;])\n pinfo.cols.info:set(tostring(json_data[&quot;message&quot;]))\n end\n if json_data[&quot;session_id&quot;] then\n subtree:add(ws_session_id, json_data[&quot;session_id&quot;])\n end\n if json_data[&quot;request_id&quot;] then\n subtree:add(ws_request_id, json_data[&quot;request_id&quot;])\n end\n if json_data[&quot;status&quot;] then\n subtree:add(ws_status, json_data[&quot;status&quot;])\n end\n if json_data[&quot;payload&quot;] then\n local payload_subtree = subtree:add(ws, &quot;Payload&quot;)\n parse_json(json_data[&quot;payload&quot;], payload_subtree)\n end\n end\nend\n</code></pre>\n"^^ . . . "Check the answers [here](https://stackoverflow.com/q/63055430/9363973), for porting existing Projects especially [this one](https://stackoverflow.com/a/77161020/9363973)"^^ . . "1"^^ . . . "0"^^ . "<p>I've found the issue. Using <code>eth_withoutfcs</code> rather than <code>eth</code> within <code>Dissector.get()</code> solved the issue.</p>\n"^^ . . "<p>I am trying to run the following code</p>\n<pre class="lang-lua prettyprint-override"><code>local lgi = require(&quot;lgi&quot;)\nlocal Gdk = lgi.Gdk\nlocal Gtk = lgi.Gtk\n\nGtk.init()\n\n-- Create a new window\nlocal window = Gtk.Window({\n title = &quot;LGI Test Window&quot;,\n default_width = 300,\n default_height = 200,\n on_destroy = Gtk.main_quit,\n})\n\n-- Create a label and add it to the window\nlocal label = Gtk.Label({ label = &quot;Hello, LGI!&quot; })\nwindow:add(label)\nwindow:show_all()\nGtk.main()\n</code></pre>\n<p>But this is giving me the following error</p>\n<pre class="lang-bash prettyprint-override"><code>lua: /home/username/.luarocks/share/lua/5.3/lgi/core.lua:14: module 'lgi.corelgilua51' not found:\n no field package.preload['lgi.corelgilua51']\n no file '/home/username/.luarocks/share/lua/5.3/lgi/corelgilua51.lua'\n no file '/home/username/.luarocks/share/lua/5.3/lgi/corelgilua51/init.lua'\n no file '/usr/local/share/lua/5.3/lgi/corelgilua51.lua'\n no file '/usr/local/share/lua/5.3/lgi/corelgilua51/init.lua'\n no file '/usr/local/lib/lua/5.3/lgi/corelgilua51.lua'\n no file '/usr/local/lib/lua/5.3/lgi/corelgilua51/init.lua'\n no file './lgi/corelgilua51.lua'\n no file './lgi/corelgilua51/init.lua'\n no file '/home/username/.luarocks/lib/lua/5.3/lgi/corelgilua51.so'\n no file '/usr/local/lib/lua/5.3/lgi/corelgilua51.so'\n no file '/usr/local/lib/lua/5.3/loadall.so'\n no file './lgi/corelgilua51.so'\n no file '/home/username/.luarocks/lib/lua/5.3/lgi.so'\n no file '/usr/local/lib/lua/5.3/lgi.so'\n no file '/usr/local/lib/lua/5.3/loadall.so'\n no file './lgi.so'\nstack traceback:\n [C]: in function 'require'\n /home/username/.luarocks/share/lua/5.3/lgi/core.lua:14: in main chunk\n [C]: in function 'require'\n /home/username/.luarocks/share/lua/5.3/lgi/init.lua:19: in main chunk\n [C]: in function 'require'\n /home/username/.luarocks/share/lua/5.3/lgi.lua:19: in main chunk\n [C]: in function 'require'\n init2.lua:1: in main chunk\n</code></pre>\n<p>I have already set <code>LUA_PATH</code> and <code>LUA_CPATH</code>, but installing <code>lgi</code> from <code>luarocks</code> does not have the <code>corelgilua51</code>, what could be the issues, the lgi only contain the following files:-</p>\n<pre class="lang-bash prettyprint-override"><code>drwxr-xr-x. 1 username username 226 Nov 15 13:01 .\ndrwxr-xr-x. 1 username username 30 Nov 15 13:05 ..\n-rw-r--r--. 1 username username 15928 Nov 15 13:01 class.lua\n-rw-r--r--. 1 username username 11130 Nov 15 13:01 component.lua\n-rw-r--r--. 1 username username 761 Nov 15 13:01 core.lua\n-rw-r--r--. 1 username username 3319 Nov 15 13:01 enum.lua\n-rw-r--r--. 1 username username 5939 Nov 15 13:01 ffi.lua\n-rw-r--r--. 1 username username 3403 Nov 15 13:01 init.lua\n-rw-r--r--. 1 username username 1090 Nov 15 13:01 log.lua\n-rw-r--r--. 1 username username 6217 Nov 15 13:01 namespace.lua\ndrwxr-xr-x. 1 username username 524 Nov 15 13:01 override\n-rw-r--r--. 1 username username 1591 Nov 15 13:01 package.lua\n-rw-r--r--. 1 username username 7088 Nov 15 13:01 record.lua\n-rw-r--r--. 1 username username 15 Nov 15 13:01 version.lua\n</code></pre>\n<p>lua version <code>5.3.6</code>, not upgraded to 5.4 as a project I am trying to use requires a lua version less than 5.4, how can a module be absent when installing from <code>luarocks</code> and any help would be appreciated. Please ask for any other information if required.</p>\n"^^ . "<pre><code>local ProximityPrompt = script.Parent\nProximityPrompt.Triggered:Connect(function(Player)\n wait(1) \n Player.Character.HumanoidRootPart.Position = game.Workspace.Orchooselimbo.Position \nend)\n</code></pre>\n<p>This script comes from ThenRemember's rig. Orchooselimbo's script is the same except its swapped to ThenRemember.</p>\n<p>The script files are in the correct destination I believe\nThenRemember &gt; ProximityPrompt &gt; Script\nOrchooselimbo &gt; ProximityPrompt &gt; Script\nOrchooselimbo is a rig, and basically i'm trying to teleport from &quot;ThenRemember&quot; to &quot;Orchooselimbo&quot;\nusing a proximity prompt. The prompt does appear but when I click it it does nothing.\nAny idea how to fix this?</p>\n<p>These are both rigs by the way</p>\n<p>I tried changing some letters to capital ones and i tried changing the symbols.</p>\n<p>Everything results in an error I do know how to fix, but this one just makes it so hard</p>\n"^^ . "<h3>Timing errors</h3>\n<p>The nodejs code is working as programmed. This answer does not look into lua code output except to say it's not following the same timing rules as JavaScipt.</p>\n<p>The timing error arises because</p>\n<ol>\n<li>\n<pre><code> for (gameTick = 0; gameTick &lt; 10; gameTick++) {\n print(`tick: ${gameTick}`);\n tasks[gameTick]?.forEach(f =&gt; f())\n if (gameTick == 2) task1();\n }\n</code></pre>\n</li>\n</ol>\n<p>executes a synchronous loop, calling <code>task1</code> with <code>gameTick</code> set to 2, and exiting the loop with <code>gameTick</code> set to 10.</p>\n<ol start="2">\n<li><p>The first iteration of the loop in <code>task1</code> calls <code>sleep(2)</code> which sets up a task for <code>gameTick</code> = 4, before <code>await</code> causes <code>task1</code> to return a promise to the caller.</p>\n</li>\n<li><p>The loop in step 1 continues iterating and fulfills the task promise for <code>gameTick</code> 4.</p>\n</li>\n<li><p>The loop in 1 has finished, and the <code>await</code> operator in <code>task1</code> returns to its surrounding loop code after &quot;execute 0&quot; has printed. The next iteration of the loop in <code>task1</code> calls <code>sleep(2)</code> with <code>i</code> set to 1 and <code>gameTick</code> set to 10 (by completion of the loop in 1).</p>\n</li>\n<li><p><code>sleep(2)</code> sets up a promise for a task at <code>gameTick</code> 12. This promise is never fulfilled in posted code, leaving <code>task1</code> waiting for it with <code>execute 1</code> left as the last line printed.</p>\n</li>\n</ol>\n<p><strong>Short Answer</strong></p>\n<p>The await doesn't return because the promise hasn't been resolved.</p>\n<p><strong>Debugging</strong></p>\n<p>This first snippet added some output to show the value of <code>i</code> and <code>gameTick</code> in more places and log when <code>await</code> returns. It was used to uncover and confirm why the <code>await</code> promise operand was not fulfilled.</p>\n<p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false" data-babel-preset-react="false" data-babel-preset-ts="false">\r\n<div class="snippet-code snippet-currently-hidden">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>function print(txt) {document.querySelector('#log').textContent += txt + '\\n';}\n\nlet gameTick = 0;\n\nconst tasks = {};\n\nfunction sleep(t) {\n const targetTick = gameTick + t;\n if (!tasks[targetTick]) {\n tasks[targetTick] = [];\n }\n return new Promise(resolve =&gt; {\n tasks[targetTick].push(resolve);\n });\n}\n\nasync function task1() {\n print('start task1');\n for (let i = 0; i &lt; 3; i++) {\n print(`execute: ${i}`);\n await sleep(2);\n print(` sleep await done with i = ${i}, gameTick now ${gameTick} `);\n }\n}\n\n// task1();\n\nfor (gameTick = 0; gameTick &lt; 10; gameTick++) {\n print(`tick: ${gameTick} tasks length = ${tasks[gameTick]?.length || 0}`);\n tasks[gameTick]?.forEach(f =&gt; f())\n if (gameTick == 2) task1();\n}\n\n// fix\n\nfunction hammer() {\n print ("\\n **** hammer fix **** ");\n for (let targetTick =10; targetTick &lt; 20; targetTick++) {\n print(`tick: ${targetTick}`);\n print(`tick ${targetTick} tasks length = ${tasks[targetTick]?.length || 0}`)\n tasks[targetTick]?.forEach(f =&gt; f())\n }\n}\nsetTimeout(hammer, 2000);\nsetTimeout(hammer, 4000);</code></pre>\r\n<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;pre&gt;&lt;code id=log&gt;&lt;/code&gt;&lt;/pre&gt;</code></pre>\r\n</div>\r\n</div>\r\n</p>\n<p><strong>Solution</strong></p>\n<ul>\n<li>Run the clock for game ticks <em>asynchronously</em></li>\n<li>Don't use synchronous loops to test <code>sleep</code> and/or initial scheduling of a task.</li>\n<li>The example clock code below reports the tick value it uses to look up task arrays of <code>resolve</code> or task functions it needs to call. It then increments <code>gameTick</code> <em>after</em> processing such an array if found. This implies:\n<ol>\n<li><code>gameTick</code> values obtained outside the clock will be one more than the last tick number processed by the clock.</li>\n<li>The example <code>schedule</code> function below, called with zero <code>ticksLater</code>, will call the task function at the next clock tick.</li>\n</ol>\n</li>\n</ul>\n<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false" data-babel-preset-react="false" data-babel-preset-ts="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>function print(txt) {document.querySelector('#log').textContent += txt + '\\n';}\n\nconst tasks = {};\n\nfunction sleep(t) {\n const targetTick = gameTick + t;\n if (!tasks[targetTick]) {\n tasks[targetTick] = [];\n }\n return new Promise(resolve =&gt; {\n tasks[targetTick].push(resolve);\n });\n}\n\nasync function task1() {\n print('start task1');\n for (let i = 0; i &lt; 3; i++) {\n print(`execute: ${i}`);\n await sleep(2);\n print(` sleep await done with i = ${i}, gameTick now ${gameTick} `);\n }\n}\n\n\n//***** Asynchronous clock *****\n\nlet gameTick = 0;\nfunction clock() {\n print("tick: " + gameTick);\n tasks[gameTick]?.forEach(f =&gt; f())\n ++gameTick;\n}\nlet clockTimer = setInterval(clock, 100) // start clock running at 10hz for example\n\n//**** scheduler\n\nfunction schedule( task, ticksLater) {\n const t = gameTick + ticksLater;\n if( !tasks[t]) tasks[t] = [];\n tasks[t].push(task);\n}\n\n//**** Test ****\n\nschedule(task1, 2);\nschedule(function() {\n print("Simulate game end, clock stopped ");\n clearInterval( clockTimer);\n}, 30);</code></pre>\r\n<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;pre&gt;&lt;code id=log&gt;&lt;/code&gt;&lt;/pre&gt;</code></pre>\r\n</div>\r\n</div>\r\n</p>\n"^^ . "0"^^ . "Can't get custom style working in pandoc for odt output"^^ . . "0"^^ . . . "arrays"^^ . . . "@DoctorD Did you manage to figure it out already? If not, try placing a print before and after the `task.wait(1)` (before the mob.Spawn). Does it print both messages in Output?"^^ . . . . . "1"^^ . . . "0"^^ . "Error: Build error: Failed compiling module mime\\core.dll How to solve this problem?"^^ . . "Thank you that fixed it, much appreciated."^^ . "Sorry this is somewhat hard to explain. I want to enter command mode by pressing `:`. I want to then execute the lua function to get the resulting string in command mode. The result would be: I am in command mode with this written: `:THE_STRING` (note the difference between `GET_STRING` and `THE_STRING`)"^^ . "1"^^ . . . "<p>From the <a href="https://redis.io/docs/latest/commands/blpop/" rel="nofollow noreferrer">BLPOP documentation</a>:</p>\n<blockquote>\n<p>Using BLPOP inside a MULTI / EXEC block does not make a lot of sense as it would require blocking the entire server in order to execute the block atomically, which in turn does not allow other clients to perform a push operation. For this reason the behavior of BLPOP inside MULTI / EXEC when the list is empty is to return a nil multi-bulk reply, which is the same thing that happens when the timeout is reached.</p>\n</blockquote>\n<p>Lua scripts are executed atomically, that is, no other script or command will run while a script is running, which gives us the same transactional semantics as MULTI / EXEC (<a href="https://redis.io/docs/latest/commands/blpop/" rel="nofollow noreferrer">source</a>).</p>\n"^^ . "@AlexanderMashin i understand, i fixed it"^^ . . . . "<p>I am attempting to make a program in Lua to sprint while shifting however im getting an &quot;attempt to index nil&quot; error</p>\n<pre><code>local UserInputSerive = game:GetService(&quot;UserInputService&quot;)\nlocal Player = game.Players.LocalPlayer\nlocal Character = Player.Character or Player.CharacterAdded:Wait()\nlocal Humanoid = Character:WaitForChild(&quot;Humanoid&quot;)\n\nUserInputSerive.InputBegan:Connect(function(input, gameProcessed)\n if input.KeyCode == Enum.KeyCode.LeftShift then\n Humanoid.WalkSpeed = 35\n end\nend)\n\nUserInputSerive.InputEnded:Connect(function(input, gameProcessed)\n if input.KeyCode == Enum.KeyCode.LeftShift then\n Humanoid.WalkSpeed = 16\n end\nend)\n</code></pre>\n"^^ . . . . . . . "0"^^ . . . . . "c++"^^ . "0"^^ . . . . "libreoffice-writer"^^ . . "lgi"^^ . "0"^^ . "0"^^ . "Thank you. I can not test in one week, just leaving on a trip, but you already clarified some doubts. Thanks for the well explained answer!!"^^ . "1"^^ . "0"^^ . "0"^^ . . . "1"^^ . . . "0"^^ . "<p>I change my layouts with a very primitive <code>xkb-switch</code> utility. I need to imitate the 'Share the same input method among all applications - disabled' behaviour of IBus.</p>\n<h3>My idea is such:</h3>\n<ul>\n<li>When exiting a certain client I want to store the output of the <code>xkb-switch</code> shell command <em>(it just lists my current layout: <code>us(altgr-intl)</code>,<code>am</code> or <code>ru</code>)</em>.</li>\n<li>After some time, when entering back into that client, I want to switch the keyboard layout back <em>(to the stored one)</em> with the shell command <code>xkb-switch --switch &lt;layout_here&gt;</code></li>\n</ul>\n<h3>My attempt:</h3>\n<pre class="lang-lua prettyprint-override"><code>client.connect_signal(&quot;unfocus&quot;, function(c)\n awful.spawn.easy_async_with_shell(&quot;xkb-switch&quot;, function(stdout)\n if c.valid then\n c.keyboard_layout = stdout\n end\n end)\nend)\n\nclient.connect_signal(&quot;focus&quot;, function(c)\n c = awful.screen.focused({client = true})\n if c.keyboard_layout == nil then\n c.keyboard_layout = &quot;us(altgr-intl)&quot;\n end\n awful.spawn.with_shell(&quot;xkb-switch -s &quot;..c.keyboard_layout)\nend)\n</code></pre>\n<p><strong>Here is the behaviour:</strong> the notification popup is showing the intended language, but for some reason the switched language is wrong, is there some race hazard? <a href="https://youtu.be/juarLneLBAo" rel="nofollow noreferrer">https://youtu.be/juarLneLBAo</a></p>\n"^^ . . . "It's definitely possible! Unfortunately I can't edit my question to show you here, but you just need your tower scripts to communicate with the script that created the enemies. So here are some steps to set that up. 1) Update the spawning Script to give each enemy an ID, and stores all the enemies. 2) Update the Enemy module so that when it spawns the model, it puts a NumberValue or an Attribute in it with that ID. 3) When a tower hits the enemy model, it finds that ID and fires a BindableEvent with that ID. 4) Your Script will listen for that event, lookup the enemy by ID, and knock it back."^^ . . . . . . "Trying to add Lua scripting support to the Zed code editor"^^ . . "3"^^ . . . . "tween"^^ . . . "As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . . . . . "1"^^ . . . . . . . . "The task.wait script keeps stopping my entire script"^^ . . . . . "0"^^ . "Running jobs in the microtask queue from synchronous code may not allow the posted code to handle real world asynchronous tasks that require returning to the event loop for some time."^^ . "2"^^ . . "0"^^ . "0"^^ . . . . "lua-5.3"^^ . . . "Thanks, that's easier to work with. Answered, below."^^ . . "I think I might have an idea why my code is not working.\nLua filters only change Pandoc's AST representation of your document, i.e. before it is then converted to LaTeX. A Raw block filter will not act on Pandoc's LaTeX output, but only on Raw LaTeX blocks that are in the markdown itself.\n\nSo, my idea was to write a custom Lua writer. The writer would use pandoc.write to generate Pandoc's own LaTeX output (body only) and modify it with regular expressions or Lua patterns.\n\nUnfortunately, I have no idea how to do this... ;/"^^ . "1"^^ . "0"^^ . "0"^^ . . "Repacking or printing unpacked Lua tables"^^ . "0"^^ . . . . . "check the result: `for k,v in pairs(v9()) do print(k,v) end` - will see many functions, and `print` too"^^ . . . "0"^^ . . . . . "writer"^^ . . . "<p>I have a project at work that uses premake5 for configuration. In VSCode, I have the <code>sumneko.lua</code> extension installed. Premake defines a large number of functions and other properties that we use, however all of our <code>premake5.lua</code> files appear with warning underlines beneath anything defined in premake (normal lua standard library stuff seems fine).</p>\n<p>How can I configure our VSCode project such that we get better language server results (and no warnings) for the premake-defined stuff?</p>\n"^^ . "0"^^ . "<p>The answer was just to suck it up and switch to msvc for the vs2022 profile</p>\n<pre class="lang-lua prettyprint-override"><code>workspace &quot;Wrenderer&quot;\nconfigurations { &quot;Debug&quot;, &quot;Release&quot;}\nproject &quot;Wrenderer&quot;\n language &quot;C&quot;\n targetname &quot;Wrenderer&quot;\n architecture &quot;x64&quot;\n kind &quot;StaticLib&quot;\n outputdir = &quot;%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}&quot;\n\n cdialect &quot;C99&quot;\n\n targetdir(&quot;%{wks.location}/Binaries/&quot; .. outputdir .. &quot;/%{prj.name}&quot;)\n objdir(&quot;%{wks.location}/Binaries/Intermediates/&quot; .. outputdir .. &quot;/%{prj.name}&quot;)\n files { &quot;include/**.h&quot;, &quot;src/**.c&quot; }\n libdirs { &quot;./libs/&quot; }\n includedirs { &quot;./include/&quot; }\n includedirs { &quot;./include/libs/&quot; }\n includedirs { os.getenv(&quot;VULKAN_SDK&quot;) .. &quot;/Include&quot; }\n links { &quot;vulkan-1&quot;, &quot;glfw3&quot; }\n removefiles { &quot;test/**.**&quot; }\n filter &quot;configurations:Debug&quot;\n defines { &quot;DEBUG&quot; }\n symbols &quot;On&quot;\n filter &quot;&quot;\n filter &quot;configurations:Release&quot;\n optimize &quot;On&quot;\n filter &quot;&quot;\n filter &quot;system:windows&quot;\n defines { &quot;VK_USE_PLATFORM_WIN32_KHR&quot; }\n filter &quot;&quot;\n filter &quot;system:linux&quot;\n defines { &quot;VK_USE_PLATFORM_XLIB_KHR&quot; }\n filter &quot;&quot;\n filter &quot;action:gmake&quot;\n prebuildcommands {\n\n &quot;mkdir -p&quot; .. &quot; %[%{wks.location}/Binaries/]&quot;,\n &quot;mkdir -p&quot; .. &quot; %[%{wks.location}/Binaries/Intermediates/]&quot;,\n\n &quot;mkdir -p&quot; .. &quot; %[%{wks.location}/Binaries/&quot; .. outputdir .. &quot;]&quot;,\n &quot;mkdir -p&quot; .. &quot; %[%{wks.location}/Binaries/Intermediates/&quot; .. outputdir .. &quot;]&quot;,\n }\n filter &quot;not action:gmake&quot;\n prebuildcommands {\n\n &quot;{MKDIR}&quot; .. &quot; %[%{wks.location}/Binaries/]&quot;,\n &quot;{MKDIR}&quot; .. &quot; %[%{wks.location}/Binaries/Intermediates/]&quot;,\n\n &quot;{MKDIR} %[%{wks.location}/Binaries/&quot; .. outputdir .. &quot;]&quot;,\n &quot;{MKDIR} %[%{wks.location}/Binaries/Intermediates/&quot; .. outputdir .. &quot;]&quot;,\n }\n filter &quot;&quot;\n filter &quot;action:gmake&quot;\n toolset &quot;clang&quot;\n buildoptions {&quot;-Wextra&quot;, &quot;-Wall&quot;}\n\n filter &quot;not action:gmake&quot;\n toolset &quot;msc&quot;\n filter&quot;&quot;\n\nproject &quot;WrenTest&quot;\n architecture &quot;x64&quot;\n kind &quot;ConsoleApp&quot; \n language &quot;C&quot; \n\n files { &quot;**.h&quot;, &quot;test/**.c&quot; }\n outputdir = &quot;%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}&quot;\n\n cdialect &quot;C99&quot;\n \n targetdir(&quot;%{wks.location}/Binaries/&quot; .. outputdir .. &quot;/%{prj.name}&quot;)\n objdir(&quot;%{wks.location}/Binaries/Intermediates/&quot; .. outputdir .. &quot;/%{prj.name}&quot;)\n\n libdirs { &quot;./libs/&quot; }\n includedirs { &quot;./include/&quot; }\n includedirs { &quot;./include/libs/&quot; }\n includedirs { os.getenv(&quot;VULKAN_SDK&quot;) .. &quot;/Include&quot; }\n links { &quot;Wrenderer&quot; }\n links { &quot;vulkan-1&quot;, &quot;glfw3&quot; }\n\n filter &quot;configurations:Debug&quot;\n defines { &quot;DEBUG&quot; }\n symbols &quot;On&quot;\n filter &quot;&quot;\n filter &quot;configurations:Release&quot;\n optimize &quot;On&quot;\n filter &quot;&quot;\n filter &quot;system:windows&quot;\n defines { &quot;VK_USE_PLATFORM_WIN32_KHR&quot; }\n filter &quot;&quot;\n filter &quot;system:linux&quot;\n defines { &quot;VK_USE_PLATFORM_XLIB_KHR&quot; }\n filter &quot;&quot;\n\n filter &quot;action:gmake&quot;\n toolset &quot;clang&quot;\n buildoptions {&quot;-Wextra&quot;, &quot;-Wall&quot;}\n links { &quot;user32&quot;, &quot;msvcrt&quot;, &quot;gdi32&quot;, &quot;shell32&quot;, &quot;libcmt&quot; }\n filter &quot;not action:gmake&quot;\n toolset &quot;msc&quot;\n filter &quot;&quot;\nnewaction {\n trigger = &quot;clean&quot;,\n description = &quot;clean the software&quot;,\n execute = function ()\n print(&quot;Cleaning&quot;)\n os.rmdir(&quot;./Binaries&quot;)\n os.remove(&quot;./Lib/*.lib&quot;)\n os.remove(&quot;*.make&quot;)\n os.remove(&quot;Makefile&quot;)\n os.remove(&quot;*.vcxproj&quot;)\n os.remove(&quot;*.vcxproj.filters&quot;)\n os.remove(&quot;*.vcxproj.user&quot;)\n os.remove(&quot;*.sln&quot;)\n print(&quot;done.&quot;)\n end\n}\n</code></pre>\n<pre class="lang-lua prettyprint-override"><code>workspace &quot;Wrenderer&quot;\nproject &quot;Wrengine&quot;\n language &quot;C&quot;\n targetname &quot;Wrengine&quot;\n architecture &quot;x64&quot;\n outputdir = &quot;%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}&quot;\n kind &quot;ConsoleApp&quot;\n cdialect &quot;C99&quot;\n\n targetdir(&quot;%{wks.location}/Binaries/&quot; .. outputdir .. &quot;/%{prj.name}&quot;)\n objdir(&quot;%{wks.location}/Binaries/Intermediates/&quot; .. outputdir .. &quot;/%{prj.name}&quot;)\n files { &quot;include/**.h&quot;, &quot;src/**.c&quot; }\n libdirs { &quot;./libs/&quot; }\n includedirs { &quot;./include/&quot; }\n includedirs { &quot;./Wrenderer/include/&quot; }\n includedirs { &quot;./include/libs/&quot; }\n includedirs { os.getenv(&quot;VULKAN_SDK&quot;) .. &quot;/Include&quot; }\n libdirs { os.getenv(&quot;VULKAN_SDK&quot;) .. &quot;/Lib&quot; }\n links { &quot;vulkan-1&quot;, &quot;glfw3&quot; }\n links { &quot;Wrenderer&quot; }\n\n filter &quot;configurations:Debug&quot;\n defines { &quot;DEBUG&quot; }\n symbols &quot;On&quot;\n filter &quot;&quot;\n filter &quot;configurations:Release&quot;\n optimize &quot;On&quot;\n filter &quot;&quot;\n filter &quot;system:windows&quot;\n defines { &quot;VK_USE_PLATFORM_WIN32_KHR&quot; }\n filter &quot;&quot;\n filter &quot;system:linux&quot;\n defines { &quot;VK_USE_PLATFORM_XLIB_KHR&quot; }\n filter &quot;&quot;\n\n prebuildcommands {\n &quot;compileShaders.bat&quot;\n }\n\n filter &quot;action:gmake&quot;\n toolset &quot;clang&quot;\n links { &quot;user32&quot;, &quot;msvcrt&quot;, &quot;gdi32&quot;, &quot;shell32&quot;, &quot;libcmt&quot; }\n buildoptions {&quot;-Wextra&quot;, &quot;-Wall&quot;}\n filter &quot;not action:gmake&quot;\n toolset &quot;msc&quot;\n filter &quot;&quot;\n\ninclude &quot;Wrenderer/premake5.lua&quot;\n</code></pre>\n"^^ . "Thanks for the info, i think i got a bit better understanding of what happened. In this case, i only used the return to see if the value updated before inserting the proxy_pass block... I did try to switch for content_by_lua_block and added the proxy_pass as updated on the first post... But it´s still not updating the variables..."^^ . "I would suggest you try over at the [Wireshark Q&A Site](https://ask.wireshark.org/questions/) and/or on the [Wireshark Discord Server](https://discord.com/invite/ts9GZCjGj5)."^^ . . . "<p>The error is telling you that <a href="https://create.roblox.com/docs/reference/engine/classes/Model" rel="nofollow noreferrer">Models</a> don't have a Position property.</p>\n<p>If you want to move Models around, you can use the <a href="https://create.roblox.com/docs/reference/engine/classes/Model#GetPivot" rel="nofollow noreferrer">GetPivot()</a> and <a href="https://create.roblox.com/docs/reference/engine/classes/Model#PivotTo" rel="nofollow noreferrer">PivotTo(CFrame)</a> methods.</p>\n<p>Try this:</p>\n<pre class="lang-lua prettyprint-override"><code> wait(1)\n local orchooseLimboModel : Model = game.Workspace.Orchooselimbo\n local targetPosition : CFrame = orchooseLimboModel:GetPivot()\n Player.Character:PivotTo(targetPosition)\n</code></pre>\n"^^ . . . "1"^^ . . . "[https://www.mediawiki.org/wiki/Extension:Scribunto]"^^ . "2"^^ . "0"^^ . . . . . . . "That's exactly what I was looking for, I just needed the key, thank you! Lua table terminology still confuses me a little, I knew that the second variable in the for loop was the value, but I didn't realize that the first was the key! I always called it the index, which after thinking about it, the key is a number by default! _No wonder when I tried use it in the past it gave errors about it being a string_"^^ . "That's particularly important since I can't reproduce this problem. You may have put this in a server script instead of a local script or something similar; there's no way of knowing without a full error."^^ . . "1"^^ . "pyright"^^ . . "<p>Use an autocommand using the vim API:</p>\n<pre><code>vim.api.nvim_create_autocmd(&quot;InsertLeave&quot;, {\n callback = function()\n print(&quot;Exited insert mode!&quot;);\n end\n});\n</code></pre>\n"^^ . "0"^^ . . "json"^^ . . . . "<p>I installed Love2D and the Love2D Support extension for VS Code. I can run Love2D from the command line (<code>$ love</code>). In addition, <code>$ which love</code> provides the app's path (<code>usr/bin/love</code>). Typing <code>$ usr/bin/love</code> runs the app and I can see it in my file explorer.</p>\n<p>Adding the path to the Love2D extension and running an app (Alt-L)\ngives me an error:</p>\n<blockquote>\n<p>Path specified in pixelbyte.love2d.path\n'/usr/bin/love' does not exist. Check your settings.</p>\n</blockquote>\n<p>Here's the weirdest part (to me): If I activate the terminal within VS Code and type</p>\n<p><code>sh-5.2$ which love</code></p>\n<p>I get the message:</p>\n<p><code>Path specified in pixelbyte.love2d.path '/usr/bin/love' does not exist. Check your settings.</code></p>\n"^^ . . "0"^^ . . "raycasting"^^ . "0"^^ . . . "1"^^ . "<p>If I have a table with known properties, but where the order of the properties is potentially unknown:</p>\n<pre class="lang-lua prettyprint-override"><code>local person = {\n name = 'James',\n age = 30,\n}\n</code></pre>\n<p>can I reliably destructure it:</p>\n<pre class="lang-lua prettyprint-override"><code>local name, age = unpack(person)\n</code></pre>\n<p>My worry is that if the order of the fields in the table is changed, that destructuring assignment will no longer work as expected.</p>\n"^^ . . . . . . . . "luau"^^ . . "0"^^ . "<p>I have <code>input.md</code>:</p>\n<pre><code>---\ntitle: My example document\n---\n\n## Overview\n\n*I am italic*\n\n**I am bold**\n</code></pre>\n<p>If I run:</p>\n<pre><code>pandoc input.md -o output.odt\n</code></pre>\n<p>I get an odt file with the expected formatting. However, in order to prepare the document for conversion to a PDF/UA-compliant PDF, I have to manually remove the bold and italic formatting and style those text items as &quot;Strong Emphasis&quot; and &quot;Emphasis&quot;, respectively, from the Styles menu.</p>\n<p>I want to automate this, so I created <code>custom_styles.lua</code>:</p>\n<pre><code>function Strong(elem)\n return pandoc.Span(elem.content, {class = &quot;StrongEmphasis&quot;})\nend\n\nfunction Emph(elem)\n return pandoc.Span(elem.content, {class = &quot;Emphasis&quot;})\nend\n</code></pre>\n<p>If I run:</p>\n<pre><code>pandoc --lua-filter=custom_styles.lua -o output.odt input.md\n</code></pre>\n<p>My odt document now shows &quot;No Character Style&quot; for the text that was bold and italic.</p>\n<p>Can somebody explain what I should be doing to achieve this?</p>\n<p>Thanks I</p>\n"^^ . . "inheritance"^^ . "1"^^ . . . . . . "-1"^^ . "<pre><code>a={ {11,22,33} }\n</code></pre>\n<p>How to remove a[1][1] aka 11 with table.remove() so it becomes <code>a={ {22,33} }</code>?</p>\n<p>In the pico8 lua it is <code>del(a[1],a[1][1])</code><br />\nI have no idea what <code>table.remove(a[1],a[1][1])</code> is doing, it seems to do nothing. I don't understand how you would create del() in vanilla lua.</p>\n<p>I suppose you can <code>a[1][1]=nil</code> and then apply some sorting algorithm, but I would hope I'm just missing the simpler solution.</p>\n"^^ . "lua5.1 work fine, but in lua5.4 I have to copy a new table without nil."^^ . "1"^^ . "<p>I'm wondering if this is a version mismatch?\nI needed to use a Lua 5.1.x version to interface with Love2D [Due to use of LuaJIT]</p>\n<p>The second example in the book, as I come to grips with how it wants syntax to work, throws an exception that, after reviewing what is in the book to my code, am lost as to why the inputted value is not getting put into the functions variable.</p>\n<pre><code>-- defines a factorial function\nfunction fact (n)\n if n == 0 then\n return 1\n else\n return n * fact(n-1)\n end\nend\n\nprint(&quot;Enter a number:&quot;)\na = io.read(&quot;*number&quot;) -- read a number\nprint(fact(a))\n</code></pre>\n<p>Attached is a snapshot of that section in the book;\nIt feels bizarre that the official book would be wrong so I am assuming it is something I am doing and I must be silly.</p>\n<p>The exact error, which was already described above:\n<code> attempt to perform arithmetic on local 'n' (a nil value)</code></p>\n<p>As far as I can tell, the &quot;a&quot; variable is not getting it's value transferred to &quot;n&quot; when it tries to run fact(a) in print().</p>\n<p>After searching online, I have not found an obvious answer and thus is why I am wondering if this is something more related to setting up Lua wrong on my system. [Hello World works and typing &quot;Lua&quot; into the command line both show that the system is using the provided 5.1 Lua]</p>\n<p>Thank you for your time! ♥</p>\n"^^ . "0"^^ . "<p>I'm experiencing an issue with Quarto and PDF output. Specifically, I have a very long enumerate list inside a callout box. The problem is that this list doesn’t allow for a page break, causing the list to extend beyond the visible area instead.</p>\n<p>After investigating, I discovered this issue is due to the minipage environment within the callout box setup. Each callout box uses two minipage environments—one for the header and another for the body. By removing the second minipage like this:</p>\n<pre><code>\\begin{minipage}[t]{\\textwidth - 5.5mm}\n\n(my items, don’t remove these)\n\n\\end{minipage}\n</code></pre>\n<p>everything renders perfectly.</p>\n<p>The ideal solution would be to create a Lua filter that removes both <code>\\begin{minipage}[t]{\\textwidth - 5.5mm}</code> and the corresponding <code>\\end{minipage}</code>.</p>\n<p>I've tried writing a Lua filter for this purpose; see <a href="https://github.com/produnis/minimal_examples/tree/longlist" rel="nofollow noreferrer">https://github.com/produnis/minimal_examples/tree/longlist</a> for a minimal example.</p>\n<p>However, my script isn’t working as expected. It doesn’t locate the target expressions, so nothing gets removed. Does anyone have insights into where the issue in my script might lie?</p>\n<p>This is my script:</p>\n<pre><code>local in_calloutlonglist = false\n\nfunction Div(el)\n if el.classes:includes(&quot;calloutlonglist&quot;) then\n in_calloutlonglist = true\n local processed_content = {}\n for _, elem in ipairs(el.content) do\n table.insert(processed_content, elem:walk({\n RawBlock = function(raw_el)\n if raw_el.format == 'latex' then\n local start_pattern = &quot;\\\\begin%{minipage%}%[t%]%{\\\\textwidth - 5.5mm%}&quot;\n local end_pattern = &quot;\\\\end%{minipage%}&quot;\n raw_el.text = raw_el.text:gsub(start_pattern, &quot;&quot;)\n raw_el.text = raw_el.text:gsub(end_pattern, &quot;&quot;)\n end\n return raw_el\n end\n }))\n end\n in_calloutlonglist = false\n return pandoc.Div(processed_content, el.attr)\n end\nend\n</code></pre>\n"^^ . "0"^^ . "2"^^ . . "0"^^ . . . . "1"^^ . "`match` returns first group as a string by default?"^^ . "0"^^ . "1"^^ . . "Thanks for your answer! I added the Telescope and Treesitter files to my question."^^ . . "0"^^ . "Second Example in Lua 2nd Book Attempts To Perform Arithmetic On Nil Value"^^ . . . . . . "2"^^ . "It looks like a bug, please report it on the [Lua mailing list](https://lua.org/lua-l.html)"^^ . . . . . . . . "Is there any chance you could cut the example and code down to the minimum required to illustrate the problem? That way someone will be happier to try and reproduce the issue. And there's also a chance that by doing that you find the answer yourself."^^ . . . . . . . "In-place array compaction with least amount of shifting"^^ . . . "How to use 'goto' in gopher-lua v1.1.0?"^^ . . "1"^^ . "<p>Tell me how can I make my script run indefinitely when I hold down the left mouse button until I release the left mouse button. I tried using chatgpt, but it gave crooked answers and nothing worked.</p>\n<pre><code>function main()\n -- Define the number of repetitions\n local repetitions = 10\n\n for i = 1, repetitions do\n -- Mouse left button down\n PressAndReleaseMouseButton(1) -- Left down\n Sleep(30) -- Delay 30 ms\n\n -- Mouse left button up\n ReleaseMouseButton(1) -- Left up\n Sleep(5) -- Delay 5 ms\n\n -- Move the mouse\n MoveMouseRelative(0, 2) -- Move right 0, down 2\n end\nend\n\nmain()\n</code></pre>\n<p>And that's what chatgpt gave me:</p>\n<pre><code>-- Define the number of repetitions\nlocal repetitions = 10\n\nfunction main()\n OutputLogMessage(&quot;Hold 'LMB' to run the script. Release to stop.\\n&quot;)\n\n while true do\n -- Check if the left mouse button is held down\n if IsMouseButtonPressed(1) then\n OutputLogMessage(&quot;LMB is pressed. Running actions...\\n&quot;)\n \n for i = 1, repetitions do\n -- Mouse left button down\n PressAndReleaseMouseButton(1) -- Left down\n Sleep(30) -- Delay 30 ms\n\n -- Mouse left button up\n ReleaseMouseButton(1) -- Left up\n Sleep(5) -- Delay 5 ms\n\n -- Move the mouse\n MoveMouseRelative(0, 2) -- Move right 0, down 2\n end\n \n -- Optionally, log that the actions are complete\n OutputLogMessage(&quot;Completed %d repetitions.\\n&quot;, repetitions)\n \n -- Optional: Wait a moment before checking the button again\n Sleep(100) -- Delay to prevent rapid retriggering\n end\n\n Sleep(10) -- Prevent high CPU usage when the button is not pressed\n end\nend\n\nmain()\n</code></pre>\n<p>Yes, it works, but not the way I need it.</p>\n"^^ . . . "1"^^ . "0"^^ . . . . "0"^^ . "0"^^ . "1"^^ . "1"^^ . . . "6"^^ . . "0"^^ . . . . . . . . "2"^^ . . . "0"^^ . . "Why does code completion not work for ".tpp" file extension in Neovim?"^^ . "3"^^ . "@traktor Yes, that's why I suggested a `setTimeout` in the game loop. Or maybe more appropriately, `requestAnimationFrame`? But I'm not sure what kind of tasks the OP expects to run, maybe they want coroutines and would be happier with a generator-function based solution."^^ . . "0"^^ . "<p>Well to help this is a simple mistake, you first need to not do such a chunky code block and make it smaller to have the code not get tied up with risking a jitter the player can notice, and may end up having the parts of your player's body get out of place for a frame and then bug out to get even worse!</p>\n<p>Avoid big code and use the more built-in ROBLOX locking mouse, that's already shift lock code, made for you!\nAnd ROBLOX actually really already has plugins for all of this so using that you can easily take that and edit it, if you want to, aides, ROBLOX is full of over 2M games using those plugins and I bet you'll find something that works for you!</p>\n"^^ . . . . "Okay, so your question is something like "how to execute command given its name as a string"."^^ . . . . "<p>The issue you're encountering with self being nil during the <code>OnLoad</code> event is a common problem in World of Warcraft UI scripting, especially for custom frames. This typically happens because when the <code>OnLoad</code> script is fired, the reference to self is not automatically passed in the way you'd expect it to be, especially when it's a custom frame or button.</p>\n<p>Here's why:</p>\n<p>In WoW, the <code>self</code> parameter is typically passed in automatically by the system when you use the <code>OnLoad</code> event in combination with a <code>frame</code> or <code>button</code>. However, if the <code>OnLoad</code> event is handled within <code>XML</code>, the <code>frame</code> might not have been fully initialized when the event fires, or the <code>XML</code> setup might not be correctly linked to the Lua function.</p>\n<p><strong>The Root Cause</strong></p>\n<p>The <code>OnLoad</code> event is generally triggered when the frame has been loaded, but in some cases (depending on the context), self might not reference the frame as expected.</p>\n<p><em>Reference the Frame Directly in Lua</em></p>\n<p>If you don’t want to change the <code>XML</code>, you can modify the Lua function to get a reference to the frame directly, even if self is nil. You can achieve this by referencing the <code>frame</code> by name within the <code>MyAddonName_OnLoad</code> function.</p>\n<p>fix:</p>\n<pre><code>local frame = self or MyAddonName -- Fallback to MyAddonName if self is nil\n</code></pre>\n"^^ . "Sorry I didnt put it clear cause I didnt know how to escape markdown on markdown.\nIt has been written in the post again , it was appended the expeted output."^^ . "<p>I installed lua5.4.2. The system variable path already contains the path. mingw-w64 uses x86_64-14.2.0-release-win32-seh-ucrt-rt_v12-rev0, and luarocks uses LuaRocks 3.11.1.\nThe following is the error I made when installing Luasocket under Windows 10 system 64-bit. Please give me some guidance. Thank you very much.</p>\n<pre><code>C:\\Users\\40341&gt;luarocks install luasocket\nInstalling https://luarocks.org/luasocket-3.1.0-1.src.rock\n\nluasocket 3.1.0-1 depends on lua &gt;= 5.1 (5.4-1 provided by VM: success)\nx86_64-w64-mingw32-gcc -O2 -c -o src/luasocket.o -IC:\\lua\\lua54\\include src/luasocket.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -O2 -c -o src/timeout.o -IC:\\lua\\lua54\\include src/timeout.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -O2 -c -o src/buffer.o -IC:\\lua\\lua54\\include src/buffer.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -O2 -c -o src/io.o -IC:\\lua\\lua54\\include src/io.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -O2 -c -o src/auxiliar.o -IC:\\lua\\lua54\\include src/auxiliar.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -O2 -c -o src/options.o -IC:\\lua\\lua54\\include src/options.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -O2 -c -o src/inet.o -IC:\\lua\\lua54\\include src/inet.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -O2 -c -o src/except.o -IC:\\lua\\lua54\\include src/except.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -O2 -c -o src/select.o -IC:\\lua\\lua54\\include src/select.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -O2 -c -o src/tcp.o -IC:\\lua\\lua54\\include src/tcp.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -O2 -c -o src/udp.o -IC:\\lua\\lua54\\include src/udp.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -O2 -c -o src/compat.o -IC:\\lua\\lua54\\include src/compat.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -O2 -c -o src/wsocket.o -IC:\\lua\\lua54\\include src/wsocket.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -shared -o C:\\Users\\40341\\AppData\\Local\\Temp\\luarocks_build-LuaSocket-3.1.0-1-2988190\\socket\\core.dll src/luasocket.o src/timeout.o src/buffer.o src/io.o src/auxiliar.o src/options.o src/inet.o src/except.o src/select.o src/tcp.o src/udp.o src/compat.o src/wsocket.o -lws2_32 C:\\lua\\lua54.dll -lm\nx86_64-w64-mingw32-gcc -O2 -c -o src/mime.o -IC:\\lua\\lua54\\include src/mime.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -O2 -c -o src/compat.o -IC:\\lua\\lua54\\include src/compat.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -Ic:\\windows\\system32\\include\nx86_64-w64-mingw32-gcc -shared -o C:\\Users\\40341\\AppData\\Local\\Temp\\luarocks_build-LuaSocket-3.1.0-1-2988190\\mime\\core.dll src/mime.o src/compat.o -Lc:\\windows\\system32 C:\\lua\\lua54.dll -lm\nC:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/lib/../lib/dllcrt2.o:crtdll.c:(.text+0x148): undefined reference to `_execute_onexit_table'\nC:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/lib/../lib/dllcrt2.o:crtdll.c:(.text+0x8): undefined reference to `_initialize_onexit_table'\nC:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/lib/../lib/dllcrt2.o:crtdll.c:(.text+0x34b): undefined reference to `_register_onexit_function'\nC:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-pseudo-reloc.o):pseudo-reloc.c:(.text+0x28): undefined reference to `__acrt_iob_func'\nC:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-pseudo-reloc.o):pseudo-reloc.c:(.text+0x51): undefined reference to `__acrt_iob_func'\ncollect2.exe: error: ld returned 1 exit status\n\nError: Build error: Failed compiling module mime\\core.dll\n</code></pre>\n<p>I get the same error after repeatedly confirming all my package versions and system variable paths</p>\n"^^ . "3"^^ . . . "haproxy"^^ . "0"^^ . . "1"^^ . . "luasocket"^^ . "instanceof"^^ . . . . . . . "1"^^ . . "0"^^ . "<p>I am not planning to study how this obfuscator actually works. Here is a way to explain how to call <code>print</code> without explicitly referencing it.</p>\n<p>In Lua, you can use the <code>load</code> function (or <code>loadstring</code> in Lua 5.1) to execute a string as Lua code.</p>\n<pre><code>load('print(&quot;Hello world&quot;)')()\n</code></pre>\n<p>Since the execution is a string, which is a byte sequence, you can completely obfuscate each character by concatenating them one by one. For example, using the <code>string.char</code> function:</p>\n<pre><code>local v0 = string.char(0x70,0x72,0x69,0x6E,0x74,0x28,0x22,0x48,0x65,0x6C,0x6C,0x6F,\n 0x2C,0x20,0x57,0x6F,0x72,0x6C,0x64,0x22,0x29)\n-- v0 equals 'print(&quot;Hello world&quot;)'\nload(v0)()\n</code></pre>\n<p>And you can futher obfuscate the <code>load</code> function:</p>\n<pre><code>local v1 = _ENV[string.char(0x6C,0x6F,0x61,0x64)]\nv1(v0)()\n</code></pre>\n<p>....</p>\n"^^ . . . . . . . . . . . . "add-on"^^ . "Why doesn't the statement after await continue to execute after promise resolves?"^^ . . . . . "2"^^ . "goto"^^ . . "0"^^ . . "3"^^ . "2"^^ . "0"^^ . "I had to change it to {['custom-style'] = "Strong Emphasis"} but working!"^^ . . "0"^^ . . "hook"^^ . . . "0"^^ . "0"^^ . . . "Please provide enough code so others can better understand or reproduce the problem."^^ . . . . "0"^^ . "4"^^ . . "1"^^ . "0"^^ . "How can I set up VSCode to recognize premake5's global functions and not warn me about them?"^^ . . . . "0"^^ . . . "<p>I am working on a Lua plugin for my Neovim config and want to have tab-complete for some of the commands. I know i can add support with the <code>-complete</code> flag but am wondering if any of the options are meant specifically for Lua tables where it looks to finish the Key?</p>\n"^^ . "recursion"^^ . . . . . "0"^^ . . "0"^^ . . "2"^^ . "0"^^ . "Lua inheritance and instanceof"^^ . . . . . . "0"^^ . . . "0"^^ . "csproj"^^ . "2"^^ . "yeah it does work"^^ . "1"^^ . "0"^^ . . "0"^^ . "Unfortunately, it's the same. I end up with plain text."^^ . "<p>I'm trying to create a simple lua dissector for a custom UDP-based tunneling protocol containing two fixed-length fields followed by the tunneled Ethernet frame. I have the following script with help from ChatGPT (being a novice), however the Ethernet frame isn't decoded properly, and displayed as a binary blob (see screenshot). Help would be much appreciated.</p>\n<p><a href="https://i.sstatic.net/mZj5GdDs.png" rel="nofollow noreferrer">Wireshark decoding</a></p>\n<pre><code>-- Define the protocol\nmy_proto = Proto(&quot;my_proto&quot;, &quot;Custom UDP Tunneling Protocol&quot;)\n\n-- Define the fields for the protocol\nlocal f_id = ProtoField.string(&quot;my_proto.id&quot;, &quot;ID&quot;, base.ASCII)\nlocal f_timestamp = ProtoField.uint64(&quot;my_proto.timestamp&quot;, &quot;Timestamp&quot;, base.DEC)\nlocal f_tunneled_eth = ProtoField.bytes(&quot;my_proto.tunneled_eth&quot;, &quot;Tunneled Ethernet Frame&quot;)\n\n-- Assign fields to the protocol\nmy_proto.fields = { f_id, f_timestamp, f_tunneled_eth }\n\n-- Dissector function\nfunction my_proto.dissector(buffer, pinfo, tree)\n -- Set the protocol column to &quot;Custom Proto&quot;\n pinfo.cols.protocol = &quot;MY_PROTO&quot;\n\n -- Check if the packet is large enough for minimum fields\n if buffer:len() &lt; 32 then\n return -- Not enough data for ID + Timestamp\n end\n\n -- Add protocol to the dissection tree\n local subtree = tree:add(my_proto, buffer(), &quot;Custom UDP Tunneling Protocol&quot;)\n\n -- Extract the ID field (24 bytes)\n subtree:add(f_id, buffer(0, 24))\n\n -- Extract the Timestamp field (8 bytes)\n subtree:add(f_timestamp, buffer(24, 8))\n\n -- Extract the Tunneled Ethernet frame (starting from byte 32)\n local eth_buffer = buffer(32):tvb()\n local eth_dissector = Dissector.get(&quot;eth&quot;) -- Get the Ethernet dissector\n\n if eth_dissector then\n -- Call the Ethernet dissector to parse the tunneled frame properly, adding it directly to the tree\n eth_dissector:call(eth_buffer, pinfo, tree)\n else\n -- Fallback if Ethernet dissector is unavailable\n subtree:add(f_tunneled_eth, buffer(32), &quot;Ethernet Frame (unrecognized)&quot;)\n end\nend\n</code></pre>\n<p>I have tried the included lua script, expecting the tunneled Ethernet frame to be decoded correctly. However, it is displayed as a binary blob.</p>\n"^^ . "0"^^ . "nginx"^^ . . . . . "I know the case of tail call, as it is clearly stated in the [manual](https://www.lua.org/manual/5.4/manual.html#lua_Hook) that LUA_HOOKTAILCALL will not have a corresponding return event, and it is possible and not difficult to be correctly handled. The case of error seems much more severe, and I feel uncertain about manually correcting stack from parent level because it is not semantically rigorous. Anyway, thanks to your answer, I know there is no other choice >.<"^^ . . . "0"^^ . . . . . "1"^^ . "<p>Adding this to my code:</p>\n<pre><code>package.cpath =&quot;/Users/user_name/.luarocks/lib/lua/5.4/?.so;&quot; .. package.cpath\npackage.path = &quot;/Users/user_name/.luarocks/share/lua/5.4/?.lua;&quot; .. package.path\n</code></pre>\n<p>... worked.</p>\n"^^ . . . "<p>I have 2 premake files 1 for my renderer, and one for my engine but when I generate a vs2022 solution via the command <code>premake5 vs2022</code> trying to build said solution hits me with a <a href="https://i.sstatic.net/ftEuf06t.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ftEuf06t.png" alt="error" /></a></p>\n<p>I would like to know why this behavior happens, as building on the command line (with gmake) works perfectly fine, and being able to build in VS would greatly increase the productivity of debugging</p>\n<p>Here are the aforementioned solution files</p>\n<pre class="lang-lua prettyprint-override"><code>workspace &quot;Wrenderer&quot;\nconfigurations { &quot;Debug&quot;, &quot;Release&quot;}\nproject &quot;Wrenderer&quot;\n language &quot;C&quot;\n targetname &quot;Wrenderer&quot;\n architecture &quot;x64&quot;\n kind &quot;StaticLib&quot;\n outputdir = &quot;%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}&quot;\n\n toolset &quot;clang&quot;\n cdialect &quot;C99&quot;\n\n targetdir(&quot;%{wks.location}/Binaries/&quot; .. outputdir .. &quot;/%{prj.name}&quot;)\n objdir(&quot;%{wks.location}/Binaries/Intermediates/&quot; .. outputdir .. &quot;/%{prj.name}&quot;)\n files { &quot;include/**.h&quot;, &quot;src/**.c&quot; }\n libdirs { &quot;./libs/&quot; }\n includedirs { &quot;./include/&quot; }\n includedirs { &quot;./include/libs/&quot; }\n includedirs { os.getenv(&quot;VULKAN_SDK&quot;) .. &quot;/Include&quot; }\n buildoptions { &quot;-Wextra -Wall&quot; }\n links { &quot;vulkan-1&quot;, &quot;glfw3&quot; }\n removefiles { &quot;test/**.**&quot; }\n filter &quot;configurations:Debug&quot;\n defines { &quot;DEBUG&quot; }\n symbols &quot;On&quot;\n filter &quot;&quot;\n filter &quot;configurations:Release&quot;\n optimize &quot;On&quot;\n filter &quot;&quot;\n filter &quot;system:windows&quot;\n links { &quot;user32&quot;, &quot;msvcrt&quot;, &quot;gdi32&quot;, &quot;shell32&quot;, &quot;libcmt&quot; }\n defines { &quot;VK_USE_PLATFORM_WIN32_KHR&quot; }\n filter &quot;&quot;\n filter &quot;system:linux&quot;\n defines { &quot;VK_USE_PLATFORM_XLIB_KHR&quot; }\n filter &quot;&quot;\n filter &quot;action:gmake&quot;\n prebuildcommands {\n\n &quot;mkdir -p&quot; .. &quot; %[%{wks.location}/Binaries/]&quot;,\n &quot;mkdir -p&quot; .. &quot; %[%{wks.location}/Binaries/Intermediates/]&quot;,\n\n &quot;mkdir -p&quot; .. &quot; %[%{wks.location}/Binaries/&quot; .. outputdir .. &quot;]&quot;,\n &quot;mkdir -p&quot; .. &quot; %[%{wks.location}/Binaries/Intermediates/&quot; .. outputdir .. &quot;]&quot;,\n }\n filter &quot;&quot;\n filter &quot;not action:gmake&quot;\n prebuildcommands {\n\n &quot;{MKDIR}&quot; .. &quot; %[%{wks.location}/Binaries/]&quot;,\n &quot;{MKDIR}&quot; .. &quot; %[%{wks.location}/Binaries/Intermediates/]&quot;,\n\n &quot;{MKDIR} %[%{wks.location}/Binaries/&quot; .. outputdir .. &quot;]&quot;,\n &quot;{MKDIR} %[%{wks.location}/Binaries/Intermediates/&quot; .. outputdir .. &quot;]&quot;,\n }\n filter &quot;&quot;\n project &quot;WrenTest&quot;\n architecture &quot;x64&quot;\n kind &quot;ConsoleApp&quot; \n language &quot;C&quot; \n\n files { &quot;**.h&quot;, &quot;test/**.c&quot; }\n outputdir = &quot;%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}&quot;\n\n toolset &quot;clang&quot;\n cdialect &quot;C99&quot;\n \n targetdir(&quot;%{wks.location}/Binaries/&quot; .. outputdir .. &quot;/%{prj.name}&quot;)\n objdir(&quot;%{wks.location}/Binaries/Intermediates/&quot; .. outputdir .. &quot;/%{prj.name}&quot;)\n\n libdirs { &quot;./libs/&quot; }\n includedirs { &quot;./include/&quot; }\n includedirs { &quot;./include/libs/&quot; }\n includedirs { os.getenv(&quot;VULKAN_SDK&quot;) .. &quot;/Include&quot; }\n links { &quot;Wrenderer&quot; }\n buildoptions { &quot;-Wextra -Wall&quot; }\n links { &quot;vulkan-1&quot;, &quot;glfw3&quot; }\n\n filter &quot;configurations:Debug&quot;\n defines { &quot;DEBUG&quot; }\n symbols &quot;On&quot;\n sanitize { &quot;Address&quot;, &quot;Fuzzer&quot; }\n filter &quot;&quot;\n filter &quot;configurations:Release&quot;\n optimize &quot;On&quot;\n filter &quot;&quot;\n filter &quot;system:windows&quot;\n links { &quot;user32&quot;, &quot;msvcrt&quot;, &quot;gdi32&quot;, &quot;shell32&quot;, &quot;libcmt&quot; }\n defines { &quot;VK_USE_PLATFORM_WIN32_KHR&quot; }\n filter &quot;&quot;\n filter &quot;system:linux&quot;\n defines { &quot;VK_USE_PLATFORM_XLIB_KHR&quot; }\n filter &quot;&quot;\nnewaction {\n trigger = &quot;clean&quot;,\n description = &quot;clean the software&quot;,\n execute = function ()\n print(&quot;Cleaning&quot;)\n os.rmdir(&quot;./Binaries&quot;)\n os.remove(&quot;./Lib/*.lib&quot;)\n os.remove(&quot;*.make&quot;)\n os.remove(&quot;Makefile&quot;)\n os.remove(&quot;*.vcxproj&quot;)\n os.remove(&quot;*.vcxproj.filters&quot;)\n os.remove(&quot;*.vcxproj.user&quot;)\n os.remove(&quot;*.sln&quot;)\n print(&quot;done.&quot;)\n end\n}\n</code></pre>\n<p>and the one for the engine</p>\n<pre class="lang-lua prettyprint-override"><code>workspace &quot;Wrenderer&quot;\nproject &quot;Wrengine&quot;\n language &quot;C&quot;\n targetname &quot;Wrengine&quot;\n architecture &quot;x64&quot;\n outputdir = &quot;%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}&quot;\n kind &quot;ConsoleApp&quot;\n toolset &quot;clang&quot;\n cdialect &quot;C99&quot;\n\n targetdir(&quot;%{wks.location}/Binaries/&quot; .. outputdir .. &quot;/%{prj.name}&quot;)\n objdir(&quot;%{wks.location}/Binaries/Intermediates/&quot; .. outputdir .. &quot;/%{prj.name}&quot;)\n files { &quot;include/**.h&quot;, &quot;src/**.c&quot; }\n libdirs { &quot;./libs/&quot; }\n includedirs { &quot;./include/&quot; }\n includedirs { &quot;./Wrenderer/include/&quot; }\n includedirs { &quot;./include/libs/&quot; }\n includedirs { os.getenv(&quot;VULKAN_SDK&quot;) .. &quot;/Include&quot; }\n libdirs { os.getenv(&quot;VULKAN_SDK&quot;) .. &quot;/Lib&quot; }\n buildoptions { &quot;-Wextra -Wall&quot; }\n links { &quot;vulkan-1&quot;, &quot;glfw3&quot; }\n links { &quot;Wrenderer&quot; }\n\n filter &quot;configurations:Debug&quot;\n defines { &quot;DEBUG&quot; }\n symbols &quot;On&quot;\n sanitize {&quot;Address&quot;}\n filter &quot;&quot;\n filter &quot;configurations:Release&quot;\n optimize &quot;On&quot;\n filter &quot;&quot;\n filter &quot;system:windows&quot;\n links { &quot;user32&quot;, &quot;msvcrt&quot;, &quot;gdi32&quot;, &quot;shell32&quot;, &quot;libcmt&quot; }\n defines { &quot;VK_USE_PLATFORM_WIN32_KHR&quot; }\n filter &quot;&quot;\n filter &quot;system:linux&quot;\n defines { &quot;VK_USE_PLATFORM_XLIB_KHR&quot; }\n filter &quot;&quot;\n filter &quot;action:gmake&quot;\n filter &quot;&quot;\n\n prebuildcommands {\n &quot;compileShaders.bat&quot;\n }\ninclude &quot;Wrenderer/premake5.lua&quot;\n</code></pre>\n<p>my file tree looks like so<br />\n<a href="https://i.sstatic.net/51LeAF6H.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/51LeAF6H.png" alt="file tree" /></a></p>\n<p>from what I've been messing around with it sort of looks like its trying to force the msvc c standard on it, which might contribute to the issue, but still evades me</p>\n"^^ . . . . . "<p>I have two Points A and B (given with coordinates ax, ay and bx, by).\nThis two points are inside of given Circle C (given with coordinates cx, cy and radius cr).</p>\n<p>How to find points T1 and T2?\nPoints T1 and T2 must be on the tangent between circle C and imaginary circles D1 and D2 (both are on the points A and B).</p>\n<p><a href="https://i.sstatic.net/YFoy7XCx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/YFoy7XCx.png" alt="tangent points" /></a></p>\n<p>Example values:</p>\n<pre><code>A (30, 30)\nB (40, 20)\nC (50, 50, 40)\n</code></pre>\n<p>right solution:</p>\n<pre><code>T1 (28.6061, 16.202)\nT2 (87.3939, 35.798)\n</code></pre>\n<p>I've started with the middle point M:\n<code>mx, my = (ax+bx)/2, (ay+by)/2</code></p>\n<p>The perpendicular line to line AB:</p>\n<pre class="lang-lua prettyprint-override"><code>m1x, m1y = mx + (ay-my), my - (ax-mx)\nm2x, m2y = mx + (by-my), my - (bx-mx)\n</code></pre>\n<p><a href="https://i.sstatic.net/3mR6q6lD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3mR6q6lD.png" alt="points D1 and D2" /></a></p>\n<p>And how to get the circles D1 and D2?</p>\n"^^ . "<p>I wrote this script:</p>\n<pre><code>local mob = require(script.mob)\nlocal map = workspace[&quot;level 0&quot;]\nlocal wave = 1\nlocal spawntime = 1\n\nif wave == 1 then\ntask.wait(1)\nmob.Spawn(&quot;wretch&quot;, map)\n\nend\n</code></pre>\n<p>It is supposed to spawn in a monster after one second, but instead of it waiting one second, it just stops the entire script and I can't figure it out. I have tried to get it to work by doing different things like to doing &quot;wait(1)&quot; instead or making it delay longer, but every time it won't work.</p>\n<p>So, I need it to spawn in my monster which will be heading to your base since this is a td game after 1 second.</p>\n"^^ . . "<p>The other answer is fine but it's also possible to compress the array in linear time and in-place while maintaining relative order of the non-empty values.</p>\n<p>Implementation in Python below.</p>\n<pre class="lang-py prettyprint-override"><code>def make_compressed(A):\n &quot;&quot;&quot;\n Compress but keep the relative order of non-free elements\n Returns the size of the compressed array though modifications are in-place\n &quot;&quot;&quot;\n free_idx = 0\n new_size = 0\n for i, x in enumerate(A):\n if x == -1:\n continue\n \n # locate next free index\n while free_idx &lt; len(A) and A[free_idx] != -1:\n free_idx += 1\n \n if free_idx &gt; i: # don't actually swap bc the free index is on the right\n new_size = i + 1\n continue\n \n # do swap; observe that i will later become a free index\n A[free_idx], A[i] = A[i], -1\n # use up this index\n free_idx += 1\n new_size = free_idx\n \n return new_size\n \ndef main():\n for A in [\n [1, 3, 6, -1, 8, -1, -1],\n [-1, -1, -1, 1, 2, 3, -1, 4],\n [-1, -1, 1, 2, 3, 4],\n [5, 4, 3, 2, 1]\n ]:\n # making copies only for debugging purposes\n B = A.copy()\n new_size = make_compressed(B)\n print(f&quot;{A} -&gt; {B[:new_size]}&quot;)\n \nif __name__ == &quot;__main__&quot;:\n main() \n</code></pre>\n"^^ . . "0"^^ . "1"^^ . . . . . . "0"^^ . . . . . . . . "@MindSwipe wow! this is impressive. It simplifies the `.csproj` file into just several lines. I am gonna propose this internally to see if we can use this instead. thanks. "^^ . "@mikyll98, thank you"^^ . . . "0"^^ . . . . "autohotkey"^^ . "Are you talking about Lua or other similar language? `local name, age = person` will just assign `person` to `name` in Lua."^^ . . "rust"^^ . . "<p><strong>IDK the whole function/loop but try this algorithm</strong> :</p>\n<pre><code>local isBattleActive = false -- new binary flag\n\nfunction StartBattle()\n if isBattleActive then return end -- battle active :do not start\n isBattleActive = true\n\n repeat\n BattleClient.PlayerAttackTween()\n task.wait(battleSpeed)\n BattleClient.EnemyAttackTween()\n task.wait(battleSpeed)\n battleRound += 1\n until isInBattle.Value == false\n \n isBattleActive = false -- battle over, reset flag\nend\n</code></pre>\n"^^ . "<p>I am working on plugin for Neovim written in Lua that parses YAML data and decided to use lyaml. The plugin is working on my private MacBook Air. But when I tried to use it at work on my MacBook Pro I received the error &quot;cache_loader: module yaml.version not found&quot;</p>\n<p>Here's the entire output from Neovim:</p>\n<pre><code>/usr/local/share/lua/5.1/lyaml/init.lua:460: attempt to call field 'parser' (a nil value)\n\n# stacktrace:\n - /usr/local/share/lua/5.1/lyaml/init.lua:460 _in_ **Parser**\n - /usr/local/share/lua/5.1/lyaml/init.lua:487 _in_ **load**\n - /xxx/lua/xxx/model/YamlHeader.lua:114 _in_ **parseDocument**\n - /xxx/lua/xxx/controller/SetUpController.lua:37 _in_ **updateNote**\n - /xxx/lua/xxx/controller/SetUpController.lua:117 _in_ **scanNoteBoxes**\n - /xxx/lua/xxx/init.lua:13 _in_ **setup**\n - .config/nvim/lua/config/lazy.lua:9\n - .config/nvim/init.lua:2\n\n^Ino field package.preload['yaml.version']\ncache_loader: module yaml.version not found\ncache_loader_lib: module yaml.version not found\n^Ino file './yaml/version.lua'\n^Ino file '/opt/homebrew/share/luajit-2.1/yaml/version.lua'\n^Ino file '/usr/local/share/lua/5.1/yaml/version.lua'\n^Ino file '/usr/local/share/lua/5.1/yaml/version/init.lua'\n^Ino file '/opt/homebrew/share/lua/5.1/yaml/version.lua'\n^Ino file '/opt/homebrew/share/lua/5.1/yaml/version/init.lua'\n^Ino file './yaml/version.so'\n^Ino file '/usr/local/lib/lua/5.1/yaml/version.so'\n^Ino file '/opt/homebrew/lib/lua/5.1/yaml/version.so'\n^Ino file '/usr/local/lib/lua/5.1/loadall.so'\n^Ino module 'yaml.version' in file '/usr/local/lib/lua/5.1/yaml.so'\nmodule 'yaml.parser' not found:\n^Ino field package.preload['yaml.parser']\ncache_loader: module yaml.parser not found\ncache_loader_lib: module yaml.parser not found\n^Ino file './yaml/parser.lua'\n^Ino file '/opt/homebrew/share/luajit-2.1/yaml/parser.lua'\n^Ino file '/usr/local/share/lua/5.1/yaml/parser.lua'\n^Ino file '/usr/local/share/lua/5.1/yaml/parser/init.lua'\n^Ino file '/opt/homebrew/share/lua/5.1/yaml/parser.lua'\n^Ino file '/opt/homebrew/share/lua/5.1/yaml/parser/init.lua'\n^Ino file './yaml/parser.so'\n^Ino file '/usr/local/lib/lua/5.1/yaml/parser.so'\n^Ino file '/opt/homebrew/lib/lua/5.1/yaml/parser.so'\n^Ino file '/usr/local/lib/lua/5.1/loadall.so'\n^Ino module 'yaml.parser' in file '/usr/local/lib/lua/5.1/yaml.so'\n\n</code></pre>\n<p>On my MacBook Pro I insalled Lua 5.1 und luarocks manually,\ni.e. I downloaded the source packages and installed them\nwith:</p>\n<pre><code> sudo make macosx install\n</code></pre>\n<p>Then I installed lyaml with:</p>\n<pre><code> sudo luarocks --server=http://rocks.moonscript.org install lyaml YAML_DIR=/opt/homebrew/lib/ YAML_INCDIR=/opt/homebrew/include/\n</code></pre>\n<p>Did I miss something? Do I have to specify the <code>yaml.version</code> in some configuration?</p>\n<p>On my private MacBook Air I installed lyaml with:</p>\n<p><code>luarocks --lua-dir=/opt/homebrew/opt/lua@5.1 install lyaml</code></p>\n<p>whiich installed it in <code>~/.luarocks/share/lua/5.1/lyaml</code>. Therefor I copied it to <code>/usr/local/share/lua/5.1</code>:</p>\n<p><code>sudo cp -r .luarocks/share/lua/5.1/lyaml /usr/local/share/lua/5.1</code></p>\n<p>On my private MacBook Air the above error does not occur. I compared the instllation of lyaml on the MacBook Air with the installation on the MacBook Pro but did not find any difference. On both machines I run <em>nvim</em> in an <code>oh-my-zsh</code> in <code>iTerm2</code>.</p>\n<p>I don't understand why the plugin is not working on the MacBook Pro.</p>\n<p>Ciao</p>\n<p>Maral</p>\n"^^ . "0"^^ . . . "1"^^ . . . . . "0"^^ . . . . . . "<p>How do I copy the client's UI into the server when the player leaves?</p>\n<p>So how it is going to work is that when the player leaves, their UI will be saved onto the server side and when they join back, they will still have that UI. Except it doesn't work or I just don't know how to use datastore properly. I want only the main <a href="https://create.roblox.com/docs/reference/engine/classes/Frame" rel="nofollow noreferrer">frame</a> to save as it contains all of the other items parented to it. Is there a better way to save the frame only?</p>\n<p><a href="https://i.sstatic.net/GsuXJUiQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/GsuXJUiQ.png" alt="The frame I want to save." /></a></p>\n<p>P.S. My knowledge on scripting is beginning to grow (still little though) so it would help out a lot if someone can explain what they do and how they work so I don't come across this question again. Thank you.</p>\n"^^ . . "0"^^ . . . . . . . "Value not changing between tables"^^ . "Shift To Sprint"^^ . "1"^^ . . . . "beginCollision callback not allowing two fixtures"^^ . . "0"^^ . "thanks, this answers my question very well"^^ . . "0"^^ . . . . . . . . "<p>I figured it out. The first argument was thisScene due to the &quot;:&quot;\nCorrected code:</p>\n<pre><code>function thisScene.contact(a, b, coll)\n</code></pre>\n"^^ . . . . "1"^^ . "0"^^ . "0"^^ . . "0"^^ . "1"^^ . . . "linux"^^ . . "0"^^ . . "1"^^ . . . "0"^^ . . . . . "0"^^ . "You `run` command does not include `command`, unlike the docker compose fragment."^^ . . . . . . . . . . . . . . "<p>I have two Lua functions, <code>getSongLyrics</code> and <code>getSongTitle</code>, whose outputs are displayed in a conky window.</p>\n<p><code>getSongLyrics</code> uses a python script that runs <code>sptlrx pipe</code> and outputs it into a FIFO file, which is read by the function and then displayed in conky using <code>conky_displaySongLyrics</code>.</p>\n<p><code>getSongTitle</code> uses <code>playerctl</code> to get the title and artist of the current song playing, which is then displayed directly to the conky window using <code>conky_displaySongTitle</code>.</p>\n<p>The problem happens when a new song plays or is changed, the output display for <code>getSongTitle</code> in the conky wndow only gets updated whenever <code>getSongLyrics</code> is updated (i.e. a new lyric line). This problem is further shown whenever a song doesn't have any lyrics available, thus <code>conky_displaySongLyrics</code> never gets updated, which causes <code>conky_displaySongTitle</code> to never get updated from the previous song, until a song with lyrics plays.</p>\n<p>I'm assuming that it's because of the FIFO file waiting for a new line from <code>sptlrx pipe</code> that causes this update problem, but I'm not quite sure how to make it so that conky updates <code>getSongTitle</code> independent of <code>getSongLyrics</code>.</p>\n<p>How do I make it so that these two functions are ran independently from each other, so that <code>conky_displaySongLyrics</code> does not affect <code>conky_displaySongTitle</code>, and vise versa?</p>\n<hr>\n<p>scripts.lua</p>\n<pre class="lang-lua prettyprint-override"><code>-- read file and print contents of file\nfunction readPrintFile(file)\n local f = io.open(file, &quot;rb&quot;)\n \n -- if file doesn't exist, return nil\n if not f then return nil end\n\n local content = f:read(&quot;*a&quot;)\n f:close()\n\n return content\nend\n\n-- get song title from a music source\nfunction getSongTitle()\n local command = io.popen(&quot;playerctl metadata --player spotify --format '{{ artist }} - {{ title }}'&quot;, &quot;r&quot;)\n local title = command:read(&quot;*l&quot;)\n command:close()\n return format:gsub(&quot;\\n&quot;, &quot;&quot;)\nend\n\n-- get song lyrics from a music source\nfunction getSongLyrics()\n local lyrics = readPrintFile(&quot;/tmp/sptlrx_lyrics&quot;) or &quot;&quot;\n return lyrics:gsub(&quot;\\n&quot;, &quot;&quot;)\nend\n\nfunction conky_displaySongTitle()\n return getSongTitle()\nend\n\nfunction conky_displaySongLyrics()\n return getSongLyrics()\nend\n</code></pre>\n<p>sptlrx_lyrics.py</p>\n<pre class="lang-py prettyprint-override"><code>import os\nimport subprocess\n\npipe_path_lyrics = &quot;/tmp/sptlrx_lyrics&quot;\ntry:\n os.mkfifo(pipe_path_lyrics)\nexcept FileExistsError:\n pass\n\nprocess_lyrics = subprocess.Popen([&quot;sptlrx&quot;, &quot;pipe&quot;], stdout=subprocess.PIPE)\n\nfor line_lyrics in iter(process_lyrics.stdout.readline, &quot;&quot;):\n with open(pipe_path_lyrics, &quot;wb&quot;) as lyrics:\n lyrics.write(line_lyrics)\n</code></pre>\n<p>conky.conf</p>\n<pre><code>conky.config = {\n lua_load = &quot;$HOME/.config/conky/scripts.lua&quot;,\n ...\n}\n\nconky.text = [[\n${if_running spotify}\\\n${alignc} ${lua displaySongTitle}\n${alignc} ${lua displaySongLyrics}\\\n...\n${endif}\n]]\n</code></pre>\n"^^ . "0"^^ . . "<p>I am currently working on a project in Lua that involves calculating the intersection points of two ellipses that share a common focus <strong>O</strong>.\nThe parameters for the ellipses include the coordinates of their shared focus, the coordinates of the second foci (F1 and F2), and the distances from the foci to the vertices of each ellipse (p1 and p2).</p>\n<p>(it's a part of Voronoi Diagram, where the sweep line is a circle, the beach line is a fan of ellipses, the project will be written in Lua)</p>\n<p>The code for eliipses:</p>\n<pre class="lang-lua prettyprint-override"><code>local f0 = {x=400, y=300, r=290}\n\nlocal function newEllipse (x, y)\n local r = f0.r\n local ellipse = {f0 = f0, f= {x=x, y=y}}\n\n ellipse.c = length(f0.x, f0.y, x, y)/2\n print ('c', ellipse.c)\n local p = (f0.r - 2*ellipse.c)/2\n print ('p', p)\n ellipse.a = ellipse.c + p\n print ('a', ellipse.a)\n ellipse.b = math.sqrt(ellipse.a^2 - ellipse.c^2)\n \n ellipse.alpha = math.atan2 (y-f0.y, x-f0.x)\n print ('alpha', ellipse.alpha)\n\n local vertices = {}\n local numPoints = 32\n for i = 1, numPoints do\n local t = (i / numPoints) * (2 * math.pi)\n local x = (f0.x + x) / 2 + ellipse.a * math.cos(t) * math.cos(ellipse.alpha) - ellipse.b * math.sin(t) * math.sin(ellipse.alpha)\n local y = (f0.y + y) / 2 + ellipse.a * math.cos(t) * math.sin(ellipse.alpha) + ellipse.b * math.sin(t) * math.cos(ellipse.alpha)\n-- print (x, y)\n table.insert (vertices, x)\n table.insert (vertices, y)\n end\n ellipse.vertices = vertices\n\n return ellipse\nend\n\nlocal e1 = newEllipse (500, 300)\nlocal e2 = newEllipse (400, 500)\n</code></pre>\n<p><a href="https://i.sstatic.net/fPuflT6t.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/fPuflT6t.png" alt="two ellipses intersection (with common focus)" /></a></p>\n<p>How can I find the points T1 and T2?</p>\n<p>Actually, it looks like a solution for PPC Apollonius Problem:\nEach circle's middle point is the ellipse and the radius to the own focus of it, it touches the circle with tangent!\n<a href="https://i.sstatic.net/YjiXtKAx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/YjiXtKAx.png" alt="PPC Apollonius Problem" /></a></p>\n<p>Update:\nI've found the solution for not inclined ellipses:</p>\n<pre class="lang-lua prettyprint-override"><code>x = f*d\ny = f*sqrt(1-d^2)\n-- where d is cos theta:\nd = (t1 - t2)/(t1*e2 - t2*e1)\nt1 = 1-e1^2 -- also t1 = b^2/a^2\nt2 = 1-e2^2\n-- f is radius for this theta:\nf = a*t1/(1-e1*d)\n</code></pre>\n<p>Example:</p>\n<p><a href="https://www.desmos.com/calculator/5mhzyskoei" rel="nofollow noreferrer">https://www.desmos.com/calculator/5mhzyskoei</a></p>\n"^^ . "<p>Im making a Raycaster style engine in Love2D, I'm using this function</p>\n<pre><code>function AngToVec(angle)\n local one = math.cos(math.rad(angle))\n local two = math.sin(math.rad(angle))\n local vec = { two, one }\n return vec\nend\n</code></pre>\n<p>to take player angle and get a normalized vector to apply to movment, and this function to calculate and apply movment to player,</p>\n<pre><code> player.Rot = AngToVec(player.Angle)\n local altRot = AngToVec(player.Angle + 90)\n\n -- Take input and apply to acceleration\n player.Accel[1] = (\n ((player.Input[1] * altRot[1]) * player.Speed) + ((-player.Input[2] * -player.Rot[1]) * player.Speed)\n )\n player.Accel[2] = (\n ((-player.Input[2] * player.Rot[2]) * player.Speed) + ((player.Input[1] * player.Rot[1]) * player.Speed)\n )\n\n -- Add Acceleration to Velocity\n for i, v in ipairs(Vec2) do\n player.Vel[i] = player.Vel[i] + player.Accel[i]\n end\n\n</code></pre>\n<p>[1] and [2] refer to X and Y respectively, input [1] is A/D L/R movment, input [2] is W/S U/D movment, the movment seems to only be snapping to the nearest 45 degree angle for movment, any help greatly appreciated.</p>\n"^^ . "1"^^ . . . . . "0"^^ . "0"^^ . . . "0"^^ . "2"^^ . . "kong"^^ . . . . . "Lua Macros Second keyboard not disabled"^^ . "ellipse"^^ . . "1"^^ . . "6"^^ . . "1"^^ . "0"^^ . . . . "1"^^ . "1"^^ . "0"^^ . . "2"^^ . "1"^^ . "0"^^ . "The which command should include the root path as `/usr/bin/love`, if you didn't see it, the path is relative to your current directory."^^ . "0"^^ . . . "lua-5.4"^^ . "<pre><code>local UserInputService = game:GetService(&quot;UserInputService&quot;)\nlocal RunService = game:GetService(&quot;RunService&quot;)\nlocal plr = game:GetService(&quot;Players&quot;).LocalPlayer\nlocal char = plr.Character or plr.CharacterAdded:Wait()\nlocal hum = char:WaitForChild(&quot;Humanoid&quot;)\nlocal root = hum.RootPart\n\nlocal pcKey = Enum.KeyCode.LeftShift\nlocal xboxKey = Enum.KeyCode.DPadLeft\nlocal isActive = false\n\nfunction shiftLock()\n isActive = not isActive\n if isActive then\n hum.CameraOffset = Vector3.new(1.75, 0, 0)\n hum.AutoRotate = false\n RunService:BindToRenderStep(&quot;ShiftLock&quot;, Enum.RenderPriority.Character.Value, function()\n UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter\n local rootCFrame = root.CFrame\n local cameraLookVector = workspace.CurrentCamera.CFrame.LookVector\n local newCFrame = CFrame.new(rootCFrame.Position, rootCFrame.Position + Vector3.new(cameraLookVector.X, 0, cameraLookVector.Z))\n root.CFrame = newCFrame\n end)\n else\n hum.CameraOffset = Vector3.new(0, 0, 0)\n hum.AutoRotate = true\n RunService:UnbindFromRenderStep(&quot;ShiftLock&quot;)\n UserInputService.MouseBehavior = Enum.MouseBehavior.Default\n end\nend\nshiftLock()\n\nUserInputService.InputBegan:Connect(function(input, process)\n if process then return end\n if input.KeyCode == pcKey or input.KeyCode == xboxKey then\n shiftLock()\n end\nend)\n</code></pre>\n<p>Im trying to make a <code>Custom</code> Roblox Shift lock Script for Xbox and PC And gonna add mobile support soon but my rotation is really janky. Like the camera shakes when at high speeds. Is there any better way to do this without altering the original Roblox ShiftLock Script? Like new calculations or better smootheners without any delay.</p>\n"^^ . . "<pre class="lang-lua prettyprint-override"><code>table.remove (a[1], 1)\n</code></pre>\n<p>Do not thank.</p>\n"^^ . . . "0"^^ . . "0"^^ . . . "So, I've just updated pandoc to the very latest version, and although it still doesn't work for odt, it is working for docx. Hoping, I can find a workaround from docx to odt..."^^ . "roblox-studio"^^ . . . "odt"^^ . . . . . "<p>In the end I changed 2 lines of code and now this works:</p>\n<pre class="lang-lua prettyprint-override"><code>client.connect_signal(&quot;unfocus&quot;, function(c)\n awful.spawn.easy_async_with_shell(&quot;xkb-switch&quot;, function(stdout)\n if c.valid then -- To avoid 'Invalid Object' error\n c.keyboard_layout = stdout\n end\n end)\nend)\n\nclient.connect_signal(&quot;focus&quot;, function(c)\n if c.keyboard_layout == nil then\n c.keyboard_layout = &quot;us(altgr-intl)&quot;\n end\n awful.spawn(&quot;xkb-switch -s &quot;..c.keyboard_layout, false) -- `false` to prevent cursor being stuck in 'loading' state\nend)\n</code></pre>\n"^^ . "I have self taught myself to use server side values and use that to modify the clients GUI, all I need to do is figure out how it changes every time rather than occasionally. Thank you and wish me luck."^^ . "Could you share your Mob ModuleScript? If there's an issue in there, that could stop your script from ever getting to the task.wait() call."^^ . . "0"^^ . . "1"^^ . "@Kylaaa How so? How would I replicate the client sided value and transform it into a server side value? Are you able to further explain more?"^^ . . . . . "`a.a` is sugar syntax for `a['a']` you are indexing the table `a` with the string `'a'` as the key so all you have done is turned a table that had a self reference into `a = { a = 3 }`"^^ . . "<p>Here is the way which I use:</p>\n<pre class="lang-lua prettyprint-override"><code>local layout = require(&quot;awful.widget.keyboardlayout&quot;)\nlocal menubar = require(&quot;menubar&quot;)\n\nrequire(&quot;awful.client&quot;).property.persist(&quot;last_layout&quot;, &quot;number&quot;)\n\nlocal kbdlayout = {\n globally_preferred = &quot;us&quot;,\n menubar_preferred = &quot;us&quot;,\n}\n\nlocal function get_idx_by_name(name)\n if not name then\n return\n end\n for i, v in ipairs(layout.get_groups_from_group_names(awesome.xkb_get_group_names())) do\n if v.file == name then\n return i - 1\n end\n end\nend\n\nlocal oneshot_lock = false\n\nlocal function on_layout_change()\n if oneshot_lock then\n oneshot_lock = false\n return\n end\n local c = client.focus\n if c then\n c.last_layout = awesome.xkb_get_layout_group()\n end\nend\n\nlocal function on_focus_changed(c)\n local idx = c.last_layout or get_idx_by_name(c.preferred_layout or kbdlayout.globally_preferred)\n if idx and awesome.xkb_get_layout_group() ~= idx then\n awesome.xkb_set_layout_group(idx)\n end\nend\n\nawesome.connect_signal(&quot;xkb::map_changed&quot;, on_layout_change)\nawesome.connect_signal(&quot;xkb::group_changed&quot;, on_layout_change)\nclient.connect_signal(&quot;focus&quot;, on_focus_changed)\n\nlocal menubar_show = menubar.show\nlocal menubar_hide = menubar.hide\n\nfunction menubar.show(...)\n menubar_show(...)\n local idx = get_idx_by_name(kbdlayout.menubar_preferred)\n if idx then\n oneshot_lock = true\n awesome.xkb_set_layout_group(idx)\n end\nend\n\nfunction menubar.hide(...)\n menubar_hide(...)\n local c = client.focus\n if c then\n on_focus_changed(c)\n end\nend\n\nreturn kbdlayout\n</code></pre>\n"^^ . . "0"^^ . . . . "0"^^ . "what's the question? I don't understand the sentence "I was expecting the output in the gfm""^^ . . . . "node.js"^^ . "1"^^ . "0"^^ . . "0"^^ . . . "0"^^ . . . . . . . "This is weired that luarocks tried to search files from c:\\windows\\system32\\include, how do you configure luarocks? Mabye you should try to run commands in mingw64."^^ . "0"^^ . . . . "0"^^ . "3"^^ . . . . "In lua why is print ("Name can't be empty") being executed instead of table[i] = io.read () in first iteration"^^ . "2"^^ . . . . "5"^^ . . "1"^^ . . . "The question about some behaviors of a.a.a.a in lua"^^ . . . . "0"^^ . . "0"^^ . "@4a6166: That's just the way value lists work. It's not `table.unpack`'s fault. My guess is that making them more flexible would make the syntax too complicated, or it would be to difficult to implement."^^ . "1"^^ . . "Failing to build Lua for EFI environment (EDK2)"^^ . . . . . . . . . . "conky"^^ . "<p>I'm trying to create a lua script that does the following with pandoc and its internal citeproc:</p>\n<p>The current input is: <code>(MPD; [@Somereference2020 noparens])</code><br />\nThe desired output is: <code>(MPD; Somereference, 2020)</code> with the correct internal link to citeproc references.</p>\n<p>I'm close, but I can't seem to wrangle removing the preceding space before <code>noparens</code> on the output.</p>\n<p>Current output is: <code>(MPD; Somereference, 2020 )</code></p>\n<p>Note the space after the year which I've been able to debug to being the preceding space before the <code>noparens</code> (based on the debug output with carrots).</p>\n<p>Thanks in advance to the Lua ninja ... Here's the code</p>\n<pre><code>function Cite(cite)\n for i, citation in ipairs(cite.citations) do\n if citation.suffix and pandoc.utils.stringify(citation.suffix):match(&quot;noparens&quot;) then\n -- Debugging: Print the original suffix\n print(&quot;Original suffix:&quot;, pandoc.utils.stringify(citation.suffix))\n\n -- Remove 'noparens' from the suffix\n local new_suffix = pandoc.List{}\n for _, item in ipairs(citation.suffix) do\n if item.t == &quot;Str&quot; then\n -- Remove 'noparens' and trim spaces/commas\n item.text = item.text:gsub(&quot;noparens&quot;, &quot;&quot;):gsub(&quot;^%s*,%s*&quot;, &quot;&quot;):gsub(&quot;%s*,%s*$&quot;, &quot;&quot;)\n if item.text ~= &quot;&quot; then\n new_suffix:insert(item)\n end\n else\n new_suffix:insert(item)\n end\n end\n citation.suffix = new_suffix\n\n -- Debugging: Print the modified suffix\n print(&quot;Modified suffix:&quot;, pandoc.utils.stringify(citation.suffix))\n\n -- Debugging: Print the original content\n print(&quot;Original content:&quot;, pandoc.utils.stringify(cite.content))\n\n -- Remove 'noparens' and unnecessary parentheses from the content\n local new_content = pandoc.List{}\n for _, item in ipairs(cite.content) do\n if item.t == &quot;Str&quot; then\n -- Remove 'noparens' and parentheses\n item.text = item.text:gsub(&quot;noparens&quot;, &quot;&quot;):gsub(&quot;%(&quot;, &quot;&quot;):gsub(&quot;%)&quot;, &quot;&quot;):gsub(&quot;^%s*,%s*&quot;, &quot;&quot;):gsub(&quot;%s*,%s*$&quot;, &quot;&quot;)\n end\n if item.text ~= &quot;&quot; then\n new_content:insert(item)\n end\n end\n cite.content = new_content\n\n -- Debugging: Print the modified content\n print(&quot;Modified citation: ^&quot; .. pandoc.utils.stringify(cite) .. &quot;^&quot;)\n\n return cite\n end\n end\nend\n</code></pre>\n<p>------- SOLUTION -----------</p>\n<pre><code>function Cite(cite)\n for i, citation in ipairs(cite.citations) do\n if citation.suffix and pandoc.utils.stringify(citation.suffix):match(&quot;noparens&quot;) then\n -- Debugging: Print the modified suffix\n -- print(&quot;Modified suffix:&quot;, pandoc.utils.stringify(citation.suffix))\n\n -- Debugging: Print the original content\n -- print(&quot;Original content:&quot;, pandoc.utils.stringify(cite.content))\n\n -- Remove 'noparens' and unnecessary parentheses from the content\n local new_content = pandoc.List{}\n for _, item in ipairs(cite.content) do\n if item.t == &quot;Str&quot; then\n -- Remove 'noparens' and parentheses\n item.text = item.text:gsub(&quot;noparens&quot;, &quot;&quot;):gsub(&quot;%(&quot;, &quot;&quot;):gsub(&quot;%)&quot;, &quot;&quot;):gsub(&quot;^%s*,%s*&quot;, &quot;&quot;):gsub(&quot;%s*,%s*$&quot;, &quot;&quot;)\n if item.text ~= &quot;&quot; then\n new_content:insert(item)\n end\n elseif item.t == &quot;Link&quot; then\n -- Keep Link items\n new_content:insert(item)\n end\n -- Space items are not added to new_content, effectively removing them\n end\n cite.content = new_content\n\n -- Debugging: Print the modified content\n -- print(&quot;Modified citation: ^&quot; .. pandoc.utils.stringify(cite) .. &quot;^&quot;)\n\n return cite\n end\n end\nend\n</code></pre>\n"^^ . . . . "0"^^ . . "1"^^ . "<p>You are doing essentially this (I renamed the keys and variables to make the distinction clearer):</p>\n<pre><code>local b = {}\nlocal a = {\n value = b\n}\n\na.value = 3\n\nprint(b)\n</code></pre>\n<p>Why would setting <code>a.value</code> change <code>b</code>? You can't change local variables like that. So even though it might seem that you can alter <code>a</code> (and more precisely in this case, what <code>a</code> is 'pointing to', as tables behave like references to something), you are actually only altering the contents of the table that you store a reference to in <code>a</code>.</p>\n"^^ . . . "0"^^ . . "0"^^ . . . . . "1"^^ . . . . . . . . . . . . . . "[How do I ask and answer homework questions?](https://meta.stackoverflow.com/q/334822)"^^ . "0"^^ . . "0"^^ . . "0"^^ . "0"^^ . . . . . . "nginx-location"^^ . "Please provide your full error message, not just its name - see [Why should I post complete errors? Why isn't the message itself enough?](https://meta.stackoverflow.com/q/359146/25441514)"^^ . . "2"^^ . . . . "<p>I'd like to run a ruff supported command on my buffer, to fix all possible auto-fixable issues with some piece of Python code.</p>\n<p>I followed the setup instructions in nvim-lspconfig (note: I'm also using mason-lspconfig and mason, by extension).</p>\n<p>I ended up with the following handler configuration:</p>\n<pre class="lang-lua prettyprint-override"><code>...\n['pyright'] = function()\n require('lspconfig')['pyright'].setup({\n capabilities = capabilities,\n on_attach = on_buffer_attach_common_actions,\n --- see keys at: https://microsoft.github.io/pyright/#/settings\n settings = {\n python = {\n pythonPath = get_python_path(),\n },\n pyright = {\n disableOrganizeImports = true, --- defer to ruff\n }\n },\n })\nend,\n\n['ruff'] = function()\n require('lspconfig')['ruff'].setup({\n capabilities = capabilities,\n --- see keys at: https://docs.astral.sh/ruff/editors/settings/\n settings = {\n configurationPreference = 'filesystemFirst',\n },\n })\n\n --- See: https://neovim.io/doc/user/lsp.html#lsp-config\n vim.api.nvim_create_autocmd('LspAttach', {\n callback = function(args)\n local client =\n vim.lsp.get_client_by_id(args.data.client_id)\n\n if client.name == 'ruff' then\n --- defers some capabilities on python LSP to pyright/basedpyright\n client.server_capabilities.hoverProvider = false\n\n on_buffer_attach_common_actions(client, args.buf)\n\n local function apply_autofix()\n local params = {\n --- command = 'ruff.applyOrganizeImports',\n command = 'ruff.applyAutofix',\n arguments = {\n { uri = vim.uri_from_bufnr(args.buf), version = 0 },\n },\n }\n\n local non_ruff_client_ids = {}\n for _, cl in ipairs(vim.lsp.get_clients()) do\n if cl.name ~= &quot;ruff&quot; then\n table.insert(non_ruff_client_ids, cl.id)\n end\n end\n\n --- Detach all clients that are not ruff so that the\n --- execute_command does not reach them.\n for _, id in ipairs(non_ruff_client_ids) do\n vim.lsp.buf_detach_client(args.buf, id)\n end\n\n vim.lsp.buf.execute_command(params)\n\n for _, id in ipairs(non_ruff_client_ids) do\n vim.lsp.buf_attach_client(args.buf, id)\n end\n end\n\n vim.api.nvim_create_user_command(\n 'RuffApplyAutofix',\n apply_autofix,\n { desc = 'Ruff: Apply auto-fix' }\n )\n\n --- activates autofix with a keymap\n vim.keymap.set('n', '&lt;leader&gt;rf', function()\n vim.cmd('RuffApplyAutofix')\n end, {\n buffer = args.buf,\n desc = 'Ruff: Apply auto-fix',\n })\n end\n end,\n })\n\nend,\n...\n</code></pre>\n<p>This works. In short, as per nvim-lspconfig instructions, one must use the <code>LspAttach</code> trigger to create a callback that binds a new command (as with <code>nvim_create_user_command</code>).</p>\n<p>The problem I have is within the local <code>apply_autofix</code> function. As you can see, I'm using <code>vim.lsp.buf.execute_command</code> to call the ruff LSP server. If I don't first detach all other LSP servers on the current buffer (<code>pyright</code> is also attached), then it looks like Neovim's <code>execute_command</code> will also try to send the same command to that server. Of course, that command is not available on pyright, which causes a pesky error message to appear every time I invoke the command.</p>\n<p>Is there a better way to implement the <code>LspAttach</code> function such that one does not have to detach and reattach servers?</p>\n"^^ . . . "0"^^ . . "Thanks. That string comes from a module I don’t control but I got it with `output:gsub(‘\\n’, ‘\\\\n’)`"^^ . . "1"^^ . . . . . "lua-table"^^ . . . . "0"^^ . "1"^^ . . "Please check out this guide: [mre]. Roblox questions can be hard to create MREs for, but some good guidelines are to start by focusing heavily on the "minimal" part (what is the absolute simplest example you can create that still produces a similar problem), then provide thorough details as to how to reproduce the problem - the code of course, but also any objects that should go in the workspace and how they should be organized."^^ . . "@TimRoberts I'm a little limited as I'm working with a MediaWiki lua module, I should've mentioned that."^^ . . "<p>When I press <code>g/</code> , it should search for word with the searched word left highlighted after pressing enter.<br />\nWhen I press <code>/</code>, it should search for word but not leave the searched word highlighted after pressing enter</p>\n<p>This is the important aspect: <strong>In either case, the search should be highlighted until I have pressed enter.</strong></p>\n<p>I have this code to allow for the first requirement with <code>/</code> but I have no idea how to accomplish the second without affecting the first one.</p>\n<pre><code>-- Highlights searched pattern only until writing the search keyword\nvim.api.nvim_create_augroup(&quot;vimrc_incsearch_highlight&quot;, { clear = true })\nvim.api.nvim_create_autocmd(&quot;CmdlineEnter&quot;, {\n pattern = { &quot;/&quot;, &quot;\\\\?&quot; },\n command = &quot;set hlsearch&quot;,\n group = &quot;vimrc_incsearch_highlight&quot;,\n})\nvim.api.nvim_create_autocmd(&quot;CmdlineLeave&quot;, {\n pattern = { &quot;/&quot;, &quot;\\\\?&quot; },\n command = &quot;set nohlsearch&quot;,\n group = &quot;vimrc_incsearch_highlight&quot;,\n})\n</code></pre>\n<p><strong>Motivation</strong>: I use <code>/</code> to move around. I do want words to highlight while I am typing but not after I have reached there. But, I do not want to lose functionality to keep the search highlighted when required.</p>\n"^^ . . "0"^^ . . "logitech-gaming-software"^^ . . "Lua pcall inconsistency while dealing with SIGINT on Linux"^^ . . . . "Lua Pandoc Citation Modifier"^^ . . . . "world-of-warcraft"^^ . . . . . . . "@LakshyaK2011 No it says nothing"^^ . "1"^^ . . . . . . . "0"^^ . . "1"^^ . . . . . . . . "Not really a Lua question"^^ . "1"^^ . . . "<p>In Lua script, I have a variable containing the string representation of a table. I want to load it into a table so that I can access each property. This works well unless the table contains a line break inside one of its elements. Working example:</p>\n<pre><code>&gt; output = 'return { date=&quot;2024-10-23T21:24:27.227996696Z&quot;, severity=&quot;Normal&quot;, category=&quot;Hardware&quot;, message=&quot;Atmos-RX-2 is Not Present&quot;, filename=&quot;&quot;, status=&quot;Not Present&quot;, source=&quot;Atmos-RX-2&quot; }'\n&gt; event = load(output)()\n&gt; print(event['message'])\nAtmos-RX-2 is Not Present\n</code></pre>\n<p>If one of the strings contains a line break, it fails:</p>\n<pre><code>&gt; output = 'return { date=&quot;2024-10-23T21:24:27.227996696Z&quot;, severity=&quot;Normal&quot;, category=&quot;Hardware&quot;, message=&quot;line 1\\nline 2&quot;, filename=&quot;&quot;, status=&quot;Not Present&quot;, source=&quot;Atmos-RX-2&quot; }'\n&gt; event = load(output)()\nstdin:1: attempt to call a nil value\nstack traceback:\n stdin:1: in main chunk\n [C]: in ?\n</code></pre>\n"^^ . "How do I transfer the client's UI into server side?"^^ . "What does "*all" mean in `io.read("*all")`?"^^ . "1"^^ . "0"^^ . "0"^^ . "2"^^ . . . "0"^^ . "1"^^ . "0"^^ . . "0"^^ . . . "3"^^ . "0"^^ . "0"^^ . "roblox"^^ . "0"^^ . . "3"^^ . . . . "There's not enough relevant information in your question for me to give you a meaningful answer. There is usually some underlying data that is displayed with your UI. If we use my previous example, if you have `local appleCount = 5`, then you might have your TextLabel display it with `TextLabel.Text = string.format("You have %d apples", appleCount)`. The only thing that needs to be saved is `appleCount`. If `appleCount` exists on your client, you can use a [RemoteEvent](https://create.roblox.com/docs/scripting/events/remote) to send it up to the server to be saved. But I need more info"^^ . . . "1"^^ . . "1"^^ . "0"^^ . . "6"^^ . . "iup"^^ . . "0"^^ . . "0"^^ . "1"^^ . "2"^^ . . . . . "https://github.com/lgi-devs/lgi/issues/196"^^ . . "0"^^ . . "3"^^ . . . "You should then remove the `task.wait(.1)` line, as it's not nessecery, unless it has some other functionality, in which case please tell me."^^ . "0"^^ . . . . "xml"^^ . . "c#"^^ . . . "neovim"^^ . . . . . . "0"^^ . . . "Executing a command on only one of the attached LSP servers in Neovim"^^ . . "0"^^ . "0"^^ . "1"^^ . "Error when using LYAML in Neovim plugin: "cache_loader: module yaml.version not found""^^ . "pandoc-citeproc"^^ . "3"^^ . . "<p>I'm writing a lua script profiler in C, and I found the <code>lua_sethook</code> C API. I expected the hook to trigger balanced amounts of entering/leaving events, so I can mesure the time cost of every function.\nBut the truth is that the returning (or leaving) event may be lost when there is an error raised during execution.</p>\n<p>The case can be summarized by the following codes:\nfile test_hook.lua:</p>\n<pre><code>function my_hook(event, line)\n local info = debug.getinfo(2)\n print(event .. &quot;: &quot; .. info.short_src .. &quot; &quot; .. tostring(info.name) .. &quot; &quot; .. tostring(info.currentline))\nend\ndebug.sethook(my_hook, &quot;cr&quot;)\n\nfunction AAA()\n print(nil + 1)\nend\n\nfunction BBB()\n pcall(AAA)\nend\n\nfunction CCC()\n BBB()\nend\n\nCCC()\n\n</code></pre>\n<p>With <code>lua test_hook.lua</code>, the output looks like this:</p>\n<pre><code>return: [C] sethook -1\ncall: test_hook.lua CCC 16\ncall: test_hook.lua BBB 12\ncall: [C] pcall -1\ncall: test_hook.lua nil 8\nreturn: [C] pcall -1\nreturn: test_hook.lua BBB 13\nreturn: test_hook.lua CCC 17\nreturn: test_hook.lua nil 19\nreturn: [C] nil -1\n</code></pre>\n<p>function AAA throws an error, and the 4th call event is no longer enclosed by a return event.</p>\n<p>In lua's interactive mode, the problem is similar:</p>\n<pre><code>... copy/paste code above ...\n&gt; CCC()\ncall: stdin nil 1\ntail call: stdin nil 2\ncall: stdin BBB 2\ncall: [C] pcall -1\ncall: stdin nil 2\nreturn: [C] pcall -1\nreturn: stdin BBB 3\nreturn: stdin nil 3\n</code></pre>\n<p>The 4th call event is not enclosed again.</p>\n<p>Because of this, I cannot know when a function ends if an error occurred (<strong>even if it was correctly handled by pcall/xpcall</strong>). Is there any other way to know it? What is the correct way to deal with it? How did existing lua profilers solve it?</p>\n<p>Thanks!</p>\n"^^ . "<p>As <a href="https://github.com/HighCommander4" rel="nofollow noreferrer">@HighCommander4</a> mentioned on <a href="https://github.com/clangd/clangd/issues/2238" rel="nofollow noreferrer">GitHub</a></p>\n<blockquote>\n<p><code>.tpp</code> is not a file extension that clang recognizes as a C++ file type.</p>\n<p>You can nonetheless get clangd to process a <code>.tpp</code> file as C++ if you specify a <code>-xc++</code> flag explicitly in the compile command (using, for example, a <a href="https://clangd.llvm.org/config.html#add" rel="nofollow noreferrer">clangd config file</a>).</p>\n</blockquote>\n<p>To make code completion work for non-standard C++ file extension, I have to specify <code>-xc++</code> argument to a compiler, e.g. <code>g++ -xc++</code> or <code>clang -xc++</code>, because <a href="https://gcc.gnu.org/" rel="nofollow noreferrer">GCC</a> and <a href="https://clang.llvm.org/" rel="nofollow noreferrer">clang</a> are not recognizing <code>.tpp</code> as C++ file extension.</p>\n<p>So for <a href="https://clangd.llvm.org/" rel="nofollow noreferrer">clangd</a>, in <code>.clangd</code> config file I have to add an <code>-xc++</code> argument and it will look like this:</p>\n<pre class="lang-none prettyprint-override"><code>CompileFlags:\n Add: [-xc++]\n</code></pre>\n<p>And for <a href="https://github.com/MaskRay/ccls" rel="nofollow noreferrer">ccls</a> <code>.ccls</code> configuration file using <a href="https://gcc.gnu.org/" rel="nofollow noreferrer">GCC</a> compiler it will look like this:</p>\n<pre><code>g++\n-xc++\n</code></pre>\n<p>Hooray! Finally code completion for <code>.tpp</code> file started to work!</p>\n"^^ . "2"^^ . . "0"^^ . . . . . . . . . . . . . . . . "How can I create a Lua filter that changes italic & bold markdown to Emphasis & Strong Emphasis styles with pandoc for LibreOffice Writer ODT file?"^^ . "Update values in a Lua table from values of another table"^^ . "2"^^ . . "0"^^ . . "markdown"^^ . "@MindSwipe is that part of .NET Core? If yes, we are yet to migrate. We are, unfortunately, still using legacy proprietary .NET Framework."^^ . "0"^^ . . . . "@Jarod42 the latest version"^^ . "0"^^ . . . "<p>Let's say I have the following table in Lua:</p>\n<pre><code>t1 = {\n name = &quot;alfa&quot;,\n weight = 10,\n height = 5,\n speed = 4,\n price = 100,\n}\n</code></pre>\n<p>Now I want to clone this, but replace some values within, but not all. So it's kind of like this:</p>\n<pre><code>-- this deepcopy function is provided by a 3rd party library\nt2 = deepcopy(t1)\nt2_diff = {\n name = &quot;beta&quot;,\n weight = 20,\n speed = 6,\n}\nfunction_to_update_table(t2, t2_diff)\n-- at this point, I expect the t2 table's values to be like this:\n-- t2.name == &quot;beta&quot;\n-- t2.weight == 20\n-- t2.height == 5 (so, no change from the value in t1)\n-- t2.speed == 6\n-- t2.price == 100 (also no change from t1)\n</code></pre>\n<p>In other words, something similar to Python's <a href="https://docs.python.org/3/library/stdtypes.html#dict.update" rel="nofollow noreferrer"><code>dict.update()</code></a> method.</p>\n<p>Is there such a function to perform table update?</p>\n"^^ . . . "<blockquote>\n<p>I modified components/modules/node.c by replacing BUILDINFO_LFS_SIZE with 0 due to the following error during make (later changing to 256K)</p>\n</blockquote>\n<p>To calculate BUILDINFO_LFS_SIZE, <code>awk &quot;{print strtonum( $1 )}&quot;</code> is currently used.\nThe <code>strtonum()</code> function is a <code>gawk</code> extension. But the <code>gawk</code> package is not included by default in Debian stable.</p>\n<p>You should either install the <code>gawk</code> package or apply <a href="https://github.com/nodemcu/nodemcu-firmware/pull/3675" rel="nofollow noreferrer">PR#3675</a>.</p>\n<p>EDIT.\nAfter installing <code>gawk</code> you need to perform <code>make clean</code></p>\n"^^ . . . . "<p>According <a href="https://pandoc.org/MANUAL.html#custom-styles" rel="nofollow noreferrer">to the doc</a>, custom-style for odt output should be straigthforward in Pandoc, without the need for any extension.</p>\n<p>However, I can't get them applied. The following styles don't get written in the xml of the odt file, while using docx output it works:</p>\n<p><strong>MD source document:</strong></p>\n<pre class="lang-none prettyprint-override"><code>### header\n\nbla\n\nthis is a &lt;span custom-style=&quot;Anote&quot;&gt;custom style span&lt;/span&gt;\n\n::: {custom-style=&quot;Poetry&quot;}\n| A Bird came down the Walk---\n| He did not know I saw---\n:::\n\n::: {custom-style=&quot;bluestyle&quot;} \nI'm blue\n:::\n\n# My Header {style=&quot;Header 7&quot;}\nscscscs\n\nthis is a &lt;span custom-style=&quot;mystyle&quot;&gt;custom style span&lt;/span&gt;\n</code></pre>\n<p><strong>Pandoc Command:</strong></p>\n<p><code>pandoc test_input.md -o test_output.odt</code></p>\n<p><strong>Versions:</strong></p>\n<ul>\n<li>pandoc 3.5.1</li>\n<li>ubuntu 22.04</li>\n</ul>\n"^^ . "async-await"^^ . . . . . . "3"^^ . . . . "0"^^ . . "Your analysis is correct. Unfortunately, a pandoc writer won't solve this, because callout blocks are a Quarto feature that pandoc isn't aware of. One would have to write a "custom Quarto writer", but there is no interface to do this. I'm afraid you'll have to export to LaTeX and then edit and compile it "by hand" each time. A possible fix could be to use the `adjustwidth` environment instead of a minipage, but that will need to be changed in Quarto."^^ . "<p>Your code does a good job setting up a list of waypoints for your enemy to walk along, and you already have the foundation for changing targets. But the logic that decides <em>when</em> to switch waypoints just needs to be a bit smarter.</p>\n<p>So let's walk through the way a knockback along a path should work :</p>\n<div class="s-table-container"><table class="s-table">\n<thead>\n<tr>\n<th>Description</th>\n<th>Diagram</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Consider the path ABC: <br> - A is the spawn point, and C is the end point, <br> - the distance from A to B is 10 studs, <br> - the distance from B to C is 15.</td>\n<td><a href="https://i.sstatic.net/2fE9v5hM.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2fE9v5hM.jpg" alt="A simple diagram with three points labelled &quot;A&quot;, &quot;B&quot;, and &quot;C&quot;. There are lines connecting &quot;A&quot; to &quot;B&quot;, and &quot;B&quot; to &quot;C&quot;." /></a></td>\n</tr>\n<tr>\n<td>Let's imagine we have an enemy marching from B to C, and they are 3 studs past B...</td>\n<td><a href="https://i.sstatic.net/Z4usr8lm.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Z4usr8lm.jpg" alt="The same diagram as before, now there is a red dot representing an enemy. It rests along the line between &quot;B&quot; and &quot;C&quot;" /></a></td>\n</tr>\n<tr>\n<td>When the enemy is knocked back 5 studs... <br> - they should be sent back the 3 studs to B, <br> - then the remaining 2 studs should send them towards A.</td>\n<td><a href="https://i.sstatic.net/BHsSVY3z.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/BHsSVY3z.jpg" alt="The enemy dot has been moved onto the line between A and B" /></a></td>\n</tr>\n</tbody>\n</table></div>\n<p>So one way to represent this process is with simple distance calculations. You subtract the distance from the enemy to their last waypoint until the distance to the next waypoint is greater than the remaining knockback, then just place the enemy along the points again. If you make it back to the beginning, just escape and set the enemy back at the spawn point</p>\n<p>So your knockback logic needs to know the following information :</p>\n<ul>\n<li>the full list of waypoints</li>\n<li>the enemy's current waypoint target</li>\n<li>the enemy's current position</li>\n<li>how far to be knocked back</li>\n</ul>\n<p>Let's make a <code>ModuleScript</code> to handle your Enemy logic. The updated knockback logic will live in the <code>Enemy:OnKnockback()</code> function, which you can trigger however you like later.</p>\n<pre class="lang-lua prettyprint-override"><code>local Enemy = {}\nEnemy.__index = Enemy\n\nfunction Enemy.new(waypoints : { BasePart }, damage : number, speed : number, health : number, modelTemplate : Model)\n assert(#waypoints &gt;= 2, &quot;List of waypoints must be &gt;= 2&quot;)\n \n local self = {\n waypoints = waypoints,\n currentWaypoint = 2, -- assume that 1 is the spawn, so the first target is 2\n damage = damage,\n speed = speed,\n health = health,\n modelTemplate = modelTemplate,\n moveToConnection = nil, -- for now\n modelRef = nil, -- for now\n }\n setmetatable(self, Enemy)\n return self\nend\n\nfunction Enemy:Spawn()\n local newModel = self.modelTemplate:Clone()\n newModel.Humanoid.Health = self.health\n newModel.Humanoid.MaxHealth = self.health\n newModel.Humanoid.WalkSpeed = self.speed\n newModel:PivotTo(self.waypoints[1].CFrame)\n newModel.Parent = game.Workspace\n\n self.modelRef = newModel\nend\n\nfunction Enemy:Walk()\n if (self.moveToConnection) then\n self.moveToConnection:Disconnect()\n end\n\n local waypointTarget = self.waypoints[self.currentWaypoint].Position\n local humanoid : Humanoid = self.modelRef.Humanoid\n \n self.moveToConnection = humanoid.MoveToFinished:Connect(function(didReach : boolean)\n if not didReach then\n warn(&quot;Failed to reach waypoint for some reason, figure out why!&quot;)\n end\n \n self.currentWaypoint += 1\n\n -- if there are no more waypoints, we've made it to the end!\n if self.currentWaypoint &gt; #self.waypoints then\n print(string.format(&quot;Enemy should deal %d damage!&quot;, self.damage))\n return\n end\n\n -- walk towards the next waypoint\n self:Walk()\n end)\n self.modelRef.Humanoid:MoveTo(waypointTarget)\nend\n\nfunction Enemy:SetPosition(newPosition : Vector3)\n local waypointTarget = self.waypoints[self.currentWaypoint].Position\n local newPivot = CFrame.new(newPosition, waypointTarget)\n self.modelRef:PivotTo(newPivot)\n\n -- tell the enemy to start moving towards its next waypoint again.\n self:Walk()\nend\n\nfunction Enemy:OnKnockback(knockbackAmount : number)\n -- take snapshots of values while we calculate\n local waypoints = self.waypoints\n local currentWaypoint = self.currentWaypoint\n local model : Model = self.modelRef\n local position : Vector3 = model:GetPivot().Position\n\n -- loop as many times as needed, but escape if we're back at the start\n while (currentWaypoint &gt; 1) do\n\n -- calculate how far it is from the enemy to their previous waypoint\n local distToLastWaypoint : Vector3 = (position - waypoints[currentWaypoint - 1].Position)\n local progress = distToLastWaypoint.Magnitude \n\n -- if the distance is greater than the knockback, translate the enemy back towards their previous waypoint\n if (progress &gt;= knockbackAmount) then\n -- reassign values\n self.currentWaypoint = currentWaypoint\n \n -- move to the new position\n local newPosition = position - (distToLastWaypoint.Unit * knockbackAmount)\n self:SetPosition(newPosition)\n \n -- we're done here, escape the loop\n return\n end\n\n -- subtract their progress from the total knockback amount\n knockbackAmount -= progress\n currentWaypoint -= 1\n\n -- adjust the position to the last waypoint, and loop as many times as necessary\n position = self.waypoints[currentWaypoint].Position\n end\n\n -- if we're here, we got pushed all the way back to the beginning\n -- set the position, and start the moveTo again\n self.currentWaypoint = 2\n local newPosition = waypoints[1].Position\n self:SetPosition(newPosition)\nend\n\nreturn Enemy\n</code></pre>\n<p>Then, in your game logic <code>Script</code> you can use it like :</p>\n<pre class="lang-lua prettyprint-override"><code>-- services\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal Workspace = game:GetService(&quot;Workspace&quot;) -- not really needed\n\n-- modules\nlocal Enemy = require(ReplicatedStorage.Enemy) -- or wherever you put it\n\n-- fetch the officer model from ReplicatedStorage, and configure some values\nlocal enemyModelTemplate = ReplicatedStorage.Enemies[&quot;Handcuff Arrest Officer&quot;]\nlocal health = 10\nlocal speed = 14 -- max studs / second\nlocal damage = 10\nlocal wps = Workspace.Waypoints\nlocal waypoints = { wps[&quot;1&quot;], wps[&quot;2&quot;], wps[&quot;3&quot;] } -- add as many as needed\n\n-- create the enemy\nlocal officerEnemy = Enemy.new(waypoints, damage, speed, health, enemyModelTemplate)\nofficerEnemy:Spawn()\nofficerEnemy:Walk()\n\n-- test out the knockback\nwait(10.0)\nlocal studsToMove = 5\nofficerEnemy:OnKnockback(studsToMove)\n</code></pre>\n"^^ . . "code-completion"^^ . . . . . . "<p>As the tittle implies in first iteration print (&quot;Name can't be empty&quot;) is executed instead of table[i] = io.read () in the first iteration</p>\n<p>Here is the whole code</p>\n<pre><code>io.write(&quot;How many names do you want to enter? &quot;)\nmaxNames = io.read(&quot;*n&quot;)\n\ntable = {}\n\nfor i = 1, maxNames, 1 do\n while true do\n io.write (&quot;Enter names: &quot;)\n table[i] = io.read ()\n\n if #table[i] == 0 or table[i] == &quot; &quot; then\n print (&quot;Name can't be empty&quot;)\n else \n break \n end\n end\nend\n\nfor k, items in pairs(table) do\n print (&quot;Name in index &quot; .. k .. &quot; of table is &quot; .. items)\nend\n\nprint (table)\n</code></pre>\n"^^ . "1"^^ . . . "table.remove() in lua 5.4 is strange"^^ . "1"^^ . "1"^^ . "0"^^ . "mingw"^^ . . "2"^^ . . "premake"^^ . "1"^^ . . . . . . . . "<p>Lua does not check the whole word. It only tests the first symbol after the optional asterisk sign.</p>\n<p>If you look at the lua sources, the <code>liolib.c</code> file that has <code>io</code> library functions - you'll find that the first <code>*</code> symbol is skipped if present, it's there for compatibility with older versions only. Then the first letter after it is tested to be 'n' for the number, 'l' for the line, 'L' for the line with end-of-line, and 'a' for the whole file. It doesn't care if there are other letters in that string, you can write whatever is better for readability - as long as the first letter is in that list - it will work. But it will check for more string arguments in the read() call if you need more than one read.</p>\n"^^ . . . "1"^^ . . . "1"^^ . . . . "1"^^ . . . "<p>You can do this in O(n) by using two indexes: one that moves from the beginning of the list, forward, and the other moving from the end of the list backward. Then, move forward in the list looking for the first empty spot. When you find one, move the index at the end of the list backwards to the first non-empty spot. Swap the two values. Repeat until the two indexes meet.</p>\n<p>I should note that this does not maintain the relative order of items in the array. The OP's example suggests that maintaining order is not important.</p>\n<p>Here's some pseudocode:</p>\n<pre><code>x = 0 // beginning of list\ny = n-1 // last item in list\nwhile (x &lt; y)\n{\n if (a[x] == -1)\n {\n // move y backwards, looking for the first non-empty element.\n while (y &gt; x &amp;&amp; a[y] == -1)\n {\n y = y - 1;\n }\n swap(a[x],a[y])\n }\n x = x + 1;\n}\n</code></pre>\n"^^ . . . . "0"^^ . "<p>I created a walking animation and a running animation. I have a script in ServerScriptService that changes the animation based on whether the player is running or walking. The walking animation works but the running animation doesnt.</p>\n<p>I tried to change the running animation (<code>plr.Character.Humanoid.Animate.run.RunAnim.AnimationId</code>), but this just breaks all the animations completely</p>\n<pre><code>local walkingAnimation = 'rbxassetid://71361029954021'\nlocal runningAnimation = 'rbxassetid://74605067173947'\nlocal config = require(script.Parent.CharacterPropertiesConfig)\n\n\nlocal function ToggleRun(plr : Player)\n\n local animator : Animator = plr.Character.Humanoid.Animator\n\n if not plr.running.Value then\n \n plr.running.Value = true\n \n plr.Character.Animate.walk.WalkAnim.AnimationId = runningAnimation\n \n \n plr.Character.Humanoid.WalkSpeed = config.RunSpeed\n plr.Character.Humanoid.JumpHeight = config.JumpHeight\n \n elseif plr.running.Value then\n \n plr.running.Value = false\n \n plr.Character.Animate.walk.WalkAnim.AnimationId = walkingAnimation\n \n plr.Character.Humanoid.WalkSpeed = config.Speed\n plr.Character.Humanoid.JumpHeight = config.JumpHeight\n \n \n end\n \nend\n\ngame.Players.PlayerAdded:Connect(function(plr)\n \n plr.CharacterAdded:Connect(function(char)\n \n wait(1)\n \n char.Animate.walk.WalkAnim.AnimationId = walkingAnimation\n\n char.Humanoid.WalkSpeed = config.Speed\n char.Humanoid.JumpHeight = config.JumpHeight\n \n end)\n \nend)\n\ngame.ReplicatedStorage.CtrlPressed.OnServerEvent:Connect(function(plr)\n \n ToggleRun(plr)\n \nend)\n</code></pre>\n"^^ . . . . . . "0"^^ . . "typescript"^^ . . . . "5"^^ . "0"^^ . . "This seems unnecessarily complicated."^^ . "1"^^ . "<p>Here's code for a timer:</p>\n<pre><code>local copyTable = require(&quot;Helpers.copyTable&quot;)\n\nlocal timer = {}\n\ntimer.max = 0\ntimer.time = 0\n\nfunction timer:add(dt)\n timer.time = timer.time + dt\nend\n\nfunction timer:reset()\n timer.time = 0\nend\n\nreturn copyTable(timer)\n</code></pre>\n<p>The copy table function returns a new table containing all the values of the one copied.</p>\n<p>Here's some basic code that uses it:</p>\n<pre><code>ovenTime = require(&quot;timer&quot;)\n\novenTime.add(.5)\n\nprint(ovenTime.time)\n</code></pre>\n<p>This gives me the output of 0.\nI was expecting it to output .5 since time gets .5 added onto it.</p>\n<p>Thanks in advance!</p>\n"^^ . . . "0"^^ . . . "1"^^ . . "1"^^ . "0"^^ . "0"^^ . . "3"^^ . . . . "<p>How to use 'goto' in gopher-lua v1.1.0? Is seems that gopher-lua has already support 'goto' over v1.1.0<a href="https://github.com/yuin/gopher-lua?tab=readme-ov-file#differences-between-lua-and-gopherlua" rel="nofollow noreferrer"> link</a></p>\n<p>I have already update gopher-lua's version in v1.1.0. But when I use goto <code>goto</code> and <code>::label::</code> statement like this</p>\n<pre><code>for i = 1, #backupSource do\n if i == 2 then\n goto continue\n end\n ::continue::\nend\n</code></pre>\n<p>It get error</p>\n<pre><code>near '::': syntax error\n</code></pre>\n<p>If someone could enlight me a bit that would be great :-) Thanks in advance</p>\n"^^ . . . . "1"^^ . . "0"^^ . . "<p>I have installed <a href="https://github.com/neovim/nvim-lspconfig" rel="nofollow noreferrer">nvim-lspconfig</a> and <a href="https://github.com/hrsh7th/nvim-cmp" rel="nofollow noreferrer">nvim-cmp</a> plugins for <a href="https://neovim.io/" rel="nofollow noreferrer">Neovim</a>. A code completion with <a href="https://github.com/MaskRay/ccls" rel="nofollow noreferrer">ccls</a> works pretty well for <code>.cpp</code> and <code>.hpp</code> file extensions. I want to make code completion to also work with <code>.tpp</code> file extension. I have created <code>tpp.vim</code> file inside <code>~/.config/nvim/ftdetect</code> directory, which contains <code>au BufRead,BufNewFile *.tpp set filetype=cpp</code> <a href="https://github.com/vim/vim" rel="nofollow noreferrer">Vim</a> script. After doing this, syntax highlighting started to work for <code>.tpp</code> file, but code completion not.</p>\n<pre class="lang-lua prettyprint-override"><code>vim.filetype.add({\n extension = {\n tpp = &quot;cpp&quot;,\n },\n})\n</code></pre>\n<p>I have also added these lines of code inside <code>~/.config/nvim/init.lua</code> file, code completion still not wants to start working. So with all of that I have done - only syntax highlighting started to work for <code>.tpp</code> file extension, but code completion not. How can I make code completion to also start working for this file extension?</p>\n<pre><code>lspconfig: require(&quot;lspconfig.health&quot;).check()\n\nLSP configs active in this session (globally) ~\n- Configured servers: ccls\n- OK Deprecated servers: (none)\n\nLSP configs active in this buffer (bufnr: 1) ~\n- Language client log: ~/.local/state/nvim/lsp.log\n- Detected filetype: `cpp`\n- 1 client(s) attached to this buffer\n- Client: `ccls` (id: 1, bufnr: [1])\n root directory: ~/TurboINI/\n filetypes: c, cpp, objc, objcpp, cuda\n cmd: /usr/local/bin/ccls\n version: `Debian ccls version 0.20241108-2-g4331c895`\n executable: true\n autostart: true\n</code></pre>\n<p>Even tho <a href="https://microsoft.github.io/language-server-protocol/" rel="nofollow noreferrer">LSP</a> detected that this file's extension is related to <a href="https://isocpp.org/" rel="nofollow noreferrer">C++</a>, but code completion still not wants to work:</p>\n<p>I assume that solution to this is hiding in <a href="https://github.com/MaskRay/ccls" rel="nofollow noreferrer">ccls</a> and not in <a href="https://neovim.io/" rel="nofollow noreferrer">Neovim</a> plugins.</p>\n<p>P.S. I have found an article on how to make a specific file extensions behave exactly like standard C++ extensions on <a href="https://vi.stackexchange.com/questions/28108/how-to-make-a-filetype-behave-exactly-like-c">vi.stackexchange.com</a>, I have tried it out and <a href="https://github.com/MaskRay/ccls" rel="nofollow noreferrer">ccls</a> still not wants to do code completion. In principe code completion works, but as database it takes already what you have typed in a file, as an example if I typed <code>#include &lt;iostream&gt;</code> its database will only contain <code>#include</code> and <code>&lt;iostream&gt;</code> and nothing else.</p>\n"^^ . . . . . . "0"^^ . . . . . . "<p>Im trying to create a program or Zed extension that allows users to write Zed extensions in Lua instead of Rust, but can't find a way to do it. I tried using the mlua crate but embedding it into my extension struct had problems with ownership and thread safety. Here was my code:</p>\n<pre><code>use mlua::prelude::*;\nuse std::sync::{Arc, Mutex};\nuse zed_extension_api as zed;\n\nstruct LuaExtension {\n lua: Arc&lt;Mutex&lt;Lua&gt;&gt;,\n lua_table: Arc&lt;Mutex&lt;LuaTable&lt;'static&gt;&gt;&gt;,\n}\n\nimpl zed::Extension for LuaExtension {\n fn new() -&gt; Self\n where\n Self: Sized,\n {\n // Init Lua environment\n let lua = Lua::new();\n let lua = Arc::new(Mutex::new(lua));\n\n let lua_script = include_str!(&quot;test.lua&quot;);\n\n let lua_table = {\n let lua_lock = lua.lock().unwrap();\n let lua_table: LuaTable = lua_lock\n .load(lua_script)\n .eval()\n .expect(&quot;failed to load Lua extension&quot;);\n Arc::new(Mutex::new(lua_table))\n };\n\n LuaExtension { lua, lua_table }\n }\n\n fn language_server_command(\n &amp;mut self,\n _language_server_id: &amp;zed::LanguageServerId,\n _worktree: &amp;zed::Worktree,\n ) -&gt; Result&lt;zed::Command, String&gt; {\n // Call the Lua method\n let lua_table = self.lua_table.lock().unwrap();\n let result: LuaResult&lt;Vec&lt;String&gt;&gt; =\n lua_table.call_function(&quot;language_server_command&quot;, (_language_server_id, _worktree));\n\n match result {\n Ok(command) =&gt; Ok(zed::Command::from(command[0].clone())),\n Err(_) =&gt; Err(&quot;failed to get command from Lua&quot;.to_string()),\n }\n }\n\n fn run_slash_command(\n &amp;self,\n _command: zed_extension_api::Command,\n _args: Vec&lt;String&gt;,\n _worktree: Option&lt;&amp;zed_extension_api::Worktree&gt;,\n ) -&gt; zed_extension_api::Result&lt;zed_extension_api::CommandOutput, String&gt; {\n // Call the Lua method with arguments\n let lua_table = self.lua_table.lock().unwrap();\n let result: LuaResult&lt;String&gt; =\n lua_table.call_function(&quot;run_slash_command&quot;, (_command, _args, _worktree));\n result.map_err(|e| e.to_string())\n }\n}\n\nzed::register_extension!(LuaExtension);\n</code></pre>\n<p>I tried wrapping the Lua instance in a Arc&lt;Mutex&lt;&gt;&gt; but that resulted in an error as the Lua class does not implement Send and Sync.</p>\n"^^ . "0"^^ . "<p>I am creating a knockback script for a Roblox tower defense game that is meant to teleport an enemy backwards toward another part by 5 studs. The knockback function works for this purpose, but after being pushed back, the enemy skips the waypoint it is moving towards. Enemies in this game move along the track by moving from waypoint blocks to waypoint blocks. When the knockback occurs, the enemy moves diagonally off the track toward the next waypoint instead of the one it is supposed to move to.</p>\n<p>So far, I have attempted to use a BindableEvent to set the enemy's waypoint target back by one, but it is having no effect on its corner-cutting movement. Here is the code for my knockback script:</p>\n<pre><code>task.wait(10)\nlocal target = game:GetService(&quot;Workspace&quot;)[&quot;Live Enemies&quot;][&quot;Handcuff Arrest Officer&quot;]\n\nlocal waypoint: Part = nil\nif target.EnemyInfo.Waypoint.Value == 0 then\n waypoint = game:GetService(&quot;Workspace&quot;).SpawnPoint\nelse\n waypoint = game:GetService(&quot;Workspace&quot;).Waypoints[target.EnemyInfo.Waypoint.Value]\nend\nlocal studsToMove = 5\n\n-- Make sure the model has a PrimaryPart set\nif target.PrimaryPart then\n -- Calculate direction from target's PrimaryPart to waypoint\n local direction = (waypoint.Position - target.PrimaryPart.Position).unit\n\n -- Calculate the new position, moving the PrimaryPart 5 studs in the direction of the waypoint\n local newPosition = target.PrimaryPart.Position + direction * studsToMove\n\n -- Offset the entire model by the same movement, preserving its orientation\n target.Knockback:Fire()\n target:SetPrimaryPartCFrame(target.PrimaryPart.CFrame + (direction * studsToMove))\nend\n</code></pre>\n<p>Additionally, here is the code for the enemy movement script. It uses a no-timeout version of <code>humanoid:MoveTo()</code> from <a href="https://create.roblox.com/docs/reference/engine/classes/Humanoid" rel="nofollow noreferrer">https://create.roblox.com/docs/reference/engine/classes/Humanoid</a>.</p>\n<pre><code>-- In case the enemy dies before this script can run, pcall blocks errors.\npcall(function(...)\n -- Constants\n local humanoid = script.Parent.Humanoid\n local info = script.Parent.EnemyInfo\n local waypoints = game:GetService(&quot;Workspace&quot;).Waypoints\n local waypoints_hit = 0 -- Not constant, waypoint counter\n local knockback = script.Parent.Knockback\n \n -- MoveTo() without timeout\n local function moveTo(humanoid, targetPoint)\n local targetReached = false\n local connection\n connection = humanoid.MoveToFinished:Connect(function(reached)\n targetReached = true\n print(&quot;Reached target &quot;..tostring(targetPoint))\n connection:Disconnect()\n connection = nil\n end)\n humanoid:MoveTo(targetPoint)\n while not targetReached do\n if not (humanoid and humanoid.Parent) then\n break\n end\n if humanoid.WalkToPoint ~= targetPoint then\n break\n end\n humanoid:MoveTo(targetPoint)\n task.wait(0.1)\n end\n if connection then\n connection:Disconnect()\n connection = nil\n end\n end\n \n knockback.Event:Connect(function(...: any)\n print(&quot;Fired&quot;)\n waypoints_hit -= 1\n script.Parent.EnemyInfo.Waypoint.Value = tostring(waypoints_hit)\n if waypoints_hit == 0 then\n moveTo(humanoid, game:GetService(&quot;Workspace&quot;).SpawnPoint.Position)\n else\n moveTo(humanoid, game:GetService(&quot;Workspace&quot;).Waypoints[waypoints_hit].Position)\n end\n end)\n\n -- Enemy configurations\n local damage: number = info.Damage.Value -- Damage to base\n local hp: number = info.HP.Value -- Hit points\n local speed: number = info.Speed.Value -- Speed\n \n -- Set HP and speed\n humanoid.MaxHealth = hp\n humanoid.Health = hp\n humanoid.WalkSpeed = speed\n \n -- Move\n for i,v in pairs(waypoints:GetChildren()) do\n moveTo(humanoid, v.Position)\n waypoints_hit += 1\n script.Parent.EnemyInfo.Waypoint.Value = tostring(waypoints_hit)\n if waypoints_hit &gt;= 8 then\n game:GetService(&quot;Workspace&quot;)[&quot;Match Config&quot;].BaseHP.Value -= damage\n script.Parent:Destroy()\n end\n end\nend)\n</code></pre>\n<p>I found out that <code>humanoid:MoveTo()</code> <a href="https://devforum.roblox.com/t/setting-humanoid-cframe-breaks-movement/2486634/4?u=scp_o54" rel="nofollow noreferrer">stops when the root part's CFrame is changed</a>, which is what I am doing to facilitate knockback. However, I'm not sure how to get around this limitation, which I need to do for the knockback feature. Any help would be appreciated!</p>\n"^^ . . "local serverstorage = game:GetService("ServerStorage")\nlocal spawner = workspace["entity spawn"]\nlocal mob = {}\nfunction mob.Spawn(name, map)\n local mobexsists = serverstorage.mobs:FindFirstChild(name)\n\n if mobexsists then\n local newmob = mobexsists:Clone()\n newmob.HumanoidRootPart.CFrame = spawner.CFrame\n newmob.Parent = workspace\n else\n warn("mob isnt here")\n end\nend\nreturn mob"^^ . "0"^^ . "Where is the programming aspect?"^^ . . . "awesome-wm"^^ . "0"^^ . . . . . . . . . . . "nvim-lspconfig"^^ . . . . "Intersection of Two Ellipses with a Common Focus, Lua"^^ . . . . . "2"^^ . "0"^^ . . . . . "It looks like `table.insert()` is the way to go, though I am still not sure why `table.unpack()` is set up to have to be last. This requires the function to have mutable elements, albeit for a theoretically short amount of time.\n\n```\n local function recursive_insert(x, n)\n if n == 1 then return {x} end\n\n local l = table.pack(table.unpack(recursive_insert(x, n-1)))\n table.insert(l, x)\n\n return l\n end\n\n```"^^ . "1"^^ . . "As you can see on the diagram ("content generated by?"), `content_by_lua_block` and `proxy_pass` are mutually exclusive. In your configuration, `proxy_pass` is executed and `content_by_lua_block` is simply ignored. If you need to programmatically dispatch requests to upstreams based on the request content, there is `balancer_by_lua_block`. Check the [docs](https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/balancer.md) and [this answer](https://stackoverflow.com/questions/53168425/how-to-dispatch-tcp-request-to-backends-with-first-byte-of-content-in-openresty/55250233#55250233)."^^ . "0"^^ . "<p>Lua (5.4) does not include the described function in its Standard Library (see: <a href="https://lua.org/manual/5.4/manual.html#6.6" rel="nofollow noreferrer"><em>6.6 – Table Manipulation</em></a>). <a href="https://lua.org/manual/5.4/manual.html#pdf-table.move" rel="nofollow noreferrer"><code>table.move</code></a> is the closet analogue, but it behaves like the C function <a href="https://en.cppreference.com/w/c/string/byte/memmove" rel="nofollow noreferrer"><code>memmove</code></a>, working on <em>array-like</em> tables (i.e., a <em>sequence</em>).</p>\n<p>You will have to implement this function yourself. In the simplest of terms, it can be written as:</p>\n<pre class="lang-lua prettyprint-override"><code>local function update(to, from)\n for key, value in pairs(from) do \n to[key] = value \n end \nend \n</code></pre>\n"^^ . . . "luarocks"^^ . . "''''player.angle'''' is angle player is looking stored in degrees, Vec2 is just used to iterate for loops twice"^^ . "<p>under MAC OS Sonoma 14.2.1</p>\n<p>luaclient.lua script line 2 is:</p>\n<pre><code>local socket = require('socket')\n</code></pre>\n<p>When the script is run, it yields:</p>\n<pre><code>lua: luaclient.lua:2: module 'socket' not found:\n no field package.preload['socket']\n no file '/usr/local/share/lua/5.4/socket.lua'\n no file '/usr/local/share/lua/5.4/socket/init.lua'\n no file '/usr/local/lib/lua/5.4/socket.lua'\n no file '/usr/local/lib/lua/5.4/socket/init.lua'\n no file './socket.lua'\n no file './socket/init.lua'\n no file '/usr/local/lib/lua/5.4/socket.so'\n no file '/usr/local/lib/lua/5.4/loadall.so'\n no file './socket.so'\nstack traceback:\n [C]: in function 'require'\n luaclient.lua:2: in main chunk\n [C]: in ?\n</code></pre>\n<p>socket is installed here:</p>\n<pre><code>/Users/user_name/.luarocks/share/lua/5.4\n</code></pre>\n<p>Lua interpreter says:</p>\n<p>Lua 5.4.7 Copyright (C) 1994-2024 Lua.org, PUC-Rio</p>\n<pre><code>print(package.path) \n\n/usr/local/share/lua/5.4/?.lua;/usr/local/share/lua/5.4/?/init.lua;/usr/local/lib/lua/5.4/?.lua;/usr/local/lib/lua/5.4/?/init.lua;./?.lua;./?/init.lua\n</code></pre>\n<p>Trying:</p>\n<pre><code>set LUA_PATH '/Users/perryhorwich/.luarocks/share/lua/5.4/?.lua'\n</code></pre>\n<p>... in the shell, gives the same error as though LUA_PATH has no effect on the lookup for 'socket'</p>\n<p>What am I missing?</p>\n"^^ . . . . . "0"^^ . . "How to use a string value as a command in Lua"^^ . "1"^^ . . "<p>The problem turned out to be because I installed VS Code through flatpak. I solved it by uninstalling the app, and then reinstalling as a .deb file through <a href="https://code.visualstudio.com" rel="nofollow noreferrer">https://code.visualstudio.com</a>.</p>\n"^^ . . "1"^^ . . . "0"^^ . "math"^^ . . . "3d"^^ . "2"^^ . "0"^^ . . . . . "i with the lua script in the logitech g hub program"^^ . "<p>so im trying to make a little casino game on roblox for fun and for whatever reason it refuses to find anything inside of the folder where you place your bet in the machine</p>\n<p>here's the script (the print functions are temporary and it will not print &quot;Found betplacer&quot;)</p>\n<pre><code>local p = game.Players.LocalPlayer\n\nfunction canBet()\n return true--p:FindFirstChild(&quot;CanBet&quot;).Value\nend\n\nfunction bet(event:RemoteEvent, racer:Instance, tokens:number)\n if canBet() then\n event:FireServer(tokens, racer)\n end\nend\n\nfor _, machine in pairs(workspace.Machines:GetChildren()) do\n if machine.Name == &quot;RacingHeads&quot; then\n local placers = machine.Placers:GetChildren()\n\n print(&quot;Found RacingHeads&quot;)\n\n for _, v in pairs(placers) do\n local event = v.Parent.Parent:FindFirstChild(&quot;Bet&quot;)\n local racer = v:FindFirstChild(&quot;Racer&quot;).Value\n local gui = v:FindFirstChild(&quot;BetGui&quot;)\n local button:TextButton = gui.Submit\n local function quickbet()\n local tokens = tonumber(gui.Amount.Text)\n\n print(&quot;Bet on RacingHeads&quot;)\n bet(event, racer, tokens)\n end\n\n print(&quot;Found betplacer&quot;)\n\n button.MouseButton1Click:Connect(quickbet)\n button.TouchTap:Connect(quickbet)\n end\n end\nend\n</code></pre>\n"^^ . . . . . . "<p>I know format <code>&quot;*a&quot;</code> is used to read a whole file, <code>&quot;*l&quot;</code> used to read a line. But what does <code>&quot;*all&quot;</code> (which appears in the book Programming in Lua) mean? I also saw <code>&quot;*line&quot;</code> on some webpages.</p>\n<p><a href="https://www.lua.org/manual/5.3/manual.html#pdf-file:read" rel="nofollow noreferrer">The Lua reference</a> only specifies those one character formats, and doesn't say anything about longer formats.</p>\n<p>At first I thought, formats with more than one characters mean reading each format individually, like <code>&quot;*nn&quot;</code> would read two numbers, <code>&quot;*ll&quot;</code> would read two lines. But that doesn't seem to be the case.</p>\n<p>The only place I've found about this is a <a href="https://www.reddit.com/r/lua/comments/4zd7r1/comment/d70ryyo/?utm_source=share&amp;utm_medium=web3x&amp;utm_name=web3xcss&amp;utm_term=1&amp;utm_content=share_button" rel="nofollow noreferrer">reddit comment</a> say that</p>\n<blockquote>\n<p>But &quot;umber&quot; is a noise string. You're relying on the implementation of file.read to ignore all characters in the format specifier after the second for star formats. What if that changes?</p>\n</blockquote>\n<p>So what's the correct behavior of <code>&quot;*all&quot;</code> and the like, or is it really defined?</p>\n<p>ps: I'm using Lua 5.3, but the relevant reference is same for other versions I have checked.</p>\n"^^ . . . "@minseong If there are no capture groups, `match` returns the entire matched substring. If there are capture groups, `match` returns all capture groups as strings (or integers for `()`) in order (as a vararg). So if there is a single capture group, then yes `match` returns that group as a string."^^ . . . "0"^^ . . . "1"^^ . . . . "0"^^ . . . . "I know this doesn't address your question, but you might consider putting all of that data into a database file (SQL or CSV or JSON or similar). Otherwise, it's going to be a pain to add additional entries."^^ . . . . . . . . . . . . . . . . . "0"^^ . "<p>I have the following lua function:</p>\n<pre><code>function GET_STRING()\n return &quot;THE_STRING&quot;\nend\n</code></pre>\n<p>I want to press <kbd>:</kbd> to enter command mode and execute the lua function so the final command looks like <kbd>:THE_STRING</kbd>. Context: I want to create a keybinding which automatically creates this command.</p>\n"^^ . "2"^^ . "0"^^ . . . . "0"^^ . "wireshark-dissector"^^ . . . . "0"^^ . . . . . . . . . . . . . "1"^^ . "<p>in Lua you can use <a href="https://www.lua.org/manual/5.3/manual.html#pdf-string.sub" rel="nofollow noreferrer">string.sub</a> to create a substring that removes the prefix.</p>\n<blockquote>\n<p>The call string.sub(s,i,j) extracts a piece of the string s, from the i-th to the j-th character inclusive. In Lua, the first character of a string has index 1. — <a href="https://www.lua.org/pil/20.html" rel="nofollow noreferrer">Programming in Lua Chapter: 20 – The String Library</a></p>\n</blockquote>\n<p>Here is a function example using the <code>string.sub</code> to remove prefix <code>p</code> from string <code>s</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>function removeprefix(s, p)\n return (string.sub(s, 0, #p) == p) and string.sub(s, #p+1) or s\nend\n</code></pre>\n<p>You can also leverage the string metatable to simplify the code:</p>\n<pre class="lang-lua prettyprint-override"><code>function removeprefix(s, p)\n return (s:sub(0, #p) == p) and s:sub(#p+1) or s\nend\n</code></pre>\n"^^ . . . . "@O5CommandStandsWithUkraine Ok, then it's probably not best do to it that way. You'd be better off getting the humaniod object for the player, then moving that. This avoids it but should help with your issue."^^ . "That MoveTo() function is specially modified to bypass the 8-second movement timeout, as in https://create.roblox.com/docs/reference/engine/classes/Humanoid."^^ . . . . "0"^^ . "How to ensure yt-dlp completes all tasks (including --recode option) before continuing in Lua script?"^^ . . "0"^^ . "Lua debug hook triggers different amount of call/returning events if error occurred during execution"^^ . . "LibreOffice Writer has an Export as PDF option that allows you to specify PDF/UA compliance. It raises direct formatting issues when text is bold / italic but passes if text is styled Strong Emphasis / Emphasis. The created PDF then passes PAC 2024 validations for PDF/UA, WCAG & Quality. That's all I'm trying to achieve right now."^^ . . . . . . . . . . "label"^^ . . . . . "0"^^ . "0"^^ . . "0"^^ . . "3"^^ . . . . . "0"^^ . . "2"^^ . . . "1"^^ . . "4"^^ . . "0"^^ . . "1"^^ . "0"^^ . "docker-compose"^^ . . . . "Why did you create a new project? Why not build with luarocks or create the project with cmake?"^^ . "0"^^ . "0"^^ . . "<p>You need to change the <code>Humanoid's</code> <code>CFrame</code> after getting it from the player. Here's a example assuming the script is inside a part, and you're getting the player from the <code>Touched</code> event without using the <code>MoveTo</code> method. Here's an example:</p>\n<pre><code>local part = script.Parent\n\npart.Touched:Connect(function(hit)\n local character = hit.Parent\n local player = game.Players:GetPlayerFromCharacter(character)\n\n if player then\n print(player.Name .. &quot; touched the part!&quot;)\n end\n end)\n</code></pre>\n"^^ . . . . "<p>Just use <code>-l lib1</code>.</p>\n<p>I guess the book you are reading is <em>Programming in Lua first edition</em>, unfortunately it is outdated. That edition was written for Lua 5.0 and since Lua 5.1, the default search path no longer needs the <code>.lua</code> extension, and dot <code>.</code> in the module name will also be replaced with a slash <code>/</code> by default.</p>\n"^^ . "3"^^ . . "0"^^ . . "Related: https://stackoverflow.com/questions/79231569/how-to-make-neovim-associate-tpp-file-extension-with-c-files"^^ . . . . . . "c"^^ . . . "1"^^ . . "2"^^ . "file-extension"^^ . "0"^^ . . . . "1"^^ . . . "1"^^ . "<p>You are almost there, however the algebra is complicated here - so I'll give you just an idea, but not a complete answer. I'll consider a circle with the center in <code>D1</code>.</p>\n<p>Note, that <code>distance(A,D1) = distance(B,D1) = distance(D1,T1)</code>. You can find a <em>unit</em> vector <code>N</code>, perpendicular to the line <code>AB</code>, and express vector <code>D1</code> in terms of the midpoint vector <code>M</code> and the vector <code>N</code>, multiplied by a scalar parameter <code>t</code>:</p>\n<pre><code>D1 = M + t*N (1)\n</code></pre>\n<p>The <code>distance(C,T1)</code> is known to be equal to <code>cr</code>, and also it's equal to the sum:</p>\n<pre><code>distance(C,T1) = distance(C,D1) + distance(D1,T1) = cr\n</code></pre>\n<p>This can be rewritten as:</p>\n<pre><code>distance(C,M + t*N) + distance(A,M + t*N) = cr (2)\n</code></pre>\n<p>This is an equation with a single unknown variable <code>t</code>, which can be solved algebraically (it's not easy) - its solutions will give you two points <code>D1</code> and <code>D2</code>.</p>\n<p>Another option is to solve this equation numerically, incrementing the parameter <code>t</code> by small value and computing a result in a loop. This kind of solvers used to be available in various programming languages (not sure about Lua).</p>\n<hr />\n<p><strong>ADDITION #1</strong>. I used C++ and two open-source libraries to verify the idea above (I don't know Lua). Hopefully you'll be able to convert my code to Lua - it's elementary geometry plus finding a root of a function using <em>bisection</em> method. The code is below:</p>\n<pre><code>#include &lt;cmath&gt;\n#include &lt;iostream&gt;\n\n#include &lt;boost/math/tools/roots.hpp&gt;\n#include &lt;CGAL/Simple_cartesian.h&gt;\n\nnamespace bmt = boost::math::tools;\n\nusing Kernel = CGAL::Simple_cartesian&lt;double&gt;;\nusing Circle = Kernel::Circle_2;\nusing Point = Kernel::Point_2;\nusing Vector = Kernel::Vector_2;\n\n// ------ return vector, corresponding to the point P\nVector toVector(Point const&amp; P)\n{\n return P - CGAL::ORIGIN;\n}\n\n// ------ return unit vector, corresponding to the vector V \nVector unitVector(Vector const&amp; V)\n{\n return V / std::sqrt(V.squared_length());\n}\n\n// ------ return the end point of the vector with origin in (0,0)\nPoint endPoint(Vector const&amp; V)\n{\n return CGAL::ORIGIN + V;\n}\n\n// ------ return the point of intersection of the circle C and its radius, passing through the point P \nPoint boundaryPoint(Circle const&amp; C, Point const&amp; P)\n{\n return C.center() + unitVector(P - C.center()) * std::sqrt(C.squared_radius());\n}\n\n// ------ given points and circle\nPoint const A{30, 30};\nPoint const B{40, 20};\nCircle const C{{50, 50}, 40 * 40};\n\n// ------ computed midpoint and perpendicular unit vector\nauto const M = (toVector(A) + toVector(B)) / 2.0;\nauto const N = unitVector((A - B).perpendicular(CGAL::CLOCKWISE)); \n\n// ------ the root of this function is used to find the center of the circle\ndouble func(double const X)\n{\n auto const D = endPoint(M + X * N);\n return\n (\n std::sqrt(CGAL::squared_distance(C.center(), D))\n +\n std::sqrt(CGAL::squared_distance(A, D))\n -\n std::sqrt(C.squared_radius())\n );\n}\n\n// ------ this function stops the root search when the root is found\nbool tolerance(double const L, double const R)\n{\n return (R - L) &lt;= 0.00001;\n}\n\n// ------ the Boost Math Tools function 'bisect' is used to find the root in the interval [MIN,MAX] \nPoint boundaryPoint(double const MIN, double const MAX)\n{\n auto const t = bmt::bisect(func, MIN, MAX, tolerance);\n auto const D = endPoint(M + t.first * N);\n return boundaryPoint(C, D);\n}\n\nint main()\n{\n auto const T1 = boundaryPoint(-50.0, 0.0);\n std::cout &lt;&lt; T1.x() &lt;&lt; '\\t' &lt;&lt; T1.y() &lt;&lt; std::endl;\n auto const T2 = boundaryPoint(0.0, 50.0);\n std::cout &lt;&lt; T2.x() &lt;&lt; '\\t' &lt;&lt; T2.y() &lt;&lt; std::endl;\n}\n</code></pre>\n<hr />\n<p><strong>Addition #2</strong>. This problem can be solved analytically, that is – without numerical methods. I’ll still use the parametric expression (1) for the point <code>D1</code>. The equation (2) can be elaborated a little bit further. Let’s find a point <code>F</code>, lying on the line, passing through points <code>M</code> and <code>D1</code>, and closest to the center <code>C</code> of the big circle. The vector <code>C-F</code> will be orthogonal to the unit vector <code>N</code>. Some notation:</p>\n<pre><code>a = half-length of the segment (A,B)\nu = length of the segment (C,F)\nv = length of the segment (M,F) \nR = radius of the big circle (= your cr) \n</code></pre>\n<p>The segment <code>(C,T1)</code> is divided by the point <code>D1</code> into two parts - <code>(C,D1)</code> and <code>(D1,T1)</code>. The length of the segment <code>(C,D1)</code> is equal to <code>sqrt(u^2 + (v-t)^2)</code>, and the length of the segment <code>(D1,T1)</code> is equal to the radius of the inscribed circle – that is <code>sqrt(a^2 + t^2)</code>. So, the equation (2) becomes:</p>\n<pre><code> sqrt(a^2 + t^2) + sqrt(u^2 + (v-t)^2) = R\n</code></pre>\n<p>We can try to solve this equation by hand, but it’s not easy. Fortunately, the symbolic algebra website &quot;PolyMathLove.com&quot; can solve it – please see <a href="https://www.polymathlove.com/polymonials/midpoint-of-a-line/symbolic-equation-solving.html#c=solve_algstepsequationsolve&amp;v239=sqrt%2528a%255E2%2Bt%255E2%2529%2Bsqrt%2528u%255E2%2B%2528v-t%2529%255E2%2529%253DR&amp;v240=t" rel="nofollow noreferrer">here</a>. However, I didn’t verify this solution.</p>\n"^^ . . . . "Try to terminate filters by `filter ""` to reset filter, especially when you have other commend afterward (as `include` which will begin with the last filter)."^^ . . "0"^^ . . . "Lua option -l "module 'lib1.lua' not found""^^ . . "esp32"^^ . . "<p>I'm encountering an issue with HAProxy configuration where the logs from the LUA core.register_action and core.register_service scripts aren't being recorded in the expected log files.</p>\n<p>The logs from core.Info(ip) are being logged in /var/log/messages, but I need them in /var/log/haproxy.log.</p>\n<p>Here's a simplified version of my code:</p>\n<pre><code>core.register_action(&quot;verify_request&quot;, { &quot;http-req&quot; }, function(txn)\n ....\n txn:Info(ip) -- this got logged into /var/log/haproxy\nend)\n\ncore.register_service(&quot;send_response&quot;, &quot;http&quot;, function(applet)\n .... \n core.Info(ip) -- this got logged into /var/log/messages\nend)\n</code></pre>\n<p>HAProxy configuration (haproxy.cfg):</p>\n<pre><code>log global \noption httplog\noption dontlognull\noption dontlog-normal\nlog 127.0.0.1 local0 debug\n</code></pre>\n<p>Rsyslog configuration (rsyslog.d/haproxy.conf):</p>\n<pre><code>$ModLoad imudp\n$UDPServerAddress 127.0.0.1\n$UDPServerRun 514\n\nlocal0.* /var/log/haproxy.log\n</code></pre>\n<p>Is there a specific configuration I might be missing that would direct all logs from both the Lua actions to the same log file?</p>\n"^^ . "@MindSwipe does the SDK-style format for projects scan the code base recursively? does it scan the nested folders as well?"^^ . "3"^^ . . . . . . "Position is not a valid member of model "Workspace.Orchooselimbo""^^ . "0"^^ . "1"^^ . "2"^^ . . . . "However, the OP is a little too vague. I can't really determine if OP wants to find the key depending on the value, or just grabbing the key."^^ . "0"^^ . "<p>This should do the trick:</p>\n<pre class="lang-none prettyprint-override"><code>function remove_prefix(str, prefix)\n if str:sub(1, #prefix) == prefix then\n return str:sub(#prefix + 1)\n else\n return str\n end\nend\n</code></pre>\n"^^ . "How to get output of lua function in command line"^^ . . . "yt-dlp"^^ . . "0"^^ . . . . "Prevent BillboardGui text scaling"^^ . . . . . . "<p>Because <code>\\n</code> will be interpreted as a line break, and this string will be interpreted as:</p>\n<pre><code>return { date=&quot;2024-10-23T21:24:27.227996696Z&quot;, severity=&quot;Normal&quot;, category=&quot;Hardware&quot;, message=&quot;line 1\nline 2&quot;, filename=&quot;&quot;, status=&quot;Not Present&quot;, source=&quot;Atmos-RX-2&quot; }\n</code></pre>\n<p>This is incorrect in syntax.</p>\n<p>If you want the value of message to include a line break, you should escape the backslash:</p>\n<pre><code>message=&quot;line 1\\\\nline 2&quot;\n</code></pre>\n"^^ . . . "0"^^ . . "1"^^ . . . . . "pandoc"^^ . . . . "0"^^ . . . "0"^^ . . "0"^^ . . . "0"^^ . . . "<p>One of the first examples in the Lua book is a function that's saved in a file called lib1.lua.\nThe file works as expected when loaded via dofile:</p>\n<pre><code>% lua\n&gt; dofile(&quot;lib1.lua&quot;)\n&gt; twice(3)\n6.0\n</code></pre>\n<p>But the file is not found when loaded via the -l option:</p>\n<pre><code>% lua -i -llib1.lua -e &quot;print(twice(3))&quot;\nLua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio\nlua: module 'lib1.lua' not found:\n no field package.preload['lib1.lua']\n no file '/usr/share/lua/5.4/lib1/lua.lua'\n no file '/usr/share/lua/5.4/lib1/lua/init.lua'\n no file '/usr/lib64/lua/5.4/lib1/lua.lua'\n no file '/usr/lib64/lua/5.4/lib1/lua/init.lua'\n no file './lib1/lua.lua'\n no file './lib1/lua/init.lua'\n no file '/usr/lib64/lua/5.4/lib1/lua.so'\n no file '/usr/lib64/lua/5.4/loadall.so'\n no file './lib1/lua.so'\n no file '/usr/lib64/lua/5.4/lib1.so'\n no file '/usr/lib64/lua/5.4/loadall.so'\n no file './lib1.so'\nstack traceback:\n [C]: in function 'require'\n [C]: in ?\n</code></pre>\n<p>lib1.lua is in the current folder where the script is being executed:</p>\n<pre><code>% ls\nlib1.lua\n</code></pre>\n<p>Why is the -l option not finding lib1.lua?</p>\n"^^ . . . "If it is the answer you are seeking for, you can accecpt it by clicking on the checkmark next to it. This marks this question as solved for others."^^ . . "<p>The problem is that promises are asynchronous, but your game loop is synchronous. When you call <code>resolve()</code>, that does not directly continue executing the coroutine. It only resolves the promise, which <em>schedules</em> any registered promise reactions (such as the continuation of the asynchronous code that <code>await</code>ed that promise, or callback functions added via <code>.then()</code>) to run soon, in the next microtask. So you'll need to give it some time to do that before running the next game tick:</p>\n<pre><code>(tasks[2] ??= []).push(task1);\n\nlet gameTick = 0; \nwhile (gameTick &lt; 10) {\n print(`tick: ${gameTick}`);\n tasks[gameTick]?.forEach(f =&gt; f())\n await Promise.resolve(); // if not even setTimeout()\n gameTick++;\n}\n</code></pre>\n"^^ . "mingw-w64"^^ . "0"^^ . . . . . . . "How does obfuscated code execute a built in function in Lua"^^ . . . . "Yes, my question is not about how to execute a lua function as a command (I don't want to do `:lua GET_STRING()`). I want to execute the lua function to get `:THE_STRING`."^^ . . "@kylaaa yes it does"^^ . . . "1"^^ . . "javascript"^^ . "How to automatically update .csproj files when adding new C# files in Neovim?"^^ . "<p>You should replace:</p>\n<pre><code>setmetatable(ClientWidget, {__index = AbstractClientObject})\n</code></pre>\n<p>By this:</p>\n<pre><code>setmetatable(ClientWidget, AbstractClientObject)\n</code></pre>\n<p>And so, your instanceof implementation should work. Since AbstractClientObject has set __index to be itself, you don't need to use a separate table as a metatable for ClientWidget (this is what cause the loop to not work). You can use AbstractClientObject directly. The loop going up metatable chain should work then.</p>\n"^^ . "Whole lot better than mine."^^ . . "quarto"^^ . "Wireshark plugin not working after update"^^ . . "<p>You not only have to worry about errors, but also about tail calls. The usual method is to use the <code>func</code> field returned by <code>getinfo</code> to build a call stack to trace calls. Unfortunately, this method cannot determine when the error occurred, and can only be corrected when the next return happens.</p>\n<pre><code>local call_stack = {}\n\nfunction my_hook(event, line)\n local info = debug.getinfo(2, 'f')\n\n -- push &quot;call&quot; and &quot;tail call&quot; onto the stack\n if event == 'call' then\n table.insert(call_stack, {func = info.func, is_tail_call = false})\n elseif event == 'tail call' then\n table.insert(call_stack, {func = info.func, is_tail_call = true})\n\n elseif event == 'return' then\n local ci\n\n repeat\n -- pop the last call info from the stack\n ci = table.remove(call_stack)\n if ci and ci.func ~= info.func then\n -- The stack is unbalanced\n -- An error was occured in ci.func\n end\n until ci == nil or ci.func == info.func\n\n while ci and ci.is_tail_call do\n ci = table.remove(call_stack)\n -- If the popped call is a tail call\n -- this &quot;ci&quot; (the preceding call) is also returned here\n end\n end\nend\n</code></pre>\n"^^ . "1"^^ . . . . "0"^^ . "I highly suggest you also migrate to the [SDK-style format](https://learn.microsoft.com/en-us/dotnet/core/project-sdk/overview) for projects, as they scan directories and include C# source file automatically"^^ . "0"^^ . . . . "<p>For the moment in time, I worked around with this solution although I'm not sure is the best one.</p>\n<p>I check with an interval of10 seconds if the file size is changed. If not, then I can consider the process finished thus LUA can continue</p>\n<pre><code>...\n...\n...\nlocal Destination = &lt;PATH/FILENAME&gt;\n\nfunction sleep(n)\n local t0 = clock()\n while clock() - t0 &lt;= n do end\nend\nlocal zzz = 10\n\nfunction get_file_size(filename)\n local file = io.open(filename, &quot;rb&quot;)\n if not file then return 0 end\n local size = file:seek(&quot;end&quot;)\n file:close()\n return size\nend\n\nlocal stable = false\nlocal last_size = get_file_size(Destination)\nwhile not stable do\n \n sleep(zzz)\n local new_size = get_file_size(Destination)\n \n if new_size &gt; 0 and new_size == last_size then\n stable = true\n else\n last_size = new_size\n end\nend\n\n...\n...\n...\n</code></pre>\n"^^ . "algorithm"^^ . "See also https://stackoverflow.com/questions/7925090/lua-find-a-key-from-a-value"^^ . . "0"^^ . . "<p>I am following the tutorial of the docs, <a href="https://pandoc.org/custom-writers.html#example-modified-markdown-writer" rel="nofollow noreferrer">example-modified-markdown-writer</a></p>\n<p>I want to try it against the following file</p>\n<pre><code>input01.html\n\n\n&lt;body&gt;\n&lt;h1&gt;My Document&lt;/h1&gt;\n\n&lt;code&gt;\nThis code will be recognised\n&lt;/code&gt;\n\n&lt;/body&gt;\n</code></pre>\n<pre><code>custom-write01A.lua\n\n\nfunction Writer (doc, opts)\n local filter = {\n CodeBlock = function (cb)\n -- only modify if code block has no attributes\n if cb.attr == pandoc.Attr() then\n local delimited = '```\\n' .. cb.text .. '\\n```'\n return pandoc.RawBlock('markdown', delimited)\n end\n end\n }\n return pandoc.write(doc:walk(filter), 'gfm', opts)\nend\n\nTemplate = pandoc.template.default 'gfm'\n</code></pre>\n<p>Now I can do the default markdown processing by</p>\n<pre><code>pandoc -f html -t markdown input01.html\n</code></pre>\n<p>Or I could be picking the custom writer</p>\n<pre><code>pandoc -f html input01.html -L custom-writer01.lua\n</code></pre>\n<p>Which is giving me</p>\n<pre><code>&lt;h1 id=&quot;my-document&quot;&gt;My Document&lt;/h1&gt;\n&lt;p&gt;&lt;code&gt; This code will be recognised &lt;/code&gt;&lt;/p&gt;\n</code></pre>\n<p>I was expecting the output in the gfm</p>\n<p>I expected the output to be as specified per code (In a fenced code block)</p>\n<pre><code>\n# My Document\n\n```\nThis code will be recognised\n```\n</code></pre>\n<p>Instead we get the in-line codeblock as the same as in -t markdown</p>\n<pre><code># My Document\n\n` This code will be recognised `\n</code></pre>\n"^^ . "0"^^ . . . . "0"^^ . "0"^^ . . . "4"^^ . "0"^^ . . . . . . "<p>I'm trying to port some Java code to Lua, while maintaining class inheritance I want to use an instanceof Lua implementation.</p>\n<p>Here are the modules I define:</p>\n<pre><code>-- ClientWidget class\nlocal ClientWidget = {}\nClientWidget.__index = ClientWidget\nClientWidget.ClassName = &quot;ClientWidget&quot;\n\nlocal AbstractClientObject = require(&quot;df.AbstractClientObject&quot;)\n\nsetmetatable(ClientWidget, {__index = AbstractClientObject})\n\nfunction ClientWidget.new()\n local self = {}\n \n setmetatable(self, ClientWidget)\n AbstractClientObject.init(self)\n ClientWidget.init(self)\n \n return self\nend\n</code></pre>\n<p>And,</p>\n<pre><code>-- AbstractClientObject class \nlocal AbstractClientObject = {}\nAbstractClientObject.__index = AbstractClientObject\nAbstractClientObject.ClassName = &quot;AbstractClientObject&quot;\n\nfunction AbstractClientObject.new()\n local self = {}\n setmetatable(self, AbstractClientObject)\n AbstractClientObject.init(self)\n return self\nend\n</code></pre>\n<p>InstanceOf is implemented as following:</p>\n<pre><code>function Object.isInstanceOf(object, className)\n if not object then return false end\n\n -- Récupère la métatable de l'objet\n local mt = getmetatable(object)\n while mt do\n if mt.ClassName == className then\n return true\n end\n -- Remonte la chaîne d'héritage\n mt = getmetatable(mt)\n end\n return false\nend\n</code></pre>\n<p>If I do:</p>\n<pre><code>local widget = ClientWidget.new() \n\nObject.isInstanceOf(widget, &quot;AbstractClientObject&quot;)\n</code></pre>\n<p>it returns false, how am I supposed to implement such a feature ?</p>\n"^^ . . . . "3"^^ . "How do I prevent my tween from playing double?"^^ . "Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking."^^ . "How do I create a character removal button from the DataStorer in Roblox Studio?"^^ . "@Jarod42 here is the full message from the output panel\n\n`1>C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\VC\\v170\\Microsoft.CppCommon.targets(1544,5): error MSB6006: "llvm-lib.exe" exited with code 1.`"^^ . . . . . "3"^^ . . . "Can you try with `{['custom-style'] = "StrongEmphasis"}` instead of `class`?"^^ . "<p>I cannot find a detailed guide on how to compile IM/CD/IUP under Mingw64. The instructions in the website do not help.</p>\n<p>I used <code>tecmake</code> and <code>mingw32-make</code> to no avail.</p>\n<p>Is it still supported?\nI get</p>\n<pre><code>c:\\work\\luvit\\cd&gt;cd src\n\nc:\\work\\luvit\\cd\\src&gt;tecmake all-gcc_dll\nThe system cannot find the path specified.\nc:\\work\\luvit\\tecmake\\tecmakewin.mak:1835: dep/cd.dep.dllw6: No such file or directory\nmingw32-make: *** [c:\\work\\luvit\\tecmake\\tecmakewin.mak:1814: dep/cd.dep.dllw6] Error 255\nThe system cannot find the path specified.\nc:\\work\\luvit\\tecmake\\tecmakewin.mak:1835: dep/cd.dep.dllw6_64: No such file or directory\nmingw32-make: *** [c:\\work\\luvit\\tecmake\\tecmakewin.mak:1814: dep/cd.dep.dllw6_64] Error 255\n</code></pre>\n"^^ . . . "Maybe `vec = {math.cos(math.rad(angle)), math.sin(math.rad(angle))}` as X and Y? Normally it's much easier to store angles in radians, not degrees."^^ . . "0"^^ . . . . "<p>I've been searching for an algorithm that can do array compaction with the least amount of movement of items. I know I can't go below O(N) and that's fine, but I'm not sure if even that's doable.</p>\n<p>I'll use Lua for my examples. I assume -1 as my empty value as using nil will break the array part of the table in Lua (the array iteration only goes until it's first nil).</p>\n<p>This is the desired outcome:</p>\n<pre class="lang-lua prettyprint-override"><code>local arr = {1,3,4,-1,6,-1,8,-1,-1}\ncompact(arr)\n-- arr: {1,3,4,8,6}\n</code></pre>\n<p>As you can see we only moved one item, <code>8</code> from it's old index 7 (lua uses 1-based indices) to it's new index 4.</p>\n<p>I tried a few stuff, like iterating the array backwards, setting every -1 to nil (which is deleting that element) and keeping a hash map of free spots in the array that I can fetch so I can still do O(N). Unfortunately that didn't quite work.</p>\n"^^ . . . "<p>It won't work as such, since table.unpack works with numbered indices. In other words,</p>\n<pre><code>local name, age = unpack(person)\n</code></pre>\n<p>is mostly equivalent to:</p>\n<pre><code>local name, age = person[1], person[2]\n</code></pre>\n<p>There is no built-in unpacking function for named keys. So you just have to write it explicitly as:</p>\n<pre><code>local name, age = person.name, person.age\n</code></pre>\n<p>Note that there is no correspondance between number and string keys at all. When you write:</p>\n<pre><code>local t = { x = true }\n</code></pre>\n<p>You cannot refer to <code>t.x</code> or <code>t['x']</code> with <code>t[1]</code>. They are in completely separate table slots.</p>\n"^^ . ".net"^^ . "0"^^ . "2"^^ . . . . . "0"^^ . . "Getting the key a value was assigned to in a table in lua"^^ . . . . "well I'm trying to make my own script because I do not have access to Plugins or Built In Roblox Code due to me using roblox studio Mobile (Studio Lite) so I cant really get a good script"^^ . . . "So you cannot save the UI, but you can save a representation of the UI, or just enough information so you can recreate the UI later. If you have a TextLabel that says, "you have 5 apples", you don't need to save the whole TextLabel, just that you have 5 apples, or maybe just the number 5. It might be worth taking some time to think about what values are worth saving, then look into how you can use [DataStoreService](https://create.roblox.com/docs/reference/engine/classes/DataStoreService) to save and retrieve those values later."^^ . "libreoffice"^^ . . "0"^^ . . . . . "0"^^ . "<p>I have a simple project where I'm making a card battling game. The battle sequence looks like this:</p>\n<pre class="lang-lua prettyprint-override"><code> repeat\n\n BattleClient.PlayerAttackTween()\n task.wait(battleSpeed)\n BattleClient.EnemyAttackTween()\n task.wait(battleSpeed)\n battleRound += 1\n\n until isInBattle.Value == false\n</code></pre>\n<p>The issue I'm having is that if the player starts another battle right after finishing one, this loop is still in the middle of a <code>task.wait()</code> and has not yet gotten to the <code>until</code> check to break the loop, so the tweens play double during that second fight.</p>\n<p>How do I prevent this from happening?</p>\n<p>Edit: <a href="https://github.com/SkitBoies/rblxvid" rel="nofollow noreferrer">Video showcasing issue</a></p>\n"^^ . . "love2d"^^ . "But realistically, that values stored on a client _shouldn't_ be the "source of truth". In many client-server arrangements, there is a common saying that you should "never trust the client". If a client can tell the server, "please save my 5 apples for me", then the client can also tell the server "please save my 9 million apples for me". So you should try to keep the data you want to save on the server. You can let the client display the number for you, but the server should be responsible for its true value."^^ . . "5"^^ . "What is the full error message (from output panel), the one from error panel is mostly a resume."^^ . . "0"^^ . "0"^^ . . . "If the input is `<pre><code>foo</code></pre>`, then you can just use `pandoc -f html -t gfm`, no filter necessary. Play around with the `-t native` option or have a look at the manual to see the difference between "code block" and "inline code"."^^ . . "edk2"^^ . . "<p>Most importantly, if you declared the method <code>add()</code> with a semicolon, so you should invoke it: <code>ovenTime:add (.5)</code>, not <code>ovenTime.add (.5)</code>.</p>\n<p>With other small improvements:</p>\n<p><code>timer.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>local copyTable = require 'Helpers.copyTable'\n\nlocal timer = { max = 0, time = 0 }\n\nfunction timer:add (dt)\n self.time = self.time + dt\nend\n\nfunction timer:reset ()\n self.time = 0\nend\n\n-- serialisable &quot;decorator&quot;:\nlocal function serialisable (tbl)\n local meta = getmetatable (tbl) or {}\n meta.__tostring = function (tbl)\n return tostring (tbl.time)\n end\n return setmetatable (tbl, meta)\nend\n\nreturn serialisable (copyTable (timer))\n</code></pre>\n<p>and the calling program:</p>\n<pre class="lang-lua prettyprint-override"><code>ovenTime = require 'timer'\n\novenTime:add (.5) -- note ':' instead of '.'.\n\nprint (ovenTime) -- it will output '0.5', not 'table: 0x...'\n</code></pre>\n<p>And some further simplifications of <code>timer.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>-- serialisable 'decorator':\nlocal function serialisable (tbl)\n local meta = getmetatable (tbl) or {}\n meta.__tostring = function (tbl)\n return tostring (tbl.time)\n end\n return setmetatable (tbl, meta)\nend\n\nreturn serialisable {\n time = 0,\n max = 0,\n add = function (self, dt)\n self.time = self.time + dt\n end,\n reset = function (self)\n self.time = 0\n end\n}\n</code></pre>\n<p>And finally, a solution that allows several independent timers, since that is what you seem to want, since you deep copied tables:</p>\n<p><code>timer.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>-- serialisable 'decorator':\nlocal function serialisable (tbl)\n local meta = getmetatable (tbl) or {}\n meta.__tostring = function (tbl)\n return tostring (tbl.time)\n end\n return setmetatable (tbl, meta)\nend\n\nreturn function ()\n return serialisable {\n time = 0,\n max = 0,\n add = function (self, dt)\n self.time = self.time + dt\n end,\n reset = function (self)\n self.time = 0\n end\n }\nend\n</code></pre>\n<p>and its caller:</p>\n<pre class="lang-lua prettyprint-override"><code>local timer = require 'timer'\nlocal ovenTime = timer ()\novenTime:add (.5)\nprint (ovenTime)\n</code></pre>\n"^^ . . "1"^^ . "Thanks for all the help, finally feels like getting somewhere... I split the code, stored the target in a ngx variable, was able to get it in the balancer_by_lua_block on the upstream and manage to split the traffic between the 2 servers...\nI updated the question with the second block... The problem now is that when i drop the second server, the "err" variable seems to not identify the connection refused error and "ok" variable is always true... So it never sends the request for the first server in case of faillure... I tried to log the values so i can see whats happening."^^ . . "0"^^ . . . "0"^^ . . "Hi, i think i just figure out how to do it and it worked... i checked nginx lua documentation and found a socket method... I implemented a ngx.socket.tcp() check on the ip / port and this one identifies the connection refused... With this i can change the target and redirect to the one working... Thanks for all the help, i really got to understand better how to do stuff, the phases, etc...."^^ . "2"^^ . "2"^^ . "2"^^ . . . . . . "1"^^ . "0"^^ . . . . "<p>Deep unpack table:</p>\n<pre class="lang-lua prettyprint-override"><code>function unpackAll(...)\n local args = {...}\n local result = {}\n\n local function unpackNested(tbl)\n for _, v in ipairs(tbl) do\n if type(v) == &quot;table&quot; then\n unpackNested(v)\n else\n table.insert(result, v)\n end\n end\n end\n\n unpackNested(args)\n return table.unpack(result)\nend\n</code></pre>\n<p>Example:</p>\n<pre><code>print(unpackAll({1,2,3},&quot;a&quot;))\n1 2 3 a\n</code></pre>\n"^^ . "From https://premake.github.io/docs/Tokens/#path-in-commands, paths in prebuild commands should be surrounded by `%[..]`; `{MKDIR}` should work for both BTW, `--shell=cmd`/`--shell=posix` might help."^^ . "0"^^ . . . "If you remove the`task.wait` call, does your code work normally?"^^ . "debug.getlocal: reading internal local variables"^^ . . . . . . . . . . "1"^^ . "0"^^ . . "<p>I try to remove nil from table, but table.remove() in lua 5.4 is strange:</p>\n<pre><code>a = { nil, -0.0227, nil, -0.1157, nil, 0.0191, 0.1476, nil, nil,nil, nil, 0.1714, nil, -0.0681};\n\nprint(&quot;table a size:&quot;,#a);\n\ntb_size = #a;\nfor j = tb_size,1,-1 do\n\n print(j,&quot;==&quot;, a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],&quot;tb size:&quot;,#a)\n\n if not a[j] then\n print(&quot;remove:&quot;,j,a[j]);\n table.remove(a,j);\n print(j,&quot;--&quot;, a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],&quot;tb size:&quot;,#a);\n end --if\n\nend --for\n</code></pre>\n<p>this code alwasy report error: bad argument #1 to 'remove' (position out of bounds), the table size will suddenly become 7 from 14.</p>\n<p><a href="https://i.sstatic.net/8KZUHITK.png" rel="nofollow noreferrer">enter image description here</a></p>\n<p>I try to remove nil from table , but table.remove() do not work , always report &quot;position out of bounds&quot;, what is wrong ??</p>\n"^^ . . "2"^^ . "<p>Like Python's <code>string.removeprefix(prefix)</code> or bash's <code>${string#&quot;$prefix&quot;}</code>, how can I similarly remove a known prefix from a string in lua?</p>\n<pre class="lang-lua prettyprint-override"><code>local str = 'onetwothree'\nlocal prefix = 'one'\nlocal suffix = removeprefix(str, prefix) --&gt; 'twothree'\n</code></pre>\n<p>It should only remove the prefix if the string starts with the prefix, if the string does not start with the prefix then it should return the unaltered string.</p>\n"^^ . . "1"^^ . . . . "<p>I'm trying to create a simple addon for vanilla wow with Lua, the very first task - is to initialise some UI and to call a function for initial configuration.</p>\n<p><code>MyAddonName.xml</code></p>\n<pre><code>&lt;Ui xmlns=&quot;http://www.blizzard.com/wow/ui/&quot;\n xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;\n xsi:schemaLocation=&quot;http://www.blizzard.com/wow/ui/ https://raw.githubusercontent.com/Gethe/wow-ui-source/live/Interface/AddOns/Blizzard_SharedXML/UI.xsd&quot;&gt;\n\n &lt;Frame name=&quot;MyAddonName&quot; parent=&quot;UIParent&quot;&gt;\n &lt;Size x=&quot;384&quot; y=&quot;512&quot; /&gt;\n\n &lt;Anchors&gt;\n &lt;Anchor point=&quot;CENTER&quot; relativePoint=&quot;CENTER&quot;\n relativeTo=&quot;UIParent&quot; /&gt;\n &lt;/Anchors&gt;\n\n &lt;Layers&gt;\n &lt;Layer level=&quot;BACKGROUND&quot;&gt;\n &lt;Texture name=&quot;$parent_Portrait&quot; parentKey=&quot;portrait&quot;\n file=&quot;Interface\\Icons\\INV_Misc_EngGizmos_30&quot;&gt;\n &lt;Size x=&quot;60&quot; y=&quot;60&quot; /&gt;\n &lt;Anchors&gt;\n &lt;Anchor point=&quot;TOPLEFT&quot;&gt;\n &lt;Offset x=&quot;7&quot; y=&quot;-6&quot; /&gt;\n &lt;/Anchor&gt;\n &lt;/Anchors&gt;\n &lt;/Texture&gt;\n &lt;/Layer&gt;\n &lt;/Layers&gt; \n\n &lt;Scripts&gt;\n &lt;OnLoad function=&quot;MyAddonName_OnLoad&quot; /&gt;\n &lt;/Scripts&gt;\n\n &lt;/Frame&gt;\n&lt;/Ui&gt;\n</code></pre>\n<p><code>MyAddonName.lua</code></p>\n<pre><code>function Print(msg, r, g, b)\n DEFAULT_CHAT_FRAME:AddMessage(&quot;|c0033ffccMyAddonName|r &quot;..msg..&quot;&quot;, r, g, b)\nend\n\nfunction MyAddonName_OnLoad(self)\n Print(&quot;loaded&quot;..tostring(self), 0, 1, 0) // &lt;- self exists\n\n self.items = {}\n\nend\n\nfunction MyAddonName_TestFunct()\n Print(MyAddonName.items) or Print(self.items) // &lt;- not exists, attempt to index field 'items' (a nil value)\n \nend\n</code></pre>\n<p><code>MyAddonName_TestFunct</code> will be called later, for test purpose I just called this from</p>\n<pre><code>/run MyAddonName_TestFunct()\n/run MyAddonName_TestFunct()\n</code></pre>\n<p>I assumed that <code>MyAddonName_OnLoad</code> with self will be called after addon is loaded from xml part where self is a table that represent instance of addon, and later on some event I can call <code>MyAddonName_TestFunct</code> with some initial value stored in a table accessible via <code>self</code>.</p>\n<p>I <strong>checked other addons</strong> (for example <a href="https://github.com/yutsuku/BetterCharacterStats/blob/master/BetterCharacterStats.lua" rel="nofollow noreferrer">BetterCharacterStats</a>) and there is a similar code, for example</p>\n<p><a href="https://github.com/yutsuku/BetterCharacterStats/blob/20fe849a2cc81d80290a03aa43f382aebbc05ec4/BetterCharacterStats.lua#L64" rel="nofollow noreferrer"><code>BetterCharacterStats.lua</code></a></p>\n<pre><code>function BCS:OnLoad() // `BCS:` means that self passed implicitly\n</code></pre>\n<blockquote>\n<p>I also noticed that <a href="https://github.com/yutsuku/BetterCharacterStats/blob/20fe849a2cc81d80290a03aa43f382aebbc05ec4/BetterCharacterStats.lua#L1" rel="nofollow noreferrer">table BSC created explicitly</a>, but thus I have <code>self</code> during check - this is not needed for me.</p>\n</blockquote>\n<p>----</p>\n<p><a href="https://drive.google.com/file/d/16asigzq8LbeDFfQLLdecgVVD8XFz2Fgt/view?usp=share_link" rel="nofollow noreferrer">Here is a more complete example </a>that I tested (with more code) - I'm trying to follow some tutorial, result now a bit different</p>\n<p>And this is result of prints</p>\n<p><a href="https://i.sstatic.net/7o68LMLe.png" rel="nofollow noreferrer">Image of output</a></p>\n<p>Can anyone suggest where I'm wrong?</p>\n"^^ . . . "How do I change leaderstats from my other script?"^^ . "1"^^ . . . . . "[Why should I not upload images of code/data/errors?](https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors)"^^ . . . . "check console if it says anything."^^ . . . . "2"^^ . . "0"^^ . "Unique keyboard layout per client"^^ . "<p>Why does the <code>table.unpack()</code> function print the unpacked table only if there is nothing following the function?</p>\n<pre><code>&gt; print(table.unpack({1,2,3}))\n1 2 3\n\n&gt; print(table.unpack({1,2,3}),&quot;a&quot;) -- expecting: 1 2 3 a\n1 a\n\n&gt; print(&quot;a&quot;,table.unpack({1,2,3}))\na 1 2 3\n</code></pre>\n<p>Background:\nI am trying to create a recursive function that unpacks a table, inserts a value, and repacks it to return a table with the new value. This works when you do something like <code>table.pack(&quot;a&quot;, table.unpack({1,2,3}))</code> but not when you do <code>table.pack(table.unpack({1,2,3}), &quot;a&quot;)</code>.</p>\n"^^ . . "@iakobski: I have just added a minimal structure at the bottom. It does not make a big difference. My problem is still not being able to access elements without quotes"^^ . "<p>I am making a tycoon game on Roblox. I have a dropper that drop parts when they come to the cube that destroys them they destroy, but now I want so when they touch this 'cube' the cash in leaderstats will change by 5.</p>\n<p>Here is the code</p>\n<pre><code>local values = script.Parent.Parent.Parent.Parent.Values\n\nscript.Parent.Touched:Connect(function(hit)\n if hit.Name == &quot;DropperPart&quot; and hit:IsA(&quot;BasePart&quot;) then\n values.Money.Value += hit:FindFirstChild(&quot;CashValue&quot;).Value\n hit:Destroy()\n end\nend)\n</code></pre>\n"^^ . "Lua functions for conky doesn't update independently"^^ . "<p>This is almost a purely mathematical problem.</p>\n<p>Ellipse centered on a focus in polar coordinates is</p>\n<pre><code>ρ = ep / (1 - ecos(θ - Δ))\n</code></pre>\n<p><code>(ρ, θ)</code> is a point on the ellipse</p>\n<p><code>e</code> is the eccentricity, calculated from <code>c / a</code></p>\n<p><code>Δ</code> is the rotation of ellipse (the angle from x-axis to the major axis of ellipse)</p>\n<p>Now you have 2 ellipses. The goal is to find 2 <code>θ</code> values that satisfy the following equation:</p>\n<pre><code>e₁p₁ / (1 - e₁cos(θ - Δ₁)) = e₂p₂ / (1 - e₂cos(θ - Δ₂))\n</code></pre>\n<p>Simplify this equation yields: (You need this formula: <code>cos(a - b) = cos(a)cos(b) + sin(a)sin(b)</code>)</p>\n<pre><code>(e₁p₁e₂sinΔ₂ - e₂p₂e₁sinΔ₁)sinθ + (e₁p₁e₂cosΔ₂ - e₂p₂e₁cosΔ₁)cosθ = e₁p₁ - e₂p₂\n</code></pre>\n<p>The simplified equation takes the form of <code>Asinθ + Bcosθ = C</code>, so we can use another formula</p>\n<pre><code>Asinθ + Bcosθ = sqrt(A² + B²)sin(θ + φ)\nφ = atan(b, a)\n</code></pre>\n<p>to calculate the value of <code>θ</code>.</p>\n<pre><code>θ = arcsin(C / sqrt(A² + B²)) - φ\n</code></pre>\n<hr />\n<p>Other tips you may need:</p>\n<ol>\n<li><p>To calculate the angle (<code>Δ</code>) between 2 vectors:</p>\n<pre><code>angle = arccos(dot(v₁, v₂) / sqrt(v₁² * v₂²))\n</code></pre>\n<p>The direction of rotation (from <code>v₁</code> to <code>v₂</code>) can be determined by: (&gt;0 means clockwise)</p>\n<pre><code>sign = v₁.x * v₂.y - v₁.y * v₂.x\n</code></pre>\n</li>\n<li><p>Since <code>math.asin</code> only returns values between <code>-π/2</code> to <code>π/2</code>, and since <code>sin(π-θ) = sin(θ)</code>, after getting one <code>θ</code>, the other one can be calculated using <code>π-θ</code></p>\n</li>\n<li><p>Here are the two points I calculated for verification (with the common focus as the origin)</p>\n<pre><code>rho, theta\nP1: 46.845589263185, 0.51139848585219\nP2: 24.79698629529, 3.5149426136911\n\nx, y\nP1: 40.852208863237, 22.926104431619\nP2: -23.088739743658, -9.044369871829\n</code></pre>\n</li>\n</ol>\n"^^ . . "<p>To answer your main question: to use a string value in a command in Neovim, you just use the string; however, it must be a well-formed Neovim command.</p>\n<p>Inferring from your function names and the use of the Neovim <a href="https://neovim.io/doc/user/tagsrch.html" rel="nofollow noreferrer"><code>tag</code></a> command, it seems like you want to perform a tag search to find the definition of some identifier. To do this, you would normally enter command mode from normal mode by pressing <code>:</code>, and then entering the following:</p>\n<pre><code>tag &lt;some_identifier&gt;\n</code></pre>\n<p>To do the same via Lua code in Neovim, you would call <code>vim.cmd</code> with the above as a string argument:</p>\n<pre><code>vim.cmd(&quot;:tag &lt;some_identifier&gt;&quot;)\n</code></pre>\n<p>In your case, you want to use the word under the current cursor position as the identifier to be searched for, thus, the function to be called becomes:</p>\n<pre><code>vim.cmd(&quot;:tag &quot; .. vim.fn.expand(&quot;&lt;cword&gt;&quot;)\n</code></pre>\n<p>Finally, you can map this function to the <code>&lt;leader&gt;-</code> key sequence via the following:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;-&quot;, function()\n vim.cmd(&quot;:tag &quot; .. vim.fn.expand(&quot;&lt;cword&gt;&quot;))\nend, { noremap = true, silent = true })\n</code></pre>\n<p>To address the second question regarding the unexpected symbol, the error comes from the call to <code>loadstring</code>. <code>loadstring</code> takes a chunk, compiles it, and returns a function that can be called to execute the chunk. In parsing the chunk passed in, Lua <em>unexpectedly</em> encounters the angle bracket as it is not apart of the language's syntax, hence the error. The solution is to only pass valid Lua syntax and well-formed strings to <code>loadstring</code>. However, you shouldn't need to use it in Neovim. Note that <code>loadstring</code> has been deprecated since Lua 5.2. You should now just use <code>load</code>.</p>\n"^^ . "1"^^ . . "0"^^ . . "0"^^ . . . . "1"^^ . "4"^^ . "1"^^ . "telescope.nvim"^^ . "0"^^ . "3"^^ . "0"^^ . . . . . "My advice is to write out the equations which express the constraints, and then look for ways to solve for T1 and T2. An algebraic solution would be great but maybe a numerical solution works for practical purposes. As it stands it looks to me like you've skipped a step -- I don't see the constraints, and instead you are going directly for a solution. Sometimes that's OK but speaking for myself, I try to work it out one step at a time, so I recommend that to you too."^^ . . . . "<p>The reason for this question is that the lib directory in the lgi's <a href="https://github.com/lgi-devs/lgi/blob/master/lgi/Makefile" rel="nofollow noreferrer">Makefile</a> is hardcoded as <code>/usr/local/lib/lua/5.1</code>.</p>\n<pre class="lang-none prettyprint-override"><code>PREFIX = /usr/local\nLUA_VERSION=5.1\nLUA_LIBDIR = $(PREFIX)/lib/lua/$(LUA_VERSION)\nLUA_SHAREDIR = $(PREFIX)/share/lua/$(LUA_VERSION)\n...\nmkdir -p $(DESTDIR)$(LUA_LIBDIR)/lgi\ncp $(CORE) $(DESTDIR)$(LUA_LIBDIR)/lgi\n</code></pre>\n<p>As you can see in the question, when you use it in another version of Lua, the directory it searches for is <code>/usr/local/lib/lua/5.3/lgi.so</code>, which resulted in the error. The solution can be to modify the value of <code>LUA_VERSION</code> in the Makefile, or copy the output file to the correct directory, or change <code>package.searchpath</code>.</p>\n"^^ . . . . "0"^^ . . "1"^^ . "Many tycoons have some kind of "Owner" value that refers to the player that owns it. It is usually set when a player touches a button that claims it and starts the whole process. Could you find the code that add it to your question?"^^ . . "Find two tangent points for given circle and two points inside the circle , Lua"^^ . . . . "<p>The <a href="https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return" rel="nofollow noreferrer"><code>return</code></a> directive is a part of <a href="https://nginx.org/en/docs/http/ngx_http_rewrite_module.html" rel="nofollow noreferrer"><code>ngx_http_rewrite_module</code></a>, which means it's executed <em>before</em> the access phase (see a diagram below), and, according to the nginx docs, it “Stops processing and returns the specified <code>code</code> to a client”, that is, the <code>access_by_lua_block</code> is not executed at all, see <a href="https://github.com/openresty/lua-nginx-module/issues/1119" rel="nofollow noreferrer">this issue</a>.</p>\n<p><a href="https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#rewrite_by_lua_block" rel="nofollow noreferrer"><code>rewrite_by_lua_block</code></a> won't work either, as “this handler always runs after the standard ngx_http_rewrite_module”, that is, with <code>return</code> it also doesn't have a chance to be executed.</p>\n<p><a href="https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#set_by_lua_block" rel="nofollow noreferrer"><code>set_by_lua_block</code></a> runs before <code>return</code>, but the cosocket API is disabled in the context of this directive, which means <code>ngx.req.read_body()</code> won't work (<code>API disabled in the context of set_by_lua* [...] in function 'read_body'</code>).</p>\n<p>I would get rid of <code>return</code> and use <a href="https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#content_by_lua_block" rel="nofollow noreferrer"><code>content_by_lua_block</code></a> to read the request body and produce the response.</p>\n<p><a href="https://i.sstatic.net/90EFFsKN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/90EFFsKN.png" alt="enter image description here" /></a></p>\n"^^ . . "You can choose one you like: https://github.com/search?q=%22function+table.update%22+language%3Alua&type=code"^^ . . . "2"^^ . "<p>I am trying to build Lua for EDK2 but it fails with the following error.</p>\n<pre><code>/home/dave/dev/edk2libc/edk2-libc/AppPkg/Applications/Lua/src/ldo.c: In function ‘luaD_throw’:\n/home/dave/dev/edk2libc/edk2-libc/AppPkg/Applications/Lua/src/ldo.c:122:1: error: ‘noreturn’ function does return [-Werror]\n 122 | }\n | ^\n</code></pre>\n<p>In the answers to the following post <a href="https://stackoverflow.com/questions/43624089/lua-efi-package-for-running-lua-in-efi-environment">Lua.efi package for running lua in EFI environment</a>; 'unixsmurf' mentions a <a href="https://lists.01.org/pipermail/edk2-devel/2017-April/010285.html" rel="nofollow noreferrer">patch</a> to avoid build errors but the link is broken, so perhaps I need that patch, anyone know where it may be?</p>\n<p>I am able to build the 'Hello' sample application without issue so my build environment seems ok.</p>\n"^^ . . . . "How to execute a Lua function after exiting insert mode in Neovim"^^ . . . . . "neovim-plugin"^^ . . . "0"^^ . . "0"^^ . . "0"^^ . "<p>This should work, but the custom styles must already exist in the reference odt.</p>\n<p>To create the reference ODT, first run</p>\n<pre class="lang-bash prettyprint-override"><code>pandoc --output=my-refdoc.odt --print-default-data-file=reference.odt\n</code></pre>\n<p>Edit the resulting file <code>my-refdoc.odt</code>, add the custom styles, and then pass the modified file to pandoc via <code>--reference-doc=my-refdoc.odt</code> when doint the conversion.</p>\n<p>The filter should set the <code>custom-style</code> attribute, so the code should use <code>{['custom-style'] = &quot;StrongEmphasis&quot;}</code>.</p>\n<p>Everything should work once those things are in place.</p>\n"^^ . "Kong Gateway: I got an error when I run docker-compose up"^^ . . "focus"^^ . "0"^^ . . "2"^^ . "0"^^ . "<p>I'm setting nginx as a load balance for web applications and in one of them we have to filter the last character of a document field to decide where to send that request. So I decided to set a flag &quot;target&quot; on the nginx location block to load/change it inside a lua script block with values 1 or 2 so I can use an IF inside the location block to proxy_pass to different upstreams.</p>\n<pre><code>location /payload-test\n{ \n set $target '0';\n\n content_by_lua_block {\n ngx.req.read_body()\n local body = ngx.req.get_body_data()\n if body then\n \n local document = string.sub(body, string.find(body, &quot;documentNumber&quot;) + 16, string.find(body, &quot;documentNumber&quot;)+30)\n ngx.print(document)\n local documentNum = string.match(document, &quot;%d+&quot;)\n ngx.print(documentNum)\n local lastDigit = string.sub(documentNum, string.len(documentNum))\n \n if math.fmod(lastDigit, 2) == 0 then\n ngx.var.target = &quot;1&quot;\n else\n ngx.var.target = &quot;2&quot;\n end\n \n ngx.print(ngx.var.target)\n end \n }\n\n #updated block\n if ($target = &quot;1&quot;) {\n proxy_pass http://port_23301;\n } \n if ($target = &quot;2&quot;) {\n proxy_pass http://port_23501;\n }\n}\n</code></pre>\n<p>The code itself works fine on lua, when I print the data, it shows the right info on Postman. The problem is that when I try to return the value of $target, nginx returns only the initial value &quot;0&quot; and not 1 or 2, set by lua block.</p>\n<hr />\n<p>After the sugestions, i split the code and created an access_by_lua_block, to be able to get the payload, extract the document and store it on ngx.ctx.target variable:</p>\n<pre><code>access_by_lua_block {\n ngx.req.read_body()\n local body = ngx.req.get_body_data()\n if body then \n \n local document = string.sub(body, string.find(body, &quot;documentNumber&quot;) + 16, string.find(body, &quot;documentNumber&quot;)+30)\n local documentNum = string.match(document, &quot;%d+&quot;)\n local lastDigit = string.sub(documentNum, string.len(documentNum))\n \n if math.fmod(lastDigit, 2) == 0 then\n ngx.ctx.target = &quot;1&quot;\n else\n ngx.ctx.target = &quot;2&quot;\n end\n end\n }\n</code></pre>\n<p>Then, on the upstream, i created a balancer_by_lua_block?</p>\n<pre><code> balancer_by_lua_block { \n local balancer = require('ngx.balancer')\n ngx.log(1,&quot;Target Variable: &quot;,ngx.ctx.target) \n\n if ngx.ctx.target == &quot;1&quot; then \n local ok, err = balancer.set_current_peer(&quot;192.168.72.133&quot;, &quot;23301&quot;)\n ngx.log(2,&quot;STATUS: &quot;,ok)\n ngx.log(2,&quot;ERROR: &quot;,err) \n if not ok then\n ok, err = balancer.set_current_peer(&quot;192.168.72.133&quot;, &quot;23502&quot;)\n end \n else \n local ok, err = balancer.set_current_peer(&quot;192.168.72.133&quot;, &quot;23502&quot;)\n ngx.log(2,&quot;STATUS: &quot;,ok)\n ngx.log(2,&quot;ERROR: &quot;,err)\n if not ok then\n ok, err = balancer.set_current_peer(&quot;192.168.72.133&quot;, &quot;23301&quot;)\n end\n end\n }\n</code></pre>\n<p>The nginx log says:</p>\n<pre><code>2024/10/29 09:58:30 [emerg] 3517796#3517796: *30 [lua] p_consult.conf:4):8: Target Variable: 2\n2024/10/29 09:58:30 [alert] 3517796#3517796: *30 [lua] p_consult.conf:4):26: STATUS: true\n2024/10/29 09:58:30 [alert] 3517796#3517796: *30 [lua] p_consult.conf:4):27: ERRO: nil\n2024/10/29 09:58:30 [error] 3517796#3517796: *30 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.72.199, server: 192.168.72.190\n</code></pre>\n"^^ . . "1"^^ . . "0"^^ . "0"^^ . "What are `player.Angle`, `player.Input` and `Vec2`? What are their values?"^^ . . "2"^^ . . . . . "<p>how to create a button that wakes up to delete a character from the memory of the database and replace it with the DataStorer character. The character is on this path.ReplicatedStorage.Characters.Common.Citizen.</p>\n<p>my problem is that the citizen is not saved to the DataStorer</p>\n<p>script button:</p>\n<pre><code>local button = script.Parent\nlocal Players = game:GetService(&quot;Players&quot;)\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\n\n-- Define the spawn location\nlocal spawnLocation = workspace:WaitForChild(&quot;SpawnLocation&quot;) -- Make sure you have a SpawnLocation part in your workspace\n\nbutton.MouseButton1Click:Connect(function()\n local player = Players.LocalPlayer\n local character = player.Character\n\n if character then\n character:Destroy()\n end\n\n -- Clone the new character and set it up\n local newCharacter = ReplicatedStorage.Characters.Common.Citizen:Clone()\n newCharacter.Name = player.Name -- Ensure the character has the player's name\n newCharacter.Parent = workspace\n player.Character = newCharacter\n\n -- Wait for the character to be set up before making adjustments\n newCharacter:WaitForChild(&quot;HumanoidRootPart&quot;)\n newCharacter:WaitForChild(&quot;Humanoid&quot;)\n\n -- Move the new character to the spawn location\n newCharacter:SetPrimaryPartCFrame(spawnLocation.CFrame)\n\n -- Set the camera to follow the new character\n workspace.CurrentCamera.CameraSubject = newCharacter:FindFirstChild(&quot;Humanoid&quot;)\n workspace.CurrentCamera.CameraType = Enum.CameraType.Custom\nend)\n</code></pre>\n<p>DataStorer_DataStore:</p>\n<pre><code>local DataStoreService = game:GetService(&quot;DataStoreService&quot;)\nlocal config = script:WaitForChild(&quot;datastore_config&quot;)\nlocal myDataStore = DataStoreService:GetDataStore(&quot;$Data$!&quot;..config:FindFirstChild(&quot;DataVersion&quot;).Value)\n\nlocal saving = config:FindFirstChild(&quot;Saving&quot;)\nlocal autoSave = config:FindFirstChild(&quot;AutoSave&quot;)\n\nlocal function create_table(plr)\n local player_stats = {}\n\n for _, folder in pairs(script:FindFirstChild(&quot;Plr&quot;):GetChildren()) do \n if folder:IsA(&quot;Folder&quot;) then\n print(folder)\n for _, stat in pairs(plr:FindFirstChild(folder.Name):GetChildren()) do\n player_stats[stat.Name..&quot; &quot;..folder.Name] = stat.Value\n end\n end\n end\n\n return player_stats\nend\n\nlocal function saveData(plr)\n local player_stats = create_table(plr)\n\n local succes, err = pcall(function()\n local key = plr.UserId..&quot;'s' Data&quot;\n myDataStore:SetAsync(key, player_stats)\n end)\n\n if succes then\n print(&quot;Saved Data Correctly!&quot;)\n else\n warn(err)\n end\nend\n\ngame.Players.PlayerAdded:Connect(function(plr)\n local key = plr.UserId..&quot;'s' Data&quot;\n local data = myDataStore:GetAsync(key)\n\n print(data)\n\n for _, folder in pairs(script:FindFirstChild(&quot;Plr&quot;):GetChildren()) do\n\n if folder:IsA(&quot;Folder&quot;) then\n\n local fc = folder:Clone()\n fc.Parent = plr\n\n if saving.Value == true then\n for _, item in pairs(fc:GetChildren()) do \n if data then\n item.Value = data[item.Name..&quot; &quot;..folder.Name]\n continue\n else\n warn(&quot;There is no data!&quot;)\n continue\n end\n end \n end\n end\n \n while autoSave.Value &gt; 0 do\n task.wait(autoSave.Value * 60)\n saveData(plr)\n print(&quot;Saved&quot;, data)\n end\n \n end\nend)\n\n\ngame.Players.PlayerRemoving:Connect(function(plr)\n if saving.Value == true then\n saveData(plr)\n end\nend)\n</code></pre>\n<p>The database contains all the data.</p>\n<p>If you need additional information, I will answer in the comments</p>\n"^^ . "Which version of premake5 do you use?"^^ . "installation"^^ . . . . . . "1"^^ . . . "3"^^ . . "destructuring"^^ . . . . "0"^^ . "0"^^ . . "0"^^ . "0"^^ . . . . . . "0"^^ . . . . . . "Thank you for patch, I have tried it but seems to fail with same error. The only way I can get it to build is to force the definition of `l_noret` to `void` in llimits.h. Any ideas?"^^ . . "0"^^ . . . . . . "0"^^ . . . "2"^^ . . "0"^^ . "Nope, you can use SDK-style projects with .NET Framework. [Here](https://learn.microsoft.com/en-us/dotnet/standard/frameworks#supported-target-frameworks) is a list of supported frameworks for the `TargetFramework` element."^^ . "the question is not about programming, but about the tool. can you edit the tags?"^^ . "1"^^ . . . . . . . "1"^^ . . . . "1"^^ . . . "trigonometry"^^ . . . "<p>I was just following the practice in the book.\nWhich is sth like:</p>\n<pre><code>a = {}\na.a = a\n\na.a.a.a = 3\n</code></pre>\n<p>It behaves normally at begin, until i found that</p>\n<p><strong>it's a.a == 3 , but not a == 3</strong></p>\n<p>could someone just tell me why</p>\n<p><em>my env:</em></p>\n<p><em>Linux 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux</em></p>\n<p><em>Lua 5.4.4 Copyright (C) 1994-2022 Lua.org, PUC-Rio</em></p>\n<pre><code>a = {}\na.a = a\nprint(a.a.a.a)\n\na.a.a.a = 3\nprint(a)\nprint(a.a)\nprint(a.a.a)\nprint(a.a.a.a)\n</code></pre>\n<p>and it's output is</p>\n<pre><code>table: 0x562c8c447fc0\ntable: 0x562c8c447fc0\n3\nlua5.4: main.lua:37: attempt to index a number value (field 'a')\nstack traceback:\n main.lua:37: in main chunk\n [C]: in ?\n</code></pre>\n"^^ . "How to compile IUP/CD/IM under mingw"^^ . . . . "0"^^ . "2"^^ . "<p>I am using <code>yt-dlp </code>in a Lua script to download and then recode a video to MP4 format. Here’s a simplified version of my Lua code:</p>\n<pre><code>local command = &quot;yt-dlp.exe --recode mp4 &lt;URL&gt;&quot;\nos.execute(command)\nprint(&quot;End&quot;)\n</code></pre>\n<p>The issue is that <code>&quot;End&quot;</code> gets printed as soon as <code>yt-dlp</code> finishes downloading, but before the <code>--recode mp4</code> operation completes. It appears that <code>os.execute</code> doesn’t wait for the recoding process to finish, only the initial download.</p>\n<p>How can I make sure that the Lua script waits until both the download and recode operations are fully completed before moving on to print <code>&quot;End&quot;</code>? Any suggestions for synchronizing this properly would be much appreciated!</p>\n<p>I tied this way but didn't bring any result</p>\n<pre><code>var = &quot;yt-dlp.exe --recode mp4 &lt;URL&gt;&quot;\nos.execute(var)\n\n-- Wait for the recode process to finish\nlocal recode_done = false\nwhile not recode_done do\n -- Check if there are any processes with &quot;ffmpeg&quot; or other expected recoding process names\n local handle = io.popen(&quot;tasklist /FI \\&quot;IMAGENAME eq ffmpeg.exe\\&quot;&quot;)\n local result = handle:read(&quot;*a&quot;)\n handle:close()\n\n -- If &quot;ffmpeg.exe&quot; isn't found in the task list, we assume recoding is complete\n if not result:find(&quot;ffmpeg.exe&quot;) then\n recode_done = true\n end\n\n -- Wait briefly before checking again\n os.execute(&quot;timeout /t 1 &gt;nul&quot;)\nend\n\nprint(&quot;End&quot;)\n</code></pre>\n<p>I've also searched on the internet for similar problems but I didn't get anything that could help.</p>\n"^^ . "1"^^ . . . "1"^^ . . . "0"^^ . "0"^^ . . . "Did you see https://neovim.io/doc/user/lua-guide.html#lua-guide-using-Lua already?"^^ . "0"^^ . "<p>I recently created script in Lua Macros.\nIt is supposed to disable second keyboard but it does not which in some programs result in shortcuts not working properly.</p>\n<p>This is the code.</p>\n<pre><code>lmc_assign_keyboard('MACROS');\nlmc_print_devices()\n\nlmc_set_handler('MACROS',function(button,direction)\n if (direction == 1) then return end\n lmc_minimize()\n print(button)\n\n if (button == 27) then -- ESC\n lmc_send_keys('^{Num0}',50)\n elseif (button == 112) then -- F1\n lmc_send_keys('^{NUM1}',50)\n elseif (button == 113) then -- F2\n lmc_send_keys('^{NUM2}',50)\n elseif (button == 114) then -- F3\n lmc_send_keys('^{NUM3}',50)\n elseif (button == 115) then -- F4\n lmc_send_keys('^{NUM4}',50)\n elseif (button == 116) then -- F5\n lmc_send_keys('^{NUM5}',50)\n elseif (button == 117) then -- F6\n lmc_send_keys('^{NUM6}',50)\n elseif (button == 118) then -- F7\n lmc_send_keys('^{NUM7}',50)\n end\nend\n)\n</code></pre>\n<p>I tried researching the problem on other forums but found nothing</p>\n"^^ . . "Using clang and trying to generate a visual studio solution with premake doesn't compile with "llvm-lib.exe exited with code 1""^^ . "Maybe it's how you run the file. Try saving that as fac.lua and running in a terminal `$ lua fac.lua`"^^ . . . . "2"^^ . . "0"^^ . . . . "1"^^ . . "As a work around, adding this to rsyslog.d/haproxy.conf works: if $programname == 'haproxy' then /var/log/haproxy.log & ~"^^ . . "1"^^ . . "0"^^ . "0"^^ . . "0"^^ . . "1"^^ . . . . "1"^^ . . . . "0"^^ . . "<p>No, there's no way to associate table fields (which are just string keys in a hash table) with local variables of the same name. You just have to be explicit and think of variables and table keys as two separate things.</p>\n"^^ . . "How can I parse a LuaTable in C#?"^^ . "0"^^ . . . "1"^^ . . "<p>Here is a cute trick. It does not set local variables but allows us to use table field as global variables:</p>\n<pre><code>local person = {\n name = 'James',\n age = 30,\n}\ndo\n local print = print\n _ENV = person\n print(name,age)\nend\n</code></pre>\n"^^ . "1"^^ . "1"^^ . "<p>I want to implement an asynchronous task scheduling. This is my code:</p>\n<pre class="lang-none prettyprint-override"><code>let gameTick = 0;\n\nconst tasks: Record&lt;string, Function[]&gt; = {};\n\nfunction sleep(t: number) {\n const targetTick = gameTick + t;\n if (!tasks[targetTick]) {\n tasks[targetTick] = [];\n }\n return new Promise&lt;void&gt;(resolve =&gt; {\n tasks[targetTick].push(resolve);\n });\n}\n\nasync function task1() {\n print('start task1');\n for (let i = 0; i &lt; 3; i++) {\n print(`execute: ${i}`);\n await sleep(2);\n }\n}\n\n// task1();\n\nfor (gameTick = 0; gameTick &lt; 10; gameTick++) {\n print(`tick: ${gameTick}`);\n tasks[gameTick]?.forEach(f =&gt; f())\n if (gameTick == 2) task1();\n}\n</code></pre>\n<p>This code behaves differently in the TypeScriptToLua environment and in the node.js environment, which confuses me.</p>\n<div class="s-table-container"><table class="s-table">\n<thead>\n<tr>\n<th style="text-align: center;"><a href="https://typescripttolua.github.io/play#code/FDA2FMBcAIHMEMC24AqBLAxga2gXmgAwDcIGA9gHYDOMk8VWVAXNAErjkBOAJgDw2c0FWABpoAMQCuFDJDSUA2gF0AfHmgBvAL4lgAM2mz5FaFQjgADgApILCpMQAjcJwCUm4NC-Ry1WvE5YKHRsdQRkEJwAamhIEm9oND1oKwBCOgYqBTpA4MwsJXcNTwTvDMZsgKDISKV1ZXjvLRKvTihJThMKcAB3aAAFTjJENCpwXgA3MjRuFSs2qjJQCfA8NWLSsvoKnOragDoLSSoAC3nwReXwV0avLRvgZuB6AE8ZaAMZOUpY7YBGKxFEoWQQUSBWADkNAC-gYfwhDy8ejInBSEBgaHUxES0F40AAzERElEokCEiChOCAAbgAAeHEkkHALAAJBo0FoqYjvPAevA0DAzOBLFYAEzc5pPAD0Ut+cMBumRqKs4VQ+SxRNVkVx0D+2K1+RJZO8FLBVipcmwrI0BuwnO5XnKWVtBQA-PslQBReAYM7JXBqPSA1wtRLJFVINWhXD4cVyrAAh5aIA" rel="nofollow noreferrer">TypeScriptToLua</a></th>\n<th style="text-align: center;"><a href="https://www.typescriptlang.org/play/?#code/GYVwdgxgLglg9mABABwE4zFAFAZyqgLkT3TAHMBKRAbwFgAoRJxCBHOAGwFMA6DuMrnwUGAXwYNuURGQCGAWy4AVGBADWiALyIADAG4J9VmDyIosnGpxEASl1aoAJgB4SGMgBpEAMXDR4YADaALoAfFo0ogb0DKCQsAjE3FzIWFBEYCDyAEZcqFR0jMzGpuaoZFxQKuoRcorVGgDUZtHMiDDAiFgAhOaWOIFlFVWqasEFDG1tfVaDsuWVDcERIa3M4kVMqJUgqEhgXADuiAAKqHDyMDhczgBucDCOoVjb7By3XFrhhVPMMwNDRajYI8ZAgHAACxeXDeHwoayYonhYkMFgAnpBEHF-IkZgBGLATIpoDDYADkeHm0nxZORRWAcFQXSk7Qi+lZzkQAGY9O1Go0iW0SZgsAADLgAD3sICgXCIABJqDBRKK6W1ZIdZDBpDhkqkAExqxAbDYMAD0ZrMFjUBLpsUZXTqylGbN5ToaiE5ePZ7tG-MFzGF2FFsHUCuovvUKqNTH+gUjYwA-DwGagAKKyCBQzqacLAQkiTbtTpYBNabSGq2WW3RURAA" rel="nofollow noreferrer">nodejs</a></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style="text-align: center;">tick: 0</td>\n<td style="text-align: center;">tick: 0</td>\n</tr>\n<tr>\n<td style="text-align: center;">tick: 1</td>\n<td style="text-align: center;">tick: 1</td>\n</tr>\n<tr>\n<td style="text-align: center;">tick: 2</td>\n<td style="text-align: center;">tick: 2</td>\n</tr>\n<tr>\n<td style="text-align: center;">start task1</td>\n<td style="text-align: center;">start task1</td>\n</tr>\n<tr>\n<td style="text-align: center;">execute: 0</td>\n<td style="text-align: center;">execute: 0</td>\n</tr>\n<tr>\n<td style="text-align: center;">tick: 3</td>\n<td style="text-align: center;">tick: 3</td>\n</tr>\n<tr>\n<td style="text-align: center;">tick: 4</td>\n<td style="text-align: center;">tick: 4</td>\n</tr>\n<tr>\n<td style="text-align: center;">execute: 1</td>\n<td style="text-align: center;">tick: 5</td>\n</tr>\n<tr>\n<td style="text-align: center;">tick: 5</td>\n<td style="text-align: center;">tick: 6</td>\n</tr>\n<tr>\n<td style="text-align: center;">tick: 6</td>\n<td style="text-align: center;">tick: 7</td>\n</tr>\n<tr>\n<td style="text-align: center;">execute: 2</td>\n<td style="text-align: center;">tick: 8</td>\n</tr>\n<tr>\n<td style="text-align: center;">tick: 7</td>\n<td style="text-align: center;">tick: 9</td>\n</tr>\n<tr>\n<td style="text-align: center;">tick: 8</td>\n<td style="text-align: center;">execute: 1</td>\n</tr>\n<tr>\n<td style="text-align: center;">tick: 9</td>\n<td style="text-align: center;"></td>\n</tr>\n</tbody>\n</table></div>\n<p>I can understand the process of TypeScriptToLua, which is equivalent to resuming the coroutine after resolve and immediately executing the code after await. But I don't understand NodeJs. Why does it continue to execute after the loop ends, and only execute once?</p>\n"^^ . . . . . . . . "1"^^ . . . "1"^^ . "docker"^^ . "intersection"^^ . "0"^^ . "0"^^ . . "1"^^ . . "Roblox Knockback Skipping Waypoint"^^ . "<p>I am at a complete loss with the syntax to parse a LuaTable. I have a table that follows the following structure:</p>\n<pre><code>mission = \n{\n [&quot;coalition&quot;] = \n {\n [&quot;blue&quot;] = \n {\n [&quot;bullseye&quot;] = \n {\n [&quot;y&quot;] = -378451.53125,\n [&quot;x&quot;] = -178644.117188,\n }, -- end of [&quot;bullseye&quot;]\n [&quot;country&quot;] = \n {\n [1] = \n {\n [&quot;plane&quot;] = \n {\n [&quot;group&quot;] = \n {\n [1] = \n {\n [&quot;hiddenOnPlanner&quot;] = false,\n [&quot;tasks&quot;] = {},\n [&quot;radioSet&quot;] = false,\n [&quot;task&quot;] = &quot;AFAC&quot;,\n [&quot;uncontrolled&quot;] = false,\n [&quot;hiddenOnMFD&quot;] = false,\n [&quot;taskSelected&quot;] = true,\n [&quot;route&quot;] = \n {..............\n</code></pre>\n<p>and I am doing the following in my Winforms C# application (just a button triggering this code to test):</p>\n<pre><code>private void button29_Click_1(object sender, EventArgs e)\n{\n Lua lua = new Lua();\n string s = File.ReadAllText(&quot;C:\\\\Users\\\\username\\\\Desktop\\\\mission&quot;);\n lua.DoString(s);\n var res = lua[&quot;mission.coalition.blue.country&quot;];\n var bluePlanes = lua[&quot;mission.coalition.blue.country.1&quot;];\n\n LuaTable tb = (LuaTable)res;\n Dictionary&lt;object, object&gt; dict = lua.GetTableDict(tb);\n Console.WriteLine(&quot;First chunk of code:&quot;);\n foreach (KeyValuePair&lt;object, object&gt; de in dict)\n {\n Console.WriteLine(&quot;{0} {1}&quot;, de.Key.ToString(), de.Value.ToString());\n }\n\n tb = (LuaTable)bluePlanes ;\n dict = lua.GetTableDict(tb);\n Console.WriteLine(&quot;Second chunk of code:&quot;);\n foreach (KeyValuePair&lt;object, object&gt; de in dict)\n {\n Console.WriteLine(&quot;{0} {1}&quot;, de.Key.ToString(), de.Value.ToString());\n }\n}\n</code></pre>\n<p>The first chunk works but as soon as I stumble upon one of the elements in square brackets without quotes (e.g. <code>[1]</code>) null is returned. I have checked that manually adding the quotes solves this, but In the Watch view, I can see there are keys and values, just that I cannot index those. Any suggestion?</p>\n<p>This is the console output:</p>\n<pre><code>First chunk of code:\n1 table\nException thrown: 'System.ArgumentNullException' in NLua.dll\nValue cannot be null.\n</code></pre>\n<p>However, the information is shown in the Watch window:\n[![Watch window screenshot][1]][1]</p>\n<p>Additionally, I thought of converting the table to JSON and using a C# class, but I cannot manage to do that from C# (tried using NLua to run a script in Lua that converts the table to JSON, but unsuccessfully, as I did not manage to reference the required Lua libraries)</p>\n<p>Edit: adding a minimal structure to show the issue as requested in comments</p>\n<pre><code> [&quot;coalition&quot;] = \n {\n [&quot;blue&quot;] = \n {\n [&quot;country&quot;] = \n {\n [1] = \n {\n }\n }\n }\n }\n\n\n</code></pre>\n<p>With this minimal structure, I am able to address up to coalition.blue.country, but would not be able to access the contenta under [1] which is the only element without double quotes\n[1]: <a href="https://i.sstatic.net/263XtjsM.png" rel="nofollow noreferrer">https://i.sstatic.net/263XtjsM.png</a></p>\n"^^ . . . . . "0"^^ . . "0"^^ . . "It seems you have to provide a [definition-file](https://luals.github.io/wiki/definition-files/)."^^ . . . . . "redis"^^ . . . . . "0"^^ . "1"^^ . "<p>I once fell in the same trap.</p>\n<blockquote>\n<p>When a multires expression is used in a list of expressions without\nbeing the last element, or in a place where the syntax expects a\nsingle expression, Lua adjusts the result list of that expression to\none element.</p>\n</blockquote>\n<p><em><a href="https://www.lua.org/manual/5.4/manual.html#3.4.12" rel="noreferrer">Lua 5.4 manual. 3.4.12 – Lists of expressions, multiple results, and adjustment</a></em>.</p>\n<p>So, <code>table.unpack(…)</code> or <code>...</code> should be last in a list of expressions.</p>\n<p>Perhaps, if you literally want to insert some values into a table, you could use <a href="https://www.lua.org/manual/5.4/manual.html#6.6" rel="noreferrer"><code>table.insert()</code></a>?</p>\n"^^ . . . "vector"^^ . . . "0"^^ . . . "<p>Here's where I set the callbacks:</p>\n<pre><code>GameWorld = love.physics.newWorld(0, 0, true)\nGameWorld:setCallbacks(self.contact)\n</code></pre>\n<p>Here's the contact method:</p>\n<pre><code>function thisScene:contact(a, b, coll)\n print(a, b, coll)\nend\n</code></pre>\n<p>Output: Fixture: 0x56e2fcb072a0 Contact: 0x56e2fd2d92e0 nil\nAs you can see a is a fixture while b is a contact.</p>\n<p>I was expecting a and b to be the two fixtures that collided and coll to be the contact.</p>\n<p>Love Version: 11.3\nThanks in advance!</p>\n"^^ . . "1"^^ . . . . . "0"^^ . . . "gtk3"^^ . . . "<p>I want the ability to filter markdown, from the command line with Pandoc, based on a passed-in list of classes. The rules would be:</p>\n<ul>\n<li>If an element has a class or classes that aren't in the passed-in list, it gets removed, including its whitespace.</li>\n<li>If the element has no class, it remains.</li>\n</ul>\n<p>The markdown I would use to test it would be something like this:</p>\n<pre><code>---\ntitle: Example doc\n---\n \n## Images\n\n![Generic image](generic_image.png)\n\n![Generic image](generic_image.png){width=30px}\n\n![Color only image](color_image.png){.color-only}\n\n![Color only image](color_image.png){.color-only width=30px}\n\n![Color only image](color_image.png){width=30px .color-only}\n\n![BW only image](bw_image.png){.bw-only}\n\n![BW only image](bw_image.png){.bw-only width=30px}\n\n![BW only image](bw_image.png){width=30px .bw-only}\n\n## Blocks\n\n::: {.other}\nBlock that shouldn't be filtered.\n:::\n\n:::\nBlock that shouldn't be filtered.\n:::\n\n::: {.color-only}\nColor only block.\n:::\n\n::: {.bw-only}\nBW only block.\n:::\n\n## Spans\n\n[Span that shouldn't be filtered]{.other}\n\n[Color only span]{.color-only}\n\n[BW only span]{.bw-only}\n\n## Links\n\n[Link that shouldn't be filtered](link.html)\n\n[Link that shouldn't be filtered](link.html){.other}\n\n[Color only link](link.html){.color-only}\n\n[BW only link](link.html){.bw-only}\n</code></pre>\n<p>I've tried to create a Lua filter, but I'm new to it, and I simply don't have the knowledge. Also, I'm guessing there is probably already a filter out there that does this, but I haven't found it. Can anyone point me in the right direction, please?</p>\n<p>Thanks</p>\n<p>I</p>\n"^^ . "go"^^ . "I updated my answer, you also need to mark longjmp in the stdlib package with the noreturn attribute."^^ . . "0"^^ . "0"^^ . "0"^^ . "0"^^ . . "0"^^ . "I'm not sure OP is looking to maintain relative order either since the question states "least amount of movement of items"."^^ . . . . . . . . . "Thank you.\nI understand now better. Now the issue is. I am trying to use this custom writer using the -t parameter. `pandoc -f html -t custom-writer01.lua input01.html` and it says `custom-writer01.lua does not contain a custom writer`"^^ . "Unpack table into same-named variables"^^ . . . . "0"^^ . "profiler"^^ . "0"^^ . "0"^^ . . . . . "Lua Wireshark dissector: decoding an Ethernet frame within a UDP-based custom tunneling protocol"^^ . . . . "macos"^^ . "0"^^ . . . "1"^^ . . . . "0"^^ . . "0"^^ . . . . . . "0"^^ . "1"^^ . "How to get VSCode's Love2D Support extension to recognize my path?"^^ . . "2"^^ . "filter to find and replace pattern in .tex before rendering to PDF in quarto"^^ . . "0"^^ . . . "0"^^ . "0"^^ . . . . . . "0"^^ . . . . . . . "how to detect another player from"^^ . . . "Neovim completion based on Lua table"^^ . . . . . . . . "0"^^ . . . "2"^^ . "macros"^^ . "zed"^^ . . . . . "0"^^ . . . . . . "0"^^ . "<p><code>nodemcu</code> <code>esp32-dev</code> branch cloned to <code>raspberry pi 5</code>. Firmware built with basic modules seems fine, bin files are produced and flashed to <code>espressif esp32-wroom-32</code> (also generic 32E, dev kit 1,...) using <code>esptool</code>. However adding <code>u8g2 for i2c</code> using make <code>menuconfig</code> and then make results in a missing <code>u8g2.ssd1306_i2c_128x64_noname</code>. Of note, the 3 fonts selected are present, e.g. <code>u8g2.font_6x10_tf</code>.</p>\n<p>Of possible interest, make shows this</p>\n<pre><code>/home/pi/esp32/nodemcu-firmware-esp32-241010a/components/modules/u8g2.c:617:12: warning: 'ldisplay_i2c' defined but not used [-Wunused-function]\n 617 | static int ldisplay_i2c( lua_State *L, display_setup_fn_t setup_fn )\n</code></pre>\n<p>Expecting something like this (from <code>esp8266</code>, but <code>chilipeppr esp32</code> static firmware would look similar and does work fine for this example)</p>\n<pre><code>for k,v in pairs(u8g2) do print(k,v) end\nssd1306_i2c_128x64_noname function: 0x4024c0b8\nuc1601_i2c_128x32 function: 0x4024c09c\nssd1306_i2c_128x32_univision function: 0x4024c080\nssd1305_i2c_128x32_noname function: 0x4024c064\nssd1306_128x64_noname function: 0x4024c0f8\nfont_6x10_tf lightfunction: 0x4027e800\nfont_unifont_t_symbols lightfunction: 0x4027c518\nDRAW_UPPER_RIGHT 1\nDRAW_UPPER_LEFT 2\nDRAW_LOWER_RIGHT 8\nDRAW_LOWER_LEFT 4\nDRAW_ALL 15\nR0 lightfunction: 0x4027f014\nR1 lightfunction: 0x4027f008\nR2 lightfunction: 0x4027effc\nR3 lightfunction: 0x4027eff0\nMIRROR lightfunction: 0x4027efe4\n</code></pre>\n<p>With <code>esp32</code> builds, I get this (missing display drivers)</p>\n<pre><code>for k,v in pairs(u8g2) do print(k,v) end\nfont_6x10_tf userdata: 0x3f40a51e\nfont_unifont_t_symbols userdata: 0x3f408236\nfont_chikita_tf userdata: 0x3f407ae5\nDRAW_UPPER_RIGHT 1\nDRAW_UPPER_LEFT 2\nDRAW_LOWER_RIGHT 8\nDRAW_LOWER_LEFT 4\nDRAW_ALL 15\nR0 userdata: 0x3f40ad30\nR1 userdata: 0x3f40ad24\nR2 userdata: 0x3f40ad18\nR3 userdata: 0x3f40ad0c\nMIRROR userdata: 0x3f40ad00\n</code></pre>\n<p>Searching the make listing shows things that may be of interest.</p>\n<pre><code>Including the following modules: FILE;GPIO;HTTP;I2C;NET;NODE;OW;PIPE;TMR;U8G2;UART;WIFI\nawk: line 2: function strtonum never defined\n</code></pre>\n<p>and these repeat for <code>RMT</code>, <code>sigma-delta</code>, <code>adc</code>, <code>dac</code>, <code>i2c</code></p>\n<pre><code>/home/pi/esp32/nodemcu-firmware-esp32-241010a/sdk/esp32-esp-idf/components/driver/deprecated/driver/i2s.h:27:2: warning: #warning &quot;This set of I2S APIs has been deprecated, please include 'driver/i2s_std.h', 'driver/i2s_pdm.h' or 'driver/i2s_tdm.h' instead. if you want to keep using the old APIs and ignore this warning, you can enable 'Suppress leagcy driver deprecated warning' option under 'I2S Configuration' menu in Kconfig&quot; [-Wcpp]\n 27 | #warning &quot;This set of I2S APIs has been deprecated, \\\n</code></pre>\n<p>I have tried builds with <code>i2c</code> and <code>spi</code> or <code>i2c</code> drivers alone</p>\n<p>Snippets from make menuconfig follow</p>\n<pre><code>[*] U8G2 module\n Displays ---&gt;\n Fonts ---&gt;\n\n[*] I2C ---&gt;\n[ ] SPI ----\n\n[*] ssd1306_i2c_128x32_univision\n[*] ssd1306_i2c_128x64_noname\n\n(font_6x10_tf,font_unifont_t_symbols,font_chikita_tf) Font list\n</code></pre>\n<p>Nodemcu Boot Header</p>\n<pre><code>NodeMCU ESP32 build 2024-11-07 03:38 powered by Lua 5.3.5 [5.3-int32-singlefp] on IDF v5.1.3\ncannot open init.lua: No such file or directory\n&gt; =node.heap()\n209168\n</code></pre>\n<p>Build Config</p>\n<pre><code>for k,v in pairs(node.info(&quot;build_config&quot;)) do print (k,v) end\nnumber_type float\nssl true\nesp_console uart\nlfs_size 262144\nmodules file,gpio,http,i2c,net,node,ow,pipe,tmr,u8g2,uart,wifi\n</code></pre>\n<p>Also <code>sdkconfig</code> deleted before the make <code>menuconfig</code>.</p>\n<p>Digging back through my notes, another possible clue is that during firmware build setup, I modified <code>components/modules/node.c</code> by replacing <code>BUILDINFO_LFS_SIZE</code> with 0 due to the following error during make (later changing to 256K)</p>\n<pre><code>/home/pi/esp32/nodemcu-firmware-esp32-241010a/components/modules/node.c: In function 'node_info':\n/home/pi/esp32/nodemcu-firmware-esp32-241010a/components/modules/node.c:475:45: error: expected expression before ',' token\n 475 | add_int_field(L, BUILDINFO_LFS_SIZE, &quot;lfs_size&quot;);\n...\nmake failed with exit code 2, output of the command is in the /home/pi/esp32/nodemcu-firmware-esp32-241010a/build/log/idf_py_stderr_output_7451 and /home/pi/esp 32/nodemcu-firmware-esp32-241010a/build/log/idf_py_stdout_output_7451\nmake[1]: *** [Makefile:18: all] Error 2\nmake[1]: Leaving directory '/home/pi/esp32/nodemcu-firmware-esp32-241010a'\nmake: *** [Makefile:10: all] Error 2\n</code></pre>\n"^^ . . . "Some lua runner extensions in VS Code will input some control characters on startup, here's a similar question: https://stackoverflow.com/questions/78816573/lua-attempt-to-perform-arithmetic-on-a-nil-value-local-answerquestion"^^ . . "firmware"^^ . "0"^^ . . . . "1"^^ . "I am old, but the math answers from https://math.stackexchange.com/ is not easy for me, sorry. It's not a homework, I'm trying to make Voronoi Diagram with round sweep line, I have some troubles there and in google was no simple solution."^^ . "<p>There might be a call to <code>setup(...)</code> somewhere in one of these file:</p>\n<ol>\n<li><code>require(&quot;core.plugin_config.treesitter&quot;)</code></li>\n<li><code>require(&quot;core.plugin_config.telescope&quot;)</code></li>\n</ol>\n<p>Double check for typos, maybe around <code>require('telescope').setup(...)</code></p>\n<p>If you post the content of these 2 files, and if they are too big, at least the lines around <code>setup()</code> would work.</p>\n"^^ . . "1"^^ . "3"^^ . "Angle to Normalized Vector seems to only be returning in 45 degree increments"^^ . "0"^^ . "0"^^ . . "0"^^ . "<p>I was looking at an online obfuscator (<a href="https://luaobfuscator.com/" rel="nofollow noreferrer">https://luaobfuscator.com/</a>) the other day, obfuscating the code <code>print(&quot;Hello, World&quot;)</code>. After obfuscating:</p>\n<pre><code>local v0=tonumber;local v1=string.byte;local v2=string.char;local v3=string.sub;local v4=string.gsub;local v5=string.rep;local v6=table.concat;local v7=table.insert;local v8=math.ldexp;local v9=getfenv or function() return _ENV;end ;local v10=setmetatable;local v11=pcall;local v12=select;local v13=unpack or table.unpack ;local v14=tonumber;local function v15(v16,v17,...) local v18=1;local v19;v16=v4(v3(v16,5),&quot;..&quot;,function(v30) if (v1(v30,2)==81) then v19=v0(v3(v30,1,1));return &quot;&quot;;else local v85=0;local v86;while true do if (v85==0) then v86=v2(v0(v30,16));if v19 then local v120=v5(v86,v19);v19=nil;return v120;else return v86;end break;end end end end);local function v20(v31,v32,v33) if v33 then local v87=0 -0 ;local v88;while true do if (v87==(0 -0)) then v88=(v31/(2^(v32-((1 + 0) -0))))%((4 -2)^(((v33-(620 -(555 + 64))) -(v32-(932 -(857 + 74)))) + (878 -(282 + 595)))) ;return v88-(v88%((2206 -(1523 + 114)) -(367 + 201))) ;end end else local v89=(929 -(214 + 641 + 72))^(v32-((1 -0) + 0)) ;return (((v31%(v89 + v89))&gt;=v89) and 1) or 0 ;end end local function v21() local v34=v1(v16,v18,v18);v18=v18 + 1 ;return v34;end local function v22() local v35,v36=v1(v16,v18,v18 + (1067 -(68 + 997)) );v18=v18 + (1272 -(226 + 1044)) ;return (v36 * (1114 -858)) + v35 ;end local function v23() local v37,v38,v39,v40=v1(v16,v18,v18 + (120 -(32 + 85)) );v18=v18 + 4 + 0 ;return (v40 * (3720433 + 13056783)) + (v39 * (66493 -(892 + (120 -55)))) + (v38 * (610 -354)) + v37 ;end local function v24() local v41=v23();local v42=v23();local v43=1 -0 ;local v44=(v20(v42,351 -(87 + 263) ,200 -(67 + 113) ) * ((2 + 0)^32)) + v41 ;local v45=v20(v42,51 -30 ,23 + 8 );local v46=((v20(v42,127 -95 )==(1 + 0)) and -(953 -(802 + (941 -(368 + 423))))) or 1 ;if (v45==(0 -0)) then if (v44==((0 -0) -0)) then return v46 * (0 + 0) ;else local v110=997 -(915 + 82) ;while true do if (v110==((18 -(10 + 8)) -0)) then v45=3 -2 ;v43=0 + 0 ;break;end end end elseif (v45==(2691 -644)) then return ((v44==(1187 -(1069 + 118))) and (v46 * ((2 -1)/(0 -0)))) or (v46 * NaN) ;end return v8(v46,v45-((620 -(416 + 26)) + 845) ) * (v43 + (v44/((3 -1)^52))) ;end local function v25(v47) local v48;if not v47 then local v90=0 -0 ;while true do if (v90==(0 + 0)) then v47=v23();if (v47==(0 -0)) then return &quot;&quot;;end break;end end end v48=v3(v16,v18,(v18 + v47) -1 );v18=v18 + v47 ;local v49={};for v65=439 -((575 -(44 + 386)) + 293) , #v48 do v49[v65]=v2(v1(v3(v48,v65,v65)));end return v6(v49);end local v26=v23;local function v27(...) return {...},v12(&quot;#&quot;,...);end local function v28() local v50=(function() return function(v91,v92,v93,v94,v95,v96,v97,v98) local v91=(function() return 1206 -(696 + 510) ;end)();local v92=(function() return;end)();local v93=(function() return;end)();while true do if (v91== #&quot;!&quot;) then if (v92== #&quot;]&quot;) then v93=(function() return v94()~=(0 -0) ;end)();elseif (v92==(1264 -(1091 + 171))) then v93=(function() return v95();end)();elseif (v92== #&quot;91(&quot;) then v93=(function() return v96();end)();end v97[v98]=(function() return v93;end)();break;end if (v91~=(0 + 0)) then else local v116=(function() return 0;end)();local v117=(function() return;end)();while true do if (v116~=(0 -0)) then else v117=(function() return 0 + 0 ;end)();while true do if ((0 + 0)==v117) then v92=(function() return v94();end)();v93=(function() return nil;end)();v117=(function() return 1;end)();end if ((255 -(163 + 91))~=v117) then else v91=(function() return #&quot;&gt;&quot;;end)();break;end end break;end end end end return v91,v92,v93,v94,v95,v96,v97,v98;end;end)();local v51=(function() return function(v99,v100,v101) local v102=(function() return 1930 -(1869 + 61) ;end)();while true do if (v102~=0) then else local v118=(function() return 0 + 0 ;end)();while true do if (v118~=(0 + 0)) then else v99[v100-#&quot;[&quot; ]=(function() return v101();end)();return v99,v100,v101;end end end end end;end)();local v52=(function() return {};end)();local v53=(function() return {};end)();local v54=(function() return {};end)();local v55=(function() return {v52,v53,nil,v54};end)();local v56=(function() return v23();end)();local v57=(function() return {};end)();for v67= #&quot; &quot;,v56 do FlatIdent_5ED46,Type,Cons,v21,v24,v25,v57,v67=(function() return v50(FlatIdent_5ED46,Type,Cons,v21,v24,v25,v57,v67);end)();end v55[ #&quot;asd&quot;]=(function() return v21();end)();for v68= #&quot;!&quot;,v23() do local v69=(function() return v21();end)();if (v20(v69, #&quot;&gt;&quot;, #&quot;:&quot;)~=(0 -0)) then else local v106=(function() return 0 + 0 ;end)();local v107=(function() return;end)();local v108=(function() return;end)();local v109=(function() return;end)();while true do if (v106~=(0 -0)) then else v107=(function() return v20(v69,204 -(14 + 188) , #&quot;91(&quot;);end)();v108=(function() return v20(v69, #&quot;0313&quot;,6);end)();v106=(function() return 1 + 0 ;end)();end if (v106~=1) then else v109=(function() return {v22(),v22(),nil,nil};end)();if (v107==(0 + 0)) then local v122=(function() return 0 + 0 ;end)();local v123=(function() return;end)();while true do if (v122==(0 + 0)) then v123=(function() return 0 -0 ;end)();while true do if ((0 -0)==v123) then v109[ #&quot;xxx&quot;]=(function() return v22();end)();v109[ #&quot;asd1&quot;]=(function() return v22();end)();break;end end break;end end elseif (v107== #&quot;&lt;&quot;) then v109[ #&quot;asd&quot;]=(function() return v23();end)();elseif (v107==2) then v109[ #&quot;-19&quot;]=(function() return v23() -((1476 -(1329 + 145))^16) ;end)();elseif (v107== #&quot;19(&quot;) then local v141=(function() return 971 -(140 + 831) ;end)();local v142=(function() return;end)();while true do if (v141~=(1850 -(1409 + 441))) then else v142=(function() return 718 -(15 + 703) ;end)();while true do if (v142==0) then v109[ #&quot;91(&quot;]=(function() return v23() -(2^16) ;end)();v109[ #&quot;.dev&quot;]=(function() return v22();end)();break;end end break;end end end v106=(function() return 1 + 1 ;end)();end if (v106~=(441 -(262 + 176))) then else if (v20(v108, #&quot;91(&quot;, #&quot;91(&quot;)~= #&quot;,&quot;) then else v109[ #&quot;0313&quot;]=(function() return v57[v109[ #&quot;xnxx&quot;]];end)();end v52[v68]=(function() return v109;end)();break;end if (v106~=(1723 -(345 + 1376))) then else if (v20(v108, #&quot;{&quot;, #&quot;~&quot;)== #&quot;,&quot;) then v109[690 -(198 + 490) ]=(function() return v57[v109[8 -6 ]];end)();end if (v20(v108,4 -2 ,2)== #&quot;|&quot;) then v109[ #&quot;91(&quot;]=(function() return v57[v109[ #&quot;gha&quot;]];end)();end v106=(function() return 3;end)();end end end end for v70= #&quot;\\\\&quot;,v23() do v53,v70,v28=(function() return v51(v53,v70,v28);end)();end return v55;end local function v29(v59,v60,v61) local v62=v59[397 -(115 + 281) ];local v63=v59[4 -2 ];local v64=v59[3 + 0 ];return function(...) local v71=v62;local v72=v63;local v73=v64;local v74=v27;local v75=2 -1 ;local v76= -(3 -2);local v77={};local v78={...};local v79=v12(&quot;#&quot;,...) -1 ;local v80={};local v81={};for v103=0,v79 do if (v103&gt;=v73) then v77[v103-v73 ]=v78[v103 + (868 -((2186 -(1373 + 263)) + 317)) ];else v81[v103]=v78[v103 + (1 -0) ];end end local v82=(v79-v73) + 1 ;local v83;local v84;while true do v83=v71[v75];v84=v83[1 -(1000 -(451 + 549)) ];if ((v84&lt;=(8 -5)) or (165&gt;=3492)) then if (v84&lt;=((91 + 195) -(134 + 151))) then if (v84==(1665 -(970 + 695))) then local v127=v83[3 -(1 -0) ];v81[v127](v81[v127 + (1991 -((977 -395) + 1408)) ]);else do return;end end elseif (v84==(6 -4)) then v81[v83[2]]=v61[v83[3 -0 ]];else do return;end end elseif ((3949&lt;4856) and (v84&lt;=5)) then if (v84==4) then local v130=v83[7 -(1389 -(746 + 638)) ];v81[v130](v81[v130 + (1825 -(1195 + 629)) ]);else v81[v83[2 -0 ]]=v83[244 -(71 + 116 + 54) ];end elseif (v84&gt;(786 -(162 + 618))) then v81[v83[2 + 0 ]]=v83[2 + 1 ];else v81[v83[3 -1 ]]=v61[v83[4 -1 ]];end v75=v75 + 1 + 0 ;end end;end return v29(v28(),{},v17)(...);end return v15(&quot;LOL!023Q0003053Q007072696E74030C3Q0048652Q6C6F2C20576F726C6400043Q0012023Q00013Q001205000100028Q000200012Q00033Q00017Q00&quot;,v9(),...);\n</code></pre>\n<p>I searched for any references to the print function but found none. Upon running the newly obfuscated code, though, the console still prints Hello, World.</p>\n<p>I tried looking up some infos on the Internet and what I found is just mainly about proxy functions, like for example</p>\n<pre><code>local p = print\np(&quot;Hello, World&quot;)\n</code></pre>\n<p>But the obfuscated code does not have any references to print to it, so I think the obfuscator have done something differently.</p>\n<p>Does anyone know how the code execute a built in function, in this case, print, without any (visible) references to it at all?</p>\n"^^ . . . . . . . . "How to fix Nvim 'E5113: Error while calling lua chunk'?"^^ . . . . "<p>Using the following code:</p>\n<pre><code>local keymap = vim.keymap\nlocal opts = { noremap = true, silent = true }\n\nfunction jumpToClassDef()\n local test1 = &quot;&quot;\n local myClass = &quot;&lt;cmd&gt; tag .&quot; .. vim.fn.expand('&lt;cword&gt;') .. &quot;&lt;cr&gt;&quot;\n assert(loadstring(myClass))\n return print(myClass)\nend\n\nkeymap.set(&quot;n&quot;, &quot;&lt;leader&gt;-&quot;, function() jumpToClassDef() end, opts)\n</code></pre>\n<p>When I place the cursor on <code>test1</code> and hit <code>&lt;leader&gt;-</code>, I receive the following error:</p>\n<pre><code>unexpected symbol near &lt;\n</code></pre>\n<p>Why does this error occur and how do I solve it?</p>\n"^^ . . "2"^^ . . . . . . . "0"^^ . "thanks @shingo, I couldn't find this issue, will write an answer for future readers."^^ . . "4"^^ . . . . . . . "@shingo I know, and I am asking about what that line should be to achieve reliable name-based destructuring"^^ . . . "0"^^ . . . . "<p>I assume he meant this <a href="https://edk2.groups.io/g/devel/message/19396" rel="nofollow noreferrer">patch</a>.</p>\n<p>You need to add the NORETURN attribute to</p>\n<ul>\n<li>LongJump: MdePkg/Include/Library/BaseLib.h</li>\n<li>InternalLongJump: MdePkg/Library/BaseLib/BaseLibInternals.h</li>\n</ul>\n<p>In addition to the changes in the patch, you also need to add it to:</p>\n<ul>\n<li>longjmp: StdLib/Include/setjmp.h</li>\n</ul>\n"^^ . . "<pre class="lang-lua prettyprint-override"><code>for i, creature in pairs(creatureArray)\n</code></pre>\n<p>When looping through a table or dictionary, it returns a key/value pair. The <code>i</code> is considered the key, and the <code>creature</code> is considered the value.</p>\n<p>Here's an example:</p>\n<pre class="lang-lua prettyprint-override"><code>local t = {\n [&quot;Item&quot;] = &quot;Value&quot;,\n [&quot;Another Item&quot;] = &quot;Another Value&quot;,\n}\n\nfor i, value in pairs(t) do\n print(i, value)\nend\n</code></pre>\n<p>The output would be:</p>\n<pre><code>Item Value\nAnother Item Another Value\n</code></pre>\n"^^ . . . . . ""_had problems with ownership and thread safety_" → What problems? Did your code fail to compile? With what error? Did your code compile but fail to run? With what error? Did your code compile and run but not do what you wanted? What did you expect and what did it do instead?"^^ . "<p>While playing around with debug.getlocal and debug.setlocal in Lua, i came across these constant values loaded at default. I've figured that the first is number of arguments passed into the file, the second is the userdata and the third seems to be some kinda of C function, which has a constant memory address of <code>004016f0</code>, calling it does nothing. The last is a bit weird, when there are no local variables defined before it returns a constant function at memory: <code>6c09e0d0</code>, this function cant be saved into a variable which is also quite weird.</p>\n<p>Can someone please explain this behavior? and what the functions may be?</p>\n<p>code:</p>\n<pre class="lang-lua prettyprint-override"><code>print(debug.getlocal(2, 1)) -- ARGS\nprint(debug.getlocal(2, 2)) -- USERDATA\nprint(debug.getlocal(2, 3)) -- CONSTANT C FUNC?\nprint(debug.getlocal(1, 1)) -- CONSTANT FUNC, IF NO LOCAL VARS\n\nlocal k, v = debug.getlocal(1, 1) -- NIL, NIL?\n\nlocal k2, v2 = debug.getlocal(2, 3)\nfor key, value in pairs(debug.getinfo(v2)) do\n print(key, value)\nend\n</code></pre>\n<p>output:</p>\n<pre><code>(C temporary) 2\n(C temporary) userdata: 00802290\n(C temporary) function: 004016f0\n(temporary) function: 6c09e0d0\nlastlinedefined -1\nfunc function: 004016f0\nftransfer 0\nistailcall false\nntransfer 0\nnamewhat\ncurrentline -1\nsource =[C]\nisvararg true\nshort_src [C]\nnparams 0\nwhat C\nnups 0\nlinedefined -1\n</code></pre>\n"^^ . . "<p>The <code>io.read(&quot;*n&quot;)</code> parses the number, but it does not consume the end-of-line symbol. So the next <code>io.read()</code> called to get the name - reads the rest of the line, which accidentally happens to be the empty line, because you've entered the number only. You can see this by entering <code>3 hello</code> when asked for a number of names, and then you will see the <code>hello</code> being the first name read.</p>\n<p>As a simple workaround you can try to change <code>maxNames = io.read(&quot;*n&quot;)</code> to <code>maxNames = io.read(&quot;*n&quot;, &quot;*l&quot;)</code>. The idea is to read the number, then read and discard the rest of the line.</p>\n"^^ . . . . "0"^^ . "1"^^ . "0"^^ . . . "wireshark"^^ . . "0"^^ . . . . "0"^^ . "0"^^ . . "<p>Teach me please how to make <a href="https://neovim.io/" rel="nofollow noreferrer">Neovim</a> execute a <a href="https://www.lua.org/" rel="nofollow noreferrer">Lua</a> function after exiting an insert mode.</p>\n"^^ . . . . "0"^^ . . "How to load multiline string with Lua load()?"^^ . "3"^^ . "nodemcu"^^ . "0"^^ . . "Filter out unwanted classes with Pandoc and Lua"^^ . . "0"^^ . "1"^^ . . . . "@Jarod42 I have implemented the filter "", and the %[] changes you recommended, --shell did not seem to work at all, giving invalid option when trying to provide it like so\n`premake5.exe --shell=posix gmake` as well as `premake5.exe gmake --shell=posix`\nI will be updating the post accordingly"^^ . "0"^^ . . "0"^^ . . . . "<p>The behavior of <code>table.remove</code> depends on the result of the length operator (<code>#</code>), which can be any non-nil index that is followed by a nil index. For performance reasons, Lua will not scan an entire table to find the largest non-nil index. In order to get well-defined results from <code>#</code> and the <code>table</code> library functions, you have to construct your arrays without nils in them.</p>\n<p>Relevant docs:</p>\n<ul>\n<li><a href="https://www.lua.org/manual/5.4/manual.html#pdf-table.remove" rel="nofollow noreferrer"><code>table.remove</code></a></li>\n<li><a href="https://www.lua.org/manual/5.4/manual.html#3.4.7" rel="nofollow noreferrer">The Length Operator</a></li>\n</ul>\n"^^ . "Thanks so much for the answer! I have been recently integrating some features into a main ModuleScript `TagFunction` that performs special unit abilities (such as knockback). The script chooses a target out of the enemy models that are currently alive. However, since knockback uses a class, I don't know how to call `OnKnockback` from just a model-I can't figure out how to access the class and its functions. Is this possible?"^^ . "@Someprogrammerdude not related"^^ . "`string.gsub` does almost any operations to delete parts of strings in `Lua` : `local suffix = str:gsub('^'..prefix,"") --> 'twothree'`"^^ . . . "0"^^ . "<p>Create the kong-gateway container using docker compose, got an error as follow:</p>\n<pre><code>[lua] globalpatches.lua:84: sleep(): executing a blocking 'sleep' (0.004 seconds), context: init_worker_by_lua*\n[lua] globalpatches.lua:84: sleep(): executing a blocking 'sleep' (0.002 seconds), context: init_worker_by_lua*\n[lua] globalpatches.lua:84: sleep(): executing a blocking 'sleep' (0.016 seconds), context: init_worker_by_lua*\n[lua] globalpatches.lua:84: sleep(): executing a blocking 'sleep' (0.008 seconds), context: init_worker_by_lua*\n[lua] warmup.lua:53: warming up DNS entries ..., context: ngx.timer\n[lua] warmup.lua:87: finished warming up DNS entries' into the cache (in 39ms), context: ngx.timer;\n</code></pre>\n<p>The kong-gateway command in docker compose file:</p>\n<pre><code>\nservices:\n networks:\n backend:\n\n postgres:\n ....\n ....\n ....\n\n kong:\n image: kong/kong-gateway\n platform: linux/amd64\n environment:\n - KONG_DATABASE=postgres\n - KONG_PROXY_ACCESS_LOG=/dev/stdout\n - KONG_ADMIN_ACCESS_LOG=/dev/stdout\n - KONG_PROXY_ERROR_LOG=/dev/stderr\n - KONG_ADMIN_ERROR_LOG=/dev/stderr\n - KONG_ADMIN_LISTEN=&quot;0.0.0.0:8001, 0.0.0.0:8444 ssl&quot;\n - KONG_PG_HOST=postgres\n - KONG_PG_USER=postgres\n - KONG_PG_PASSWORD=postgres\n - KONG_CASSANDRA_CONTACT_POINTS=postgres\n ports:\n - 8000:8000\n - 8001:8001\n - 8002:8002\n - 8443:8443\n - 8444:8444\n command:\n - kong\n - start\n - --vv\n restart: no\n networks:\n - backend\n</code></pre>\n<p>But there is no issue when creating the container directly using docker run command:</p>\n<pre><code> docker run \\\n -d \\\n --platform=linux/amd64 \\\n --name kong \\\n --network=test_backend \\\n -e &quot;KONG_DATABASE=postgres&quot; \\\n -e &quot;KONG_PROXY_ACCESS_LOG=/dev/stdout&quot; \\\n -e &quot;KONG_ADMIN_ACCESS_LOG=/dev/stdout&quot; \\\n -e &quot;KONG_PROXY_ERROR_LOG=/dev/stderr&quot; \\\n -e &quot;KONG_ADMIN_ERROR_LOG=/dev/stderr&quot; \\\n -e &quot;KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl&quot; \\\n -e &quot;KONG_PG_HOST=postgres&quot; \\\n -e &quot;KONG_PG_USER=postgres&quot; \\\n -e &quot;KONG_PG_PASSWORD=postgres&quot; \\\n -e &quot;KONG_CASSANDRA_CONTACT_POINTS=postgres&quot; \\\n -p 8000:8000 \\\n -p 8001:8001 \\\n -p 8002:8002 \\\n -p 8443:8443 \\\n -p 8444:8444 \\\n kong/kong-gateway\n</code></pre>\n<p>There is no issue with the Postgres container, and also the kong migrations (kong bootstrap).</p>\n<p>I created the 'kong' database manually in Postgres without any issue.\nAfter that manually run the kong migration using docker run, also no issue with this.</p>\n"^^ . . . . "0"^^ . "0"^^ . . . "Error compiling Lua's SDL.dll library using Visual Studio 2019"^^ . . "0"^^ . . "0"^^ . "0"^^ . "<p>I have a similar filter that appears to work -- there's a pretty frustrating hiccup, though, as I'll try to explain below.</p>\n<p>My method was to supply names of the classes that I want to keep, as a comma separated list, in a metadata argument to the pandoc cli. Inside the filter I parsed that list into a table using LPeg; I then applied a filter each to Blocks and Inlines elements, using that table to test inclusion.</p>\n<p>Given this filter (<code>classfilter.lua</code> on the <code>LUA_PATH</code>):</p>\n<pre><code>-- split arglist by lpeg, function as it appears on lpeg documentation:\n-- https://www.inf.puc-rio.br/~roberto/lpeg/\nlocal function split(s, sep)\n sep = lpeg.P(sep)\n local elem = lpeg.C((1 - sep) ^ 0)\n local p = lpeg.Ct(elem * (sep * elem) ^ 0) -- make a table capture\n return lpeg.match(p, s)\nend\n\nlocal keeplist = {}\n-- This function will go inside the Meta filter\n-- the keeplist table will be available to the rest\n-- of the filters to consult\nlocal function collect_vars(m)\n for _, classname in pairs(split(m.keeplist, &quot;,&quot;)) do\n keeplist[classname] = true\n end\nend\n\nlocal function keep_elem(_elem)\n -- keep if no class designation\n if not _elem.classes or #_elem.classes == 0 then\n return true\n end\n -- keep if class name in keeplist\n for _, classname in ipairs(_elem.classes) do\n if keeplist[classname] ~= nil then\n return true\n end\n end\n -- don't keep otherwise\n\n return false\nend\n\nlocal function filter_list_by_classname(_elems)\n for _elemidx, _elem in ipairs(_elems) do\n if not keep_elem(_elem) then\n _elems:remove(_elemidx)\n end\n end\n return _elems\nend\n\n-- forcing the meta filter to run first\nreturn { { Meta = collect_vars }, { Inlines = filter_list_by_classname, Blocks = filter_list_by_classname } }\n</code></pre>\n<p>-- and this pandoc cli command:\n<code>pandoc -f markdown -t markdown --lua-filter=classfilter.lua &lt;YOUR EXAMPLE INPUT&gt; -M 'keeplist=other,bw-only'</code></p>\n<p>-- I get the following output:</p>\n<pre><code>## Images\n\n![Generic image](generic_image.png)\n\n![Generic image](generic_image.png){width=&quot;30px&quot;}\n\n&lt;figure&gt;\n\n&lt;figcaption&gt;Color only image&lt;/figcaption&gt;\n&lt;/figure&gt;\n\n&lt;figure&gt;\n\n&lt;figcaption&gt;Color only image&lt;/figcaption&gt;\n&lt;/figure&gt;\n\n&lt;figure&gt;\n\n&lt;figcaption&gt;Color only image&lt;/figcaption&gt;\n&lt;/figure&gt;\n\n![BW only image](bw_image.png){.bw-only}\n\n![BW only image](bw_image.png){.bw-only width=&quot;30px&quot;}\n\n![BW only image](bw_image.png){.bw-only width=&quot;30px&quot;}\n\n## Blocks\n\n::: other\nBlock that shouldn't be filtered.\n:::\n\n::: Block that shouldn't be filtered. :::\n\n::: bw-only\nBW only block.\n:::\n\n## Spans\n\n[Span that shouldn't be filtered]{.other}\n\n[BW only span]{.bw-only}\n\n## Links\n\n[Link that shouldn't be filtered](link.html)\n\n[Link that shouldn't be filtered](link.html){.other}\n\n[BW only link](link.html){.bw-only}\n\n</code></pre>\n<p>... which appears to be the desired output, except the <code>&lt;figure&gt;</code> tags, which I haven't been able to remove. <em>Assuming</em> that my <code>Inline</code> filter removes only the <code>src</code> element from a <code>Figure</code>, and keeps the <code>caption</code> intact, I tried iterating over <code>Figure</code> and <code>Image</code> elements in a separate filter, to locate <code>Figure</code> blocks with empty <code>contents</code> fields, to replace them with an empty table -- but that didn't alter the result at all. I mean, adding the following to the <code>filter_list_by_classname</code> function before OR after the ipairs loop, with, OR without <code>traverse=&quot;topdown&quot;</code> inside the filter:</p>\n<pre><code>_elems:walk({\n Figure = function(a_figure)\n if not a_figure.content[1].content[1] then\n return {}\n else\n return a_figure\n end\n end\n})\n\n</code></pre>\n<p>made no difference.</p>\n<p>So maybe this could be the start of a solution.</p>\n"^^ . "0"^^ . . "visual-studio-code"^^ . . "5"^^ . . "My lua require statement fails to search the correct path. How can I modify the installation or my environment so that Lua require statements work?"^^ . "2"^^ . "0"^^ . "1"^^ . . . "`corelgilua51` not found in lgi lua"^^ . . . "0"^^ . . "1"^^ . "0"^^ . . . . "1"^^ . "2"^^ . "1"^^ . . . . . . . . . . . . "How to Disable Syntax Highlighting in LuaHelper While Keeping Debugger and Formatter Features?"^^ . . . "Just wanted to tell that all of the sudden i get same problem while jdtls -nvim worked just fine before. My guess is that something broke aomewhere around jdtls updated. I'm yet to figure out what is wrong."^^ . . . "0"^^ . "0"^^ . "<p>I wrote a code that when a player spawns in Roblox, immediately spawns him behind the wheel of my car model (that is, you do not need to press any extra keys). I took the car model from the Toolbox and placed it in Workspace (model ID 111087632034479). The car model itself has all the functionality for its operation.</p>\n<p>But I can not understand why when I try to move the car model from Workspace to ServerStorage or ReplicatedStorage, my script for automatically getting the player into the car stops working?</p>\n<pre><code>local Players = game:GetService(&quot;Players&quot;)\nlocal ReplicatedStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal Workspace = game:GetService(&quot;Workspace&quot;)\n\nlocal LOBBY_START_TIME = 5\nlocal MIN_PLAYERS = 1\n\nlocal carsFolder = Workspace:WaitForChild(&quot;Cars&quot;)\nlocal lobbySpawn = Workspace:WaitForChild(&quot;LobbySpawn&quot;)\n\nlocal function assignCarToPlayer(player)\n\n for _, car in pairs(carsFolder:GetChildren()) do\n if car:FindFirstChild(&quot;DriveSeat&quot;) and not car.DriveSeat.Occupant then\n\n local character = player.Character or player.CharacterAdded:Wait()\n if character and character:FindFirstChild(&quot;Humanoid&quot;) then\n local humanoid = character:FindFirstChild(&quot;Humanoid&quot;)\n\n\n character:SetPrimaryPartCFrame(car.DriveSeat.CFrame) \n\n\n car.DriveSeat:Sit(humanoid)\n\n print(player.Name .. &quot; seating in car!&quot;)\n break\n end\n end\n end\nend\n\n\nlocal function startGame()\n print(&quot;Game is started!&quot;)\n for _, player in pairs(Players:GetPlayers()) do\n assignCarToPlayer(player)\n end\nend\n\nlocal function waitForPlayers()\n while true do\n if #Players:GetPlayers() &gt;= MIN_PLAYERS then\n print(&quot;Enought players &quot; .. LOBBY_START_TIME .. &quot; seconds.&quot;)\n wait(LOBBY_START_TIME)\n startGame()\n break\n else\n print(&quot;Waiting Players... &quot; .. #Players:GetPlayers() .. &quot;/&quot; .. MIN_PLAYERS)\n end\n wait(1)\n end\nend\n\nPlayers.PlayerAdded:Connect(function(player)\n player.CharacterAdded:Connect(function(character)\n character:SetPrimaryPartCFrame(lobbySpawn.CFrame)\n end)\nend)\n\nwaitForPlayers()\n</code></pre>\n"^^ . "0"^^ . . "0"^^ . . . . . . "0"^^ . . . . "1"^^ . "<p>I am trying to use <a href="https://github.com/luvit/luv" rel="nofollow noreferrer">luv</a> to build an NES emulator plugin that can communicate with another process without pausing the game emulation. I had something that was working smoothly when I tested it by manually typing in input data, but when I went to test communicating with another process via a pipe, the lua script never seemed to receive any data.</p>\n<p>As a minimal reproducible example, use the following lua script:</p>\n<pre><code>local uv = require(&quot;luv&quot;)\nlocal stdin = uv.new_poll(1)\nstdin:start(&quot;r&quot;, function() print(&quot;uv callback&quot;) end)\nuv.run(&quot;once&quot;)\n</code></pre>\n<p>When I press enter manually, everything works as expected:</p>\n<pre class="lang-none prettyprint-override"><code>% lua-5.1 min.lua\n \nuv callback\n%\n</code></pre>\n<p>However, passing in a blank line from another program via a pipe does not appear to work:</p>\n<pre class="lang-none prettyprint-override"><code>% echo | lua-5.1 min.lua\n-- nothing happens, and lua-5.1 does not exit\n</code></pre>\n<p>I believe from additional testing that this is not a buffering issue: writing a program that manually flushes to put in place of <code>echo</code> and adding <code>io.stdin:setvbuf(&quot;no&quot;)</code> at the top of the lua script does not change the behavior. (In fact, experimentally it seems to somehow have attached directly to the terminal: pressing enter manually still causes the callback to run and the program to exit!)</p>\n<p>Why doesn't my script see the piped-in data, and how can I change it so that it does?</p>\n"^^ . "windows-subsystem-for-linux"^^ . . "0"^^ . "1"^^ . . "1"^^ . . . . . . "0"^^ . "0"^^ . . . "Embeding Lua with sol2 in C++ not working as intended with shared_ptr"^^ . . "-1"^^ . . . . . . . . . . "0"^^ . . . . "0"^^ . . . . . . "<p>From <a href="https://lua.org/manual/5.4/manual.html#pdf-table.insert" rel="nofollow noreferrer"><code>table.insert</code></a>, we can see that <code>table.insert(t, 42)</code> behaves as</p>\n<pre class="lang-lua prettyprint-override"><code>t[#t + 1] = 42\n</code></pre>\n<p>From <a href="https://lua.org/manual/5.4/manual.html#3.4.7" rel="nofollow noreferrer"><em>3.4.7 – The Length Operator</em></a>:</p>\n<blockquote>\n<p>The length operator applied on a table returns a border in that table. A border in a table t is any non-negative integer that satisfies the following condition:</p>\n<pre><code>(border == 0 or t[border] ~= nil) and\n(t[border + 1] == nil or border == math.maxinteger)\n</code></pre>\n<p>[ ... ]<br />\nA table with exactly one <em>border</em> is called a <em>sequence</em>.<br />\n[ ... ]<br />\nWhen t is a sequence, #t returns its only border, which corresponds to the intuitive notion of the length of the sequence. <strong>When t is not a sequence, #t can return any of its borders.</strong> (The exact one depends on details of the internal representation of the table, which in turn can depend on how the table was populated and the memory addresses of its non-numeric keys.)</p>\n</blockquote>\n<p>In other words, calling <code>table.insert</code> on tables with multiple borders, without specifying a position, will insert the value at an index determined by the internal representation of the table.</p>\n<p>Avoid this if <a href="https://en.wikipedia.org/wiki/Software_portability" rel="nofollow noreferrer">portability</a> is a concern. For example, on my system, the results of your program differ between the <a href="https://lua.org/versions.html#5.4" rel="nofollow noreferrer">reference implementation of Lua</a> and <a href="https://luajit.org/" rel="nofollow noreferrer">LuaJIT</a>.</p>\n<pre class="lang-none prettyprint-override"><code>$ lua -v\nLua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio\n$ luajit -v\nLuaJIT 2.1.1734355927 -- Copyright (C) 2005-2023 Mike Pall. https://luajit.org/\n$ diff &lt;(lua example.lua) &lt;(luajit example.lua)\n2c2\n&lt; t[2] = nil\n---\n&gt; t[2] = 10\n4c4\n&lt; t[4] = 10\n---\n&gt; t[4] = nil\n17,19c17,19\n&lt; x[3] = nil\n&lt; x[4] = 2\n&lt; x[5] = 10\n---\n&gt; x[3] = 2\n&gt; x[4] = 10\n&gt; x[5] = nil\n</code></pre>\n"^^ . . . "Why is this Lua code sending increasingly more messages per execution of the code?"^^ . "1"^^ . . "Passing a Model through a Remote Function"^^ . . . . . . "0"^^ . . . "2"^^ . "scripting"^^ . . . . . . . "<p>I was programming a Roblox game, and I need a timer that loops, and it must add to the money IntValue. I play tested the code, but it did not loop or add to the money value. How would I solve this problem? There aren't any errors occurring.\nHere's the code for the timer script. It is in a local script.</p>\n<pre><code>local minutes = 0\nlocal seconds = 15\n\nlocal player = game.Players.LocalPlayer\nlocal leaderstats = player:FindFirstChild(&quot;leaderstats&quot;)\nlocal money = leaderstats:FindFirstChild(&quot;Effect Coins&quot;)\n\nwhile true do\n for i = 1, 15 do\n wait(1)\n if seconds == 0 then\n minutes = minutes - 1\n secconds = 59\n else\n seconds = seconds - 1\n end\n \n if seconds &lt; 10 then\n script.Parent.Text = tostring(minutes)..&quot;:0&quot;..tostring(seconds)\n else\n script.Parent.Text = tostring(minutes)..&quot;:&quot;..tostring(seconds)\n end\n end\n \n money += 1\n minutes = 0\n seconds = 15\n \nend\n\n</code></pre>\n<p>I tried changing the value of the time lengths, but it doesn't seem to work.</p>\n"^^ . . . . . "1"^^ . . "module"^^ . "<p>lua-resty-openidc version 1.8.0\nOpenID Connect provider Spring Authotrization Server</p>\n<p>Question\nIn this code</p>\n<pre class="lang-lua prettyprint-override"><code>local state = resty_string.to_hex(resty_random.bytes(16))\n</code></pre>\n<p>When state will be set in session, should check session has already exists state?</p>\n<p>Expected</p>\n<ol>\n<li>When state has already in session, use it.</li>\n<li>When state not in session, generate a new and set in session.</li>\n</ol>\n<pre class="lang-lua prettyprint-override"><code>local function openidc_authorize(opts, session, target_url, prompt)\n local resty_random = require(&quot;resty.random&quot;)\n local resty_string = require(&quot;resty.string&quot;)\n local err\n\n -- generate state and nonce\n local state = resty_string.to_hex(resty_random.bytes(16))\n local nonce = (opts.use_nonce == nil or opts.use_nonce)\n and resty_string.to_hex(resty_random.bytes(16))\n local code_verifier = opts.use_pkce and b64url(resty_random.bytes(32))\n\n -- assemble the parameters to the authentication request\n local params = {\n client_id = opts.client_id,\n response_type = &quot;code&quot;,\n scope = opts.scope and opts.scope or &quot;openid email profile&quot;,\n redirect_uri = openidc_get_redirect_uri(opts, session),\n state = state,\n }\n\n if nonce then\n params.nonce = nonce\n end\n\n if prompt then\n params.prompt = prompt\n end\n\n if opts.display then\n params.display = opts.display\n end\n\n if code_verifier then\n params.code_challenge_method = 'S256'\n params.code_challenge = openidc_s256(code_verifier)\n end\n\n if opts.response_mode then\n params.response_mode = opts.response_mode\n end\n\n -- merge any provided extra parameters\n if opts.authorization_params then\n for k, v in pairs(opts.authorization_params) do params[k] = v end\n end\n\n -- store state in the session\n session:set(&quot;original_url&quot;, target_url)\n session:set(&quot;state&quot;, state)\n session:set(&quot;nonce&quot;, nonce)\n session:set(&quot;code_verifier&quot;, code_verifier)\n session:set(&quot;last_authenticated&quot;, ngx.time())\n\n if opts.lifecycle and opts.lifecycle.on_created then\n err = opts.lifecycle.on_created(session, params)\n if err then\n log(WARN, &quot;failed in `on_created` handler: &quot; .. err)\n return err\n end\n end\n\n local res\n res, err = session:save()\n if err then\n log(WARN, &quot;unable to save session: &quot; .. err)\n end\n\n -- redirect to the /authorization endpoint\n ngx.header[&quot;Cache-Control&quot;] = &quot;no-cache, no-store, max-age=0&quot;\n return ngx.redirect(openidc_combine_uri(opts.discovery.authorization_endpoint, params))\nend\n</code></pre>\n<p><a href="https://i.sstatic.net/2fBKJY4M.png" rel="nofollow noreferrer">lua-resty-oidc</a></p>\n"^^ . "What have you tried and what didn't work as expected? What you're showing is simply two functions with the same name. Maybe you wanted to write two functions? Maybe something else? Please clarify the problem you have encountered in your attempt."^^ . "<p>So i get this when i open a .java file when using my nvim setup like here: <a href="https://github.com/elmcgill/neovim-config/tree/main" rel="nofollow noreferrer">https://github.com/elmcgill/neovim-config/tree/main</a></p>\n<p>&quot;\nThere were issues reported with your <strong>which-key</strong> mappings.<br />\nUse <code>:checkhealth which-key</code> to find out more.\n&quot;\n&amp;\n&quot;\nNo LSP client found that supports vscode.java.resolveMainClass\n&quot;</p>\n"^^ . . . "1"^^ . "1"^^ . . . "0"^^ . . . "Attempt to call missing method of table"^^ . . "1"^^ . . . "<p>I am trying to configure Harpoon in Neovim to allow seamless navigation between files using <code>Ctrl-h</code>, <code>Ctrl-j</code>, <code>Ctrl-k</code>, and <code>Ctrl-l</code> keybindings. My goal is to replace the default numeric bindings (<code>&lt;leader&gt;1</code>, <code>&lt;leader&gt;2</code>, etc.) with these keys to switch between the first four files in the Harpoon list.</p>\n<p>Additionally, I want to bind <code>&lt;leader&gt;a</code> to add files to the Harpoon list and <code>&lt;leader&gt;o</code> to toggle the Harpoon menu. However, after configuring these bindings, they don’t seem to work as expected.</p>\n<h3>What I Tried</h3>\n<ol>\n<li><p>Installed Harpoon and added it to my <code>lazy.nvim</code> setup.</p>\n</li>\n<li><p>Configured the plugin and added the following keybindings:</p>\n<pre class="lang-lua prettyprint-override"><code>local harpoon_mark = require(&quot;harpoon.mark&quot;)\nlocal harpoon_ui = require(&quot;harpoon.ui&quot;)\n\n-- Add files to Harpoon\nvim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;a&quot;, harpoon_mark.add_file)\n\n-- Toggle Harpoon menu\nvim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;o&quot;, harpoon_ui.toggle_quick_menu)\n\n-- Navigate between files with Ctrl-h/j/k/l\nvim.keymap.set(&quot;n&quot;, &quot;&lt;C-h&gt;&quot;, function() harpoon_ui.nav_file(1) end)\nvim.keymap.set(&quot;n&quot;, &quot;&lt;C-j&gt;&quot;, function() harpoon_ui.nav_file(2) end)\nvim.keymap.set(&quot;n&quot;, &quot;&lt;C-k&gt;&quot;, function() harpoon_ui.nav_file(3) end)\nvim.keymap.set(&quot;n&quot;, &quot;&lt;C-l&gt;&quot;, function() harpoon_ui.nav_file(4) end)\n</code></pre>\n</li>\n<li><p>Opened two Lua files (<code>foo.lua</code> and <code>init.lua</code>) in Neovim.</p>\n</li>\n<li><p>Pressed <code>&lt;leader&gt;a</code> to add each file to the Harpoon list.</p>\n</li>\n<li><p>Tried navigating between them using <code>Ctrl-h</code> and <code>Ctrl-j</code>.</p>\n</li>\n</ol>\n<h3>What I Expected</h3>\n<p>So! The files would be added to Harpoon, and I could switch between them with <code>Ctrl-h</code> and <code>Ctrl-j</code>.</p>\n<h3>What Actually Happened</h3>\n<p>The <code>&lt;leader&gt;a</code> keybinding worked, and I could see the files in the Harpoon menu (opened with <code>&lt;leader&gt;o</code>). However, the navigation bindings (<code>Ctrl-h/j/k/l</code>) didn’t work. Instead of switching files, they either did nothing or conflicted with existing Neovim behavior for <code>Ctrl-h</code> and <code>Ctrl-l</code>.</p>\n"^^ . . . "0"^^ . . "game-development"^^ . . . . . . . . . . "1"^^ . . . . . "How to move in neovim insertmode"^^ . . . "<p>I'm trying to create a hierarchical UI in Lua. The following code is called with <code>local ui = UI:new()</code> and then <code>local w = ui.addWidget()</code>. But the child Widget doesn't inherit the <code>__tostring</code> metamethod of the parent &quot;class&quot; (UI). Printing it outputs the default string (&quot;table 0x...&quot;).</p>\n<p>What am I doing wrong here?</p>\n<pre><code>function UI:new()\n local o = {\n type = 'UI',\n x = 0,\n y = 0,\n widgets = {}\n }\n\n o.root = o\n\n setmetatable(o, self)\n self.__index = self\n self.__tostring = function()\n return 'whatever'\n end\n return o\nend\n\nfunction UI:addWidget(widget)\n local w = widget or UI.Widget:new()\n w.root = self.root\n table.insert(self.widgets, w)\n return w\nend\n\nUI.Widget = {}\nsetmetatable(UI.Widget, {__index = UI })\n\nfunction UI.Widget:new()\n local o = {\n type = 'UI.Widget',\n root = self,\n isEnabled = true,\n --- more fields...\n }\n\n setmetatable(o, self)\n self.__index = self\n return o\nend\n```\n</code></pre>\n"^^ . "dynamic"^^ . . "0"^^ . . . . . "2"^^ . "1"^^ . "<p>You can use the table interpreter within Lua to interpret your string using <code>load</code> (formerly known as <code>loadstring</code>):</p>\n<pre><code>local s = [[{a=&quot;foo&quot;, b=&quot;bar&quot;, c=12345}]]\nlocal t = load(&quot;return &quot;..s)()\nprint(t.a) -- foo\nprint(t.b) -- bar\nprint(t.c) -- 12345\n</code></pre>\n<p>This works as long as your table has the same syntax as a valid Lua table.</p>\n"^^ . . "coroutine"^^ . . . "1"^^ . . . "voronoi"^^ . "Freeswitch mask and unmask commands doesnt work when recording is started by lua script"^^ . "keyboard-layout"^^ . "lua"^^ . . . . . . "user-defined-functions"^^ . "HAProxy Lua: Loading Protobuf Modules with Dependencies"^^ . . "<p>The record UDF will be running entirely while holding a lock on the record. You therefore cannot have a record changed by another VM while inside a UDF that would read and then update the record. Hope this helps (I may have missed some subtleties of your specific use case).</p>\n"^^ . . . . . . . . "0"^^ . "I have tested few things by building a simple web app with oak and react. I am seeing some error messages like:\n```Cannot find module '@oak/oak' or its corresponding type declarations. [2307]```\nIf I am importing the package `import {} from "../.";`\nThe this run perfectly if I try to run the app but that annoying error is not going away.\nI trying the test my deno setup by making this project\nhttps://docs.deno.com/examples/create_react_tutorial/"^^ . "<p>From Lua, if the <a href="https://lua.org/manual/5.4/manual.html#6.10" rel="nofollow noreferrer"><code>debug</code></a> library is available, you can use <a href="https://lua.org/manual/5.4/manual.html#pdf-debug.getmetatable" rel="nofollow noreferrer"><code>debug.getmetatable</code></a> and <a href="https://lua.org/manual/5.4/manual.html#pdf-debug.setmetatable" rel="nofollow noreferrer"><code>debug.setmetatable</code></a> to change the <em>metatables</em> for non table types.</p>\n<p>As with any metatable, the <a href="https://lua.org/manual/5.4/manual.html#2.4" rel="nofollow noreferrer"><code>__index</code></a> metamethod can be used to make the object respond to key indexing.</p>\n<p>A cursory example. Note that in <code>debug.getmetatable(0)</code> and <code>debug.setmetatable(0, mt)</code>, <code>0</code> is a chosen as an arbitrary <a href="https://lua.org/manual/5.4/manual.html#2.1" rel="nofollow noreferrer"><em>number</em></a> value. Passing any <a href="https://lua.org/manual/5.4/manual.html#2.1" rel="nofollow noreferrer"><em>number</em></a> value to these functions will work to access the metatable for the type.</p>\n<pre class="lang-lua prettyprint-override"><code>local mt = debug.getmetatable(0) or {}\nlocal methods = {}\nmt.__index = methods \n\nfunction methods:clamp(lower, upper)\n if lower &gt; self then return lower end\n if upper &lt; self then return upper end\n return self\nend\n\ndebug.setmetatable(0, mt)\n\nfor i = 1, 5 do \n local n = math.random(100)\n print(n, n:clamp(33, 66))\nend \n</code></pre>\n<pre class="lang-none prettyprint-override"><code>88 66\n48 48\n46 46\n20 33\n70 66\n</code></pre>\n<hr />\n<p><sup>See Lua 5.4: <a href="https://lua.org/manual/5.4/manual.html#2.1" rel="nofollow noreferrer"><em>2.1 - Values and Types</em></a> | <a href="https://lua.org/manual/5.4/manual.html#2.4" rel="nofollow noreferrer"><em>2.4 – Metatables and Metamethods</em></a> | <a href="https://lua.org/manual/5.4/manual.html#6.10" rel="nofollow noreferrer"><em>6.10 – The Debug Library</em></a> </sup></p>\n"^^ . "<p>Go and NodeJS produced the same result, but not Lua. I want Lua to produce the same one.</p>\n<pre class="lang-golang prettyprint-override"><code>package main\n\nimport (\n &quot;crypto/ecdh&quot;\n &quot;encoding/base64&quot;\n &quot;log&quot;\n &quot;os&quot;\n\n &quot;github.com/joho/godotenv&quot;\n)\n\nfunc main() {\n _ = godotenv.Load()\n\n aDecodedPrivateKey, _ := base64.StdEncoding.DecodeString(os.Getenv(&quot;A_PRIVATE_KEY&quot;))\n bDecodedPrivateKey, _ := base64.StdEncoding.DecodeString(os.Getenv(&quot;B_PRIVATE_KEY&quot;))\n\n aPrivateKey, _ := ecdh.P256().NewPrivateKey(aDecodedPrivateKey)\n bPrivateKey, _ := ecdh.P256().NewPrivateKey(bDecodedPrivateKey)\n\n sharedSecret, _ := aPrivateKey.ECDH(bPrivateKey.PublicKey())\n\n log.Println(base64.StdEncoding.EncodeToString(sharedSecret))\n}\n</code></pre>\n<pre class="lang-js prettyprint-override"><code>require('dotenv').config()\n\nimport { createECDH } from 'crypto'\n\nconst aKey = createECDH('prime256v1')\nconst bKey = createECDH('prime256v1')\n\naKey.setPrivateKey(Buffer.from(String(process.env.A_PRIVATE_KEY), 'base64'))\nbKey.setPrivateKey(Buffer.from(String(process.env.B_PRIVATE_KEY), 'base64'))\n\nconsole.log(aKey.computeSecret(bKey.getPublicKey()).toString('base64'))\n</code></pre>\n<pre class="lang-lua prettyprint-override"><code>local openssl_pkey = require &quot;resty.openssl.pkey&quot;\nlocal openssl_bn = require &quot;resty.openssl.bn&quot;\nlocal ngx = require &quot;ngx&quot;\n\nlocal function ecdh()\n local a_decoded_key = ngx.decode_base64(a_private_key)\n local b_decoded_key = ngx.decode_base64(b_private_key)\n local a_bn = openssl_bn.new(a_decoded_key, 2)\n local b_bn = openssl_bn.new(b_decoded_key, 2)\n\n local a_key = openssl_pkey.new({\n type = &quot;EC&quot;,\n params = {\n private = a_bn,\n group = &quot;prime256v1&quot;\n }\n })\n local b_key = openssl_pkey.new({\n type = &quot;EC&quot;,\n params = {\n private = b_bn,\n group = &quot;prime256v1&quot;\n }\n })\n local b_public_key = openssl_pkey.new(b_key:to_PEM('public'))\n\n return ngx.encode_base64(a_key:derive(b_public_key))\nend\n</code></pre>\n<p>Please help me create the Lua version that produces the same result as Go and NodeJS.</p>\n<p>In case you need environment variables, take this <code>.env</code>.</p>\n<pre><code>A_PRIVATE_KEY=&quot;w2UwuwmF9h5p02fnr3MkxtKoDTl8aTtJXqLbsPwbqPg=&quot;\nB_PRIVATE_KEY=&quot;ZyoPMal0TZzNwDyUUE30iThXCKgPOthPaIN2qnOhkNs=&quot;\n</code></pre>\n<p>Here is my testing environment.</p>\n<ul>\n<li>Go 1.23.4</li>\n<li>NodeJS v22.12.0</li>\n<li>Lua 5.1</li>\n</ul>\n<p>References that might help.</p>\n<ul>\n<li><a href="https://github.com/fffonion/lua-resty-openssl?tab=readme-ov-file#restyopensslpkey" rel="nofollow noreferrer">https://github.com/fffonion/lua-resty-openssl?tab=readme-ov-file#restyopensslpkey</a></li>\n<li><a href="https://github.com/fffonion/lua-resty-openssl/blob/master/examples/x25519-dh.lua" rel="nofollow noreferrer">https://github.com/fffonion/lua-resty-openssl/blob/master/examples/x25519-dh.lua</a></li>\n</ul>\n<p>Thank you in advance.</p>\n"^^ . . . . . . "Also, luac can compile and combine multiple Lua scripts."^^ . "0"^^ . "Note that `[don't%(%)]` defines a *set* - a union of characters. It is equivalent to the set `[%)to'nd%(]`, or any other permutation of those characters. `[don't%(%)]?` matches *zero or one* of any single character in the set."^^ . "-2"^^ . . . "0"^^ . . "syntax-highlighting"^^ . . . . . "file"^^ . . "timer"^^ . . . "<ul>\n<li>The animation is owned by the group and the game is also owned by the\ngroup.</li>\n<li>I created the animation on a R6 rig and all the players in the\ngame is R6.</li>\n<li>The priority is set to the highest (action 4)</li>\n<li>The animation id is correct</li>\n<li>Animation is publish to roblox.</li>\n<li>The console says it's playing.</li>\n<li>Player is not doing the animation.</li>\n</ul>\n<pre><code>local Players = game:GetService(&quot;Players&quot;)\nlocal selectedPlayer = game:GetService('ReplicatedStorage'):WaitForChild(&quot;Events&quot;):WaitForChild(&quot;SelectedPlayer&quot;)\nlocal tool = script.Parent\nlocal blade = tool:WaitForChild('Blade')\nlocal slashAnim = tool:WaitForChild('SlashAnim')\nlocal debounce = false\nlocal playersHit = {}\nlocal COOLDOWN = 1\n\ntool.Activated:Connect(function()\n if debounce then\n return\n end\n\n local humanoid : Humanoid = tool.Parent:FindFirstChild(&quot;Humanoid&quot;)\n if not humanoid then\n warn(&quot;Humanoid not found in tool.Parent:&quot;, tool.Parent.Name)\n return\n end\n\n local animator : Animator = humanoid:FindFirstChild(&quot;Animator&quot;) or Instance.new(&quot;Animator&quot;, humanoid)\n local animTrack : AnimationTrack = animator:LoadAnimation(slashAnim)\n --animTrack:AdjustWeight(1)\n \n print(animator:GetPlayingAnimationTracks())\n\n repeat task.wait() until animTrack.Length &gt; 0\n animTrack:Play()\n print(&quot;Animaion ID: &quot;, animTrack.Animation.AnimationId)\n print(&quot;Animation Playing:&quot;, animTrack.IsPlaying)\n print(&quot;Animation Priority:&quot;, animTrack.Priority)\n\n debounce = true\n animTrack.Stopped:Wait() -- Wait for animation to complete\n debounce = false\nend)\n\nblade.Touched:Connect(function(hit)\n local humanoid = hit.Parent:FindFirstChild('Humanoid')\n\n if not humanoid or hit.Parent == tool.Parent or playersHit[hit.Parent] or not debounce then\n return\n end\n\n selectedPlayer:FireServer(humanoid)\n\n -- Prevents overloading server when player has activated tool\n playersHit[hit.Parent] = true \n task.wait(COOLDOWN)\n playersHit[hit.Parent] = nil\nend)\n</code></pre>\n<p>Console Prints this.</p>\n<pre><code>{\n [1] = ToolNoneAnim,\n [2] = Animation1,\n [3] = SlashAnim\n} - Client - WeaponScript:25\n\nAnimaion ID: rbxassetid://107803674678292 - Client - WeaponScript:29\nAnimation Playing: true - Client - WeaponScript:30\nAnimation Priority: Enum.AnimationPriority.Action4 - Client - WeaponScript:31\n</code></pre>\n"^^ . "1"^^ . . . "<p>In Lua, this error typically occurs with table mapping when the index or table property doesn't exist on the referenced class or table. Lua is a table-first language where almost all data types can be treated as tables. Let me explain why you're encountering this error:</p>\n<p>In <code>require(&quot;mysqloo&quot;)</code>, you're assuming that a table or function called <code>ASAPDriver</code> has a <code>MySQLQuery</code> property (e.g., <code>ASAPDriver = {};</code> <code>ASAPDriver.MySQLQuery = function(perform sql connection)</code>). Since your current library may not be well maintained, I recommend switching to a more actively maintained alternative.</p>\n<p>Example of such is <a href="https://github.com/FredyH/MySQLOO" rel="nofollow noreferrer">https://github.com/FredyH/MySQLOO</a></p>\n<p>You can use this library to query your MySQL connection and map the response to your UI or cache it in a global table.</p>\n<p>Also, check if <code>ASAPDriver</code> table exist at all in your codebase or the library. otherwise you another library to query mysql and cache the response in a table where you can use it across your application.</p>\n<p>Additionally, see if you follow the instruction as described here <a href="https://nodecraft.com/support/games/gmod/adding-mysqloo-to-your-gmod-server" rel="nofollow noreferrer">https://nodecraft.com/support/games/gmod/adding-mysqloo-to-your-gmod-server</a></p>\n"^^ . "Avante plugin won't generate Responses"^^ . . . "probability"^^ . . "0"^^ . "Sorry for the misunderstanding only the keys <C-l> and <C-h> does not work.\nAnd i tried all of what you said to debug it. i used - ghostty, kitty, xterm, cosmic term and none of them worked and i don't think it is a terminal issue. when i tried to delete the key map it caused error because they were not already mapped, and at last I was able to map <CS-l> and <CS-h> but not <C-h> and <C-l> for some reason. i think it might be a special case"^^ . . "4"^^ . . "2"^^ . "1"^^ . "0"^^ . . "1"^^ . . . "<p>That's a really overly complicated way to do it.</p>\n<p>In any case, the error lies in <code>ListConcat</code>. This function should return a new list, but you are actually modifying the first list and returning that one. This causes that <code>key1s</code> and <code>keys</code> will be identical. Which makes</p>\n<pre><code> if has_value(key1s, key) then\n</code></pre>\n<p>be true for all keys.</p>\n<p>A much simpler solution is to just do this</p>\n<pre><code>function TableConcat(t1, t2)\n local rtb = {}\n for k,v in pairs(t2) do\n rtb[k] = v\n end\n for k,v in pairs(t1) do\n rtb[k] = v\n end\n return rtb\nend\n\n</code></pre>\n"^^ . "4"^^ . . . "0"^^ . . . . "<p>In Swift, you can add methods to existing types using extensions, and in JavaScript, you can do the same using prototypes. How can I achieve a similar functionality in Lua?</p>\n<p>I want to add a clamp function to numbers.</p>\n<p>If this is not possible, please let me know.</p>\n"^^ . "0"^^ . . "0"^^ . . . . . . . "fusionpbx"^^ . . "0"^^ . . . "-1"^^ . . . . . . . . . "<p>Something to keep in mind is that objects created in LocalScripts only exist on the client and are not replicated, and Scripts execute on the server.</p>\n<p>So when you pass the Model reference with the RemoteEvent, the server has no idea what you are talking about because you are referencing a non-existing object in its eyes. And according to <a href="https://create.roblox.com/docs/scripting/events/remote#argument-limitations" rel="nofollow noreferrer">the docs</a> regarding the limitations of RemoteEvent arguments :</p>\n<blockquote>\n<p><strong>Non-Replicated Instances</strong></p>\n<p>If a RemoteEvent or RemoteFunction passes a value that's only visible to the sender, Roblox doesn't replicate it across the client-server boundary and passes nil instead of the value. For example, if a Script passes a descendant of ServerStorage, the client listening to the event will receive a nil value because that object isn't replicable for the client.</p>\n</blockquote>\n<p>That's why you are seeing <code>nil</code> when you try to print it out.</p>\n<p>So unless creating things on the client is a specific design decision, a better way to structure your code is to have the server create your tower for you, and your LocalScript just tells the server which tower to create and where.</p>\n<p>So in your LocalScript :</p>\n<pre class="lang-lua prettyprint-override"><code>-- tell the server to create a tower\nlocal tower = &quot;Boxer&quot;\ngame.ReplicatedStorage.SpawnTowerEvent:FireServer(tower, mouse.Hit.Position)\n</code></pre>\n<p>Then your Script finds which tower the client is talking about and creates it :</p>\n<pre class="lang-lua prettyprint-override"><code>game.ReplicatedStorage.SpawnTowerEvent.OnServerEvent:Connect(function(plr, towerName, pos)\n -- make sure that the requested tower actually exists\n local towerTemplate = game.ReplicatedStorage.Towers[towerName]\n if not towerTemplate then\n warn(string.format(&quot;Could not find a tower named %s&quot;, tostring(towerName))\n return\n end\n\n -- TO DO : make sure the player can create this kind of tower\n\n -- clone the tower into the workspace\n local towerToPlace = towerTemplate:Clone()\n towerToPlace:PivotTo(CFrame.new(pos))\n towerToPlace.Parent = workspace.Map.TowersToPlace\n print(towerName, &quot; created at &quot;, pos)\nend)\n</code></pre>\n"^^ . "1"^^ . . . . . . . "0"^^ . "3"^^ . . . . . "0"^^ . . "1"^^ . "0"^^ . . . . . "1"^^ . . "<p>Per the <a href="https://github.com/starwing/lua-protobuf/blob/master/README.md" rel="nofollow noreferrer">documentation</a>, <a href="https://github.com/starwing/lua-protobuf/blob/master/README.md#schema-loading" rel="nofollow noreferrer"><code>pb.load</code></a> accepts binary schema data, returning a boolean indicating success and, if applicable, the binary offset at which it failed parsing. A quick sanity check</p>\n<pre class="lang-lua prettyprint-override"><code>local res, off = pb.load([[\n syntax = &quot;proto3&quot;;\n message Request {\n string user_id = 1;\n int32 action = 2;\n }\n]])\n\nprint(res, off)\n</code></pre>\n<p>shows the results here to be <code>false, 6</code>.</p>\n<p>Use the <a href="https://github.com/starwing/lua-protobuf/blob/master/README.md#protoc-module" rel="nofollow noreferrer"><code>protoc</code></a> module to <em>compile</em> your schema. A very cursory example:</p>\n<pre class="lang-lua prettyprint-override"><code>local pb = require &quot;pb&quot;\nlocal protoc = require &quot;protoc&quot;\n\nlocal p = protoc.new()\n\np:load [[\n syntax = &quot;proto3&quot;;\n message Request {\n string user_id = 1;\n int32 action = 2;\n }\n]]\n\nprint(pb.type &quot;Request&quot;)\n</code></pre>\n<pre class="lang-bash prettyprint-override"><code>$ lua message_pb.lua \n.Request Request message\n</code></pre>\n"^^ . . . . . . ""`child->setParent(std::weak_ptr(shared_from_this()))`" - why is there a weak_ptr conversion there? Also, the error message seems quite descriptive - how is it not helpful?"^^ . "0"^^ . . . . . "uid"^^ . . . . . "0"^^ . . . . "3"^^ . . "0"^^ . "os.remove works but Shell:Run with luacom doesn't"^^ . "1"^^ . . "logitech"^^ . . . "0"^^ . . . "How to Extend Existing Types with Methods in Lua, Similar to Swift Extensions or JavaScript Prototypes?"^^ . "1"^^ . . . "0"^^ . . . "0"^^ . . "1"^^ . . "0"^^ . . "Parsing Regex in Lua returns nil"^^ . . . . "0"^^ . . . . . "0"^^ . "1"^^ . . "1"^^ . . . "ECDH Exchange in Go, NodeJS, and Lua"^^ . . "c++"^^ . "1"^^ . . . . . . . "How to Externalize Lua Code in APISIX serverless-pre-function Plugin?"^^ . "0"^^ . . . "Thanks for the answer. I assume that also means there's no direct language support for constructing a partially-bound method with a `self` reference? Like using `local x = foo:bar; x()`. Obviously not useful like that, but useful to pass a member function as a callback etc. Of course you can always construct a free function that does the job, capturing `self` in the closure."^^ . "luac"^^ . . "1"^^ . "1"^^ . . "1"^^ . . . . . . . . . . "3"^^ . . "1"^^ . . . . "0"^^ . . "0"^^ . "0"^^ . . . . "1"^^ . . . . "<p>amazing how I've come across the same need on the same day with you!</p>\n<p>Managed to do this as follows:</p>\n<ol>\n<li>Set the <code>extra_lua_path</code> variable in the Apisix config as you do. I set it to <code>/opt/?.lua</code> but I doubt this makes any difference.</li>\n<li>Created a docker volume to map the <code>.lua</code> file from my local drive to the <code>extra_lua_path</code> location (as read-only), as I guess you also do.</li>\n<li>Set the <code>functions</code> variable in the JSON configuration to <code>&quot;functions&quot;: [&quot;local test=require('test');return test;&quot;]</code> (my file is <code>test.lua</code>).</li>\n</ol>\n"^^ . "can you tell me what the internal representation of the table means? how does it influence the index chosen to assign the value?\n(if you can even explain it to me, I'm quite new to this, thanks anyway)."^^ . "<p>According to <code>auth/signer</code> documentation:</p>\n<blockquote>\n<p>The JWT signing component creates a wrapper for your existing login endpoint that signs with your secret key the selected fields of the backend payload right before returning the content to the end-user.\nThe JWT signing component creates a wrapper for your existing login endpoint that signs with your secret key the selected fields of the backend payload right before returning the content to the end-user.</p>\n</blockquote>\n<blockquote>\n<p>The primary usage for this component is in migrations from monolith to microservices, or in ecosystems where there is no Identity/OAuth server yet, as it allows the immediate adoption of signed JSON Web Tokens without the need to implement a new service.</p>\n</blockquote>\n<p>This means that <code>auth/signer</code> by itself is not intended to generate JWT from scratch, but to be configured on top of a backend that returns user information that can be signed into a JWT.</p>\n<p>Your config is far from being correct, as it is specifying arguments that <code>auth/signer</code> does not understand at all</p>\n<p>Having said that, there are a couple approaches you may want to consider:</p>\n<h4>Wrapping a token endpoint</h4>\n<p>Just following the documentation examples, you can wrap your own login endpoint (if available) to sign the response into a JWT.</p>\n<p>By doing that, you'd have a Krakend endpoint that is able to return JWT, but since you're looking for a way to generate a JWT + use it to call a backend in the same request, you should also consider checking the sequential proxy feature: <a href="https://www.krakend.io/docs/enterprise/endpoints/sequential-proxy/#content" rel="nofollow noreferrer">https://www.krakend.io/docs/enterprise/endpoints/sequential-proxy/#content</a></p>\n<h4>Using a body generator (enterprise)</h4>\n<p>If you don't have a legacy login endpoint to wrap around, you can use a <a href="https://www.krakend.io/docs/enterprise/backends/response-body-generator/" rel="nofollow noreferrer">Krakend Enterprise modifier to generate a body</a> based on a template. This generator could be configured in an &quot;internal&quot; Krakend endpoint and then wrapped by the <code>auth/signer</code>. Once this is done, it would be a matter of following the same sequential proxy approach described above</p>\n"^^ . . . . . "0"^^ . "0"^^ . . . "<p>I have a C++ Project and want to use Lua with sol2 for scripting but I have some trouble with shared_ptr.\nThere is a function in my class SceneNode which takes an shared_ptr as Argument, but I always get an error...</p>\n<p>Function:</p>\n<pre class="lang-cpp prettyprint-override"><code>std::shared_ptr&lt;SceneNode&gt; SceneNode::addChild(std::shared_ptr&lt;SceneNode&gt; child)\n{\n child-&gt;setParent(std::weak_ptr(shared_from_this()));\n children.push_back(child);\n\n return child;\n}\n</code></pre>\n<p>Here I want to set everything up for Lua:</p>\n<pre class="lang-cpp prettyprint-override"><code>void setup_lua() {\n sol::state lua;\n lua.open_libraries(sol::lib::base);\n\n lua.new_usertype&lt;SceneNode&gt;(&quot;SceneNode&quot;,\n sol::constructors&lt;\n void(),\n void(std::string)&gt;(),\n //sol::base_classes, sol::bases&lt;std::enable_shared_from_this&lt;SceneNode&gt;&gt;(),\n &quot;id&quot;, &amp;SceneNode::id,\n &quot;name&quot;, &amp;SceneNode::name,\n &quot;addChild&quot;, &amp;SceneNode::addChild\n );\n\n lua.script_file(&quot;/Path/to/setup_lua.lua&quot;);\n}\n</code></pre>\n<p>setup_lua.lua looks like this:</p>\n<pre class="lang-lua prettyprint-override"><code>local node = SceneNode:new(&quot;node&quot;)\nprint(node.name)\nprint(node.id)\n\nlocal childNode = SceneNode:new(&quot;child&quot;)\nnode:addChild(childNode)\nprint(childNode.name)\nprint(childNode.id)\n\nprint(node)\nprint(childNode)\n</code></pre>\n<p>When I run the program, I get this output:</p>\n<pre><code>node\n-2472761803519894154\n[sol2] An error occurred and has been passed to an error handler: sol: runtime error: stack index 2, expected userdata, received sol.SceneNode: value is a userdata but is not the correct unique usertype (bad argument into 'std::shared_ptr&lt;SceneNode&gt;(std::shared_ptr&lt;SceneNode&gt;)')\nstack traceback:\n [C]: in method 'addChild'\n /Path/to/setup_lua.lua:13: in main chunk\nterminate called after throwing an instance of 'sol::error'\n what(): sol: runtime error: stack index 2, expected userdata, received sol.SceneNode: value is a userdata but is not the correct unique usertype (bad argument into 'std::shared_ptr&lt;SceneNode&gt;(std::shared_ptr&lt;SceneNode&gt;)')\nstack traceback:\n [C]: in method 'addChild'\n /Path/to/setup_lua.lua:13: in main chunk\nAborted (core dumped)\n</code></pre>\n<p>I tried to add a Child to my parent node but always get an error:</p>\n<pre><code>sol: runtime error: stack index 2, expected userdata, received sol.SceneNode: value is a userdata but is not the correct unique usertype (bad argument into 'std::shared_ptr&lt;SceneNode&gt;(std::shared_ptr&lt;SceneNode&gt;)')\n</code></pre>\n"^^ . . . . . "How to configure Harpoon in Neovim to navigate between files using Ctrl-hjkl?"^^ . . . . "<p><a href="https://github.com/Subtixx/vscode-mtalua" rel="nofollow noreferrer">https://github.com/Subtixx/vscode-mtalua</a> will need to update their extension.<br />\nThey are overriding the default <code>source.lua</code> scopeName instead of supplying their own.<br />\nShould change it to something like <code>source.lua.mta</code>.</p>\n<p>You can manually fix it by going into the extension files.<br />\nUpdate <code>&quot;scopeName&quot;: &quot;source.lua&quot;</code> in both <code>extensions\\subtixx.mtasa-lua-2.3.6\\syntaxes\\mtalua.tmLanguage.json</code> and <code>extensions\\subtixx.mtasa-lua-2.3.6\\package.json</code></p>\n"^^ . . "0"^^ . . . . . . . "0"^^ . . . . "indexing"^^ . "3"^^ . . . "1"^^ . "0"^^ . "2"^^ . "0"^^ . . . "3"^^ . "<p>I'm trying to make a c++ function address mapping with lua, so that I can do hot fix,but I can correctly pass nested struct to lua (I guess, because I print table before call lua function), but I got lua error: attempt to call a nil value. What's wrong?</p>\n<pre><code>#include &lt;sol/sol.hpp&gt;\n#include &lt;iostream&gt;\n#include &lt;string&gt;\n#include &lt;unordered_map&gt;\n\nstruct NestedData {\n int a;\n float b;\n};\n\nstruct ComplexData {\n int id;\n std::string name;\n NestedData nested;\n};\n\nvoid stack_struct(lua_State* L, const ComplexData&amp; data) {\n lua_newtable(L); \n\n lua_pushstring(L, &quot;id&quot;);\n lua_pushinteger(L, data.id);\n lua_settable(L, -3);\n\n lua_pushstring(L, &quot;name&quot;);\n lua_pushstring(L, data.name.c_str());\n lua_settable(L, -3);\n\n lua_pushstring(L, &quot;nested&quot;);\n {\n lua_newtable(L);\n\n lua_pushstring(L, &quot;a&quot;);\n lua_pushinteger(L, data.nested.a);\n lua_settable(L, -3);\n\n lua_pushstring(L, &quot;b&quot;);\n lua_pushnumber(L, data.nested.b);\n lua_settable(L, -3);\n\n lua_settable(L, -3);\n }\n}\n\nint main() {\n lua_State* L = luaL_newstate();\n luaL_openlibs(L);\n std::unordered_map&lt;int64_t, std::function&lt;double(ComplexData*)&gt;&gt; SkillMap;\n std::string script_name = &quot;register.lua&quot;;\n std::string func_name = &quot;WaterBall&quot;;\n int64_t id = 100;\n if (!L) {\n std::cerr &lt;&lt; &quot;Lua interpreter is not initialized!&quot; &lt;&lt; std::endl;\n return 0;\n }\n if (luaL_dofile(L, script_name.c_str()) != LUA_OK) {\n std::cerr &lt;&lt; &quot;Error loading Lua script: &quot; &lt;&lt; lua_tostring(L, -1) &lt;&lt; std::endl;\n lua_pop(L, 1);\n return 0;\n }\n lua_getglobal(L, func_name.c_str()); // anonymity function at the top of the stack\n if (lua_isfunction(L, -1)) {\n \n SkillMap[id] = [L, func_name](ComplexData* info) -&gt; double {\n stack_struct(L, *info);\n // print table here, values are correct\n if (lua_pcall(L, 1, 1, 0) != LUA_OK) {\n std::cerr &lt;&lt; &quot;Error calling Lua function: &quot; &lt;&lt; lua_tostring(L, -1) &lt;&lt; std::endl;\n lua_pop(L, 1);\n return 0.0;\n }\n double result = 0.0;\n if (lua_isnumber(L, -1)) {\n result = lua_tonumber(L, -1);\n }\n else {\n std::cerr &lt;&lt; &quot;Lua function did not return a number!&quot; &lt;&lt; std::endl;\n }\n lua_pop(L, 1);\n return result;\n };\n std::cout &lt;&lt; &quot;Lua function &quot; &lt;&lt; func_name &lt;&lt; &quot; registered successfully!&quot; &lt;&lt; std::endl;\n }\n else {\n std::cerr &lt;&lt; &quot;Function &quot; &lt;&lt; func_name &lt;&lt; &quot; not found or not callable in Lua&quot; &lt;&lt; std::endl;\n }\n lua_pop(L, 1);\n\n ComplexData data = { 1, &quot;example&quot;, {10, 3.14f} };\n\n auto _func1 = SkillMap.find(id)-&gt;second;\n double damage1 = _func1(&amp;data);\n\n lua_close(L);\n\n std::wcout &lt;&lt; damage1 &lt;&lt; std::endl;\n return 0;\n}\n</code></pre>\n<p>and the lua function:</p>\n<pre><code>function WaterBall(info)\n return 50\nend\n\n</code></pre>\n<p>The Error: Error calling Lua function: attempt to call a nil value</p>\n<p>sol/sol.cpp is a project from github <a href="https://github.com/ThePhD/sol2" rel="nofollow noreferrer">https://github.com/ThePhD/sol2</a></p>\n"^^ . . . . . . "<p>I'm using a <a href="https://github.com/omerxx/tmux-floax" rel="nofollow noreferrer">Tmux extension called Floax</a>, and need to activate it from Neovim (only if Neovim is running inside Tmux, otherwise it should perform another action).</p>\n<p>So far I manage to create my lua script for the binkdkey, but I'm finding problem for the last part: <strong>how do I tell neovim to perform a key combination inside Tmux?</strong></p>\n<p>In this case it should trigger Alt+p, I'm trying using <code>tmux send-keys</code> but it's not working:</p>\n<pre class="lang-lua prettyprint-override"><code>local function open_floating_window()\n if vim.fn.getenv('TMUX') ~= vim.NIL then\n open_nvim_floating_window()\n else\n vim.fn.system('tmux send-keys -t ! M-p')\n end\nend\nvim.keymap.set('n','&lt;leader&gt;ft', open_floating_window, { desc = 'Open floating terminal'})\n</code></pre>\n<p>Thank you very much for any insight you could give me.</p>\n"^^ . . "<p><strong>Background:</strong></p>\n<p>Currently, I am forwarding a selection to Telescope's Live-Grep-Args plugin via a register by using the following code:</p>\n<pre><code>...\n-- Forward Visual Selection to Live-Grep-Args --\nlocal function grep_visual_selection()\n\n -- Yank the current visual selection into to register &quot;a&quot; \n vim.cmd('normal! &quot;ay') \n \n -- Get the content of register &quot;a&quot; and escape spaces \n local visual_selection = vim.fn.escape(vim.fn.getreg('a'), ' ') \n\n -- Call Telescope live_grep with the escaped visual selection \n vim.cmd('Telescope live_grep default_text=' .. visual_selection) \nend \n\n...\n\nkeymap('v', '&lt;leader&gt;fs', grep_visual_selection, { noremap = true, silent = true })\n\n</code></pre>\n<p>While this works, I am wondering myself why the unnamed register is also modified in parallel to the register &quot;a&quot;. This behaviour also persists when yanking manually a selection to a specific register (in this case register &quot;a&quot;). I would have expected only the register &quot;a&quot; to be modified. Because of this behaviour, the following questions came up to my mind</p>\n<p><strong>Questions</strong></p>\n<ol>\n<li>Does yanking in vim/nvim always modify the unnamed register? (Even when depositing a selection in a special register)</li>\n<li>Are there any approaches which do not modify the unnamed register?</li>\n</ol>\n"^^ . . "And then there is https://www.love2d.org/wiki/love.window.getFullscreenModes to check."^^ . . . "1"^^ . . . "<p>I would like to use &quot;words&quot; instead of individual characters in Lua's char-set functionality. My toy-example below should illustrate my problem.</p>\n<p><a href="https://www.lua.org/pil/20.2.html" rel="nofollow noreferrer">https://www.lua.org/pil/20.2.html</a></p>\n<pre class="lang-lua prettyprint-override"><code>--\nprint (string.find('Animal=Dog','Animal=[(Dog)(Cat)]')) -- gets a match, good\nprint (string.find('Animal=Cat','Animal=[(Dog)(Cat)]')) -- gets a match, good\nprint (string.find('Animal=DogCat','Animal=[(Dog)(Cat)]')) -- gets a match as expected, but not what I want\nprint (string.find('Animal=CatDog','Animal=[(Dog)(Cat)]')) -- to my surprise, this one matches\n\n-- so I try to anchor the string for an exact match, but it yields nil?\nprint (string.find('Animal=Dog','^Animal=[(Dog)(Cat)]$')) -- nil, but this is what I think should work\n</code></pre>\n"^^ . "json"^^ . . . "<p>I’m working with APISIX and using the serverless-pre-function plugin to execute custom Lua code during the request lifecycle. Currently, I have my Lua function embedded directly in the JSON configuration, but I’d like to externalize it into a separate Lua file for better maintainability and readability.</p>\n<p>Here’s my current setup:</p>\n<p>JSON Configuration</p>\n<pre><code> {\n &quot;plugins&quot;: {\n &quot;serverless-pre-function&quot;: {\n &quot;phase&quot;: &quot;access&quot;,\n &quot;functions&quot;: [\n &quot;return function(conf, ctx) local jwt = require('resty.jwt'); local userinfo = ngx.req.get_headers()['x-userinfo']; if userinfo then local jwt_obj = jwt:verify(nil, userinfo); if jwt_obj.payload then local preferred_username = jwt_obj.payload.preferred_username; if preferred_username then ngx.req.set_header('X-User-Uid', preferred_username); else ngx.log(ngx.ERR, 'Claim preferred_username not found in JWT'); end; else ngx.log(ngx.ERR, 'Failed to decode JWT: ', jwt_obj.reason); end; else ngx.log(ngx.ERR, 'No x-userinfo header found'); end; end&quot;\n ]\n }\n }\n}\n</code></pre>\n<p>Goal\nI want to move the Lua function into a separate file (e.g., /usr/local/apisix/lua_scripts/extract_userinfo.lua) and reference it in the serverless-pre-function plugin configuration.</p>\n<p>Attempted Solution\nI tried referencing the file like this:</p>\n<pre><code> {\n &quot;plugins&quot;: {\n &quot;serverless-pre-function&quot;: {\n &quot;phase&quot;: &quot;access&quot;,\n &quot;functions&quot;: [\n {\n &quot;file&quot;: &quot;/usr/local/apisix/lua_scripts/extract_userinfo.lua&quot;\n }\n ]\n }\n }\n}\n</code></pre>\n<p>However, this results in an error:</p>\n<pre><code> {&quot;error_msg&quot;:&quot;failed to check the configuration of plugin serverless-pre-function err: property \\&quot;functions\\&quot; validation failed: failed to validate item 1: wrong type: expected string, got table&quot;}\n</code></pre>\n<p>config.yaml of apisix docker:</p>\n<pre><code>apisix:\n node_listen: 9080\n enable_admin: true\n log_level: debug\n lua_module_cache: true\n lua_path: &quot;/usr/local/apisix/lua_scripts/?.lua;;&quot;\n extra_lua_path: /usr/local/apisix/lua_scripts/?.lua\n proxy:\n ssl:\n verify: true\n trusted_ca_certificates: /usr/local/apisix/keycloak-cert.pem\n plugins: # plugin list\n - authz-keycloak\n - basic-auth\n - clickhouse-logger\n - client-control\n - consumer-restriction\n - cors\n - csrf\n - datadog\n - echo\n - error-log-logger\n - ext-plugin-post-req\n - ext-plugin-post-resp\n - ext-plugin-pre-req\n - fault-injection\n - file-logger\n - forward-auth\n - google-cloud-logging\n - gzip\n - hmac-auth\n - http-logger\n - ip-restriction\n - jwt-auth\n - kafka-logger\n - kafka-proxy\n - key-auth\n - ldap-auth\n - limit-conn\n - limit-count\n - limit-req\n - loggly\n - mocking\n - opa\n - openid-connect\n - opentelemetry\n - openwhisk\n - prometheus\n - proxy-cache\n - proxy-control\n - proxy-mirror\n - proxy-rewrite\n - public-api\n - real-ip\n - redirect\n - referer-restriction\n - request-id\n - request-validation\n - response-rewrite\n - rocketmq-logger\n - server-info\n - serverless-post-function\n - serverless-pre-function\n - skywalking\n - skywalking-logger\n - sls-logger\n - splunk-hec-logging\n - syslog\n - tcp-logger\n - traffic-split\n - ua-restriction\n - udp-logger\n - uri-blocker\n - wolf-rbac\n - zipkin\n - elasticsearch-logger\n - cas-auth\n plugin_attr:\n log-rotate:\n enable_compression: false\n max_kept: 3\n max_size: 10240\n\ndeployment:\n admin:\n admin_key:\n - name: &quot;admin&quot;\n key: &quot;admin123&quot;\n role: admin\n allow_admin:\n - 0.0.0.0/0\n\n etcd:\n host:\n - &quot;http://etcd:2379&quot;\n</code></pre>\n<p>Questions\nHow can I properly externalize Lua code in the serverless-pre-function plugin?</p>\n<p>What is the correct way to reference an external Lua file in the configuration?</p>\n<p>Are there any specific requirements for the Lua file (e.g., return value, structure)?\nis there additional config in docker-compose or config of apisix docker</p>\n<p>Additional Context\nI’m running APISIX in a Docker container.</p>\n<p>The Lua file is placed in /usr/local/apisix/lua_scripts/.</p>\n<p>The Lua function works correctly when embedded directly in the JSON configuration.</p>\n<p>Any guidance or examples would be greatly appreciated!</p>\n<p>Thanks in advance!</p>\n"^^ . . "0"^^ . "Can you elaborate on "I want the probability for each slot to be adjusted dynamically as the cars are assigned"? And when you say "ensuring that cars are distributed across the slots with the correct probabilistic weighting", what is the correct probabilistic weighting?"^^ . "0"^^ . "@Mr.Unforgettable That is a **ts_ls** warning. As you can see in the config **ts_ls** will start when a **package.json** or **tsconfig.json** files exists in the current working directory and **denols** will start when a **deno.json** file exists, so both servers are running in the same project. My suggestion is you can turn off **ts_ls** when you are working in those **deno.json** and **package.json/tsconfig.json** mixed projects and only keep **denols** running. You can also write a function or autocommand in your nvim config so that happens automatically when you open that kind of project."^^ . "0"^^ . . . . . "hey guys, thanks for responding. I was just updating the post to explain that I figured out the source of that resolution, and it's now rendering at 1080p (the resolution I have my display set to). however, that's not the resolution I've set in my love code. see the addendum to my question for a full explanation."^^ . "How to precompile and dump Lua binary with C closures?"^^ . . "<p>Client-side</p>\n<pre><code>RegisterNetEvent('ch_nui:bob')\nAddEventHandler('ch_nui:bob',function (identifier)\n print('1'\n)\n CreateThread(function ()\n print('1'\n )\n while true do\n Wait(50)\n \n local playerId = PlayerPedId()\n local playerCoords = GetEntityCoords(playerId)\n local playerHeading = GetEntityHeading(playerId)\n \n SendNUIMessage({\n type = 'position',\n x = playerCoords.x,\n y = playerCoords.y,\n z = playerCoords.z,\n heading = playerHeading,\n })\n SendNUIMessage({\n type='identifierr',\n identifierr = identifier\n })\n \n end\n \n end)\n \n\nend)\n\nTriggerServerEvent('ch_nui:kok')\n</code></pre>\n<p>Server-side</p>\n<pre><code>RegisterNetEvent('ch_nui:kok')\nAddEventHandler('ch_nui:kok',function ()\n print('2')\n local identifier = GetPlayerIdentifierByType(source,'license')\n TriggerClientEvent('ch_nui:bob',identifier)\nend)\n</code></pre>\n<p>For some reason, in any of my code, when I try to trigger a client event from the server it never works, and I'm just stuck trying to display an value in my sql database. Why is this happening? Is there another easier way to transfer data from server to JavaScript?</p>\n<p>My js file is this</p>\n<pre><code>if(data.type === 'identifier'){\n const identifier = data.identifierr\n }\n const money = MySQL.scalar('SELECT `money` FROM `money` WHERE `identifier` = ? LIMIT 1', [\n identifier\n ])\n\n console.log(money)\n</code></pre>\n<p>Although it doesn't matter because the problem is that the client event doesn't get triggered.</p>\n<p>I tried the code, played around with events stuff and nothing worked.</p>\n"^^ . . . . "1"^^ . . . . "Gmod lua mysql attempt to index global "" (a nil value) (DarkRP)"^^ . . "luau"^^ . . "6"^^ . "0"^^ . . . . . . "2"^^ . "<p>2025-01-21 20:45:59.832751 90.95% [ERR] switch_odbc.c:529 ERR: [update tbl_channel set msisdn = 100 where chan_name = 'CH001']\n[STATE: 23000 CODE 2601 ERROR: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Cannot insert duplicate key row in object 'dbo.tbl_channel' with unique index 'idx_msisdn'. The duplicate key value is (100).\n]</p>\n<p>I'm getting above error when trying to execute the update query in lua script but it throw exception error for unique column. Is there any way for lua script to capture the exception error?</p>\n<pre><code>local dbh = freeswitch.Dbh(DSN);\ndbh:query(&quot;update tbl_channel set msisdn = 100 where chan_name = 'CH001'&quot;);\ndbh:release();\n</code></pre>\n"^^ . . . "0"^^ . "drawing"^^ . . "1"^^ . "garrys-mod"^^ . . "0"^^ . "This seems to work! Thank you!"^^ . "<p>I see at least three problems:</p>\n<ol>\n<li>X25519 and prime256v1 are totally different curves. You need to pick one or the other and use it consistently.</li>\n<li>That's not the right syntax to make a pkey with existing key material. Here's how you'd modify that part of your code to do that correctly:</li>\n</ol>\n<pre class="lang-lua prettyprint-override"><code>local openssl_bn = require &quot;resty.openssl.bn&quot;\nlocal a_bn = openssl_bn.new(a_decoded_key, 2)\nlocal a_key = openssl_pkey.new({\n type = &quot;EC&quot;,\n params = {\n private = a_bn,\n group = &quot;prime256v1&quot;\n }\n})\n</code></pre>\n<ol start="3">\n<li>OpenSSL doesn't automatically calculate the public key from the private key, so you have to do that yourself, as <a href="https://stackoverflow.com/q/12480776/7509065">How do I obtain the public key from an ECDSA private key in OpenSSL?</a> explains. Unfortunately, lua-resty-openssl doesn't expose a lot of necessary functions for this, e.g., <code>EC_POINT_mul</code>, so you'd have to either switch libraries or write a lot of C FFI code yourself to do this.</li>\n</ol>\n"^^ . . . . "1"^^ . "1"^^ . . . . "0"^^ . "0"^^ . "0"^^ . "Try `env | grep UID`."^^ . . . "1"^^ . . . "1"^^ . "<p>Since you are using Mason LSP Config and Kickstart you have to place your config in the servers table:</p>\n<pre><code> local servers = {\n lua_ls = {\n settings = {\n Lua = {\n completion = {\n callSnippet = &quot;Replace&quot;,\n },\n hint = {\n enable = true,\n },\n },\n },\n },\n ts_ls = {\n root_dir = require(&quot;lspconfig&quot;).util.root_pattern({ &quot;package.json&quot;, &quot;tsconfig.json&quot; }),\n single_file_support = false,\n settings = {},\n },\n denols = {\n root_dir = require(&quot;lspconfig&quot;).util.root_pattern({&quot;deno.json&quot;, &quot;deno.jsonc&quot;}),\n single_file_support = false,\n settings = {},\n },\n }\n</code></pre>\n<p>The suggested config from Deno website only works if you are not using Mason LSP Config.</p>\n<p>You don't need to pass on_attach since Kickstart already sets an autocommand on 'LspAttach'</p>\n"^^ . "<p>You need to retrieve these functions as values that live in the Lua state. You <strong>must not</strong> store pointers to values <strong>managed by Lua</strong>. These may become invalid at any point because <strong>the GC does not know you are holding them</strong>.</p>\n<p>For example one option are global callbacks, or global callback tables. In this case the function is identified by the &quot;path&quot; of names that leads for it. On the C side of things, you then just index <code>_G[&quot;callback&quot;]</code> and call that, or you get <code>_G[&quot;myapitable&quot;][&quot;mycallbacks&quot;]</code>, iterate that and call each callback.</p>\n<p>If you want to &quot;hide&quot; these functions for encapsulation purposes, use <a href="https://www.lua.org/manual/5.1/manual.html#3.5" rel="nofollow noreferrer">the registry</a>.</p>\n<p>As soon as you've decided for a table to store your functions in, you can manage them however you please, using names or numbers as keys into this table, and removing or adding &quot;callbacks&quot; to this table as you please.</p>\n"^^ . . . . . "<p>I'm making a dash but when I run the game it doesn't work as well as I expected, the first 2 dashes don't work well, the third one already works. and then at the end of the dash that transitions to being still or walking, your feet accelerate a lot. I disguised it by changing the dash time and velocity, but would someone here know something more?</p>\n<pre><code>--Servicios\nlocal player = game:GetService(&quot;Players&quot;).LocalPlayer\nlocal repStorage = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal UIS = game:GetService(&quot;UserInputService&quot;)\nlocal runservice = game:GetService(&quot;RunService&quot;)\nlocal debris = game:GetService(&quot;Debris&quot;)\nlocal character = player.Character or player.CharacterAdded:Wait()\nlocal loadedAnimation \n\n\nlocal fxFolder = repStorage.Fx\nlocal dustFx = fxFolder.DustFx\nlocal smokeFx = fxFolder.SmokeFx\n\n-- Configuracion Dash\nlocal key = Enum.KeyCode.Q -- Tecla para hacer el Dash\nlocal velocity = 20000 -- velocidad del dash\nlocal debounce = false\nlocal cooldown = 0.20 -- Cooldown despues del Dash\nlocal duration = 0.25 -- duracion del dash\nlocal sideDash = false\nlocal DashLeft = script:WaitForChild(&quot;DashLeft&quot;)\nlocal DashRight = script:WaitForChild(&quot;DashRight&quot;)\n\n--Variables para DustFX\nlocal character = player.Character or player.CharacterAdded:Wait()\nlocal humanoid = character:WaitForChild(&quot;Humanoid&quot;)\n--Partes donde se adjunatara el efecto\nlocal lfoot = character:WaitForChild(&quot;LeftFoot&quot;) --LeftLowerLeg / LeftFoot\nlocal rfoot = character:WaitForChild(&quot;RightFoot&quot;) --RightLowerLeg / RightFoot\n--Aca las Particulas del efecto\nlocal fx1 = game.ReplicatedStorage.Dash.Fx.DusFX.Dust:Clone() --Fx.DusFX.ef:Clone()\nfx1.Parent = rfoot\nlocal fx2 = game.ReplicatedStorage.Dash.Fx.DusFX.Dust:Clone()\nfx2.Parent = lfoot\nfx1.Enabled = false\nfx2.Enabled = false\n\n\n\n\nlocal function UserInputButton (input, Keyboard)\n --si esta suando el teclado para escribir en el chat salgo\n if Keyboard == true then\n return\n end\n --si no esta suando el teclado para escribir continuo\n if input.KeyCode == key then\n Dash() \n end\nend\n\n\nUIS.InputBegan:Connect(UserInputButton)\n\n\nfunction Dash()\n\n if DashLeft == nil and DashRight == nil then return end\n\n if character and not debounce then\n debounce = true\n -- aca comienza el script del dash\n local humanoid = character.Humanoid\n local HRP = character.HumanoidRootPart\n\n --aca cambio el dash\n\n sideDash = not sideDash\n\n -- Cargamos la animación correspondiente\n\n if sideDash then\n loadedAnimation = humanoid.Animator:LoadAnimation(DashRight)\n else\n loadedAnimation = humanoid.Animator:LoadAnimation(DashLeft)\n end\n\n local dashDirection = nil\n local moveDirection = humanoid.MoveDirection\n local lookVector = HRP.CFrame.LookVector\n local minusVelocity = -velocity \n\n --Chequeo que este en el piso y no flotando\n local isOnGround = humanoid.FloorMaterial ~= Enum.Material.Air and humanoid.FloorMaterial ~= Enum.Material.Water\n\n if isOnGround then \n\n if moveDirection == Vector3.new(0,0,0) then -- si no se esta moviendo then\n dashDirection = HRP.Position + Vector3.new(lookVector.x, 0, lookVector.z)\n else\n dashDirection = HRP.Position + Vector3.new(moveDirection.X, 0, moveDirection.Z)\n end \n\n --usando bodygiro para rotar al jugador en la direccion del dash suavemente\n local bodyGyro = Instance.new(&quot;BodyGyro&quot;)\n bodyGyro.Parent = HRP\n bodyGyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)\n bodyGyro.D = 0-- is the dampening\n bodyGyro.P = 500000 -- es la agresividad\n bodyGyro.CFrame = CFrame.lookAt(HRP.Position, dashDirection) -- mira hacia donde esta y luego dash\n\n local attachment = Instance.new(&quot;Attachment&quot;)\n attachment.Parent = HRP\n\n local vectorForce = Instance.new(&quot;VectorForce&quot;)\n vectorForce.Parent = HRP\n --vector necesario para adjuntar a donde esta mirando el jugador\n vectorForce.Attachment0 = attachment\n --now it will move player foeward as the settings \n vectorForce.Force = Vector3.new(0,0,minusVelocity)\n\n loadedAnimation:Play() -- comienzo la animacion\n humanoid.AutoRotate = true -- previene que el personaje se rote en si mismo\n DustFx(true, fx1, fx2)\n \n wait(duration)\n\n humanoid.AutoRotate = true\n \n\n vectorForce:Destroy()\n bodyGyro:Destroy()\n attachment:Destroy()\n\n -- Establecer la velocidad a cero\n humanoid.RootPart.Velocity = Vector3.new(0, 0, 0)\n loadedAnimation:Stop() \n DustFx(false, fx1, fx2)\n end \n wait(cooldown)\n debounce = false \n end \nend\n\n\nfunction DustFx(active, fx1, fx2)\n if active then\n fx1.Enabled = true\n fx2.Enabled = true\n else\n fx1.Enabled = false\n fx2.Enabled = false\n end\nend\n\n--Buscar Boton y hacer dash\nlocal function getImageButton()\n local ScreenGuiBoton = player:WaitForChild(&quot;PlayerGui&quot;):WaitForChild(&quot;ScreenGuiBotón&quot;)\n local ImageButton = ScreenGuiBoton:FindFirstChild(&quot;ImageButton&quot;) \n\n if ImageButton then\n return ImageButton \n else\n return nil \n end\nend\n\nlocal TextBoton = getImageButton()\nTextBoton.MouseButton1Click:Connect(Dash)\n</code></pre>\n"^^ . "0"^^ . "Krakend Community Edition - Generate a JWT token"^^ . . "0"^^ . "2"^^ . "1"^^ . "<p>Ok so I found out a method that fixed my load times. I had my data script create a <code>BoolValue</code> and parent it to each player when they join called <code>hasLoaded</code>. I set it to true after the profile loaded and stopped my other scripts from doing anything until <code>hasLoaded == true</code>.</p>\n<pre class="lang-lua prettyprint-override"><code>local function PlayerAdded(player: Player)\n local hasLoaded = Instance.new(&quot;BoolValue&quot;)\n hasLoaded.Name = &quot;hasLoaded&quot;\n hasLoaded.Value = false\n hasLoaded.Parent = player\n \n local profile = ProfileStore:LoadProfileAsync(&quot;Player_&quot;..player.UserId..&quot;_Save5&quot;)\n \n hasLoaded.Value = true\n\n -- Unrelated code\nend\n</code></pre>\n<p>And here's the script where I manage all of my client scripts:</p>\n<pre class="lang-lua prettyprint-override"><code>local player = game.Players.LocalPlayer\nlocal hasLoaded = player:WaitForChild(&quot;hasLoaded&quot;)\n\nwhile hasLoaded.Value == false do\n task.wait(1)\nend\n\n-- Variables for my scripts and calls to their start functions\n</code></pre>\n<p>After doing this, the load times are basically instantaneous again. I'm not sure why this reduced the load times so drastically, but it did!</p>\n"^^ . . "3"^^ . "this also did not work. they did not raise any errors but silently failed or something"^^ . "colors"^^ . "copas"^^ . "0"^^ . "4"^^ . "<p>Oh, I just knew the problem. In Lua, we can not create keys from this source.</p>\n<pre><code>A_PRIVATE_KEY=&quot;w2UwuwmF9h5p02fnr3MkxtKoDTl8aTtJXqLbsPwbqPg=&quot;\nB_PRIVATE_KEY=&quot;ZyoPMal0TZzNwDyUUE30iThXCKgPOthPaIN2qnOhkNs=&quot;\n</code></pre>\n<p>So, these syntaxes are wrong.</p>\n<pre class="lang-lua prettyprint-override"><code>local a_key = openssl_pkey.new({\n type = &quot;EC&quot;,\n params = {\n private = a_bn,\n group = &quot;prime256v1&quot;\n }\n})\nlocal b_key = openssl_pkey.new({\n type = &quot;EC&quot;,\n params = {\n private = b_bn,\n group = &quot;prime256v1&quot;\n }\n})\n</code></pre>\n<p>These AI-suggested syntaxes are also wrong.</p>\n<pre class="lang-lua prettyprint-override"><code>local a_key = openssl_pkey.new({\n type = &quot;X25519&quot;,\n curve = &quot;prime256v1&quot;,\n private_key = a_decoded_key,\n})\n</code></pre>\n<p>We need to convert the source to the PEM keys first. So, the correct source would be like this.</p>\n<pre><code>A_PRIVATE_KEY=&quot;-----BEGIN PRIVATE KEY-----\\nYOUR_CONTENT_HERE\\n-----END PRIVATE KEY-----&quot;\nB_PRIVATE_KEY=&quot;-----BEGIN PRIVATE KEY-----\\nYOUR_CONTENT_HERE\\n-----END PRIVATE KEY-----&quot;\n</code></pre>\n<p>Then, the correct Lua syntax would be like this.</p>\n<pre class="lang-lua prettyprint-override"><code>local a_key = openssl_pkey.new(a_private_key)\nlocal b_key = openssl_pkey.new(b_private_key)\n</code></pre>\n"^^ . . . . "how to use luv with pipes?"^^ . "2"^^ . . . . . "Initialize lua dissector ProtoField table inside protocol init function"^^ . "1"^^ . "0"^^ . "1"^^ . "0"^^ . . "Awesome Thanks alot"^^ . . "4"^^ . . . "0"^^ . "3"^^ . "2"^^ . "0"^^ . "<p>Assuming a protocol listener pattern, you can simply add to obtain a subtree and then add in a loop the values, for example:</p>\n<pre><code>function DecoderListener:setParameter(widgetID, paramID, value)\n if (type(value) == &quot;table&quot;) then\n local array_tree = self.subtree:add(paramID)\n if #value &gt;= 1 then\n for i, value0 in ipairs(value) do\n self:setArrayParameter(array_tree, value0, i)\n end\n end\n end\nend\n\nfunction DecoderListener:setArrayParameter(array_tree, value, index)\n local real_value = value:getValue()\n -- this can handle int/float/string real values\n array_tree:add(real_value)\nend\n</code></pre>\n<p>This will result in folding elements in Wireshark with all the values you have speficied.</p>\n"^^ . . . . . "0"^^ . . . "2"^^ . "0"^^ . . . "How to call lua functions from another language"^^ . "3"^^ . . "<p>The <a href="https://www.lua.org/manual/5.4/manual.html#2.4" rel="nofollow noreferrer">manual</a> states:</p>\n<blockquote>\n<p>Lua queries metamethods in metatables using a raw access (see <a href="https://www.lua.org/manual/5.4/manual.html#pdf-rawget" rel="nofollow noreferrer">rawget</a>).</p>\n</blockquote>\n<p>Therefore, you cannot expect to use <code>__index</code> to inherit metamethods, you must define the metamethods explicitly.</p>\n<pre><code>UI.Widget = {\n __tostring = function ()\n return 'widget'\n end\n}\n</code></pre>\n"^^ . "haproxy"^^ . . . "0"^^ . . . "<p>After you randomly select the blue value, the red component implies a minimum and maximum value, so you can't use 0 and 255 as random ranges:</p>\n<pre><code>-- 0.3r + 0.59g = luminance\n-- r = (luminance - 0.59g) / 0.3\n\nlocal red_min = (luminance - 255 * 0.59) / 0.3\nlocal red_max = luminance / 0.3\nif red_min &lt; 0 then red_min = 0 end\n\nif luminance &lt;= 76 then\n red = math.random(red_min, luminance/0.3)\nelseif luminance &gt;= 179 then\n red = math.random(math.max(red_min, (luminanceStart-179)/0.3), red_max)\nelse\n red = math.random(red_min, red_max)\nend\n</code></pre>\n"^^ . . "1"^^ . . . . . . . . "<p>Use lib classic.\nI have next code:</p>\n<pre><code>Combination = Object:extend()\n\nfunction Combination:new(level, score)\nself.curentCombinationValues = 0\nself.curentCombination = {}\nself.level = level\nself.score = score \nend\n\nNonPair = Combination:extend()\n\nfunction NonPair:new()\nNonPair.super:new(1, 2)\nend\n\nOnePair = Combination:extend()\n\nfunction OnePair:new()\nOnePair.super:new(1, 3)\nend\n</code></pre>\n<p>When I create two objects, the second one replaces the variables of the inherited object, which means the first one also changes.</p>\n<pre><code>local one = NonPair()\nlocal second = OnePair()\n</code></pre>\n<p>one.level = second.level .\nWhy?</p>\n"^^ . . "How can I correctly distribute cars across slots based on probabilistic assignment in Lua?"^^ . "<p>I'm currently testing krakend community edition (playground) and I need to generate a JWT token, just before sending a request to the backend. The JWT must be added as a Bearer token to the Authorization header.</p>\n<p>The program that calls the endpoint must not be aware of the required JWT token.</p>\n<p>How can I do this? I've tried it with the extra_config auth/signer and with lua scripts but I can't get it to work</p>\n<p>This is my krakend.json endpoint</p>\n<pre><code>{\n &quot;@comment&quot;: &quot;Test all the open zaken based on bsn&quot;,\n &quot;endpoint&quot;: &quot;/debug/{bsn}/zaken&quot;,\n &quot;method&quot;: &quot;GET&quot;,\n &quot;backend&quot;: [\n {\n &quot;url_pattern&quot;: &quot;/__debug/zaken/api/v1/zaken&quot;,\n &quot;method&quot;: &quot;GET&quot;,\n &quot;host&quot;: [&quot;http://localhost:8080&quot;],\n &quot;extra_config&quot;: {\n &quot;auth/signer&quot;: {\n &quot;alg&quot;: &quot;HS256&quot;,\n &quot;signature-key&quot;: &quot;&lt;the secret&gt;&quot;,\n &quot;disable_jwk_security&quot;: false,\n &quot;header&quot;: {\n &quot;typ&quot;: &quot;JWT&quot;,\n &quot;alg&quot;: &quot;HS256&quot;\n },\n &quot;payload&quot;: {\n &quot;iss&quot;: &quot;&lt;the client_id&gt;&quot;,\n &quot;iat&quot;: &quot;{{time.now}}&quot;,\n &quot;client_id&quot;: &quot;&lt;the client_id&gt;&quot;,\n &quot;user_id&quot;: &quot;&lt;user id&gt;&quot;,\n &quot;user_representation&quot;: &quot;&lt;user representation&gt;&quot;\n }\n },\n &quot;modifier/martian&quot;: {\n &quot;fifo.Group&quot;: {\n &quot;scope&quot;: [&quot;request&quot;],\n &quot;aggregateErrors&quot;: true,\n &quot;modifiers&quot;: [\n { &quot;header.Append&quot;: { &quot;scope&quot;: [&quot;request&quot;], &quot;name&quot;: &quot;Accept-Crs&quot;, &quot;value&quot;: &quot;EPSG:4326&quot; }},\n { &quot;header.Append&quot;: { &quot;scope&quot;: [&quot;request&quot;], &quot;name&quot;: &quot;Content-Crs&quot;, &quot;value&quot;: &quot;EPSG:4326&quot; }}\n ]\n }\n }\n }\n }\n ]\n }\n</code></pre>\n<p>The debug logging shows the following:</p>\n<pre><code>▶ DEBUG [ENDPOINT: /__debug/*] Method: GET\n▶ DEBUG [ENDPOINT: /__debug/*] URL: /__debug/zaken/api/v1/zaken\n▶ DEBUG [ENDPOINT: /__debug/*] Params: [{param /zaken/api/v1/zaken}]\n▶ DEBUG [ENDPOINT: /__debug/*] Headers: map[Accept-Crs:[EPSG:4326] Accept-Encoding:[gzip] Content-Crs:[EPSG:4326] User-Agent:[KrakenD Version 2.9.1] X-B3-Sampled:[1] X-B3-Spanid:[0ee29d32d672bbc9] X-B3-Traceid:[c9a2c8c6ee8c92fa1bb2137e30772ad1] X-Forwarded-For:[172.18.0.1] X-Forwarded-Host:[localhost:8080]]\n▶ DEBUG [ENDPOINT: /__debug/*] Body: \n</code></pre>\n<p>As you can see there is no Authorization header.</p>\n<p>I've also tried it with LUA scripts but because I can't 'require' the library luajwtjitsi I can not generate a token that way (easily) either.</p>\n<p>Is there a way to generate a token using krakend (community edition)? If the answer is no: is it possible with the enterprise edition?</p>\n"^^ . "0"^^ . . "0"^^ . . . "tried using xpcall but the err return nil instead of exception error message"^^ . . "1"^^ . "3"^^ . "1"^^ . "1"^^ . . . . . . "<p>This is for the game World of Warcraft Classic. I want to send a message to the chat on successful spell cast from my pet. This reads the combat log for success spell cast, gets my pet's name, the target of the spell, and sends a message. However, each successful running of the code, an additional message will be sent. For example, first time one message sends, second time two messages send, and so forth. Here is the code below:</p>\n<pre><code>_G.petTarget = &quot;their target&quot; -- Default value for pet's target\n\n-- Create a frame to listen for combat log events\nlocal frame = CreateFrame(&quot;Frame&quot;)\nframe:RegisterEvent(&quot;COMBAT_LOG_EVENT_UNFILTERED&quot;)\nframe:SetScript(&quot;OnEvent&quot;, function()\n local _, subEvent, _, sourceGUID, _, _, _, _, destName = CombatLogGetCurrentEventInfo()\n \n -- If the event is a successful spell cast by your pet, store the target's name\n if subEvent == &quot;SPELL_CAST_SUCCESS&quot; and sourceGUID == UnitGUID(&quot;pet&quot;) then\n if destName then -- Prevent overwriting with nil\n _G.petTarget = destName\n end\n \n -- Delay calling the emote slightly to ensure the pet’s target updates in-game\n C_Timer.After(0.1, PetCommandEmote)\n end\nend)\n\nfunction PetCommandEmote()\n local petName = UnitName(&quot;pet&quot;) or &quot;my pet&quot; -- Get pet's name\n local petTarget = _G.petTarget -- Fetch the most recent target\n\n local phrases = {\n &quot;commands &quot; .. petName .. &quot; to devour magic from &quot; .. petTarget .. &quot;. Good puppy!&quot;,\n &quot;orders &quot; .. petName .. &quot; to feast on the magic of &quot; .. petTarget .. &quot;. Well done!&quot;,\n &quot;directs &quot; .. petName .. &quot; to absorb magical energy from &quot; .. petTarget .. &quot;. Good job!&quot;,\n &quot;commands &quot; .. petName .. &quot; to siphon power from &quot; .. petTarget .. &quot;. Atta boy!&quot;\n }\n\n SendChatMessage(phrases[math.random(#phrases)], &quot;EMOTE&quot;) -- Sends the emote to chat\nend\n</code></pre>\n<p>I am not too familiar with Lua coding so I was not able to pinpoint what the issue may be since nothing stopped the duplicate messages from sending. At this point the code works almost exactly how I want except the duplicate messages are too much of a hurdle for me to overcome.</p>\n"^^ . . "0"^^ . "0"^^ . . "Thx, I think I get it.. so require("telescope.builtin") will follow the filesystem path and require("telescope").builtin will just access the builtin field within the telescope module table?"^^ . . . "0"^^ . . "1"^^ . "luaj"^^ . . "2"^^ . "Perfom a Tmux key combination from Neovim"^^ . "0"^^ . . . . . . . "camera"^^ . . . "1"^^ . . . . . "0"^^ . "1"^^ . . "<p>If you are getting an infinite yield warning, it is Because <code>carsFolder</code> refers to the <code>Workspace</code> variable, which is <code>game:GetService('Workspace')</code>. Change it to <code>ReplicatedStorage</code> or <code>ServerStorage</code> depending on what you are using.</p>\n<p>After this, make sure you are changing the <code>car</code> parent to the <code>workspace</code> so that it spawns in correctly.</p>\n"^^ . "Its still not working only upper part of the script works the lower doesn't work."^^ . . . . . "string"^^ . . "0"^^ . . "Can a Redis key expire between two commands inside a Lua script?"^^ . "Have you tried pcall?"^^ . . "0"^^ . . "0"^^ . . "2"^^ . "<p>Inside a .lua file, there are the following two lines. I want to ask if it’s possible for v1 to be different from v2:</p>\n<pre><code>local v0 = redis.call('exists', KEY);\nlocal v1 = redis.call('exists', KEY);\n</code></pre>\n<p>I appreciate your help.</p>\n"^^ . "1"^^ . . "1"^^ . "upvoted: It worked. Why are you using 0 with getmetatable and setmetatable? There was no description of numbers in the documentation. `debug.getmetatable(value): Returns the metatable of the given value or nil if it does not have a metatable.` If it would be better as a separate question, I can create a new one."^^ . . . "nginx"^^ . "0"^^ . . "0"^^ . . . "Yes, that's right. It needs the IUP-IM binding.\nYou you are dynamically loading with require it does not need any additional link. And iupimlua_open will automatically be called by require("iupluaim")"^^ . . "Generate PDF with LUA"^^ . . "<p>I have a file at <code>c:\\test.mp3</code>. Removing it with <code>os.remove(&quot;c:\\\\test.mp3&quot;)</code> works but I want to remove it with <code>del</code> command from luacom's Shell. Unfortunately, it doesn't work:</p>\n<pre class="lang-lua prettyprint-override"><code>local command = string.format('del &quot;c:\\\\test.mp3&quot;')\nlocal Shell = luacom.CreateObject(&quot;WScript.Shell&quot;)\nShell:Run(command, 0, false)\n</code></pre>\n<p>It returns <code>COM exception:(luacom\\src\\library\\tLuaCOM.cpp,386):The system cannot find the file specified.</code></p>\n<p>Running other operations on this file from WScript.Shell, i.e. using ffmpeg (with the exact same path) have no issues finding this file.</p>\n"^^ . . "<p>The <code>%</code> in <code>expand(&quot;%:p:h&quot;)</code> represents the name of the current buffer, which…</p>\n<ul>\n<li>doesn't seem to be what you are actually after,</li>\n<li>and can reasonably be assumed to be different from plugin to plugin anyway.</li>\n</ul>\n<p>Furthermore, the <code>gx</code> command is not a native Vim command. It has historically been provided by Netrw, which is distributed with Vim, using its own state and methods, etc. Other file explorers <em>can</em> implement a <code>gx</code> command as well but, as they are all third-party plugins (including Netrw itself), they are not required to do so and… there is no universal API or even &quot;guideline&quot; to help with that.</p>\n<p>All you have at your disposal is, at a low level:</p>\n<ul>\n<li>Vim's own file-related functions found at <code>:help file-functions</code>,</li>\n<li>functionalities provided by embedded scripting languages like Lua, Ruby, Python, etc.</li>\n</ul>\n<p>and, at a higher level:</p>\n<ul>\n<li>whatever API, if any, is exposed by those plugins.</li>\n</ul>\n<p>FWIW, the general pattern is to:</p>\n<ol>\n<li>yank the word under the cursor,</li>\n<li>put it into a variable,</li>\n<li>try to get a proper filename out of it with some of the functions under <code>:help file-functions</code>.</li>\n</ol>\n<p>Note that it may require <em>some</em> context that <em>may</em> or <em>may</em> not be available at the time of execution, like parent directory, filetype, etc.</p>\n<p><a href="https://gist.github.com/habamax/0a6c1d2013ea68adcf2a52024468752e" rel="nofollow noreferrer">Here</a> is a very good low-level <code>gx</code> rewrite to serve as inspiration.</p>\n<p>Expanding on @Matt's comment, there are dozens of file explorers out there, and they all work around the lack of an actual &quot;common API for Vim file managers&quot; with various mutually incompatible hacks. That lack of common API will undoubtedly force you to make a choice:</p>\n<ul>\n<li>implement your generic <code>gx</code>-like command entirely on your own, only using low-level methods,</li>\n<li>implement your generic <code>gx</code>-like command using the private APIs of some or all of the myriad file explorers, eventually implementing a low-level fallback anyway.</li>\n</ul>\n<p>None of those seem particularly thrilling to me.</p>\n"^^ . "How to stop JDTLS quitting ("Exit code 13 and signal 0") every time I open a java file in neovim?"^^ . . . . . . . . "2"^^ . "1"^^ . "0"^^ . . "Pass NestedStruct from c++ to lua"^^ . . "1"^^ . . . "0"^^ . . . "0"^^ . . "1"^^ . "<p>Currently I have a Lua-driven system with C functions connected. When it is built from source, it is constructed as below:</p>\n<pre><code>// bind C functions to make them callable inside Lua code\nlua_pushlightuserdata(lua, some_cxx_object);\nlua_pushcclosure(lua, global_function_foo, 1);\nlua_setglobal(lua, &quot;foo&quot;);\n\nlua_pushcclosure(lua, global_function_bar, 0);\nlua_setglobal(lua, &quot;bar&quot;);\n\n...... many more bindings ......\n\n// compile Lua source code\nauto re = luaL_loadbufferx( guts-&gt;lua, source, source_len, nullptr, nullptr );\nif (re != LUA_OK)\n raise_exceptions();\n\n// use the prepared Lua system\n......\n</code></pre>\n<p>Now I want to use precompiled binaries to improve system init speed. My question is: how does <code>lua_dump</code> work with those C closure globals? Specifically:</p>\n<ul>\n<li>When I'm going to compile &amp; dump, should I bind C functions before compile?</li>\n<li>When I'm going to use the precompiled binary, do I need to bind C functions again, before loading the binary?</li>\n</ul>\n"^^ . . "0"^^ . "0"^^ . . . . . . "<p>In lua, if we try to index a series of nested table (any of which can be nil), we might write code like this:</p>\n<pre class="lang-lua prettyprint-override"><code>-- try to get a.b.c\n\nlocal ret\nif a then\n local b = a.b\n if b then\n ret = b.c\n end\nend\n</code></pre>\n<p>Which I think is lenthy and ugly. There are also simpler ways:</p>\n<pre class="lang-lua prettyprint-override"><code>-- method 1\nlocal ret = a and a.b and a.b.c\n\n-- method 2\nlocal ret = ((a or {}).b or {}).c\n</code></pre>\n<p>I know I'm splitting hairs, but these two methods are still not perfect, method 1 causes more index operations (do a.b twice), method 2 create some unnecessary tables.</p>\n<p>So I wonder if there is a way with no side-effect like '?.' in C#? Or '?.' operator violates lua's design philosophy?</p>\n"^^ . "0"^^ . . . . "0"^^ . "animation"^^ . "0"^^ . . . "The documentation mentions `FullscreenType` and specific behavior. Did you check this? Which version of love2d are you using?"^^ . . . . "0"^^ . "0"^^ . "0"^^ . . "0"^^ . . "2"^^ . "I already found out why probably could that happen. Maybe it is because of the optimization, where for client if the object is too far from the player character it just gets deleted, so Roblox won't be so laggy. And when I scripted the character to move along with the camera it got fixed."^^ . . . . . "0"^^ . . . "0"^^ . "1"^^ . . "0"^^ . . . "0"^^ . . . . "<p>I'm implementing a Manhattan Voronoi diagram in Love2D, where regions are divided based on the Manhattan distance from a set of given sites. However, I'm encountering an issue when two or more sites are located on the same diagonal. In such cases, some grid cells are marked as 'tie' regions and displayed as black areas, which I want to avoid.</p>\n<p>I understand that the problem occurs because the Manhattan distances to these sites are equal for certain points on the grid. Here's my current findClosestSite function:</p>\n<pre class="lang-lua prettyprint-override"><code>function findClosestSite(x, y, sites)\n local minDistance = math.huge\n local closestSite = nil\n local isTie = false\n\n for _, site in ipairs(sites) do\n local distance = math.abs(x - site[1]) + math.abs(y - site[2])\n if distance &lt; minDistance then\n minDistance = distance\n closestSite = site\n isTie = false\n elseif distance == minDistance then\n isTie = true\n end\n end\n\n return closestSite, isTie\nend\n</code></pre>\n<p>In the case of a tie, I currently mark the cell as black. I'd like to resolve ties by prioritizing one of the sites.</p>\n<p>How can I modify my function to handle ties in a robust way, or are there better approaches for resolving this issue in Manhattan Voronoi diagram?</p>\n<p><a href="https://i.sstatic.net/0bL2kcUC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0bL2kcUC.png" alt="manhattan voronoi" /></a></p>\n"^^ . . "3"^^ . . . . . . "1"^^ . "<p>I'm writing a <code>yazi</code> plugin to preview documents. I'm on GNU/Linux. I'm trying to save the temporary files in a dedicated folder with the UID —user id— as suffix.</p>\n<p>According to <a href="https://www.lua.org/pil/22.2.html" rel="nofollow noreferrer"><em>Programming in Lua</em></a></p>\n<blockquote>\n<p>The os.getenv function gets the value of an environment variable. It receives the name of the variable and returns a string with its value.... If the variable is not defined, the call returns <code>nil</code></p>\n</blockquote>\n<p>The thing is, <code>UID</code> it's indeed defined</p>\n<pre class="lang-bash prettyprint-override"><code>[user@hostname ~]$ echo $UID\n1000\n</code></pre>\n<p>What I've tried is to use <code>os.getenv(&quot;UID&quot;)</code> but the function returns <code>nil</code>. On the other hand, other environment variables such as <code>XDG_RUNTIME_DIR</code> or <code>HOME</code> are retrieved successfully.</p>\n<p>For instance</p>\n<pre class="lang-lua prettyprint-override"><code>...\n\nlocal user_id = os.getenv(&quot;UID&quot;)\nlocal run_dir = os.getenv(&quot;XDG_RUNTIME_DIR&quot;)\nlocal tmp_dir = run_dir .. &quot;/office.yazi-&quot; .. user_id .. &quot;/&quot;\nlocal pdf_file = tmp_dir .. self.file.name:gsub(&quot;%..*$&quot;, &quot;.pdf&quot;)\n\n...\n</code></pre>\n<p>Fails to concatenate a <code>nil</code> value assigned to <code>user_id</code> due to <code>os.getenv(&quot;UID&quot;)</code></p>\n<p>Another approach I've tried is to use <code>io.popen()</code> instead</p>\n<pre class="lang-lua prettyprint-override"><code>...\n\nlocal handle = io.popen(&quot;id -u&quot;)\nlocal user_id = handle:read(&quot;*a&quot;)\nhandle:close()\nlocal run_dir = os.getenv(&quot;XDG_RUNTIME_DIR&quot;)\nlocal tmp_dir = run_dir .. &quot;/office.yazi-&quot; .. user_id .. &quot;/&quot;\nlocal pdf_file = tmp_dir .. self.file.name:gsub(&quot;%..*$&quot;, &quot;.pdf&quot;)\n\n...\n</code></pre>\n<p>But the problem with said approach is that returns a trailing newline character as</p>\n<pre><code>1000\\n\n</code></pre>\n<p>And maybe I can remove it somehow, but as it's a plugin what I'm writing I would prefer to go down the <code>os.getenv</code> route and keep it simple as far it's possible. If what I'm asking it's not possible, please let me know.</p>\n<p>My guess is <code>os.getenv(&quot;UID&quot;)</code> not reading the correct variable name or trying to read it from the wrong place.</p>\n<p>Does someone has any idea as to why is this happening or any suggestion as to read the <code>UID</code> env?</p>\n"^^ . . "screen resolution always overridden"^^ . . "0"^^ . "Also `env UID=$UID lua foo.lua` and `lua -eUID=$UID foo.lua`."^^ . . . "2"^^ . "3"^^ . . "immutability"^^ . . "<p>I'm in the process to implement a WireShark dissector, and I have a technical question (I'm still learning the details of a lua dissector).</p>\n<p>In particular I want to add int/float/string items to the dissected subtree based on a variable length array (the length depend on a file loaded from the preferences).</p>\n<p>I would like to avoid to create as many ProtoField as there are items in the array (I don't know the length), the arrays I dissect have a coherent item type, they are either all int or all float or all string.</p>\n<p>I don't see question in stack overflow of how to achieve that.</p>\n"^^ . "<p>So i wanted to play gmod after some time and when i looked up server was down. They published the files on web and i am trying to make it work. Now i get an error called: attempt to index global 'ASAPDriver' (a nil value) (not just once, this is used in 13 places and i am getting errors for them too) I don't know much about MySQL and lua so i need your help.\nThank you!\nIn short:</p>\n<p><a href="https://pastebin.com/QxHwz7Cj" rel="nofollow noreferrer">https://pastebin.com/QxHwz7Cj</a></p>\n<p>One of the lua :</p>\n<pre><code>&lt;https://pastebin.com/9GzVKPeH&gt;\n</code></pre>\n<p>(sorry about pastebin i don't know how to paste here)</p>\n"^^ . "<p>In general your approach is good but the execution method for writing PDF as text in a programmable stream, needs to hold as few variables as is possible.<br />\nCurrently your limited to about one lines worth of text.<br />\n<a href="https://i.sstatic.net/lW6ZVY9F.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lW6ZVY9F.png" alt="enter image description here" /></a></p>\n<p>All those variables need to tally in the trailer. Thus I suggest you adapt slightly to use this basic structure.</p>\n<pre><code>%PDF-1.4\n1 0 obj &lt;&lt;/Type/Catalog/Pages 2 0 R&gt;&gt; endobj\n2 0 obj &lt;&lt;/Type/Pages/Count 1/Kids [3 0 R]&gt;&gt; endobj\n3 0 obj &lt;&lt;/Type/Page/Parent 2 0 R/MediaBox [0 0 595 842]/Resources&lt;&lt;/Font&lt;&lt;/F1 4 0 R&gt;&gt;&gt;&gt;/Contents 5 0 R&gt;&gt; endobj\n4 0 obj &lt;&lt;/Type/Font/Subtype/Type1/BaseFont/Helvetica&gt;&gt; endobj\n5 0 obj &lt;&lt;/Length 6 0 R&gt;&gt;\nstream\nBT /F1 20 Tf 100 700 Td (Something or nothing line 1) Tj ET\n...line 2...\n...line 3...\n\netc. ... etc.\n\nendstream\nendobj\n6 0 obj ..$Length.. endobj\nxref\n0 7\n0000000000 65535 f \n0000000009 00000 n \n0000000054 00000 n \n0000000106 00000 n \n0000000219 00000 n \n0000000282 00000 n \n0.$length+ 00000 n \ntrailer\n&lt;&lt;/Root 1 0 R/Size 7&gt;&gt;\nstartxref\n.$Above+20.\n%%EOF\n</code></pre>\n<p>So to add lines it is simpler, beware this is NOT correct syntax just proves the method works!<br />\n<a href="https://i.sstatic.net/CjRExcrk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/CjRExcrk.png" alt="enter image description here" /></a></p>\n<p>The difference is we add the stream length after the data stream and only alter the fewest variable entries.</p>\n<pre><code>5 0 obj &lt;&lt;/Length 6 0 R&gt;&gt;\nstream\nq 0 g\nBT /F1 12 Tf 1 0 0 1 50 700 Tm (FID: 17, IDType: nothing, CID: nothing, Name: Mac Aura PXL 1, Mode: Standard, Uaddrs: 1.301) Tj ET\nBT 1 0 0 1 50 660 Tm (FID: 18, IDType: something, CID: controller, Name: Spot Moving Head, Mode: Advanced, Uaddrs: 2.101) Tj ET\nBT 1 0 0 1 50 620 Tm (FID: 19, IDType: example, CID: another, Name: Wash Light, Mode: Standard, Uaddrs: 3.401) Tj ET\nBT 1 0 0 1 50 580 Tm (FID: 20, IDType: , CID: , Name: , Mode: , Uaddrs: 0.000) Tj ET\nQ\n\nendstream\nendobj\n6 0 obj 0469 endobj\nxref\n0 7\n0000000000 65536 f \n0000000009 00000 n \n0000000054 00000 n \n0000000105 00000 n \n0000000217 00000 n \n0000000280 00000 n \n0000000800 00000 n \n\ntrailer\n&lt;&lt;/Size 7/Root 1 0 R&gt;&gt;\nstartxref\n820\n%%EOF\n\n</code></pre>\n<h2>Explanation</h2>\n<p>Adobe Acrobat Reader will accept some errors and correct others, however a stream LENGTH must be close to correct.</p>\n<p>When adding lines of text as variable page contents you cannot count until all done. So the stream length shown here as <code>469</code> needs to be added after the stream (or carried back to stream header).</p>\n<p>Any variable length needs to adjust for itself in the trailer. The decimal distance addresses can be static up to the last which impacts the startXREF (A known fixed amount later)</p>\n<p>The maths is then simplified to if <code>6 0 obj 0469 endobj</code> value is 4 digits <code>0469</code> starting at <code>0800</code> then startxref is 20 more @ <code>820</code></p>\n<p>There is usually no problem using leading zer0's to ensure fixed character string lengths.</p>\n<p>Thus heading objects 0-5 up to stream have a static value of 313 (800-469+ approx. 18 for EOS&amp;EOO)\nThus stream = 0+ and the later index value is <code>(313 + 18) + stream length</code> and <code>startxref</code> a fixed <code>+20</code> after that.</p>\n"^^ . . . "3"^^ . . "Can I copy the vim api in neovim"^^ . "1"^^ . . . "@Ivo it's not the same since I'm not using unpack as a function argument, but as a table entry."^^ . . "Ellipses used when declaring a variable"^^ . . . . . "1"^^ . "<p>I'd like to capture all occurrences of a pattern between 2 strings using Lua.\nThis is the current pattern I built:</p>\n<pre class="lang-lua prettyprint-override"><code>do%(%).-(mul%(%d+%,%d+%))[don't%(%)]?\n</code></pre>\n<p>This does what I want except that it only captures a single occurrence between &quot;do()&quot; and &quot;don't()&quot;</p>\n<p>example: <code>do()mul(41,51)mul(1,1)don't()</code> only <code>mul(41,51)</code> is captured</p>\n<p>Is it possible to achieve what I want in Lua?</p>\n"^^ . "0"^^ . . . "4"^^ . . "Physics broken for unanchored parts when i use :Destroy()"^^ . . . "2"^^ . . . . . "How to spawn a player in a car?"^^ . "1"^^ . "1"^^ . "0"^^ . . . . "Is there any way lua script to capture the exception error in freeswitch.Dbh?"^^ . "<p>I am fairly new to using neovim and set things up with <a href="https://github.com/nvim-lua/kickstart.nvim" rel="nofollow noreferrer">kickstart.nvim</a>. I tried to setup jdtls to run with mason. It was working fine until today, when it has been quitting immediately upon opening of a java file with the message &quot;Exit code 13 and signal 0&quot;.</p>\n<p>Here's were I've got to with my mason stuff (please see my full <a href="https://github.com/helboi4/mykickstart.nvim/blob/current-config/init.lua" rel="nofollow noreferrer">init.lua</a> and <a href="https://github.com/helboi4/mykickstart.nvim/tree/current-config" rel="nofollow noreferrer">config</a> for context):</p>\n<pre><code> local servers = {\n lua_ls = {\n settings = {\n Lua = {\n runtime = { version = 'LuaJIT' },\n workspace = {\n checkThirdParty = false,\n library = {\n '${3rd}/luv/library',\n unpack(vim.api.nvim_get_runtime_file('', true)),\n },\n },\n completion = {\n callSnippet = 'Replace',\n },\n },\n },\n },\n jdtls = {\n root_dir = vim.fs.dirname(vim.fs.find({ 'gradlew', '.git', 'mvnw' }, { upward = true })[1]),\n },\n angularls = {},\n html = {},\n ts_ls = {},\n }\n\n vim.list_extend(ensure_installed, {\n 'stylua', -- Used to format Lua code\n })\n require('mason-tool-installer').setup { ensure_installed = ensure_installed }\n\n require('java').setup {}\n\n require('mason-lspconfig').setup {\n handlers = {\n function(server_name)\n local server = servers[server_name] or {}\n server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})\n require('lspconfig')[server_name].setup(server)\n end,\n },\n ensure_installed = ensure_installed,\n automatic_installation = true,\n }\n end,\n },\n\n</code></pre>\n<p>Here is the output in the lsp log file:</p>\n<pre><code>[START][2025-01-13 22:21:45] LSP logging initiated\n[ERROR][2025-01-13 22:21:45] .../vim/lsp/rpc.lua:770 &quot;rpc&quot; &quot;/Users/hopecah/.local/share/nvim/mason/bin/java&quot; &quot;stderr&quot; &quot;WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign\\n&quot;\n[ERROR][2025-01-13 22:21:45] .../vim/lsp/rpc.lua:770 &quot;rpc&quot; &quot;/Users/hopecah/.jenv/versions/21.0.3/bin/java&quot; &quot;stderr&quot; &quot;Disabling server log output. No more output will be sent after this.\\n&quot;\n[ERROR][2025-01-13 22:21:46] .../vim/lsp/rpc.lua:770 &quot;rpc&quot; &quot;/Users/hopecah/.local/share/nvim/mason/bin/java&quot; &quot;stderr&quot; &quot;Jan 13, 2025 10:21:46 PM org.apache.aries.spifly.BaseActivator log\\nINFO: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic\\n&quot;\n[ERROR][2025-01-13 22:21:46] .../vim/lsp/rpc.lua:770 &quot;rpc&quot; &quot;/Users/hopecah/.local/share/nvim/mason/bin/java&quot; &quot;stderr&quot; &quot;Jan 13, 2025 10:21:46 PM org.apache.aries.spifly.BaseActivator log\\nINFO: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic\\n&quot;\n[WARN][2025-01-13 22:27:15] ...lsp/handlers.lua:135 &quot;The language server spring-boot triggers a registerCapability handler for workspace/didChangeWorkspaceFolders despite dynamicRegistration set to false. Report upstream, this warning is harmless&quot;\n[WARN][2025-01-13 22:27:15] ...lsp/handlers.lua:135 &quot;The language server spring-boot triggers a registerCapability handler for textDocument/semanticTokens despite dynamicRegistration set to false. Report upstream, this warning is harmless&quot;\n[START][2025-01-13 22:28:14] LSP logging initiated\n[ERROR][2025-01-13 22:28:14] .../vim/lsp/rpc.lua:770 &quot;rpc&quot; &quot;/Users/hopecah/.local/share/nvim/mason/bin/java&quot; &quot;stderr&quot; &quot;WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign\\n&quot;\n[ERROR][2025-01-13 22:28:15] .../vim/lsp/rpc.lua:770 &quot;rpc&quot; &quot;/Users/hopecah/.jenv/versions/21.0.3/bin/java&quot; &quot;stderr&quot; &quot;Disabling server log output. No more output will be sent after this.\\n&quot;\n[ERROR][2025-01-13 22:28:15] .../vim/lsp/rpc.lua:770 &quot;rpc&quot; &quot;/Users/hopecah/.local/share/nvim/mason/bin/java&quot; &quot;stderr&quot; &quot;Jan 13, 2025 10:28:15 PM org.apache.aries.spifly.BaseActivator log\\nINFO: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic\\n&quot;\n[ERROR][2025-01-13 22:28:15] .../vim/lsp/rpc.lua:770 &quot;rpc&quot; &quot;/Users/hopecah/.local/share/nvim/mason/bin/java&quot; &quot;stderr&quot; &quot;Jan 13, 2025 10:28:15 PM org.apache.aries.spifly.BaseActivator log\\nINFO: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic\\n&quot;\n\n</code></pre>\n<p>When I have had problems with it before it was usually because I needed to clean install my java project I'm working on but this is not the case this time. I've done that like 10 times.</p>\n<p>Extra info: I'm using jenv and its running java version 21.0.3</p>\n<p>I have tried every answer I've found on github, stackoverflow and reddit, including trying to just use nvim-jdtls with a ftplugin/java.lua file instead of my kickstart generated init.lua, deleting all the jdtls files in the mason folder and making it remake them etc. But nothing is helping.</p>\n<p>I did see someone suggest clearing eclipse cache but I don't know where that exists or how to identify it.</p>\n<p>I've been working on this for about 12 hours and I've tried a ridiculous amount of setups, please can someone explain what I'm doing wrong here?</p>\n"^^ . . "0"^^ . "<p><code>NonPair.super:new(1, 2)</code> is syntactic sugar for <code>NonPair.super.new(NonPair.super, 1, 2)</code> (the same pattern applies for <code>OnePair</code>).</p>\n<p>This means the contextual <code>self</code> inside <code>Combination:new</code> will not refer to the new instance (<code>one</code>), but rather the parent class itself (<code>Combination</code>). With this, <code>self.level = level</code> is then equivalent to <code>Combination.level = level</code>, setting a key-value pair on the class itself.</p>\n<p>The call to <code>OnePair.super:new(1, 3)</code> overwrites the values that were set by <code>NonPair.super:new(1, 2)</code>, so both <code>one.level</code> and <code>second.level</code> result in the same value (both invoking the <code>__index</code> <em>metamethod</em> to find the value on the parent class).</p>\n<p>The correct pattern to use with <a href="https://github.com/rxi/classic" rel="nofollow noreferrer">this library</a> is</p>\n<pre class="lang-lua prettyprint-override"><code>NonPair = Combination:extend()\n\nfunction NonPair:new()\n NonPair.super.new(self, 1, 2)\nend\n\nOnePair = Combination:extend()\n\nfunction OnePair:new()\n OnePair.super.new(self, 1, 3)\nend\n</code></pre>\n<p>as <a href="https://github.com/rxi/classic?tab=readme-ov-file#extending-an-existing-class" rel="nofollow noreferrer">shown in the README</a>.</p>\n"^^ . "Yup, I completely missed that on the list of metamethods, thank you!"^^ . . "I thought I'd included this in my previous reply, but I'm using Love 11.5.0."^^ . . "3"^^ . . . . . . "1"^^ . . . "<p>On a ESP8266 with nodemcu and LUA 5.1 I need to use an upvalue to process a turn event for a rotary encoder. However this variable is always NIL. As I understand the principle of upvalues, the variable sv should be passed the the callback of the 'turn' function, but it is not. What I miss by understanding of upvalues?</p>\n<pre><code>local turn = function(type, pos, when)\n print(type, pos, when, sv.value)\n if type == rotary.TURN then\n local move = sv.last - pos\n sv.last = pos\n sv.x = sv.value + move\n local tm\n if tm == nil then\n tm = tmr.create()\n tm:register(500, tmr.ALARM_SINGLE, function()\n setTo(sv)\n end)\n end\n tm:start() \n end\nend\n\nlocal setupRotary = function(sv)\n local ch, a, b, sw = sv.rotary_ch, sv.rotary_a, sv.rotary_b, sv.rotary_sw\n print(ch, a, b, sw)\n rot.init(ch, a, b, 1, sw)\n sv.last = 0\n rot.on(ch, rot.TURN, turn)\nend\n</code></pre>\n<p>By the way, &quot;rot&quot; is also a lua module. When I rotate the encoder, I get &quot;attempt to index global 'sv' (a nil value)&quot; at the first line of th &quot;turn&quot; function.</p>\n"^^ . "<p>I have some Lua scripts that serve as LIBs, they create custom methods to be used later, for example:</p>\n<pre><code>function Player:addPartner()\n print('Party partner added from Lua script!' .. tostring(self))\nend\n</code></pre>\n<p>I have the player class like this:</p>\n<pre><code>class Player {\n private String name;\n\n public Player(String name) {\n this.name = name;\n }\n\n @Override\n public String toString() {\n return &quot;Player{name='&quot; + name + &quot;'}&quot;;\n }\n}\n</code></pre>\n<p>What I need is for the <code>addPartner</code> method to be available to all instances of <code>Player</code> that are created, remembering that this is just one example of a method, there may be several others with or without parameters.\nIn addition, within the method, <code>self</code> must be accessible within the method.</p>\n<p>I need this method to be available to be accessed via Java and via Lua Script</p>\n"^^ . . . "0"^^ . . . "If you are really curious, the comments preceding [`luaH_getn`](https://lua.org/source/5.4/ltable.c.html#luaH_getn) and [`hash_search`](https://lua.org/source/5.4/ltable.c.html#hash_search) go into extreme detail about the specifics of how table boundaries are handled in the reference implementation of Lua."^^ . "Difference between require("some.module") and require("some").module?"^^ . "vim-registers"^^ . . . . "<p>So, as of now, I am attempting to make a brush that does 2 things, the first is that it jitters to create some sort of &quot;texture&quot;, and the second is that it draws a random colour that has the same amount of luminance as the foreground/input colour. For the most part, I've managed to successfully implement it, but for some reason, it has a bias for blue in low luminance level, and a bias for green in high luminance level, any help please? (Firealpaca uses Lua, just a reminder) (also, I started learning coding yesterday, so, apologies for my sloppy coding work)</p>\n<pre><code>Firstdraw = true\n\nfunction param1()\n -- minimum, maximum, default value\n return &quot;random&quot; , 0 , 100 , 2\nend\n\nfunction main(x, y, p)\n if Firstdraw then\n r, g, b = bs_fore()\n luminance = (r * 0.3) + (g * 0.59) + (b * 0.11)\n luminanceStart = luminance\n if luminance &lt;= 28 then\n blue = math.random(0, luminance/0.11)\n elseif luminance &gt;= 227 then\n blue = math.random((luminance-227)/0.11, 255)\n else\n blue = math.random(0, 255)\n end\n luminance = luminance - blue*0.11\n if luminance &lt;= 76 then\n red = math.random(0, luminance/0.3)\n elseif luminance &gt;= 179 then\n red = math.random((luminanceStart-179)/0.3, 255)\n else\n red = math.random(0, 255)\n end\n luminance = luminance - red*0.3\n green = luminance/0.59\n if green &gt; 255 then\n green = 255\n end\n luminanceEnd = (red * 0.3) + (green * 0.59) + (blue * 0.11)\n local sx = tostring(luminanceStart)\n local sv = tostring(luminanceEnd)\n local sy = tostring(red)\n local sp = tostring( green)\n local sd = tostring( blue)\n bs_debug_log( &quot;sx: &quot; .. sx .. &quot; sv: &quot; .. sv .. &quot; sy: &quot; .. sy .. &quot; sp: &quot; .. sp.. &quot; sd: &quot; .. sd )\n bs_debug_log(&quot;&quot;)\n\n end\n local width = bs_width()\n local x, y = x+math.random(bs_param1()*-1, bs_param1())*p*width/10, y+math.random(bs_param1()*-1, bs_param1())*p*width/10\n local opacity = bs_opaque() * 255\n\n bs_ellipse(x, y, width, width, 0, red, green, blue, opacity)\n Firstdraw = false\n return 1\nend\n\n</code></pre>\n<p>I honestly don't know how to fix this, I expected it to output a random colour with the same luminance, but it instead has a bias for green or blue.</p>\n<p><a href="https://i.sstatic.net/tCIJKany.png" rel="nofollow noreferrer">resulting colours, green bias on high luminance, blue bias on low luminance</a></p>\n<p>another problem that rose from this, is that on high luminance value, sometimes the green just goes over 255, making it return back to small numbers from 0, so I capped it to 255, but as a result, it reduces the luminance value of the resulting colour. I figured that the reason this happened is because of the green bias</p>\n"^^ . "0"^^ . "0"^^ . "Still not solved. It is still producing inconsistent random strings. Check my updated Lua code."^^ . . "1"^^ . . "dialplan"^^ . . . . . . . . . . "This is how VM stack works. So it applies to function calls, table constructors, multi-assignments, and so on and so on. Anywhere comma stands."^^ . . "@shingo add : print(one.score) print(second.score) and recive 3 - 3 but it was necessary to get 2 - 3"^^ . "@Beso I added the code"^^ . . . . . "<p>I want to assemble a table based on the values of other tables. For this I'm unpacking a two tables into the new table. Here's what I have</p>\n<pre><code>local function assemble_abspath_candidates()\n -- Make sure user data path preceedes the system paths\n local user_data = vim.fn.stdpath('data')\n local data_dirs = vim.fn.stdpath('data_dirs')\n -- Make sure user config path preceedes system config paths\n local user_config = vim.fn.stdpath('config')\n local config_dirs = vim.fn.stdpath('config_dirs')\n\n\n -- Print data_dirs\n for i, val in ipairs(data_dirs) do\n vim.print(&quot;datadir &quot; .. i .. &quot;: &quot; .. val)\n end\n\n -- Print config dirs\n for i, val in ipairs(config_dirs) do\n vim.print(&quot;config dir &quot; .. i .. &quot;: &quot; .. val)\n end\n\n local combined_paths = { user_data, user_config, unpack(data_dirs), unpack(config_dirs) }\n\n -- Print it all\n for i, val in ipairs(combined_paths) do\n vim.print(i .. &quot;: &quot; .. val)\n end\n\n return combined_paths\nend\n</code></pre>\n<p>The outcome of this however is not how I expected it:</p>\n<pre><code>datadir 1: /usr/share/i3/nvim\ndatadir 2: /usr/share/gnome/nvim\ndatadir 3: /usr/local/share/nvim\ndatadir 4: /usr/share/nvim\ndatadir 5: /var/lib/snapd/desktop/nvim\nconfig dir 1: /etc/xdg/xdg-i3/nvim\nconfig dir 2: /etc/xdg/nvim\n1: /home/myuser/.local/share/nvim\n2: /home/myuser/.config/nvim\n3: /usr/share/i3/nvim\n4: /etc/xdg/xdg-i3/nvim\n5: /etc/xdg/nvim\n</code></pre>\n<p>For some reason only the first value from datadir is taken. Why does this happen?</p>\n<p><strong>The question is different</strong> from <a href="https://stackoverflow.com/questions/37372182/what-is-happening-when-i-call-unpack-as-luas-function-arguments">unpack as function argument</a> since I don't call a function but I want to expand a table using the unpack results (which according to <a href="https://www.lua.org/pil/5.1.html" rel="nofollow noreferrer">this documentation</a> should result in the expanded values being reimagined as table elements).</p>\n<p>I suppose this is also the use case for unpack, or what else would be? And it even works for one of the unpacks, but just not for both at the same time..</p>\n<p>(NVIM v0.11.0-dev-1161+g6ef80eb42c LUA 5.1 interpreter)</p>\n"^^ . . . "How do I convert a string to a table in Lua?"^^ . "2"^^ . "Humanoid not moving with mouse on Rbx Studio"^^ . . . . . . "0"^^ . . . "openresty"^^ . "1"^^ . . "0"^^ . "1"^^ . "<p>When the argument is a string or table, you can omit parentheses, which is <a href="https://www.lua.org/manual/5.4/manual.html#3.4.10" rel="nofollow noreferrer">specified by Lua</a>, but in other cases parentheses must be used.</p>\n<pre><code>local mod_action = require(moduletoload)\n</code></pre>\n"^^ . . . . . "0"^^ . "Merging 2 Scripts into 1 script"^^ . "1"^^ . . . "How to send data from a fivem FXServer server script to JavaScript"^^ . "1"^^ . "2"^^ . "0"^^ . . . . "lua-c++-connection"^^ . "0"^^ . "1"^^ . . . . "<p>I have the following script, which checks the current keyboard layout (Ubuntu 22.04) and changes the color.</p>\n<pre><code>local function set_cursor_color()\n -- Get the current keyboard layout\n local layout = vim.system({&quot;xkblayout-state&quot;, &quot;print&quot;, &quot;%n&quot;}, { text = true }):wait()\n -- vim.notify(&quot;layout = &quot; .. layout.stdout, &quot;info&quot;, { title = &quot;Layout&quot; })\n if layout.stdout == &quot;English&quot; then\n -- Change cursor color for English layout\n vim.cmd([[highlight CursorLine cterm=NONE ctermbg=DarkGray guibg=#373944]])\n else\n -- Change cursor color for other layouts\n vim.cmd([[highlight CursorLine cterm=NONE ctermbg=DarkGray guibg=#44373f]])\n end\nend\n\n-- Call set_cursor_color when cursor moved.\nvim.api.nvim_create_autocmd({&quot;CursorMoved&quot;, }, {\n callback = set_cursor_color,\n})\n</code></pre>\n<p>However, I'm frustrated by the fact that it executes every time I move the cursor, even though there's no need for it.</p>\n<ul>\n<li>Is it possible to hook it to a more appropriate event in the autocommand, like a non-interceptive <code>CapsLock</code> key press (which I use for switching), a change in an environment variable, or some temporary file (this I can set up)?</li>\n<li>And is there a way to notify all running <code>nvim</code> processes about the change?</li>\n</ul>\n"^^ . "1"^^ . "<p>I am trying to mask and unmask the call recordings which is being recorded automatically through some lua scrip using the command record_session. the lua script execut this command when the call is answered.\nhere is the lua script.</p>\n<pre><code>package.cpath =&quot;/usr/lib/x86_64-linux-gnu/lua/5.2/?.so;&quot; .. package.cpath\npackage.path = &quot;/usr/share/lua/5.2/?.lua;&quot; .. package.path\n\nlocal callType = session:getVariable(&quot;sip_h_X-CallType&quot;)\nlocal record_path = session:getVariable(&quot;record_path&quot;)\nlocal uuid = session:getVariable(&quot;uuid&quot;)\nlocal ext = session:getVariable(&quot;record_ext&quot;)\nlocal customer_leg_uuid = ''\nlocal api = freeswitch.API();\n\n-- can be consult, OUT, MONITOR, PROGRESSIVE, \n\nlocal function fileExists(file)\n local f = io.open(record_path .. '/' .. file, 'r')\n if f == nil then\n -- freeswitch.consoleLog(&quot;ERROR&quot;, &quot;set_recording_name.lua FILE NOT FOUND: &quot; .. file)\n return false;\n end\n io.close(f);\n -- freeswitch.consoleLog(&quot;ERROR&quot;, &quot;set_recording_name.lua FILE WAS FOUND: &quot; .. file)\n return true;\nend\n\nlocal destination = tostring(session:getVariable(&quot;destination_number&quot;))\n-- freeswitch.consoleLog(&quot;NOTICE&quot;, &quot; \\n set_recording_name.lua DESTINATION \\n &quot; .. destination)\n\n\nif (callType == &quot;CONSULT&quot;) then\n freeswitch.consoleLog(&quot;NOTICE&quot;, &quot; \\n set_recording_name.lua RECORDING CONSULT CALL \\n&quot;)\n session:execute(&quot;stop_record_session&quot;,&quot;all&quot;)\n if (string.match(tostring(destination), &quot;99887766&quot;)) then\n return\n end return\nelseif (callType == &quot;MONITOR&quot;) then -- no recording enabled here\n return\n -- callType == &quot;PROGRESSIVE&quot; or \nelseif (callType == &quot;OUT&quot;) then -- for manual outbound use the preset other leg uuid i.e. customer leg uuid\n\n customer_leg_uuid = session:getVariable(&quot;customer_leg_uuid&quot;)\n freeswitch.consoleLog(&quot;NOTICE&quot;, &quot; \\n set_recording_name.lua UUID \\n &quot; .. uuid)\n freeswitch.consoleLog(&quot;NOTICE&quot;, &quot; \\n set_recording_name.lua CUSTOMER \\n&quot; .. customer_leg_uuid)\n if (uuid ~= customer_leg_uuid) then\n freeswitch.consoleLog(&quot;NOTICE&quot;, &quot; \\n set_recording_name.lua RECORDING MANUAL OUTBOUND CALL \\n&quot;)\n session:setVariable(&quot;recording_command&quot; , &quot;nolocal:execute_on_answer=record_session &quot; .. record_path .. &quot;/&quot; .. customer_leg_uuid .. &quot;.&quot; .. ext)\n session:setVariable(&quot;recording_filename&quot; , customer_leg_uuid .. &quot;.&quot; .. ext)\n return\n end\n session:execute(&quot;stop_record_session&quot;,&quot;all&quot;)\n local res = api:executeString(&quot;bgapi uuid_broadcast &quot; .. uuid .. &quot; stop_record_session::all&quot;)\n uuid = customer_leg_uuid\nend\n\nlocal filename = uuid\n-- inbound ivr case\nfreeswitch.consoleLog(&quot;NOTICE&quot;, &quot;\\n set_recording_name.lua RECORDING INBOUND CALL \\n&quot;)\nlocal count = 0\nwhile (fileExists(filename .. '.' .. ext)) do\n count = count + 1\n filename = uuid .. '_' .. count\nend\n\nlocal suffix = '_' .. count\nif (count == 0) then\n suffix = ''\nend\n\nfilename = uuid .. suffix.. &quot;.&quot; .. ext\nsession:setVariable(&quot;recording_filename&quot; , filename)\nsession:setVariable(&quot;recording_command&quot; , &quot;nolocal:execute_on_answer=record_session &quot; .. record_path .. &quot;/&quot; .. filename)\n\n</code></pre>\n<p>when the recording is started then I use the the below commands to mask and unmask the ongoing recording.</p>\n<pre><code>uuid_broadcast 6ce5c548f60e413ba70d6149a4883096 record_session_mask::${record_path}/${recording_filename}\nuuid_broadcast 6ce5c548f60e413ba70d6149a4883096 record_session_unmask::${record_path}/${recording_filename}\n</code></pre>\n<p>the recording path and recording_filename are being retrieved from the session variable.</p>\n<p>so the problem is that when I listen to the recording it doesn't get masked or unmasked.</p>\n<p>PS: If I start the recording using the same command record_session and then run the above masking and unmasking commands, the recording gets masked.</p>\n<p>So my question is what am I doing wrong here in the file or the commands that the call recorded by the Lua script doesn't get masked/unmasked</p>\n<p>Any help will be appreciated\nthanks</p>\n"^^ . . . . . . "node.js"^^ . "1"^^ . . . . "1"^^ . "Yes, exactly. The same logic applies to strings, functions, *light userdata*, booleans, and even *nil*."^^ . . "0"^^ . "0"^^ . . . . "1"^^ . . . "0"^^ . . . "1"^^ . "0"^^ . . . . . . . . . "<p>I want to practice Lua writing EdgeTX scripts for FPV drone telemetry. I have found a pretty decent documentation for <a href="https://luadoc.edgetx.org/" rel="nofollow noreferrer">edge tx</a> and Lua. In order to accomplish my task I need to establish a communication of my radio (transmitter) with flight controller on my drone which has betaflight firmware (<a href="https://betaflight.com/docs/development/API/MSP-Extensions" rel="nofollow noreferrer">see MSP communication</a>). There is a nice lua script for communication with betaflight (<a href="https://github.com/betaflight/betaflight-tx-lua-scripts" rel="nofollow noreferrer">see here</a>) but for me it is hard to understand how it communicates with betaflight on byte level. Do you have any small easy to understand examples to dive into it? Thank you</p>\n<p>So far, I have found that <code>crossfireTelemetryPush</code> function sends a request via telemetry to receiver. This is the starting point.\nAn example of using this function you can see here:</p>\n<pre class="lang-lua prettyprint-override"><code>local function crsfDisplayPortCmd(cmd, data)\n local payloadOut = { CONST.address.betaflight, CONST.address.transmitter, cmd }\n if data ~= nil then\n for i = 1, #(data) do\n payloadOut[3 + i] = data[i]\n end\n end\n return crossfireTelemetryPush(CONST.frameType.displayPort, payloadOut) \nend\n</code></pre>\n<p>Another one example might be found in ELRS lua script:</p>\n<pre class="lang-lua prettyprint-override"><code>crossfireTelemetryPush(0x2D, { deviceId, handsetId, fieldPopup.id, 5 })\n</code></pre>\n<p><a href="https://luadoc.edgetx.org/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/crossfiretelemetrypush" rel="nofollow noreferrer">Here</a> you can find a documentation to this function but as you might have noticed it is poorly explained what is going on there.</p>\n<p><strong>To summarize</strong>\nI'd like to understand more hot to make a payload and send it from radio with help of Lua script to flight controller.</p>\n"^^ . . "2"^^ . . "<p>Hi I wanted to create a key map of <code>ctrl + {hjkl}</code> to be able to move through the code, with these keys while I'm in <strong>insert mode</strong>.\nHere is what i wrote in my <code>keymaps.lua</code> file:</p>\n<pre class="lang-lua prettyprint-override"><code>local function map(mode, lhs, rhs, opts)\n local options = { noremap = true, silent = true }\n if opts then\n options = vim.tbl_extend('force', options, opts)\n end\n vim.api.nvim_set_keymap(mode, lhs, rhs, options)\nend\n\n-- InsertMode movement\nmap('i', '&lt;C-h&gt;', '&lt;Left&gt;')\nmap('i', '&lt;C-j&gt;', '&lt;Down&gt;')\nmap('i', '&lt;C-k&gt;', '&lt;Up&gt;')\nmap('i', '&lt;C-l&gt;', '&lt;Right&gt;')\n</code></pre>\n<p>The problem is that and are working correctly but and do not seem to do any thing at all.\nI also checked if terminal is sending the correct keys when I press them and i think it was OK.</p>\n<p>Anyone has any idea about it or any better ways to move in insert mode would be appreciated.</p>\n<h2>Update:</h2>\n<ul>\n<li>I tried 4 different terminals (Ghostty - Kitty - xterm - cosmic terminal) and none worked so it is <strong>not terminal related issue</strong></li>\n<li>I tried removing keymaps first and It throw an error saying the keymaps does not exist to delete them</li>\n<li>I tried modern way of setting the keymaps and they did not worked</li>\n<li>For some reason none of the mappings in insert mode were listed in <code>:map</code> commands output while two of them were working.</li>\n</ul>\n"^^ . "Alternatively, if you're sure the values in the file are safe and valid, you could use the `loadstring` function, which parses each string as if it was lua code, and make sure each string is in the correct syntax for a Lua table"^^ . . . . . "<p>I am interested in knowing how to code a single assignment variable in Lua, similar to this example in Rust.</p>\n<pre class="lang-rust prettyprint-override"><code>fn main() {\n println!(&quot;Hello, world!&quot;);\n let x; //---&gt; This is the single assignment variable\n let y = 20;\n x = 10;\n x = 20; //---&gt; This will cause a compiler error\n println!(&quot;{} + {} = {}&quot;,x,y,x+y);\n \n}\n</code></pre>\n"^^ . "0"^^ . "0"^^ . "1. Yes, after a while it was a function, that works as I've expected. The first one made wrong result with more cars at the first slots and less cars in the last slots. Now it works, but I am not sur why and how to do it in the right way.\n2. It's numbers 499818, 263101, 131607, 62389, 29966, 10827, 3826, 1128, 287, 48, 4, but they are too long for the column."^^ . . . "How to connect Lua module with Simion workbench program"^^ . . . "0"^^ . . . . "0"^^ . . "Parts get deleted when I run and camera is scripted in Roblox Studio"^^ . "1"^^ . . . "The idea is that this time we want to extend number, so any instance of number should be fine, right? (I'm not sure if "instance" is the correct term in Lua)"^^ . . "0"^^ . . "3"^^ . . . . . "metaprogramming"^^ . . "<p>Basically I have a shooting mechanic in my side scroller game and I made it work with parts, having them have health.</p>\n<p>I wanted these parts to be unanchored and I have tested them without shooting them, and they work fine as unanchored parts.</p>\n<p>The issue is when I shoot one of the parts holding up a part on the top, when you fully destroy a part in my game i use <code>part:Destroy()</code> to remove the parts, the part on the top floats midair and moves like its laggy?? see this <a href="https://streamable.com/i8qyga" rel="nofollow noreferrer">video</a>.</p>\n<p>I don't really know what to try to fix this problem, which is why I'm posting it on here.</p>\n<p>A few things to note:</p>\n<ol>\n<li><p>This is on a new pc which runs stuff like mortal kombat 1 and elden ring etc so i don't think its performance.</p>\n</li>\n<li><p>My studio on this pc is quite buggy for some reason, especially with animations.</p>\n</li>\n<li><p>I tried loading the ACTUAL game up in the roblox player to no avail.</p>\n<p>here is my code for shooting (it goes in starterplayer.startercharacterscripts):</p>\n<pre><code>local player = game.Players.LocalPlayer\nlocal mouse = player:GetMouse()\nlocal gui = player.PlayerGui:WaitForChild(&quot;GameGui&quot;) \nlocal targetImage = gui:WaitForChild(&quot;Target&quot;) \nlocal bulletSpeed = 70 \nlocal damageAmount = 25 \nlocal shootCooldown = 1 \nlocal lastShootTime = 0 \n\n\ntargetImage.Visible = false\n\n\nlocal function unanchorBreakableParts()\n local breakableFolder = workspace:WaitForChild(&quot;Breakable&quot;)\n for _, part in pairs(breakableFolder:GetChildren()) do\n if part:IsA(&quot;Part&quot;) then\n part.Anchored = false \n end\n end\nend\n\n\nlocal function fireBullet(startPosition, targetPosition)\n local bullet = Instance.new(&quot;Part&quot;)\n bullet.Size = Vector3.new(1, 0.5, 0.5) \n bullet.Material = Enum.Material.Neon\n bullet.BrickColor = BrickColor.new(&quot;Bright yellow&quot;) \n bullet.Position = startPosition\n bullet.Anchored = false\n bullet.CanCollide = false\n bullet.Parent = workspace\n\n\n local direction = (targetPosition - startPosition).unit\n\n\n bullet.CFrame = CFrame.lookAt(startPosition, startPosition + direction)\n\n\n local bodyVelocity = Instance.new(&quot;BodyVelocity&quot;)\n bodyVelocity.Velocity = direction * bulletSpeed\n bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge) \n bodyVelocity.Parent = bullet\n\n\n local connection\n connection = bullet.Touched:Connect(function(hit)\n if hit and hit.Parent and hit.Parent:FindFirstChild(&quot;Humanoid&quot;) then\n local humanoid = hit.Parent:FindFirstChild(&quot;Humanoid&quot;)\n local character = player.Character\n\n\n if humanoid.Parent ~= character then\n humanoid:TakeDamage(damageAmount)\n bullet:Destroy() \n connection:Disconnect()\n end\n elseif hit and hit.Parent and hit:FindFirstChild(&quot;Health&quot;) then\n\n local health = hit:FindFirstChild(&quot;Health&quot;)\n if health then\n health.Value = health.Value - damageAmount \n\n\n if health.Value &lt;= 0 then\n hit:Destroy() \n end\n end\n\n bullet:Destroy() \n connection:Disconnect()\n else\n\n bullet:Destroy()\n connection:Disconnect()\n end\n end)\n\n\n game:GetService(&quot;Debris&quot;):AddItem(bullet, 5)\nend\n\n\nmouse.Button1Down:Connect(function()\n\n unanchorBreakableParts()\n\n\n local currentTime = tick()\n if currentTime - lastShootTime &lt; shootCooldown then\n return \n end\n\n\n local mousePosition = Vector2.new(mouse.X, mouse.Y)\n targetImage.Position = UDim2.new(0, mousePosition.X - (targetImage.Size.X.Offset / 2), 0, mousePosition.Y - (targetImage.Size.Y.Offset / 2))\n targetImage.Visible = true\n\n\n task.delay(0.3, function()\n targetImage.Visible = false\n end)\n\n\n local ray = workspace.CurrentCamera:ScreenPointToRay(mouse.X, mouse.Y)\n local rayTarget = ray.Origin + ray.Direction * 500\n\n\n local raycastParams = RaycastParams.new()\n raycastParams.FilterDescendantsInstances = {player.Character} \n raycastParams.FilterType = Enum.RaycastFilterType.Blacklist\n\n local raycastResult = workspace:Raycast(ray.Origin, ray.Direction * 500, raycastParams)\n if raycastResult then\n rayTarget = raycastResult.Position \n end\n\n\n local character = player.Character or player.CharacterAdded:Wait()\n local rightArm = character:FindFirstChild(&quot;ShootPart&quot;)\n local startPosition = rightArm.Position\n\n\n local humanoid = character:FindFirstChild(&quot;Humanoid&quot;)\n local shootAnim = character:FindFirstChild(&quot;Animations&quot;):FindFirstChild(&quot;Shoot&quot;)\n\n if humanoid and shootAnim and shootAnim:IsA(&quot;Animation&quot;) then\n\n local loadedAnim = humanoid:LoadAnimation(shootAnim)\n\n\n loadedAnim.Priority = Enum.AnimationPriority.Action3\n\n\n loadedAnim:Play()\n else\n warn(&quot;Humanoid or Shoot animation not found!&quot;)\n end\n\n\n fireBullet(startPosition, rayTarget)\n\n\n lastShootTime = currentTime\nend)\n\n</code></pre>\n</li>\n</ol>\n"^^ . . "<p>In JavaScript, you can make an object that is callable like this:</p>\n<pre class="lang-js prettyprint-override"><code>const prox = new Proxy(function() {}, {\n get(target, key) { return true }\n apply(target, that, argList) { console.log('This came from a proxy') }\n})\nprox() // This came from a proxy\nconsole.log(prox.name) // true\n</code></pre>\n<p>I'd like to have something similar to that for a function that I am working on that has a method available to call instead.</p>\n<pre class="lang-lua prettyprint-override"><code>local function describe()\n -- ...\nend\nfunction describe.skip()\n -- ...\nend\n</code></pre>\n<p>This doesn't work because a function isn't a table.</p>\n<p>Ideally this would be possible:</p>\n<pre class="lang-lua prettyprint-override"><code>local describe = {}\n\nfunction describe.__apply()\n -- ...\nend\nfunction describe.skip()\n -- ...\nend\n\ndescribe()\ndescribe.skip()\n</code></pre>\n"^^ . . "3"^^ . . "1"^^ . . "3"^^ . "0"^^ . "<p>(Luajit with Lua 5.1)</p>\n<p>When using <code>debug.sethook(hookfunction, 'l')</code> on code such as the following:</p>\n<pre><code>1: local x\n2: local y \n3:\n4: local t = {\n5: v1 = 1, v2 = 2, \n6: v3 = 3, \n7: v4 = x,\n8: } \n</code></pre>\n<p>The line events that are passed to the hook function seem to skip lines 2, 5 and 6. Could someone provide an explanation for this as well as perhaps an alternative solution? Context: I am working on a code coverage library for lua and I am finding situations like these lead to a lot of unexpected results in code coverage.</p>\n<p>Additionally, it seems that code such as:</p>\n<pre><code>local x = obj:f()\n</code></pre>\n<p>is double counted when doing a simple line execution counting hook function such as:</p>\n<pre><code>local hookfunction = function(event, line) \n executioncount[line] = executioncount[line] + 1\nend\n</code></pre>\n<p>Executing the above code with this hook function active will result in the line being counted twice. My guess is that assignment and function call are both counting as line events, but this seems to directly contradict the explanation in the manual for what a line event is. Any clarity would be extremely helpful.</p>\n<p>To save on time for those responding, I am aware that</p>\n<pre><code>local x\nlocal y\n</code></pre>\n<p>could be rewritten as</p>\n<pre><code>local x, y\n</code></pre>\n<p>and this would address one of the issues, but I don't want to place unnecessary restrictions on coding styles with my coverage library.</p>\n"^^ . "0"^^ . "1"^^ . . . "0"^^ . "Roblox ProfileService: What would cause LoadProfileAsync() to take a full minute to load?"^^ . "0"^^ . . . "0"^^ . . "Forward Visual Mode Selection in Neovim to Telescope's Live-Grep-Args via Register"^^ . . . . "<p><code>$UID</code> is not an environment variable, thus you cannot get it with <code>os.getenv</code></p>\n<p>Your another approach can work, just change the mode to read one line:</p>\n<pre><code>local handle = io.popen(&quot;id -u&quot;)\nlocal user_id = handle:read(&quot;l&quot;)\nhandle:close()\n</code></pre>\n<p>Or you can pass <code>$UID</code> to your lua script as an argument:</p>\n<pre><code>$ lua example.lua $UID\n\n-- example.lua\nlocal user_id = arg[1];\n</code></pre>\n"^^ . . . . "1"^^ . "<p>​\nHi,</p>\n<p>I am a new user of Simion and Lua, so probably my question is rather silly, but I will be very grateful for the answer though)</p>\n<p>I would like to realize some useful Simion functions as separate Lua modules, that will be required from Simion workbench program.</p>\n<p>Say, I have the following Lua module test.lua</p>\n<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false" data-babel-preset-react="false" data-babel-preset-ts="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-html lang-html prettyprint-override"><code>test = {}\n\nfunction test.print_ion_number()\n print("ion number = ", ion_number)\nend\n\nreturn test</code></pre>\r\n</div>\r\n</div>\r\n</p>\n<p>And I want to use it in segment.other_actions() function of Simion workbench program as</p>\n<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false" data-babel-preset-react="false" data-babel-preset-ts="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-html lang-html prettyprint-override"><code>test = require "test"\n\nsimion.workbench_program()\nfunction segment.other_actions()\n test.print_ion_number()\nend</code></pre>\r\n</div>\r\n</div>\r\n</p>\n<p>But what I get is nil, since my function from test module doesn't see Simion ion_number variable.</p>\n<p>So, my question is: how make Simion segment variables visible for external modules? I understand that it is probably possible to pass all of them to it as a table, but maybe there is more convenient way to do it?</p>\n<p>Thank you</p>\n<p>​</p>\n"^^ . . . "2"^^ . "lua-table"^^ . "protofield"^^ . "0"^^ . . . . . "0"^^ . . . "I have tried to merge the both scripts but the problem i face is that after merging only the upper part of the script works and the lower doesn't irrelevant of which script i put first and last. I want the script to perform 2 functions like the first part adjust the recoil and the lower part is for movement of my player. The upper part should activates only when scroll lock is activated and the lower activates when num lock activated, i have put these condition still both doesn't work as single script. SO I want the professionals to help me out."^^ . "envoyproxy"^^ . "<p>Short answer: not possible.</p>\n<hr />\n<p>Longer:</p>\n<p>As you've correctly identified, the syntactic sugar</p>\n<pre class="lang-none prettyprint-override"><code>exp ::= functiondef\n\nfunctiondef ::= function funcbody\nfuncbody ::= ‘(’ [parlist] ‘)’ block end\n\nstat ::= function funcname funcbody\nstat ::= local function Name funcbody\nfuncname ::= Name {‘.’ Name} [‘:’ Name]\n</code></pre>\n<p>that enables the shorthand <code>function name () end</code> syntax (and thus the form with an implicit <code>self</code> variable) changes the function definition from an expression to a statement by introducing the assignment.</p>\n<p>There is no mechanism to interrupt this syntactically, in order to insert an arbitrary expression in to the assignment (desired here: a <em>functioncall</em>, <code>coroutine.wrap</code>).</p>\n<p>Similarly, the arguments to a function call must be expressions - so something like <code>coroutine.wrap(function Foo:bar() end)</code> is also not possible.</p>\n<p>Short of modifying the language with a new keyword (think <code>async function Foo:bar() end</code>), your example of</p>\n<pre class="lang-lua prettyprint-override"><code>Foo.bar = coroutine.wrap(function(self) ... end)\n</code></pre>\n<p>is as good as it gets. For what it is worth, this example is perfectly understandable, and self-documenting (IMO; pun intended).</p>\n<hr />\n<p><sup>Lua 5.4: <a href="https://lua.org/manual/5.4/manual.html#3" rel="nofollow noreferrer">3 – The Language</a> | <a href="https://lua.org/manual/5.4/manual.html#3.3.3" rel="nofollow noreferrer">3.3.3 – Assignment</a> | <a href="https://lua.org/manual/5.4/manual.html#3.4.10" rel="nofollow noreferrer">3.4.10 – Function Calls</a> | <a href="https://lua.org/manual/5.4/manual.html#3.4.11" rel="nofollow noreferrer">3.4.11 – Function Definitions</a> | <a href="https://lua.org/manual/5.4/manual.html#9" rel="nofollow noreferrer">9 – The Complete Syntax of Lua</a></sup></p>\n"^^ . "logitech-gaming-software"^^ . . . . . . . . . . . "Changing the appearance depending on the keyboard layout"^^ . . "Setting up denols to work along with tsls in kickstart neovim"^^ . . . "0"^^ . "world-of-warcraft"^^ . . "2"^^ . "0"^^ . . "Is money value text label or some other object in game?"^^ . . . . . . . "<p>I started learning Lua recently, as far as I can tell, when I don't specify the index, the function <code>table.insert</code> tries to put the value in the first nil in the table.</p>\n<p>Why then is it that in table <code>t</code> the <code>10</code> ends up at index 4, in table <code>y</code> the <code>10</code> ends up at index 2, and in table <code>x</code> it ends up at index <code>5</code>?</p>\n<pre><code>local t = {1, nil, 2}\ntable.insert(t,10)\nfor i = 1, 6 do\n print(string.format(&quot;t[%d] = %s&quot;, i, t[i]))\nend\n\nprint()\n\nlocal y = {1, nil, 2}\ny[5]= 3\ntable.insert(y, 10)\nfor i = 1, 6 do\n print(string.format(&quot;y[%d] = %s&quot;, i, y[i]))\nend\n\nprint()\n\nlocal x = {1, nil, 2}\ntable.insert(x,2,20)\nx[6]= 3\ntable.insert(x,10)\nfor i = 1, 6 do\n print(string.format(&quot;x[%d] = %s&quot;, i, x[i]))\nend\n\n\nTerminal result:\nt[1] = 1\nt[2] = nil\nt[3] = 2\nt[4] = 10\nt[5] = nil\nt[6] = nil\n\ny[1] = 1\ny[2] = 10\ny[3] = 2\ny[4] = nil\ny[5] = 3\ny[6] = nil\n\nx[1] = 1\nx[2] = 20\nx[3] = nil\nx[4] = 2\nx[5] = 10\nx[6] = 3\n</code></pre>\n"^^ . . . . . "1"^^ . "2"^^ . . . . . . "0"^^ . "0"^^ . . . "0"^^ . . . . "1"^^ . "<p>Try with:</p>\n<pre><code>local opts = { noremap = true, silent = true }\n\nvim.keymap.set (&quot;i&quot;, &quot;&lt;c-h&gt;&quot;, &quot;&lt;left&gt;&quot;, opts)\nvim.keymap.set (&quot;i&quot;, &quot;&lt;c-j&gt;&quot;, &quot;&lt;down&gt;&quot;, opts)\nvim.keymap.set (&quot;i&quot;, &quot;&lt;c-k&gt;&quot;, &quot;&lt;up&gt;&quot;, opts)\nvim.keymap.set (&quot;i&quot;, &quot;&lt;c-l&gt;&quot;, &quot;&lt;right&gt;&quot;, opts)\n</code></pre>\n<p>I'd recommend you to run <code>nvim --clean</code> and then set each keymap manually in command mode, because they might be conflicting with plugin keymaps, for example:</p>\n<pre><code>:lua vim.keymap.set (&quot;i&quot;, &quot;&lt;c-l&gt;&quot;, &quot;&lt;right&gt;&quot;, { noremap = true, silent = true })\n</code></pre>\n<p>or write all the keymaps in a lua file and source.</p>\n"^^ . "0"^^ . "0"^^ . . "0"^^ . "roblox"^^ . . "Capture pattern multiple times between 2 strings in Lua"^^ . . . . . . . . . . "2"^^ . . . . . "<p>I have a string like such:\n<code>{a=&quot;foo&quot;, b=&quot;bar&quot;, c=12345}</code>\n(imported &amp; read from a file)</p>\n<p>How do I convert this into a table/set with those contents? Or how can I save tables/sets in a file without having to use strings as a middleman?</p>\n<p>I am using a program which uses Lua as its base, but doesn't easily let me use libraries (CC:Tweaked) so things like dkjson aren't a real option, and I cant find anything else to help me on here or in the documentation.</p>\n<p>I am a beginner with Lua, so would greatly prefer something simple.</p>\n"^^ . "3"^^ . . "3"^^ . . "related: https://stackoverflow.com/questions/78446476/will-key-expire-during-transaction-in-redis"^^ . "iup"^^ . . . "1"^^ . . . "Lua doesn't even have `++` or `+=`, yet you ask for null conditional operator? This is too ahead of its time."^^ . . . . "0"^^ . "1"^^ . "children of wibox.layout.ratio.vertical in custom widget are not visible"^^ . "Istio EnvoyFilter Lua HTTP Filter - Is it possible publish a prometheus metic from the filter?"^^ . . . "0"^^ . "3"^^ . . "c#"^^ . . "neovim"^^ . "0"^^ . . . . . . . "0"^^ . "<p>As pointed out in <a href="https://stackoverflow.com/a/34718877/13140898">this</a> answer,</p>\n<blockquote>\n<p>It is up to the designer of the module to decide what can be seen from\nthe outside.</p>\n</blockquote>\n<p>The working <code>require(&quot;telescope.builtin&quot;)</code> approach loads a separate module that contains the <code>find_files</code> function. However, that module, and so its function, apparently is not automatically part of the <code>telescope</code> table/module.\nSince the <code>builtin</code> module is not accessible from the outside by default, Lua in this instance assumes that <code>builtin</code> in the reference <code>telescope.builtin</code> is a field of the telescope module, which it isn't, resulting in the error <code>&quot;attempt to index **field** 'builtin' (a nil value).&quot;</code></p>\n<p>Now, if you really want to use the <code>require(&quot;some&quot;).module</code> approach, you may add a line to expose <code>builtin</code> as a field of <code>telescope</code> explicitly, like so:</p>\n<pre><code>local telescope = require(&quot;telescope&quot;)\ntelescope.builtin = require(&quot;telescope.builtin&quot;) -- Add this line\n</code></pre>\n<p>Then the line in question would work correctly:</p>\n<pre><code>telescope.builtin.find_files({ cwd = selection.path })\n</code></pre>\n<p>But to avoid ambiguity and unnecessary additions to the <code>telescope</code> namespace, I'd say it’s better to stick with the working version:</p>\n<pre><code>local builtin = require(&quot;telescope.builtin&quot;)\n...\nbuiltin.find_files({ cwd = selection.path })\n</code></pre>\n<p>Finally, I think it was a deliberate intention by the developers of the telescope module to have that structure, as their own <a href="https://github.com/nvim-telescope/telescope.nvim/blob/master/lua/telescope/builtin/init.lua" rel="nofollow noreferrer">code snippets</a> show the <code>require(&quot;some.module&quot;)</code> approach:</p>\n<pre><code>--- To use any of Telescope's default options or any picker-specific options, call your desired picker by passing a lua\n--- table to the picker with all of the options you want to use. Here's an example with the live_grep picker:\n---\n--- &lt;code&gt;\n--- :lua require('telescope.builtin').live_grep({\n--- prompt_title = 'find string in open buffers...',\n--- grep_open_files = true\n--- })\n--- -- or with dropdown theme\n--- :lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{\n--- previewer = false\n--- })\n--- &lt;/code&gt;\n</code></pre>\n<p>You can check such things by iterating over the module's fields (as it typically has the format of a simple table):</p>\n<pre><code>local telescope = require(&quot;telescope&quot;)\nfor key, value in pairs(telescope) do\n print(key, value)\nend\n</code></pre>\n<p>This will list all keys (field names) and their corresponding values in the module.</p>\n"^^ . "1"^^ . . "1"^^ . . "0"^^ . "<p>I'm writing a neovim plugin.<br />\nI want json decoding to fail silently. This is what I have tried:</p>\n<pre class="lang-lua prettyprint-override"><code> partial_chunk = partial_chunk .. chunk\n pcall(function()\n -- vim.defer_fn(function()\n local data = vim.fn.json_decode(partial_chunk .. &quot;]&quot;)\n on_next_line(data[#data].candidates[1].content.parts[1].text)\n -- end, 0)\n end)\n do_some_stuff()\n\n</code></pre>\n<p>This gives me the error that I can't call a vimscript function in a fast event context.<br />\nI have tried wrapping the json_decode in <code>vim.defer_fn</code> but that doesn't work - i start seeing the errors.</p>\n<p>I'm looking for a way to basically ignore whenever json_decode fails.</p>\n"^^ . . . "2"^^ . "0"^^ . "How is this question related to the Java programming language, as *suggested* by the [tag:java] tag added to the question ?"^^ . . . . "1"^^ . "3"^^ . "Ahh I see, reading the doc would have been helpful. Ok thanks @romainl"^^ . . . "1"^^ . "0"^^ . "<p>Simply put the bodies of the two functions in a single function. It also looks like you forgot the final <code>end</code>. So</p>\n<pre><code>function OnEvent(event, arg)\n if IsKeyLockOn (&quot;scrolllock&quot;) then\n repeat\n if IsMouseButtonPressed(1) then\n repeat\n MoveMouseRelative(0,1)\n Sleep(13)\n MoveMouseRelative(0,1)\n Sleep(14)\n MoveMouseRelative(0,1)\n Sleep(15)\n MoveMouseRelative(0,1)\n Sleep(14)\n MoveMouseRelative(0,1)\n Sleep(15)\n MoveMouseRelative(0,2)\n Sleep(16)\n MoveMouseRelative(0,1)\n until not IsMouseButtonPressed(1)\n end\n until not IsKeyLockOn (&quot;scrolllock&quot;)\n end\n\n -- Quick Peek Movement Script (Activated when Num Lock is ON)\n if IsKeyLockOn(&quot;numlock&quot;) and event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 5 then\n repeat\n PressKey(&quot;e&quot;) -- Right peak\n Sleep(50)\n PressKey(&quot;n&quot;) -- Aim before crouch\n Sleep(50)\n PressKey(&quot;c&quot;) -- Crouch\n Sleep(50)\n ReleaseKey(&quot;n&quot;) -- Release Aim\n ReleaseKey(&quot;c&quot;)\n PressKey(&quot;n&quot;) -- Press Aim again after crouch release\n Sleep(50)\n PressKey(&quot;q&quot;) -- Left peak\n Sleep(50)\n ReleaseKey(&quot;n&quot;) -- Release Aim after Left Peek\n ReleaseKey(&quot;q&quot;)\n ReleaseKey(&quot;e&quot;)\n Sleep(50)\n until not IsMouseButtonPressed(5)\n end\nend\n</code></pre>\n"^^ . "<p>Do this instead:</p>\n<pre><code>local gridBox = iup.gridbox{\n numcolumns = 3,\n alignment = &quot;ACENTER&quot;,\n expand = &quot;YES&quot;,\n table.unpack(Instances)\n}\n</code></pre>\n<p>When a function returns multiple values, if you want to keep them all rather than just the first, there can't be a comma after it. Since order doesn't matter otherwise in your case, just reordering them makes it work. If order did matter, then you'd need a more complicated solution instead, such as the one in <a href="https://stackoverflow.com/a/78289436/7509065">my answer to this other question</a>.</p>\n"^^ . . . . "0"^^ . . . "1"^^ . . "when i tried to delete the key map it caused error because they were not already mapped,"^^ . . "Roblox Animation Not Playing Even Though Animation Owned by Group and Game Owned by Group and Priority Is Highest"^^ . . "protocol-buffers"^^ . "0"^^ . "Here's a paste bin - https://pastebin.com/tEybSWGB. I changed the code slightly to used the GetTower() module script in the spawn script but it is still erroring."^^ . "1"^^ . . . "libuv"^^ . "Lua equivalent for null conditional operator?"^^ . . "Problem with upvalue in nodemcu on ESP8266"^^ . . . . "How to extend classes in Lua"^^ . . . . . "Correct again, as the *functioncall* `self`-insert is also purely syntactic sugar (`foo:bar()` -> `foo.bar(foo)`, where `foo` is only evaluated once). Utilizing closures is definitely the approach for a bound function."^^ . . . "0"^^ . "0"^^ . "Thanks soooo much! my project is running properly now!"^^ . . "configuration"^^ . "Can you share more details about the error which occurs during dependency resolution? You could also check the working directory when the script is run."^^ . . "2"^^ . "1"^^ . "<p>I had the same issue. You have to update your Java to version &gt;=21.</p>\n"^^ . . "1"^^ . "1"^^ . . "cursor-ide"^^ . . . "0"^^ . . "apache-apisix"^^ . . . . "probability-distribution"^^ . . . . . . "eclipse-jdt"^^ . "0"^^ . "0"^^ . . . "1"^^ . . . . "Maybe `[["(.-)"%s+%-%s+(%C*)]]` is close enough to what you want."^^ . . "0"^^ . "0"^^ . . "<p>I am trying to use a library using pollnet 1.1.0, and in the pollnet.lua in this particular instance, there are a few lines that are confusing me, and I can't figure out what they are supposed to do.</p>\n<pre><code>local _, own_path = ... -- needs at least Lua 5.2\nlocal LIBDIR = own_path:match(&quot;(.*&quot;..package.config:sub(1,1)..&quot;)&quot;)\n</code></pre>\n<p>I understand that the triple dot/ellipses is how you set variable arguments, and that is the only explanation I could find. I am confused about how it could be used to define a variable, and why it is Lua 5.2+ specific. Based on the variable names, I am assuming it is getting the path of either itself (pollnet.lua) or the dll (pollnet.dll). Both of these files are in the same directory.</p>\n"^^ . . "1"^^ . . "1"^^ . . . "2"^^ . . . "3"^^ . . "1"^^ . . "1"^^ . "<p><strong>Problem:</strong> <a href="https://github.com/yetone/avante.nvim" rel="nofollow noreferrer">Avante</a> plugin never responds with a generated response. It just hangs forever.</p>\n<p><strong>Suspicion:</strong> There is something wrong with the API key or way it is being used.</p>\n<p><strong>Question:</strong></p>\n<ol>\n<li>How do I properly set and verify my API Key?</li>\n<li>How do I get Avante to respond with it's generated response; rather than hang forever.</li>\n</ol>\n<p><strong>Setup:</strong></p>\n<p>I copied the standard avante install with lazy to <code>~/.config/nvim/lua/plugins/avante'</code> as shown below.</p>\n<p>I pay for Claude. I created my anthropic api key by going to: <a href="https://console.anthropic.com/settings/keys" rel="nofollow noreferrer">https://console.anthropic.com/settings/keys</a> and creating a new key.</p>\n<p>I tried setting this key three ways:</p>\n<ol>\n<li>in <code>~/.config/fish/config.fish</code> I added <code>set -gx ANTHROPIC_API_KEY &lt;MY-API-KEY&gt;</code>. I verified it was set by running <code>source ~/.config/fish/config.fish</code> then <code>echo $ANTHROPIC_API_KEY</code>.</li>\n<li>With no env var. I execute <code>&lt;leader&gt;aa</code> in neovim. I am prompted to enter <code>ANTHROPIC_API_KEY</code> by Avante and I enter my real api key.</li>\n<li>With no env var. I execute <code>&lt;leader&gt;aa</code> in neovim. I am prompted to enter <code>ANTHROPIC_API_KEY</code> by Avante and I enter my something random like: <code>asdfasdfjkl</code>.</li>\n</ol>\n<p>Then I <code>nvim index.js</code> and <code>&lt;leader&gt;aa</code> to open Avante. I enter a prompt, eg. <code>Write a Javascript function that takes in two arguments and returns their sum.</code> then Ctrl-S and I see <code>Generating response ...</code> forever.</p>\n<p>It never outputs anything. It just hangs here forever:</p>\n<pre><code>---\n\n- Datetime: 2024-12-03 09:43:21\n\n- Model: claude/claude-3-5-sonnet-20241022\n\n- Selected file: index.js\n\n&gt; Write a Javascript function that takes in two arguments and returns their sum.\n\n**Generating response ...**\n</code></pre>\n<p>All three produce the same result. It seems that my API key is incorrect because it behaves the same as when I give something random for the API keys.</p>\n<pre class="lang-lua prettyprint-override"><code>return {\n &quot;yetone/avante.nvim&quot;,\n event = &quot;VeryLazy&quot;,\n lazy = false,\n version = false, -- set this if you want to always pull the latest change\n opts = {\n -- add any opts here\n },\n -- if you want to build from source then do `make BUILD_FROM_SOURCE=true`\n build = &quot;make&quot;,\n -- build = &quot;powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false&quot; -- for windows\n dependencies = {\n &quot;stevearc/dressing.nvim&quot;,\n &quot;nvim-lua/plenary.nvim&quot;,\n &quot;MunifTanjim/nui.nvim&quot;,\n --- The below dependencies are optional,\n &quot;hrsh7th/nvim-cmp&quot;, -- autocompletion for avante commands and mentions\n &quot;nvim-tree/nvim-web-devicons&quot;, -- or echasnovski/mini.icons\n &quot;zbirenbaum/copilot.lua&quot;, -- for providers='copilot'\n {\n -- support for image pasting\n &quot;HakonHarnes/img-clip.nvim&quot;,\n event = &quot;VeryLazy&quot;,\n opts = {\n -- recommended settings\n default = {\n embed_image_as_base64 = false,\n prompt_for_file_name = false,\n drag_and_drop = {\n insert_mode = true,\n },\n -- required for Windows users\n use_absolute_path = true,\n },\n },\n },\n {\n -- Make sure to set this up properly if you have lazy=true\n &quot;MeanderingProgrammer/render-markdown.nvim&quot;,\n opts = {\n file_types = { &quot;markdown&quot;, &quot;Avante&quot; },\n },\n ft = { &quot;markdown&quot;, &quot;Avante&quot; },\n },\n }\n}\n</code></pre>\n"^^ . "UDF Write Generation Check within UDF context"^^ . "0"^^ . "0"^^ . . . "java"^^ . . . . "<p>I am trying to make a humanoid move with the mouse cursor in Roblox Studio.</p>\n<pre><code>local player = game.Players.LocalPlayer\nlocal mouse = player:GetMouse()\n\n \nlocal tower = getTower(towerOneIndex):Clone()\n \ntower.Parent = workspace.Map1.Towers\n \nlocal towerHum = tower:WaitForChild(&quot;HumanoidRootPart&quot;)\n \nmouse.Move:Connect(function()\n print(&quot;moved&quot;)\n towerHum.CFrame = mouse.Hit\n print(towerHum.CFrame)\n print(mouse.Hit)\nend)\n</code></pre>\n<p>The 'tower' humanoid spawns on the map but does not follow the mouse</p>\n<p>The final two print functions return the same value but despite the tower humanoid CFrame being updated the humanoid does not movve</p>\n"^^ . . "This implies I'll have to manually add a `__tostring` metamethod to all the widget subclasses, of which there might be many. Surely there is a way to automate this so that all "subclasses" use an inherited `__tostring` method unless explicitly overriden?"^^ . "typescript"^^ . . "<p>there's a number of issue with the code you provided.</p>\n<ul>\n<li><p>calling <code>copas.loop()</code>, only makes sense if you first add 'work' to the scheduler (a task, timer, server socket)</p>\n</li>\n<li><p>io.read should not be used. Since it will block the process, without ever yielding to the Copas scheduler. Use <code>system.readansi()</code> instead, and give it <code>copas.pause</code> as the sleep method such that Copas can go of and do other work while this task is waiting.</p>\n</li>\n<li><p>for <code>readansi</code> to work properly, the terminal must be set up properly, make it non-blocking for reading, and disable canonical mode (canonical is &quot;line mode&quot;, it reads a line, until a user presses enter)</p>\n</li>\n</ul>\n<p>I added comments to your code, and fixed the above items:</p>\n<pre><code>local sys = require(&quot;system&quot;)\n-- local UI = require(&quot;ui&quot;)\nlocal copas = require(&quot;copas&quot;)\n\n\n-- define the UI library in line here\nlocal UI = {}\n\nfunction UI.progressBar(current, total)\n local widthOfBar = 50\n local progress = math.floor((current / total) * widthOfBar)\n local remaining = widthOfBar - progress\n local bar = &quot;[&quot; .. string.rep(&quot;=&quot;, progress) .. string.rep(&quot; &quot;, remaining) .. &quot;]&quot;\n io.write(&quot;\\r&quot; .. bar .. math.floor((current / total) * 100) .. &quot;%&quot;) -- carriage return for progress bar to stay on the same line\n io.flush()\nend\n\nfunction UI.prompt(message)\n print(message .. &quot; (y/n):&quot;)\n --local response = io.read() -- io.read is blocking, use readansi instead\n local response = sys.readansi(math.huge, copas.pause) -- use readansi, and pass a NON-blocking sleep function for use with Copas\n if response == &quot;y&quot; then -- readansi only return 1 character\n return true\n elseif response == &quot;n&quot; then -- check for the other result as well\n return false\n else -- report an error and retry the prompt\n print(&quot;Invalid input&quot;)\n return UI.prompt(message)\n end\nend\n\n\n-- end of UI library definition\n\nlocal function displayMenu()\n print(&quot;=============&quot;)\n print(&quot;1. Check Time&quot;)\n print(&quot;2. Get Mono Time&quot;)\n print(&quot;3. Give Feedback&quot;)\n print(&quot;4. Progress Bar Demo&quot;)\n print(&quot;6. Exit&quot;)\n print(&quot;=============&quot;)\nend\n\nlocal function getTime()\n local time = math.floor(sys.gettime()) -- wrapped in math.floor to make it an integer\n local date = os.date(&quot;Current Time: %Y-%m-%d %H:%M:%S&quot;, time)\n print(date)\nend\n\n\nlocal function monoTime()\n local response = sys.monotime()\n print(response)\nend\n\nlocal function uiPrompt()\n local response = UI.prompt(&quot;Do you like lua?&quot;)\n if response == true then\n print(&quot;Thats great!&quot;)\n else\n print(&quot;So sad to hear :(&quot;)\n end\nend\n\n\n-- instead of just running this loop, wrap it in a Copas task.\n-- when calling `copas.loop()` below, execution will start. Copas will\n-- keep running until all tasks have exited.\ncopas.addthread(function () -- added\nwhile true do\n displayMenu()\n io.write(&quot;Select an Option: &quot;)\n --local choice = tonumber(io.read()) -- io.read is blocking, nothing will ever run until the user presses enter. so we shouldn't use it.\n local char = sys.readansi(math.huge, copas.pause) -- use readansi, and pass a NON-blocking sleep function for use with Copas\n -- if no input is available, it will call copas.pause to wait a bit, and then try again, until a key was actually pressed,\n -- or a timeout occurs (but since we pass &quot;math.huge&quot; here, it will wait forever).\n -- copas.pause (when called by readansi) will not just sleep (and block the current thread), but will yield to the Copas scheduler, the scheduler will\n -- then check if there are any other tasks that need to run, and if so, it will run them. Only when the sleep period\n -- has passed, will the current task be resumed by the scheduler. The effects:\n -- 1. from the perspective of the code here, it looks like the code blocks, it will not return until a key is pressed\n -- 2. from the perspective of readansi, it will try in a loop, and sleep (copas pause) short periods in between.\n -- 3. from the perspective of the Copas scheduler, it will not block, it will keep running other tasks, everytime readansi\n -- calls copas.pause, and then resume the readansi task when the sleep period has passed.\n local choice = tonumber(char) -- convert the string to an actual number\n\n if choice == 1 then\n getTime()\n elseif choice == 2 then\n monoTime()\n elseif choice == 3 then\n uiPrompt()\n elseif choice == 4 then\n copas.addthread(function ()\n local total = 100\n for i=1, total do\n UI.progressBar(i, total)\n copas.pause(0.1)\n end\n print()\n end)\n elseif choice == 6 then\n break\n end\nend\nend) -- added: end of `copas.addthread`\n\n\n-- before starting the loop, we must configure the terminal\n\n-- setup Windows console to handle ANSI processing\nsys.setconsoleflags(io.stdout, sys.getconsoleflags(io.stdout) + sys.COF_VIRTUAL_TERMINAL_PROCESSING)\nsys.setconsoleflags(io.stdin, sys.getconsoleflags(io.stdin) + sys.CIF_VIRTUAL_TERMINAL_INPUT)\n\n-- setup Posix to disable canonical mode and echo\nlocal of_attr = sys.tcgetattr(io.stdin)\nsys.setnonblock(io.stdin, true)\nsys.tcsetattr(io.stdin, sys.TCSANOW, {\n lflag = of_attr.lflag - sys.L_ICANON - sys.L_ECHO, -- disable canonical mode and echo\n})\n\ncopas.loop() -- this will exit once all tasks defined are finished\n\n-- after exiting restore terminal configuration\n\n-- windows\nsys.setconsoleflags(io.stdout, sys.getconsoleflags(io.stdout) - sys.COF_VIRTUAL_TERMINAL_PROCESSING)\nsys.setconsoleflags(io.stdin, sys.getconsoleflags(io.stdin) - sys.CIF_VIRTUAL_TERMINAL_INPUT)\n\n-- posix\nlocal of_attr = sys.tcgetattr(io.stdin)\nsys.setnonblock(io.stdin, false)\nsys.tcsetattr(io.stdin, sys.TCSANOW, {\n lflag = of_attr.lflag + sys.L_ICANON + sys.L_ECHO,\n})\n</code></pre>\n"^^ . "set"^^ . . "0"^^ . "1"^^ . . "<pre class="lang-lua prettyprint-override"><code>local _, own_path = ... -- needs at least Lua 5.2\n</code></pre>\n<p><code>...</code> is known as the <a href="https://lua.org/manual/5.4/manual.html#3.4" rel="nofollow noreferrer"><em>vararg</em> expression</a>, for use directly inside <a href="https://lua.org/manual/5.4/manual.html#3.4.11" rel="nofollow noreferrer">variadic functions</a>. Note that a <a href="https://lua.org/manual/5.4/manual.html#3.3.2" rel="nofollow noreferrer"><em>chunk</em></a> (e.g., a Lua program file) is treated as the body of an anonymous variadic function.</p>\n<p>The vararg expression was <a href="https://lua.org/manual/5.1/manual.html#7" rel="nofollow noreferrer">introduced in Lua 5.1</a>, as a replacement for Lua 5.0's <a href="https://lua.org/manual/5.0/manual.html#2.5.8" rel="nofollow noreferrer">implicit <code>arg</code> variable</a> (which collected variadic arguments into a table).</p>\n<p>The <a href="https://lua.org/manual/5.2/manual.html#8" rel="nofollow noreferrer">major change in Lua 5.2</a> was with how <a href="https://lua.org/manual/5.2/manual.html#2.2" rel="nofollow noreferrer">function environments are handled</a> - a separate topic from variadic functions.</p>\n<p>This comment looks like a misunderstanding.</p>\n<hr />\n<pre class="lang-lua prettyprint-override"><code>local LIBDIR = own_path:match(&quot;(.*&quot;..package.config:sub(1,1)..&quot;)&quot;)\n</code></pre>\n<p>Assuming <a href="https://github.com/probable-basilisk/pollnet/blob/main/bindings/luajit/pollnet.lua" rel="nofollow noreferrer">this is the source</a>, the unmodified version reads as</p>\n<pre class="lang-lua prettyprint-override"><code>-- Change this as necessary to point to where [lib?]pollnet.dll|.so|.dylib\n-- is actually located.\nlocal LIBDIR = &quot;./&quot;\n</code></pre>\n<p>so your example appears to be generating the path for the shared library, given whatever <em>calls</em> your code provides it a file path.</p>\n<p><code>package.config:sub(1, 1)</code> yields the <a href="https://lua.org/manual/5.4/manual.html#pdf-package.config" rel="nofollow noreferrer">directory separating character</a>, which is used to <a href="https://lua.org/manual/5.4/manual.html#pdf-string.match" rel="nofollow noreferrer">match</a> and <a href="https://lua.org/manual/5.4/manual.html#6.4.1" rel="nofollow noreferrer">capture</a> the leading directory path.</p>\n"^^ . . . . . . "<p><strong>Here is what I am getting out of this:</strong></p>\n<p>The tower’s HumanoidRootPart is probably still moving, but the rest of the tower might not be. If the tower is a model, you can use :MoveTo() on it to move the whole thing. Example code:</p>\n<pre><code>mouse.Move:Connect(function()\n print(&quot;moved&quot;)\n tower:MoveTo(mouse.Hit)\n print(towerHum.CFrame)\n print(mouse.Hit)\nend)\n</code></pre>\n<p>I am writing this on a school iPad, so I am not able to test this or provide documentation links (they blocked roblox.com), but please tell me if it works!</p>\n"^^ . "1"^^ . "1"^^ . "0"^^ . "0"^^ . . . . . . "1"^^ . "1"^^ . . . "istio-prometheus"^^ . . . "1"^^ . . "0"^^ . "The first answer to the proposed duplicate should answer your question. Value lists work the same way in table constructors as they do in function calls, or in any other place where you put a comma between two function calls."^^ . . "1"^^ . . . "0"^^ . . . . "1"^^ . . "0"^^ . . . "0"^^ . "0"^^ . . . "<p>I was able to figure this out thanks to the people at the love2d subreddit. apparently, fullscreen defaults to borderless, and thus takes on the desktop resolution. however, it's possible to change the fullscreen type to 'exclusive', which has the behaviour I wanted, in a few ways. I went with adding this line to conf.lua:</p>\n<pre><code>t.window.fullscreentype = 'exclusive'\n</code></pre>\n"^^ . "2"^^ . "awesome-wm"^^ . . "jwt"^^ . . . . "<p>In terms of classical OOP, with</p>\n<pre class="lang-lua prettyprint-override"><code>timer = Timer()\n</code></pre>\n<p><code>timer</code> is considered a new <em>instance</em> of the <code>Timer</code> class<sup>1</sup>. When calling methods, the colon syntax should be used (in <code>love.load</code>)</p>\n<pre class="lang-lua prettyprint-override"><code>timer:after(4, function() Game_object.dead = true end)\n</code></pre>\n<p>and (in <code>love.update</code>)</p>\n<pre class="lang-lua prettyprint-override"><code>timer:update(dt)\n</code></pre>\n<p>so that the <em>implicit</em> <code>self</code> inside the method references the calling <em>instance</em>.</p>\n<hr />\n<p>More completely, when a function is defined with the colon syntax</p>\n<pre class="lang-lua prettyprint-override"><code>function foo:bar(arg)\n print(self, arg)\nend\n</code></pre>\n<p>it is <em>syntactic sugar</em> for the following assignment, where the function has an explicit first argument named <code>self</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>foo.bar = function (self, arg)\n print(self, arg)\nend\n</code></pre>\n<p>Likewise, the syntax of calling a function as <code>foo:bar(42)</code> is <em>syntactic sugar</em> for <code>foo.bar(foo, 42)</code>, inserting that implicit first <code>self</code> argument.</p>\n<p>This is why <code>timer.after(4, function () ... end)</code> is assigning <code>4</code> to the implicit local <code>self</code> inside the method. The <code>after</code> method is defined<sup>1</sup> as</p>\n<pre class="lang-lua prettyprint-override"><code>function Timer:after(delay, func)\n return self:during(delay, _nothing_, func)\nend\n</code></pre>\n<p>which in your case leads to <code>(4):during(delay, _nothing_, func)</code>, hence the error.</p>\n<hr />\n<p><sup>1. Source code from <a href="https://github.com/vrld/hump/blob/master/timer.lua" rel="nofollow noreferrer"><em>hump/timer</em></a></sup><br />\n<sup>* Lua 5.1: <a href="https://lua.org/manual/5.1/manual.html#2.5.8" rel="nofollow noreferrer">2.5.8 – Function Calls</a> | <a href="https://lua.org/manual/5.1/manual.html#2.5.9" rel="nofollow noreferrer">2.5.9 – Function Definitions</a></sup></p>\n"^^ . . "0"^^ . . . "Why are you trying to pass the model itself through the remote event? I would think it would make more sense to have logic in the remote event handler that can look up where the cloned part is stored in the local workspace. Can you explain more of your use case? I would also like a pastebin or something of your full script for context"^^ . . "nvim-lspconfig"^^ . . . "When Authorize should state check in session?"^^ . . "1"^^ . . . . . "0"^^ . . . . . . . . "environment-variables"^^ . . . . "shared-ptr"^^ . . "This was the solution, there is more information in the github issue I made, for anybody else who has this problem. [https://github.com/rochus-keller/Simula/issues/1](https://github.com/rochus-keller/Simula/issues/1). Though I'm going to be using Cim as it's a unfinished project, though I'm not sure how well it could work."^^ . "0"^^ . . "1"^^ . . . "1"^^ . "1"^^ . . "1"^^ . . "<p>I am working with Lua in VS Code and using two extensions:</p>\n<ol>\n<li><code>LuaHelper</code> by Tencent (provides debugging and formatting features).</li>\n<li><code>MTA:SA Lua</code> by Dominic Hock (provides syntax highlighting for MTA-specific functions).</li>\n</ol>\n<p>The issue arises when I enable <code>LuaHelper</code> after <code>MTA:SA Lua</code> is already active. <code>LuaHelper</code> seems to override the syntax highlighting provided by <code>MTA:SA Lua</code>, causing the MTA-specific syntax highlighting to disappear.</p>\n<p>I want to disable syntax highlighting in <code>LuaHelper</code> while keeping its other features, such as the debugger and formatter.</p>\n<p>Is there a way to achieve this?</p>\n<p>Steps to reproduce:</p>\n<ol>\n<li>Install and activate the <code>MTA:SA Lua</code> extension.</li>\n<li>Enable the <code>LuaHelper</code> extension.</li>\n<li>Notice that <code>MTA:SA Lua</code>'s syntax highlighting is overridden.</li>\n</ol>\n<p>What I've tried:</p>\n<ul>\n<li>Checking <code>LuaHelper</code>'s settings for an option to disable syntax highlighting (couldn't find one).</li>\n<li>Reordering the extensions in VS Code's settings (didn't help).</li>\n</ul>\n<p>Any advice or workarounds would be greatly appreciated!</p>\n<p>Environment:</p>\n<ul>\n<li>VS Code Version: version 1.96.1</li>\n<li><code>LuaHelper</code> Version: version 0.2.29</li>\n<li><code>MTA:SA Lua</code> Version: version 2.4.0 GitHub</li>\n</ul>\n"^^ . . "2"^^ . . . . "2"^^ . . . . "3"^^ . . "Please provide enough code so others can better understand or reproduce the problem."^^ . "<p>None of those patterns do what you think they do. Parentheses aren't special inside of classes, so <code>Animal=[(Dog)(Cat)]</code> is the same as <code>Animal=[()CDagot]</code>. So it was never matching your whole string, but rather just <code>Animal=C</code> and <code>Animal=D</code>, which is why adding the anchors made it stop matching. Note that unlike regexes, Lua patterns don't support alternation, i.e., there's no way to do a single <code>find</code> to match what the regex <code>Animal=(Dog|Cat)</code> would match. You need to either modify your code to not rely on a single <code>find</code>, or get and use a library like <a href="https://www.inf.puc-rio.br/%7Eroberto/lpeg/lpeg.html" rel="nofollow noreferrer">LPeg</a> to do the matching instead.</p>\n"^^ . . . . . "1"^^ . . . "1"^^ . . . . . "0"^^ . . "1"^^ . "isn't `a and a.b` equivalent to `a?.b` in C#?"^^ . . . "4"^^ . . "Create a function in Lua script and associate an object in java using luaJ"^^ . . "0"^^ . . . . "1"^^ . . . . . . . "<p>If you simplify your process, it would be:</p>\n<pre><code>lua_getglobal(L, func_name.c_str()); // push WaterBall\nif (lua_isfunction(L, -1))\n SkillMap[id] = ...blabla\nlua_pop(L, 1); // pop WaterBall\n\nauto _func1 = SkillMap.find(id)-&gt;second;\ndouble damage1 = _func1(&amp;data); // call WaterBall\n</code></pre>\n<p>See? You want to call <code>WaterBall</code>, but <code>WaterBall</code> is popped before that, so a nil gets called.</p>\n<p>I see that your lambda function captured the variable <code>func_name</code>, do you want to get the function first?</p>\n<pre><code>SkillMap[id] = [L, func_name](ComplexData* info) -&gt; double {\n lua_getglobal(L, func_name.c_str());\n stack_struct(L, *info);\n ...\n</code></pre>\n<p>Or do you want to cache the function?</p>\n<pre><code>if (lua_isfunction(L, -1)) {\n int func = luaL_ref(L, LUA_REGISTRYINDEX); // cache function\n\n SkillMap[id] = [L, func](ComplexData* info) -&gt; double {\n lua_rawgeti(L, LUA_REGISTRYINDEX, func); // get function\n stack_struct(L, *info);\n ....\n}\n//lua_pop(L, 1);\n</code></pre>\n<p><code>luaL_ref</code> can save the object to the registry and pop the object from the stack, so the call to <code>lua_pop</code> after the if block should be removed.</p>\n"^^ . . "config"^^ . . . . "wireshark-dissector"^^ . . "2"^^ . "2"^^ . . . . . . . "@user29212913 It looks like you took care of my first two points but completely ignored my third point."^^ . . . . . . "2"^^ . "0"^^ . . . . "1"^^ . "1"^^ . . "1"^^ . "<p>I want to set up language server for my JS/TS project with Deno. I am using <code>modular_kickstart</code> which is a fork of kickstart neovim. I have put my config for deno in my <code>lspconfig.nvim</code> plugin file like so:</p>\n<pre><code>-- LSP Plugins\nreturn {\n {\n -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins\n -- used for completion, annotations and signatures of Neovim apis\n 'folke/lazydev.nvim',\n ft = 'lua',\n opts = {\n library = {\n -- Load luvit types when the `vim.uv` word is found\n { path = 'luvit-meta/library', words = { 'vim%.uv' } },\n },\n },\n },\n { 'Bilal2453/luvit-meta', lazy = true },\n {\n -- Main LSP Configuration\n 'neovim/nvim-lspconfig',\n dependencies = {\n -- Automatically install LSPs and related tools to stdpath for Neovim\n { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants\n 'williamboman/mason-lspconfig.nvim',\n 'WhoIsSethDaniel/mason-tool-installer.nvim',\n\n -- Useful status updates for LSP.\n -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`\n { 'j-hui/fidget.nvim', opts = {} },\n\n -- Allows extra capabilities provided by nvim-cmp\n 'hrsh7th/cmp-nvim-lsp',\n },\n config = function()\n -- Brief aside: **What is LSP?**\n --\n -- LSP is an initialism you've probably heard, but might not understand what it is.\n --\n -- LSP stands for Language Server Protocol. It's a protocol that helps editors\n -- and language tooling communicate in a standardized fashion.\n --\n -- In general, you have a &quot;server&quot; which is some tool built to understand a particular\n -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers\n -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone\n -- processes that communicate with some &quot;client&quot; - in this case, Neovim!\n --\n -- LSP provides Neovim with features like:\n -- - Go to definition\n -- - Find references\n -- - Autocompletion\n -- - Symbol Search\n -- - and more!\n --\n -- Thus, Language Servers are external tools that must be installed separately from\n -- Neovim. This is where `mason` and related plugins come into play.\n --\n -- If you're wondering about lsp vs treesitter, you can check out the wonderfully\n -- and elegantly composed help section, `:help lsp-vs-treesitter`\n\n -- This function gets run when an LSP attaches to a particular buffer.\n -- That is to say, every time a new file is opened that is associated with\n -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this\n -- function will be executed to configure the current buffer\n vim.api.nvim_create_autocmd('LspAttach', {\n group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),\n callback = function(event)\n -- NOTE: Remember that Lua is a real programming language, and as such it is possible\n -- to define small helper and utility functions so you don't have to repeat yourself.\n --\n -- In this case, we create a function that lets us more easily define mappings specific\n -- for LSP related items. It sets the mode, buffer and description for us each time.\n local map = function(keys, func, desc, mode)\n mode = mode or 'n'\n vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })\n end\n\n -- Jump to the definition of the word under your cursor.\n -- This is where a variable was first declared, or where a function is defined, etc.\n -- To jump back, press &lt;C-t&gt;.\n map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')\n\n -- Find references for the word under your cursor.\n map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')\n\n -- Jump to the implementation of the word under your cursor.\n -- Useful when your language has ways of declaring types without an actual implementation.\n map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')\n\n -- Jump to the type of the word under your cursor.\n -- Useful when you're not sure what type a variable is and you want to see\n -- the definition of its *type*, not where it was *defined*.\n map('&lt;leader&gt;D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')\n\n -- Fuzzy find all the symbols in your current document.\n -- Symbols are things like variables, functions, types, etc.\n map('&lt;leader&gt;ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')\n\n -- Fuzzy find all the symbols in your current workspace.\n -- Similar to document symbols, except searches over your entire project.\n map('&lt;leader&gt;ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')\n\n -- Rename the variable under your cursor.\n -- Most Language Servers support renaming across files, etc.\n map('&lt;leader&gt;rn', vim.lsp.buf.rename, '[R]e[n]ame')\n\n -- Execute a code action, usually your cursor needs to be on top of an error\n -- or a suggestion from your LSP for this to activate.\n map('&lt;leader&gt;ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })\n\n -- WARN: This is not Goto Definition, this is Goto Declaration.\n -- For example, in C this would take you to the header.\n map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')\n\n -- The following two autocommands are used to highlight references of the\n -- word under your cursor when your cursor rests there for a little while.\n -- See `:help CursorHold` for information about when this is executed\n --\n -- When you move your cursor, the highlights will be cleared (the second autocommand).\n local client = vim.lsp.get_client_by_id(event.data.client_id)\n if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then\n local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })\n vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {\n buffer = event.buf,\n group = highlight_augroup,\n callback = vim.lsp.buf.document_highlight,\n })\n\n vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {\n buffer = event.buf,\n group = highlight_augroup,\n callback = vim.lsp.buf.clear_references,\n })\n\n vim.api.nvim_create_autocmd('LspDetach', {\n group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),\n callback = function(event2)\n vim.lsp.buf.clear_references()\n vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }\n end,\n })\n end\n\n -- The following code creates a keymap to toggle inlay hints in your\n -- code, if the language server you are using supports them\n --\n -- This may be unwanted, since they displace some of your code\n if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then\n map('&lt;leader&gt;th', function()\n vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })\n end, '[T]oggle Inlay [H]ints')\n end\n end,\n })\n\n -- Change diagnostic symbols in the sign column (gutter)\n -- if vim.g.have_nerd_font then\n -- local signs = { Error = '', Warn = '', Hint = '', Info = '' }\n -- for type, icon in pairs(signs) do\n -- local hl = 'DiagnosticSign' .. type\n -- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })\n -- end\n -- end\n\n -- LSP servers and clients are able to communicate to each other what features they support.\n -- By default, Neovim doesn't support everything that is in the LSP specification.\n -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.\n -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.\n local capabilities = vim.lsp.protocol.make_client_capabilities()\n capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())\n\n -- Enable the following language servers\n -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.\n --\n -- Add any additional override configuration in the following tables. Available keys are:\n -- - cmd (table): Override the default command used to start the server\n -- - filetypes (table): Override the default list of associated filetypes for the server\n -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.\n -- - settings (table): Override the default settings passed when initializing the server.\n -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/\n local servers = {\n -- clangd = {},\n -- gopls = {},\n -- pyright = {},\n -- rust_analyzer = {},\n -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs\n --\n -- Some languages (like typescript) have entire language plugins that can be useful:\n -- https://github.com/pmizio/typescript-tools.nvim\n --\n -- But for many setups, the LSP (`ts_ls`) will work just fine\n -- ts_ls = {},\n --\n\n lua_ls = {\n -- cmd = {...},\n -- filetypes = { ...},\n -- capabilities = {},\n settings = {\n Lua = {\n completion = {\n callSnippet = 'Replace',\n },\n -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings\n -- diagnostics = { disable = { 'missing-fields' } },\n },\n },\n },\n }\n\n -- Ensure the servers and tools above are installed\n -- To check the current status of installed tools and/or manually install\n -- other tools, you can run\n -- :Mason\n --\n -- You can press `g?` for help in this menu.\n require('mason').setup()\n\n -- You can add other tools here that you want Mason to install\n -- for you, so that they are available from within Neovim.\n local ensure_installed = vim.tbl_keys(servers or {})\n vim.list_extend(ensure_installed, {\n 'stylua', -- Used to format Lua code\n })\n require('mason-tool-installer').setup { ensure_installed = ensure_installed }\n\n require('mason-lspconfig').setup {\n handlers = {\n function(server_name)\n local server = servers[server_name] or {}\n -- This handles overriding only values explicitly passed\n -- by the server configuration above. Useful when disabling\n -- certain features of an LSP (for example, turning off formatting for ts_ls)\n server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})\n require('lspconfig')[server_name].setup(server)\n end,\n },\n }\n end,\n },\n}\n-- vim: ts=2 sts=2 sw=2 et\n</code></pre>\n<p>I have followed the suggestion on the official deno docs for setup for neovim. It say to put this in my lspconfig file.</p>\n<pre><code>local nvim_lsp = require('lspconfig')\nnvim_lsp.denols.setup {\n on_attach = on_attach,\n root_dir = nvim_lsp.util.root_pattern(&quot;deno.json&quot;, &quot;deno.jsonc&quot;),\n}\n\nnvim_lsp.ts_ls.setup {\n on_attach = on_attach,\n root_dir = nvim_lsp.util.root_pattern(&quot;package.json&quot;),\n single_file_support = false\n}\n</code></pre>\n<p>However, I am facing conflict with my <code>ts_ls</code> and <code>denols</code> occupying the same buffer. I am unaware with the <code>lazy.nvim</code> lua configuration used by the <code>modular_kickstart</code> as well as kickstart nvim.</p>\n"^^ . . . "<p>Suppose I have two Lua arrays <code> a = {1, 2, 3}</code> and <code>b = {4, 5, 6}</code>.</p>\n<p>And then do the following assignation</p>\n<pre><code>q, w, e, r, t, y = table.unpack(a), table.unpack(b)\n</code></pre>\n<p>I would expect to get that</p>\n<pre><code>q == 1 and w == 2 and e == 3 and r == 4 and t == 5 and y == 6\n</code></pre>\n<p>But I get that\n<code>q == 1 and w == 4 and e == 5 and r == 6</code> and <code>t, y</code> are <code>nil</code>!</p>\n<p>Could you please explain such a strange behavior?</p>\n"^^ . "exactly. you need a dota instead a colon when calling the parent constructor"^^ . . . . . "0"^^ . . . . . . "0"^^ . "<p>When working with OOP in lua, there's 3 things to double check are all present and working properly :</p>\n<pre class="lang-lua prettyprint-override"><code>-- 1. The base table is defined\nlocal Thing = {}\n\n-- 2. The base table has a self referential __index meta method\nThing.__index = Thing\n\nfunction Thing.new()\n -- 3. A call to setmetatable to link the new object to the base table\n return setmetatable({}, Thing)\nend\n\n</code></pre>\n<p>And looking at your code...</p>\n<pre class="lang-lua prettyprint-override"><code>FistCombat._index = FistCombat\n</code></pre>\n<p>It looks like you didn't set the <code>__index</code> metamethod properly. Notice that <code>__index</code> has two underscores at the front. When you defined it, it looks like you only used one.</p>\n<p>So change that line to this :</p>\n<pre class="lang-lua prettyprint-override"><code>FistCombat.__index = FistCombat\n</code></pre>\n<p>And see if that helps</p>\n"^^ . . "0"^^ . . "0"^^ . "How to code a run-time, single-assignment, variable in Lua?"^^ . . . "0"^^ . . . . "How do I use pcall with vimscript functions?"^^ . . "0"^^ . "0"^^ . . . . . "0"^^ . . . "0"^^ . . "1"^^ . . . . . . . "1"^^ . . . "'isPacked' is not a member of 'Lua::jitComposer""^^ . . . "0"^^ . . "1"^^ . "0"^^ . "6"^^ . "2"^^ . . . . "<p>Like I got two tables:\n<code>{[&quot;a&quot;] = &quot;aaa&quot;}</code> and <code>{[&quot;b&quot;] = &quot;bbb&quot;}</code>\nAnd make it into one table: <code>{[&quot;a&quot;] = &quot;aaa&quot;, [&quot;b&quot;] = &quot;bbb&quot;}</code></p>\n<p>I am already tried this code:</p>\n<pre><code>function ListConcat(t1,t2)\n for i=1,#t2 do\n t1[#t1+1] = t2[i]\n end\n return t1\nend\n\nlocal function getkeys(tab)\n local keyset={}\n local n=0\n for k,v in pairs(tab) do\n n=n+1\n keyset[n]=k\n end\n return keyset\nend\n\nlocal function has_value (tab, val)\n for index, value in ipairs(tab) do\n if value == val then\n return true\n end\n end\n\n return false\nend\n\nfunction TableConcat(t1, t2)\n local key1s = getkeys(t1)\n local key2s = getkeys(t2)\n local keys = ListConcat(key1s, key2s)\n local rtb = {}\n for i=1,#keys do\n local key = keys[i]\n if has_value(key1s, key) then\n rtb[key] = t1[key]\n else\n rtb[key] = t2[key]\n end\n end\n return rtb\nend\n</code></pre>\n<p>Where am I wrong, and is there are easier solution?\nNothing works, tried other codes. And I don't need to print it like in other people's question.</p>\n<p>Dummy code:</p>\n<pre><code>local funcs = require(&quot;funcs&quot;)\na = {[&quot;a&quot;] = &quot;a&quot;}\nb = {[&quot;b&quot;] = &quot;b&quot;}\nprint(funcs.TableConcat(a, b)) -- Wanted: {[&quot;a&quot;] = &quot;a&quot;, [&quot;b&quot;] = &quot;b&quot;}\n -- Returns: {[&quot;a&quot;] = &quot;a&quot;}\n</code></pre>\n"^^ . "0"^^ . "1"^^ . "0"^^ . . "0"^^ . . . "0"^^ . . "1"^^ . . "0"^^ . . . "The *internal representation* of a table is how any given *implementation* of Lua chooses to store / retrieve the data associated with said table. See the comment near the top of [`ltable.c`](https://lua.org/source/5.4/ltable.c.html) for an explanation of how the *reference implementation* of Lua works. By specifying that the length operator (`#`) returns an *unspecified* border from a non-sequence, this frees up other implementations from having to design the code that backs their tables in the exact same way (i.e., they are free to optimize for different use-cases)."^^ . . "regex"^^ . . . . . . "<pre><code>local gridBox = iup.gridbox{\n table.unpack(Instances),\n --Instances[1],\n --Instances[2],\n numcolumns = 3,\n alignment = &quot;ACENTER&quot;,\n expand = &quot;YES&quot;\n}\n</code></pre>\n<p>When I run this in VSCode it will show only 1 Element of the Instance Table, which is always random, however if I do it with e.g. Instances[1] then they will show up to 100%. I however need it more &quot;dynamically&quot;</p>\n<p>Tried puting in the table directly with</p>\n<pre><code>local gridBox = iup.gridbox{\n Instances,\n numcolumns = 3,\n alignment = &quot;ACENTER&quot;,\n expand = &quot;YES&quot;\n}\n</code></pre>\n<p>and like already mentioned with Instances[1]</p>\n"^^ . . "1"^^ . . "0"^^ . "<p>The <a href="https://www.lua.org/manual/5.1/manual.html#2.6" rel="nofollow noreferrer">manual</a> describes upvalue as follows:</p>\n<blockquote>\n<p>A local variable used by an inner function is called an upvalue, or external local variable, inside the inner function.</p>\n</blockquote>\n<p><code>turn</code> is not an inner function of <code>setupRotary</code>, so <code>sv</code> will not be passed.</p>\n<p>You can fix this problem by moving the function inside:</p>\n<pre><code>local turn\n\nlocal setupRotary = function(sv)\n turn = function(type, pos, when)\n -- here sv is visible\n end\nend\n</code></pre>\n"^^ . "<p>I would like to initialize the fields protocol table inside the protocol init function, is it possible ?</p>\n<p>I've tried the following but it doesn't seem to be working:</p>\n<pre><code>function my_protocol_addProtoFieds()\n local field_table = {}\n local attr_id = &quot;test&quot;\n local field_name = &quot;proto.&quot; .. attr_id\n local field_abbr = attr_id\n local ltype = ftypes.BOOLEAN\n\n if ltype ~= nil then\n local field = ProtoField.new(field_name, field_abbr, ltype)\n table.insert(field_table, field)\n end\n my_protocol.fields = field_table\nend\n\nfunction my_protocol.init()\n -- read some initialization files\n my_protocol_addProtoFieds()\nend\n</code></pre>\n"^^ . . . . "1"^^ . "@shingo I didn't come across that one when I was googling. It answers my question. I'll see if I can mark mine as a duplicate."^^ . . . . . . . . . "1"^^ . . "3"^^ . . . "nlua"^^ . . . . "vim"^^ . . "0"^^ . "<p>A capture cannot be made to repeat within a single application of a pattern.</p>\n<p>Instead, capture everything between your phrases, then use <a href="https://lua.org/manual/5.4/manual.html#pdf-string.gmatch" rel="nofollow noreferrer"><code>string.gmatch</code></a> to pull out each substring.</p>\n<pre class="lang-lua prettyprint-override"><code>local s = &quot;do()mul(41,51)mul(1,1)don't()&quot;\nlocal m = s:match(&quot;do%(%)(.*)don't%(%)&quot;)\n\nif m then\n for v in m:gmatch(&quot;mul%(%d+,%d+%)&quot;) do\n print(v)\n end\nend\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>mul(41,51)\nmul(1,1)\n</code></pre>\n"^^ . . "<p><a href="https://github.com/rochus-keller/LjTools/commit/350dfbb245e2e706670c7bba716a8eede8bd4938" rel="nofollow noreferrer">This commit</a> removed <code>isPacked(quint32)</code> and put a static <code>isRowCol()</code> in its place.</p>\n<p>I suggest you just stub it out:</p>\n<pre><code>static bool isPacked(quint32) { return true; }\n</code></pre>\n<p>or revert your LjTools repository to commit 350dfbb245e2e706670c7bba716a8eede8bd4938.</p>\n"^^ . "luacom"^^ . . . "0"^^ . . "1"^^ . "luajit"^^ . . . "0"^^ . "0"^^ . . . . "strange behavior of table.unpack"^^ . . "2"^^ . . . . "0"^^ . "0"^^ . "0"^^ . . "@AlirezaBahrami What's your Neovim version?"^^ . "Are the tables any more complex than the example you gave? If not, you could just directly remove the braces, split the string by commas, and then parse each `key=value` pair yourself (although again, this would require assurance that string inputs follow approximately the form shown above)"^^ . . . "1"^^ . . "<p>Can someone help me combine these two scripts in one. I tried but couldn't make it work. I'm not very good at this...\nI want to use them on Logitech scripting for a game and I wanna make them work together.</p>\n<pre><code>function OnEvent(event, arg)\n if IsKeyLockOn (&quot;scrolllock&quot;) then\n repeat\n if IsMouseButtonPressed(1) then\n repeat\n MoveMouseRelative(0,1)\n Sleep(13)\n MoveMouseRelative(0,1)\n Sleep(14)\n MoveMouseRelative(0,1)\n Sleep(15)\n MoveMouseRelative(0,1)\n Sleep(14)\n MoveMouseRelative(0,1)\n Sleep(15)\n MoveMouseRelative(0,2)\n Sleep(16)\n MoveMouseRelative(0,1)\n until not IsMouseButtonPressed(1)\n end\n until not IsKeyLockOn (&quot;scrolllock&quot;)\n end\nend\n\n\nfunction OnEvent(event, arg)\n -- Quick Peek Movement Script (Activated when Num Lock is ON)\n if IsKeyLockOn(&quot;numlock&quot;) and event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 5 then\n repeat\n PressKey(&quot;e&quot;) -- Right peak\n Sleep(50)\n PressKey(&quot;n&quot;) -- Aim before crouch\n Sleep(50)\n PressKey(&quot;c&quot;) -- Crouch\n Sleep(50)\n ReleaseKey(&quot;n&quot;) -- Release Aim\n ReleaseKey(&quot;c&quot;)\n PressKey(&quot;n&quot;) -- Press Aim again after crouch release\n Sleep(50)\n PressKey(&quot;q&quot;) -- Left peak\n Sleep(50)\n ReleaseKey(&quot;n&quot;) -- Release Aim after Left Peek\n ReleaseKey(&quot;q&quot;)\n ReleaseKey(&quot;e&quot;)\n Sleep(50)\n until not IsMouseButtonPressed(5)\n end\n</code></pre>\n<p>i tried to merge these 2 scripts but one works the other doesn't.</p>\n<p>the merge script is this:</p>\n<pre><code>function OnEvent(event, arg)\n -- Quick Peek with Mouse Button 5\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 5 then\n -- Hold Right Peak (E), Crouch (C), and Aim (N)\n PressKey(&quot;e&quot;)\n PressKey(&quot;c&quot;)\n PressKey(&quot;n&quot;)\n end\n\n if event == &quot;MOUSE_BUTTON_RELEASED&quot; and arg == 5 then\n -- Release Right Peak (E), Crouch (C), and Aim (N)\n ReleaseKey(&quot;e&quot;)\n ReleaseKey(&quot;n&quot;)\n \n -- Press C again to make the player stand up\n PressKey(&quot;c&quot;)\n Sleep(50) -- Briefly hold C to ensure it registers as standing up\n ReleaseKey(&quot;c&quot;)\n end\n\n -- No Recoil Script with Scroll Lock ON for Mouse Button 1\n if IsKeyLockOn(&quot;scrolllock&quot;) then\n -- Start No Recoil when Mouse Button 1 is pressed\n if IsMouseButtonPressed(1) then\n repeat\n -- Apply recoil control (move mouse slightly up)\n MoveMouseRelative(0, 1)\n Sleep(13)\n MoveMouseRelative(0, 1)\n Sleep(14)\n MoveMouseRelative(0, 1)\n Sleep(15)\n MoveMouseRelative(0, 1)\n Sleep(14)\n MoveMouseRelative(0, 1)\n Sleep(15)\n MoveMouseRelative(0, 2)\n Sleep(16)\n MoveMouseRelative(0, 1)\n until not IsMouseButtonPressed(1) -- Stop when Mouse Button 1 is released\n end\n end\nend\n</code></pre>\n"^^ . . "0"^^ . . "0"^^ . . . . . "0"^^ . . . . . "<p>I'm trying to use Lua to test the Serialization and Deserialization I have <code>message_pb.lua</code> which has below content</p>\n<pre><code>cat message_pb.lua\n</code></pre>\n<pre><code>local pb = require &quot;pb&quot;\nlocal message_pb = {}\n\npb.load([[\n syntax = &quot;proto3&quot;;\n message Request {\n string user_id = 1;\n int32 action = 2;\n }\n]])\n\nreturn message_pb -- Return module for require()\n</code></pre>\n<p>Executing this command works <code>lua message_pb.lua</code></p>\n<p>This is my <code>test.lua</code> file which should load <code>message_pb</code> and do seriazation desriazation test</p>\n<pre class="lang-lua prettyprint-override"><code>local pb = require(&quot;pb&quot;) -- Use pb module\nrequire(&quot;message_pb&quot;) -- Load the compiled protobuf schema\n\nlocal request_data = { user_id = &quot;user_123&quot;, action = 1 }\n\n-- Serialize the request\nlocal encoded = pb.encode(&quot;Request&quot;, request_data)\nif not encoded then\n print(&quot;Encoding failed!&quot;)\n return\nend\nprint(&quot;Serialized:&quot;, encoded)\n\n-- Deserialize the request\nlocal decoded = pb.decode(&quot;Request&quot;, encoded)\nif not decoded then\n print(&quot;Decoding failed!&quot;)\n return\nend\n\nprint(&quot;Deserialized:&quot;)\nfor k, v in pairs(decoded) do\n print(k, v)\nend\n</code></pre>\n<p>when I ran <code>test.lua</code> it throws error</p>\n<pre><code>lua test.lua\nlua: test.lua:7: bad argument #1 to 'encode' (type 'Request' does not exists)\nstack traceback:\n [C]: in function 'pb.encode'\n test.lua:7: in main chunk\n [C]: in ?\n</code></pre>\n"^^ . . "0"^^ . . "tmux"^^ . . . "0"^^ . "manhattan"^^ . "From `:help quote-quote`: "*Vim fills this register with text deleted with the "d", "c", "s", "x" commands or copied with the yank "y" command, regardless of whether or not a specific register was used (e.g. "xdd).*""^^ . "0"^^ . "0"^^ . "Can't reproduce, https://onecompiler.com/lua/433wcz5hr, please provide a [mre]."^^ . "0"^^ . . . . . . . . "0"^^ . . . "1"^^ . . "1"^^ . . "0"^^ . . "javascript"^^ . "4"^^ . . "0"^^ . . . . . . . . . . . "function"^^ . "<p>The issue was that I hadn't added credits to anthropic. I thought that since I was paying for &quot;Professional&quot; account with Claude.ai that this would work. It doesn't.</p>\n<p>Solution: I added credits to Anthropic and then cancelled my Claude.ai subscription.</p>\n"^^ . "0"^^ . "1"^^ . "1"^^ . . "0"^^ . . . "<p>A function may not behave like a table, but a table may behave like a function through the <a href="https://lua.org/manual/5.4/manual.html#2.4" rel="nofollow noreferrer"><code>__call</code></a> <em>metamethod</em>.</p>\n<p>A <code>__call</code> metamethod is invoked whenever the associated table is called as if it were a function. For example:</p>\n<pre class="lang-lua prettyprint-override"><code>local describe = setmetatable({}, {\n __call = function (self)\n print('describe() called', self)\n end\n})\n\nfunction describe.skip()\n print('describe.skip() called')\nend\n\ndescribe()\ndescribe.skip()\n</code></pre>\n<pre class="lang-none prettyprint-override"><code>describe() called table: 0x5570496f0890\ndescribe.skip() called\n</code></pre>\n<p>Additionally, <a href="https://lua.org/manual/5.4/manual.html#2.4" rel="nofollow noreferrer"><code>__index</code></a> and <a href="https://lua.org/manual/5.4/manual.html#2.4" rel="nofollow noreferrer"><code>__newindex</code></a> may be used to create complete proxies.</p>\n<p>See also <a href="https://www.lua.org/pil/13.4.4.html" rel="nofollow noreferrer"><em>PIL 13.4.4 – Tracking Table Accesses</em></a>, which discusses proxy tables.</p>\n"^^ . . "terminal"^^ . . "keyboard-events"^^ . . "0"^^ . . . . . . "0"^^ . . . "1"^^ . "0"^^ . . "1"^^ . . . . . "4"^^ . . . "0"^^ . . "<p>I'm trying to learn love2d and I am having an issue with fullscreen. no matter how I try to set the resolution, it always ends up setting itself to 1536x864. My native resolution is 1920x1080, and I am trying to set the game's resolution to 1280x720. I've tried including this in conf.lua:</p>\n<pre><code>t.window.width = 1280\nt.window.height = 720\nt.window.fullscreen = true\n</code></pre>\n<p>I know conf.lua is being loaded, because it does go to fullscreen, and the window title is setting correctly from there. I've tried also doing it via love.window.setMode() in love.load() as follows:</p>\n<pre><code>local mode_flags = {}\nmode_flags['fullscreen'] = true\nlove.window.setMode(1280, 720, mode_flags)\n</code></pre>\n<p>These are the two methods I found online, and both end up with a 1536x864 resolution (which is not even one of the resolutions available on my monitor, as best I can tell). Why is it doing this, and how can I fix it?</p>\n<p>EDIT: Having found <a href="https://love2d.org/forums/viewtopic.php?t=94055" rel="nofollow noreferrer">this forum discussion</a>, I understand that the reason I was getting this specific resolution was due to the DPI scaling assigned by windows. I navigated to love.exe in my install dir, and pulled up its Properties window. Under Compatibility, I clicked 'Change high DPI settings', then enabled 'Override high DPI behaviour' under 'High DPI scaling override', and selected 'Application' on the associated dropdown menu. Applying these settings resolved half of my issue; I'm not longer getting the strange resolution. However, I am now getting my native resolution (1080p), regardless of assigning width and height to 1280 and 720 in conf.lua or by using love.window.setMode() in love.load(). Why does love ignore any resolution I set on fullscreen, and how can I resolve the issue? Thanks in advance, by the way.</p>\n"^^ . "0"^^ . . "0"^^ . "1"^^ . . "Is nested tables okay for you? Then you could do `a[1][2] = 6`"^^ . "0"^^ . "<h1>TL;DR</h1>\n<p>You can use <code>loadfile()</code> inside the serverless <code>functions</code> config parameter. This function allows you to load the content of a file, which you can call and execute afterwards, in case it's a function.</p>\n<p>Example:</p>\n<pre class="lang-json prettyprint-override"><code>&quot;plugins&quot;: {\n &quot;serverless-pre-function&quot;: {\n &quot;phase&quot;: &quot;access&quot;,\n &quot;functions&quot;: [\n &quot;return function(conf, ctx); ... local code = loadfile(\\&quot;/path/to/file.lua\\&quot;); ... code(); ... end&quot;\n ]\n }\n}\n</code></pre>\n<h1>Long Answer</h1>\n<h2>Possible Solutions</h2>\n<p>There are at least 2 ways you can achieve that behaviour:</p>\n<ol>\n<li>load and call the function's code from within <code>serverless.conf.functions</code> parameter, without changing the <code>serverless</code> plugin source code;</li>\n<li>edit <code>serverless</code> plugin or write a separate <code>custom-serverless</code> plugin so that you can directly set the path in its parameters.</li>\n</ol>\n<p><strong>NB</strong>: for the examples below I assume you have placed the file containing the functions at <code>/usr/local/apisix/lua_scripts/extract_userinfo.lua</code>, with the following content:</p>\n<pre class="lang-lua prettyprint-override"><code>return function(conf, ctx)\n local jwt = require('resty.jwt')\n local userinfo = ngx.req.get_headers()['x-userinfo']\n \n if userinfo then\n local jwt_obj = jwt:verify(nil, userinfo)\n\n if jwt_obj.payload then\n local preferred_username = jwt_obj.payload.preferred_username\n\n if preferred_username then\n ngx.req.set_header('X-User-Uid', preferred_username)\n else\n ngx.log(ngx.ERR, 'Claim preferred_username not found in JWT')\n end\n\n else\n ngx.log(ngx.ERR, 'Failed to decode JWT: ', jwt_obj.reason)\n end\n\n else\n ngx.log(ngx.ERR, 'No x-userinfo header found')\n end\nend\n</code></pre>\n<h3>1. Load the File Content Inside Serverless Functions</h3>\n<p>From serverless <code>functions</code> parameter, you can return a function that loads the file content using Lua <code>loadfile(&quot;/path/to/file&quot;)</code>, and execute it afterwards.</p>\n<p>With this solution you don't have to change the source code of <a href="https://github.com/apache/apisix/blob/master/apisix/plugins/serverless/init.lua" rel="nofollow noreferrer"><code>serverless</code></a> plugin.</p>\n<h4>Example</h4>\n<h5>APISIX Traditional Mode</h5>\n<pre class="lang-bash prettyprint-override"><code>curl http://127.0.0.1:9180/apisix/admin/routes/1 -H &quot;X-API-KEY: $admin_key&quot; -X PUT -d '\n{\n &quot;uri&quot;: &quot;/custom-serverless/*&quot;,\n &quot;plugins&quot;: {\n &quot;serverless-pre-function&quot;: {\n &quot;phase&quot;: &quot;rewrite&quot;,\n&quot;functions&quot; : [\n &quot;return function(conf, ctx); local core = require(\\&quot;apisix.core\\&quot;); local code, err = loadfile(\\&quot;/usr/local/apisix/lua_scripts/extract_userinfo.lua\\&quot;); if code then; local success, func = pcall(code); if success then; func(); end; end; end&quot;\n ]\n },\n &quot;proxy-rewrite&quot;: {\n &quot;regex_uri&quot;: [\n &quot;^/serverless/(.*)&quot;,\n &quot;/$1&quot;\n ]\n }\n },\n &quot;upstream&quot;: {\n &quot;type&quot;: &quot;roundrobin&quot;,\n &quot;nodes&quot;: {\n &quot;httpbin.org&quot;: 1\n }\n }\n}'\n</code></pre>\n<h5>APISIX Standalone</h5>\n<p>File <code>apisix.yaml</code>:</p>\n<pre class="lang-yaml prettyprint-override"><code>upstreams:\n - id: ext-httpbin\n nodes:\n &quot;httpbin.org&quot;: 1\n\nroutes:\n - id: serverless\n uri: /serverless/*\n upstream_id: ext-httpbin\n plugins:\n serverless-pre-function:\n # Uncomment to customize priority\n # _meta:\n # priority: 20000\n phase: access\n functions:\n - |\n return function(conf, ctx)\n local core = require(&quot;apisix.core&quot;)\n\n local code, err = loadfile(&quot;/usr/local/apisix/lua_scripts/extract_userinfo.lua&quot;)\n if code then\n local success, func = pcall(code)\n if success then\n func()\n end\n end\n \n end\n # This is used to correctly parse request URI for httpbin.org\n proxy-rewrite:\n regex_uri:\n - ^/serverless/(.*)\n - /$1\n#END\n</code></pre>\n<h5>Sending a Request</h5>\n<p>Upon sending a request, you can notice that APISIX logs the JWT message:</p>\n<pre class="lang-bash prettyprint-override"><code>curl localhost:9080/serverless/get\n</code></pre>\n<p>Log messages:</p>\n<pre class="lang-none prettyprint-override"><code>2025/01/23 10:58:32 [error] 36#36: *2890 [lua] test.lua:22: func(): No x-userinfo header found, client: 172.18.0.1, server: _, request: &quot;GET /serverless/get HTTP/1.1&quot;, host: &quot;localhost:9080&quot;\n172.18.0.1 - - [23/Jan/2025:10:58:32 +0000] localhost:9080 &quot;GET /serverless/get HTTP/1.1&quot; 200 299 0.376 &quot;-&quot; &quot;curl/8.5.0&quot; 52.203.38.8:80 200 0.345 &quot;http://localhost:9080/get&quot;\n</code></pre>\n<h3>2. Customize the <code>serverless</code> Plugin</h3>\n<p>I wrote a custom version of the <a href="https://github.com/apache/apisix/blob/master/apisix/plugins/serverless/init.lua" rel="nofollow noreferrer"><code>serverless</code></a> plugin, which provides two configuration parameters:</p>\n<ul>\n<li><code>functions</code>, an array of strings (already present);</li>\n<li><code>file_paths</code>, an array of strings representing the file paths from which you want to load the functions code;</li>\n</ul>\n<p>This plugin also performs a check on the configuration schema, verifying that at least <code>functions</code> or <code>file_paths</code> is present.</p>\n<p>You can just copy and paste the following code in <code>/usr/local/apisix/apisix/plugins/serverless/init.lua</code>:</p>\n<pre class="lang-lua prettyprint-override"><code>--\n-- Licensed to the Apache Software Foundation (ASF) under one or more\n-- contributor license agreements. See the NOTICE file distributed with\n-- this work for additional information regarding copyright ownership.\n-- The ASF licenses this file to You under the Apache License, Version 2.0\n-- (the &quot;License&quot;); you may not use this file except in compliance with\n-- the License. You may obtain a copy of the License at\n--\n-- http://www.apache.org/licenses/LICENSE-2.0\n--\n-- Unless required by applicable law or agreed to in writing, software\n-- distributed under the License is distributed on an &quot;AS IS&quot; BASIS,\n-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-- See the License for the specific language governing permissions and\n-- limitations under the License.\n--\nlocal ipairs = ipairs\nlocal pcall = pcall\nlocal loadstring = loadstring\nlocal require = require\nlocal type = type\n\n\nlocal phases = {\n &quot;rewrite&quot;, &quot;access&quot;, &quot;header_filter&quot;, &quot;body_filter&quot;,\n &quot;log&quot;, &quot;before_proxy&quot;\n}\n\n\nreturn function(plugin_name, priority)\n local core = require(&quot;apisix.core&quot;)\n\n\n local lrucache = core.lrucache.new({\n type = &quot;plugin&quot;,\n })\n\n local schema = {\n type = &quot;object&quot;,\n properties = {\n phase = {\n type = &quot;string&quot;,\n default = &quot;access&quot;,\n enum = phases,\n },\n functions = {\n type = &quot;array&quot;,\n items = {type = &quot;string&quot;},\n minItems = 1\n },\n file_paths = {\n type = &quot;array&quot;,\n items = {type = &quot;string&quot;},\n minItems = 1\n },\n },\n oneOf = {\n { required = { &quot;functions&quot; } },\n { required = { &quot;file_paths&quot; } }\n },\n }\n\n local _M = {\n version = 0.1,\n priority = priority,\n name = plugin_name,\n schema = schema,\n }\n\n local function load_funcs(functions)\n local funcs = core.table.new(#functions, 0)\n\n local index = 1\n for _, func_str in ipairs(functions) do\n local _, func = pcall(loadstring(func_str))\n funcs[index] = func\n index = index + 1\n end\n\n return funcs\n end\n\n local function load_funcs_from_files(file_paths)\n local funcs = core.table.new(#file_paths, 0)\n\n local index = 1\n for _, file_content in ipairs(file_paths) do\n local _, func = pcall(loadfile(file_content))\n funcs[index] = func\n index = index + 1\n end\n\n return funcs\n end\n\n local function call_funcs(phase, conf, ctx)\n if phase ~= conf.phase then\n return\n end\n\n if conf.functions then\n local functions = core.lrucache.plugin_ctx(lrucache, ctx, nil,\n load_funcs, conf.functions)\n for _, func in ipairs(functions) do\n local code, body = func(conf, ctx)\n if code or body then\n return code, body\n end\n end\n end\n\n if conf.file_paths then\n local functions = core.lrucache.plugin_ctx(lrucache, ctx, nil,\n load_funcs_from_files, conf.file_paths)\n for _, func in ipairs(functions) do\n local code, body = func(conf, ctx)\n if code or body then\n return code, body\n end\n end\n end\n end\n\n function _M.check_schema(conf)\n local ok, err = core.schema.check(schema, conf)\n if not ok then\n return false, err\n end\n\n if conf.functions then\n local functions = conf.functions\n for _, func_str in ipairs(functions) do\n local func, err = loadstring(func_str)\n if err then\n return false, 'failed to loadstring: ' .. err\n end\n\n local ok, ret = pcall(func)\n if not ok then\n return false, 'pcall error: ' .. ret\n end\n if type(ret) ~= 'function' then\n return false, 'only accept Lua function,'\n .. ' the input code type is ' .. type(ret)\n end\n end\n end\n\n if conf.file_paths then\n local functions = conf.file_paths\n for _, func_str in ipairs(functions) do\n local func, err = loadfile(func_str)\n if err then\n return false, 'failed to loadstring: ' .. err\n end\n\n local ok, ret = pcall(func)\n if not ok then\n return false, 'pcall error: ' .. ret\n end\n if type(ret) ~= 'function' then\n return false, 'only accept Lua function,'\n .. ' the input code type is ' .. type(ret)\n end\n end\n end\n\n return true\n end\n\n for _, phase in ipairs(phases) do\n _M[phase] = function (conf, ctx)\n return call_funcs(phase, conf, ctx)\n end\n end\n\n return _M\nend\n</code></pre>\n<h4>Example Usage</h4>\n<h5>APISIX Traditional Mode</h5>\n<pre class="lang-bash prettyprint-override"><code>curl http://127.0.0.1:9180/apisix/admin/routes/1 -H &quot;X-API-KEY: $admin_key&quot; -X PUT -d '\n{\n &quot;uri&quot;: &quot;/custom-serverless/*&quot;,\n &quot;plugins&quot;: {\n &quot;serverless-pre-function&quot;: {\n &quot;phase&quot;: &quot;rewrite&quot;,\n &quot;file_paths&quot; : [\n &quot;/usr/local/apisix/lua_scripts/extract_userinfo.lua&quot;\n ]\n },\n &quot;proxy-rewrite&quot;: {\n &quot;regex_uri&quot;: [\n &quot;^/serverless/(.*)&quot;,\n &quot;/$1&quot;\n ]\n }\n },\n &quot;upstream&quot;: {\n &quot;type&quot;: &quot;roundrobin&quot;,\n &quot;nodes&quot;: {\n &quot;httpbin.org&quot;: 1\n }\n }\n}'\n</code></pre>\n<h5>APISIX Standalone Mode</h5>\n<p>File <code>apisix.yaml</code>:</p>\n<pre class="lang-yaml prettyprint-override"><code>upstreams:\n - id: ext-httpbin\n nodes:\n &quot;httpbin.org&quot;: 1\n\nroutes:\n - id: custom-serverless\n uri: /custom-serverless/*\n upstream_id: ext-httpbin\n plugins:\n serverless-pre-function:\n # Uncomment to customize priority\n # _meta:\n # priority: 20000\n phase: access\n file_paths:\n - &quot;/usr/local/apisix/lua_scripts/extract_userinfo.lua&quot;\n # This is used to correctly parse request URI for httpbin.org\n proxy-rewrite:\n regex_uri:\n - ^/custom-serverless/(.*)\n - /$1\n#END\n</code></pre>\n<h5>Sending a Request</h5>\n<p>Upon sending a request, you can notice the log message:</p>\n<pre class="lang-bash prettyprint-override"><code>curl localhost:9080/custom-serverless/get\n</code></pre>\n<p>Log messages:</p>\n<pre class="lang-none prettyprint-override"><code>2025/01/23 10:26:56 [error] 63#63: *78379 [lua] test.lua:22: func(): No x-userinfo header found, client: 172.18.0.1, server: _, request: &quot;GET /custom-serverless/get HTTP/1.1&quot;, host: &quot;localhost:9080&quot;\n172.18.0.1 - - [23/Jan/2025:10:26:56 +0000] localhost:9080 &quot;GET /custom-serverless/get HTTP/1.1&quot; 200 299 0.556 &quot;-&quot; &quot;curl/8.5.0&quot; 50.19.58.113:80 200 0.544 &quot;http://localhost:9080/get&quot;\n</code></pre>\n<hr />\n<h2>Extra</h2>\n<p>Notice that you can also make APISIX respond without proxying the request to the upstream:</p>\n<pre class="lang-lua prettyprint-override"><code>ngx.say(&quot;Hello world&quot;)\nngx.exit(200)\n</code></pre>\n<p>Example:</p>\n<pre class="lang-bash prettyprint-override"><code>curl localhost:9080/serverless/get\nHello world\n</code></pre>\n"^^ . "1"^^ . "0"^^ . "1"^^ . "0"^^ . . . . . . . . . . . . . . "<p>I wrote this piece of code to generate a pdf without external modules like (LUApdf).</p>\n<p>I have a problem because in my table I have three elements, yet at the time of creating my pdf when I open it I have only the first lines of my table that was encoded in the PDF.</p>\n<p>If you have a solution or an idea,</p>\n<p>Thanks</p>\n<pre><code>\nlocal patch = {\n {FID = 17, IDType = &quot;nothing&quot;, CID = &quot;nothing&quot;, Name = &quot;Mac Aura PXL 1&quot;, Mode = &quot;Standard&quot;, Uaddrs = 1.301},\n {FID = 18, IDType = &quot;something&quot;, CID = &quot;controller&quot;, Name = &quot;Spot Moving Head&quot;, Mode = &quot;Advanced&quot;, Uaddrs = 2.101},\n {FID = 19, IDType = &quot;example&quot;, CID = &quot;another&quot;, Name = &quot;Wash Light&quot;, Mode = &quot;Standard&quot;, Uaddrs = 3.401}\n}\n\n\nlocal function escape_pdf_string(str)\n return str:gsub(&quot;\\\\&quot;, &quot;\\\\\\\\&quot;):gsub(&quot;%(&quot;, &quot;\\\\(&quot;):gsub(&quot;%)&quot;, &quot;\\\\)&quot;)\nend\n\n\nlocal file = io.open(&quot;patch_corrected.pdf&quot;, &quot;wb&quot;)\n\n\nfile:write(&quot;%PDF-1.4\\n&quot;)\nfile:write(&quot;1 0 obj\\n&lt;&lt; /Type /Catalog /Pages 2 0 R &gt;&gt;\\nendobj\\n&quot;)\nfile:write(&quot;2 0 obj\\n&lt;&lt; /Type /Pages /Count 1 /Kids [3 0 R] &gt;&gt;\\nendobj\\n&quot;)\nfile:write(&quot;3 0 obj\\n&lt;&lt; /Type /Page /Parent 2 0 R /MediaBox [0 0 595 842] /Contents 4 0 R /Resources &lt;&lt; /Font &lt;&lt; /F1 5 0 R &gt;&gt; &gt;&gt; &gt;&gt;\\nendobj\\n&quot;)\n\n\nlocal content_stream = &quot;BT\\n/F1 12 Tf\\n&quot;\nlocal y_position = 800 \n\n\nfor index, element in ipairs(patch) do\n \n local line = string.format(&quot;FID: %d, IDType: %s, CID: %s, Name: %s, Mode: %s, Uaddrs: %.3f&quot;,\n element.FID, element.IDType, element.CID, element.Name, element.Mode, element.Uaddrs)\n line = escape_pdf_string(line) \n content_stream = content_stream .. string.format(&quot;50 %d Td\\n(%s) Tj\\n&quot;, y_position, line)\n y_position = y_position - 40 \n\ncontent_stream = content_stream .. &quot;ET\\n&quot;\n\nprint(&quot;Contenu complet de content_stream :\\n&quot; .. content_stream)\n\nfile:write(string.format(&quot;4 0 obj\\n&lt;&lt; /Length %d &gt;&gt;\\nstream\\n%s\\nendstream\\nendobj\\n&quot;, #content_stream, content_stream))\n\nfile:write(&quot;5 0 obj\\n&lt;&lt; /Type /Font /Subtype /Type1 /BaseFont /Helvetica &gt;&gt;\\nendobj\\n&quot;)\n\n\nfile:write(&quot;xref\\n&quot;)\nfile:write(&quot;0 6\\n&quot;)\nfile:write(&quot;0000000000 65535 f \\n&quot;)\nfile:write(&quot;0000000009 00000 n \\n&quot;)\nfile:write(&quot;0000000056 00000 n \\n&quot;)\nfile:write(&quot;0000000104 00000 n \\n&quot;)\nfile:write(string.format(&quot;%010d 00000 n \\n&quot;, 247))\nfile:write(string.format(&quot;%010d 00000 n \\n&quot;, 317))\n\n\nfile:write(&quot;trailer\\n&quot;)\nfile:write(&quot;&lt;&lt; /Root 1 0 R /Size 6 &gt;&gt;\\n&quot;)\nfile:write(&quot;startxref\\n394\\n&quot;)\nfile:write(&quot;%%EOF\\n&quot;)\n\nfile:close()\n\nprint(&quot;Le fichier PDF corrigé a été généré : patch_corrected.pdf&quot;)\n</code></pre>\n"^^ . "<p>I'm working with HAProxy and have generated Lua code from Protobuf files. These files are structured as follow in the <code>/etc/haproxy/lua</code> The HAproxy is compiled with LUA flag</p>\n<pre><code>tree\n.\n└── beeswax\n ├── adgroup\n │   ├── ghost_bidding_pb.lua\n │   └── vendor_fee_pb.lua\n ├── base\n │   └── eventid_pb.lua\n ├── bid\n │   ├── adcandidate_pb.lua\n │   └── request_pb.lua\n ├── currency\n │   └── currency_pb.lua\n └── openrtb\n ├── extension_pb.lua\n ├── openrtb_common_pb.lua\n ├── openrtb_pb.lua\n └── seat_constraints_pb.lua\n</code></pre>\n<p>For example, request_pb.lua has the following dependencies</p>\n<pre><code>local protobuf = require &quot;protobuf&quot;\nlocal beeswax/bid/adcandidate_pb = require(&quot;beeswax/bid/adcandidate_pb&quot;)\nlocal beeswax/openrtb/openrtb_pb = require(&quot;beeswax/openrtb/openrtb_pb&quot;)\nlocal beeswax/adgroup/ghost_bidding_pb = require(&quot;beeswax/adgroup/ghost_bidding_pb&quot;)\nmodule('beeswax/bid/request_pb')\n</code></pre>\n<p>I'm trying to load the <code>local request_pb = require(&quot;beeswax/bid/request_pb&quot;)</code> and parse the bid request but it's failing on dependencies resolution</p>\n<p>How can I correctly resolve the dependencies between my Protobuf-generated Lua files within the HAProxy environment?</p>\n"^^ . . "aerospike-ce"^^ . . "0"^^ . . . "0"^^ . . "How to load module using a variable with Lua in Openresty?"^^ . "0"^^ . "0"^^ . . . "1"^^ . . . . "0"^^ . "0"^^ . . "2"^^ . "1"^^ . . . "diagram"^^ . . . . . . . "0"^^ . "ecdh"^^ . "love2d"^^ . "<p>The Problem with thinking in terms of content flow is that a PDF cannot be written like one HTML page.</p>\n<p>A PDF is defined as a number of page medias either before or after first parse and thus before any second pass needed to use those numbers.</p>\n<p>We can decide that if there are 30 lines per page and we know we need to write 75 entries, then we will need to prepare 3 pages. It does not matter if blank or the same content or different content we MUST either know OR replace any estimate later (by total rewrite the catalogue of objects).</p>\n<p>Let use presume 3 the same from one page header style. Then we know at the start we only need to count for page 0, 1 &amp; 2 (ALL PDF writers internally start with Page 0 which a PDF Viewer will later display as Page 1).</p>\n<p><a href="https://i.sstatic.net/wiDVLTkY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wiDVLTkY.png" alt="enter image description here" /></a></p>\n<pre><code>%PDF-1.4\n1 0 obj &lt;&lt;/Type/Catalog/Pages 2 0 R&gt;&gt; endobj\n2 0 obj &lt;&lt;/Type/Pages/Count 3/Kids[4 0 R 5 0 R 6 0 R ]&gt;&gt; endobj\n3 0 obj &lt;&lt;/Type/Font/Subtype/Type1/BaseFont/Helvetica&gt;&gt; endobj\n4 0 obj &lt;&lt;/Type/Page/Parent 2 0 R/MediaBox[0 0 595 842]/Resources&lt;&lt;/Font&lt;&lt;/F0 3 0 R&gt;&gt;&gt;&gt;/Contents 7 0 R&gt;&gt; endobj\n5 0 obj &lt;&lt;/Type/Page/Parent 2 0 R/MediaBox[0 0 595 842]/Resources&lt;&lt;/Font&lt;&lt;/F0 3 0 R&gt;&gt;&gt;&gt;/Contents 7 0 R&gt;&gt; endobj\n6 0 obj &lt;&lt;/Type/Page/Parent 2 0 R/MediaBox[0 0 595 842]/Resources&lt;&lt;/Font&lt;&lt;/F0 3 0 R&gt;&gt;&gt;&gt;/Contents 7 0 R&gt;&gt; endobj\n7 0 obj &lt;&lt;/Length 8 0 R&gt;&gt;\nstream\nq 0 g\nBT /F0 12 Tf 1 0 0 1 20 820 Tm (Programmeur : LumiArt-Studio) Tj ET\n1 0 0 1 20 800 cm BT (Date : &quot; .. os.date \\(&quot;%d/%m/%Y %H:%M&quot;\\) .. &quot;) Tj ET\n1 0 0 1 0 -20 cm BT (Machine : Test Machine) Tj ET\n1 0 0 1 30 -100 cm BT (ID :) Tj ET\n1 0 0 1 100 0 cm BT (Type :) Tj ET\n1 0 0 1 100 0 cm BT (Name :) Tj ET\n1 0 0 1 100 0 cm BT (Fixture Type :) Tj ET\n1 0 0 1 100 0 cm BT (U.Address :) Tj ET\nQ\nendstream\nendobj\n8 0 obj 0548 endobj\nxref\n0 9\n0000000000 65536 f \n0000000009 00000 n \n0000000054 00000 n \n0000000118 00000 n \n0000000181 00000 n \n0000000293 00000 n \n0000000405 00000 n \n0000000517 00000 n \n0000000957 00000 n \ntrailer\n&lt;&lt;/Size 9/Root 1 0 R&gt;&gt;\nstartxref\n977\n%%EOF\n</code></pre>\n<p>If you need each page to show different entries like a page number of different font text and or images. Then you need a fresh object for each page and possibly their resources if different.</p>\n<p>If you need to write the pages last we can append a replacement line for the first estimated one. This is usually done either as an incremental addition or allowed for in build by index the &quot;only&quot; entry with a higher address in the Xref index.</p>\n<p>thus a late object 2 entry could be like this</p>\n<pre><code>2 0 obj &lt;&lt;/Type/Pages/Count 4/Kids[4 0 R 5 0 R 6 0 R 13 0 R]&gt;&gt; endobj\nxref\n0 15\n0000000000 65536 f \n0000000009 00000 n \n0000025168 00000 n \n0000000054 00000 n \n</code></pre>\n"^^ . . . . . . . "0"^^ . "0"^^ . "my current Neovim version is v0.10.4"^^ . . . . "1"^^ . "0"^^ . . . . . . "<p>The issue is that when I script a camera to move in 1 direction, all the parts get deleted for no reason. It's not a visual bug, I saw my explorer and Workspace was empty. No errors in Output, and this only happens when my camera is scriptable. I had this issue for months, maybe even years. Why is that and how could I fix it?</p>\n<p>Edit: Forgot to say, it only happens in client, while in server everything is there.</p>\n"^^ . . . . . . . "I assumed that the keymap may exists, so i prefer to unset it or just set it using `vim.keymap.set` api, and if you just need to safely remove some present keymap, \nyou find the `keynode` using `vim.api.nvim_get_keymap` make a function to pass the key and to run a loop over the nodes, if `map.lhs == key` then remove it, to solve this problem."^^ . . . . . . . . . . . . "2"^^ . "1"^^ . "This is not quite what I am looking for. Nevermind."^^ . . . "<p>I'm using the envoyfilter to read requests and make some decisions. I'm interested to log how long the script took to run.\nI normally use prometheus metrics for my other services. I see that istio publishes its metrics via /stats/prometheus endpoint. Is it possible to publish some to the same endpoint? Or is there any other way I can achieve this usecase?</p>\n"^^ . . . "1"^^ . "0"^^ . . "0"^^ . "<p>The native button has some limitations regarding the background color. See the BGCOLOR attribute documentation:</p>\n<blockquote>\n<p>BGCOLOR: Background color. If text and image are not defined, the\nbutton is configured to simply show a color, in this case set the\nbutton size because the natural size will be very small. In Windows\nand in GTK 3, the BGCOLOR attribute is ignored if text or image is\ndefined.</p>\n</blockquote>\n"^^ . . . "2"^^ . . . . . . . "istio-sidecar"^^ . "1"^^ . "5"^^ . "krakend"^^ . "1"^^ . "1"^^ . "0"^^ . . "0"^^ . . . . . "Have you tried clearing the cache in `~/.cache/jdtls`? Have you confirmed that your workspace directories are valid? Just some ideas that will hopefully help"^^ . . . "1"^^ . "0"^^ . . . "Two unpacks into one table doesn't work in lua"^^ . "0"^^ . "lua string pattern matching - using specific words as char-sets"^^ . . "0"^^ . . . . . . . . . "<p>From the snippet you have provided, it seems like your code does not even run properly since there are errors like:</p>\n<p>Typos in variable:</p>\n<pre><code>secconds = 59\n</code></pre>\n<p>Lua does not have operator +=. Instead use:</p>\n<pre><code>seconds = seconds + 1\n</code></pre>\n<p>There might be another problem. When you search for money.</p>\n<pre><code>leaderstats:FindFirstChild(&quot;Effect\n</code></pre>\n<p>It returns reference to object. When you want to change the object you have to access its property or method.</p>\n<p>I have never programmed anything in roblox, but i have found in documentation reference to text label. It contains property named &quot;ContentText&quot;, what means you can change money by doing this: <code>money.ContentText = &quot;money value&quot;</code></p>\n<p><a href="https://create.roblox.com/docs/reference/engine/classes/TextLabel" rel="nofollow noreferrer">Link to documentation</a></p>\n"^^ . . "Don't link to external sources. Have you read this : [Struct containing std::string being passed to lua](https://stackoverflow.com/questions/3771784/struct-containing-stdstring-being-passed-to-lua), since I think that's your main issue"^^ . . "@dalija Prasnikar why the answer was deleted,?"^^ . "<p>I want to make a neovim plugin but my plugin need to be able to copy the whole vim api, do some changes to it and roll back later</p>\n<pre class="lang-lua prettyprint-override"><code>backup = vim\n-- do some stuff with `vim`\nvim = backup\n</code></pre>\n<p>I tried to do it like written above</p>\n<pre class="lang-none prettyprint-override"><code>lua vim.o.number = true\nlua backup = vim\nlua vim.o.number = false\nlua vim = backup\n</code></pre>\n<p>but the line numbers didn't reappear once I tried to resign <code>vim = backup</code></p>\n<p>I also tried to do</p>\n<pre class="lang-lua prettyprint-override"><code>backup = vim.deepcopy(vim)\n</code></pre>\n<p>but it got worst as this time I got an error\n<code>E5108: Error executing lua vim/shared.lua:0: Cannot deepcopy object of type userdata</code></p>\n<p>I also tried to read the <a href="https://neovim.io/doc/" rel="nofollow noreferrer">neovim documentation</a> but didn't found the information</p>\n<p>Because of what I want to do, I have to be able to store a copy of it and to be able to roll back to this copy, and I need to do it multiple times</p>\n"^^ . . . "<p>Turns out the animation was built with R15 and I had set the game to only R6 and due to the different body parts between the two types, the game couldn't play the R15 animation on the R6 body.</p>\n<p>A misconception I had was R6 means the character is blocky and R15 means the character is not blocky. However it's only the body parts that are different.</p>\n<p><img src="https://i.sstatic.net/IYr8SXQW.png" alt="R6 VS R15 Picture On Blocky Character" /></p>\n"^^ . . . . "0"^^ . . . . "1"^^ . "1"^^ . "1"^^ . "1"^^ . . "0"^^ . "1"^^ . "2"^^ . . . "<p>From the Lua <a href="https://www.lua.org/pil/5.1.html" rel="noreferrer">documentation</a> on multiple results:</p>\n<blockquote>\n<p>Lua always adjusts the number of results from a function to the circumstances of the call. When we call a function as a statement, Lua discards all of its results. When we use a call as an expression, Lua keeps only the first result. <strong>We get all results only when the call is the last (or the only) expression in a list of expressions.</strong></p>\n</blockquote>\n<p>So <code>table.unpack(a), table.unpack(b)</code> doesn't concatenate all return values from both calls. You get the first return value of <code>table.unpack(a)</code>, followed by all return values of <code>table.unpack(b)</code>.</p>\n"^^ . "0"^^ . . "0"^^ . . . "0"^^ . . . "0"^^ . . . . "@ggg123 Can you clarify the question then?"^^ . . . . . . . . "1"^^ . "neovim-plugin"^^ . "<p>I had the same problem try disabling StreamingEnabled from Worksapce that worked for me.</p>\n<p>Edit: You can also put your cameras in ReplicatedFirst so don't gets deleted.</p>\n<p><a href="https://i.sstatic.net/WqQysqwX.png" rel="nofollow noreferrer">Example</a></p>\n<p><a href="https://devforum.roblox.com/t/issue-with-parts-disappearing-in-studio/2478353" rel="nofollow noreferrer">https://devforum.roblox.com/t/issue-with-parts-disappearing-in-studio/2478353</a></p>\n"^^ . . . "<p>I think they are not applying because of the default behavior in some Neovim configurations.</p>\n<pre class="lang-lua prettyprint-override"><code>-- first unset it,\nvim.keymap.del('i', '&lt;C-h&gt;', '&lt;Left&gt;')\n...\n\n-- and then set it\nvim.keymap.set('i', '&lt;C-h&gt;', '&lt;Left&gt;')\n...\n\n</code></pre>\n<p>So, the use of <code>vim.keymap.set</code> is preferable for your configuration.\nIf, the issue resides, let me know.</p>\n"^^ . "3"^^ . . . . . . . "2"^^ . "1"^^ . "lua-resty-openidc"^^ . . "1"^^ . . . . "0"^^ . "IUPLUA Putting Elements into the .gridbox with table.unpack doesn't work"^^ . . . "1"^^ . . . "<p>Standard input is FD 0, not FD 1, so do <code>uv.new_poll(0)</code> instead of <code>uv.new_poll(1)</code>. The reason it worked when you pressed Enter manually instead of piping into it is that with no pipes, all of the standard FDs are the TTY opened in read-write mode.</p>\n"^^ . . "Are you using a retina monitor? If you call `getMode` right after `setMode`, is the resolution also `1536x864`?"^^ . "1"^^ . . . . . . "0"^^ . . . "<p>The code is mostly working, I just added:</p>\n<pre><code>require(&quot;iupluaim&quot;)\n</code></pre>\n<p>So I believe you don have all the dependancies. <code>IUP</code> is not enough, you need <a href="https://sourceforge.net/projects/imtoolkit/files/3.15/" rel="nofollow noreferrer">the IM library</a>.</p>\n<p>You will need to link against:</p>\n<ul>\n<li>The library IM itself, at least libim.a and libz.a</li>\n<li>The Lua wrapper, for example libimlua54.a</li>\n</ul>\n<p>Obviously, on the C side, <a href="https://www.tecgraf.puc-rio.br/iup/en/iupim.html" rel="nofollow noreferrer">iupimlua_open</a> need to be called somewhere.</p>\n"^^ . . . "0"^^ . "0"^^ . . . . . . "0"^^ . "4"^^ . . "0"^^ . . . . . . . . "Index lua table with table"^^ . "0"^^ . . . "1"^^ . . . "0"^^ . . . "<p>In Lua, I can define a member function like this:</p>\n<pre><code>Foo = {}\n\nfunction Foo:bar()\n ...\nend\n</code></pre>\n<p>I realise this is just syntactic sugar for this:</p>\n<pre><code>Foo = {}\n\nfoo.bar = function(self)\n ...\nend\n</code></pre>\n<p>Is there a way to write an anonymous function with an implicit <code>self</code> parameter or do I always have to spell out the <code>self</code> parameter on anonymous functions?</p>\n<p>The motivation is to create coroutine member functions in a way most analogous to ordinary functions. I can do this:</p>\n<pre><code>Foo.bar = coroutine.wrap(function(self) ... end)\n</code></pre>\n<p>Or this:</p>\n<pre><code>function Foo:bar() ... end\n\nFoo.bar = coroutine.wrap(Foo.bar)\n</code></pre>\n<p>But is there a way to do a one-line declaration with an implicit <code>self</code> parameter?</p>\n"^^ . "0"^^ . . . "2"^^ . "pdf"^^ . . . . . "1"^^ . . "1"^^ . . . . . "<p>Usually, weird physics bugs tend to be caused by <a href="https://devforum.roblox.com/t/network-ownership-for-beginners-how-to-handle-physics-on-the-client/947029" rel="nofollow noreferrer">network ownership</a> issues.</p>\n<p>The server is source of truth for all objects, their positions, properties, everything. However, you are deleting objects on the client and trying to run the resulting physics sim. The client is trying to move objects around but the server (which has no idea that these changes have happened because client changes are not replicated to the server) is insisting that these objects haven't moved.</p>\n<p>So to fix this issue, you need to either :</p>\n<ul>\n<li>a) Create the objects you plan to destroy in LocalScripts, or</li>\n<li>b) Use RemoteEvents to destroy the objects on the server.</li>\n</ul>\n<p>I'll explain Option B. So you'll to...</p>\n<ol>\n<li>Create a RemoteEvent in ReplicatedStorage, and name it something like <code>ShootEvent</code></li>\n<li>Create a Script in ServerScriptService</li>\n<li>Move all of your bullet logic into the Script</li>\n<li>Have your LocalScript fire the RemoteEvent instead</li>\n<li>Connect your Script to the RemoteEvent to spawn the bullet the client fires the event.</li>\n</ol>\n<p>So in your LocalScript...</p>\n<pre class="lang-lua prettyprint-override"><code>local player = game.Players.LocalPlayer\nlocal mouse = player:GetMouse()\nlocal gui = player.PlayerGui:WaitForChild(&quot;GameGui&quot;) \nlocal shootEvent = game.ReplicatedStorage.ShootEvent\nlocal targetImage = gui:WaitForChild(&quot;Target&quot;) \nlocal shootCooldown = 1 \nlocal lastShootTime = 0\n\n\ntargetImage.Visible = false\n\n-- listen for mouse clicks\nmouse.Button1Down:Connect(function()\n -- escape if we're on cooldown\n local currentTime = tick()\n if currentTime - lastShootTime &lt; shootCooldown then\n return \n end\n\n -- update the ui\n targetImage.Visible = true\n task.delay(0.3, function()\n targetImage.Visible = false\n end)\n\n -- figure out what we're aiming at\n local mousePosition = Vector2.new(mouse.X, mouse.Y)\n targetImage.Position = UDim2.new(0, mousePosition.X - (targetImage.Size.X.Offset / 2), 0, mousePosition.Y - (targetImage.Size.Y.Offset / 2))\n \n\n local ray = workspace.CurrentCamera:ScreenPointToRay(mouse.X, mouse.Y)\n local rayTarget = ray.Origin + ray.Direction * 500\n local raycastParams = RaycastParams.new()\n raycastParams.FilterDescendantsInstances = {player.Character} \n raycastParams.FilterType = Enum.RaycastFilterType.Blacklist\n local raycastResult = workspace:Raycast(ray.Origin, ray.Direction * 500, raycastParams)\n if raycastResult then\n rayTarget = raycastResult.Position \n end\n\n -- play an animation\n local humanoid = character:FindFirstChild(&quot;Humanoid&quot;)\n local shootAnim = character:FindFirstChild(&quot;Animations&quot;):FindFirstChild(&quot;Shoot&quot;)\n\n if humanoid and shootAnim and shootAnim:IsA(&quot;Animation&quot;) then\n local loadedAnim = humanoid:LoadAnimation(shootAnim)\n loadedAnim.Priority = Enum.AnimationPriority.Action3\n loadedAnim:Play()\n else\n warn(&quot;Humanoid or Shoot animation not found!&quot;)\n end\n\n -- tell the server to fire the bullet\n shootEvent:FireServer(rayTarget)\n\n -- reset the debounce/cooldown\n lastShootTime = currentTime\nend)\n</code></pre>\n<p>Then in your server Script...</p>\n<pre class="lang-lua prettyprint-override"><code>local bulletSpeed = 70 \nlocal damageAmount = 25 \n\nlocal function unanchorBreakableParts()\n local breakableFolder = workspace:WaitForChild(&quot;Breakable&quot;)\n for _, part in pairs(breakableFolder:GetChildren()) do\n if part:IsA(&quot;Part&quot;) then\n part.Anchored = false \n end\n end\nend\n\n\nlocal function fireBullet(startPosition, targetPosition)\n -- create the bullet\n local bullet = Instance.new(&quot;Part&quot;)\n bullet.Size = Vector3.new(1, 0.5, 0.5) \n bullet.Material = Enum.Material.Neon\n bullet.BrickColor = BrickColor.new(&quot;Bright yellow&quot;) \n bullet.Position = startPosition\n bullet.Anchored = false\n bullet.CanCollide = false\n bullet.Parent = workspace\n\n local direction = (targetPosition - startPosition).unit\n bullet.CFrame = CFrame.lookAt(startPosition, startPosition + direction)\n\n -- make the bullet move\n local bodyVelocity = Instance.new(&quot;BodyVelocity&quot;)\n bodyVelocity.Velocity = direction * bulletSpeed\n bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge) \n bodyVelocity.Parent = bullet\n\n -- listen for when the bullet hits things\n local connection\n connection = bullet.Touched:Connect(function(hit)\n if hit and hit.Parent and hit.Parent:FindFirstChild(&quot;Humanoid&quot;) then\n local humanoid = hit.Parent:FindFirstChild(&quot;Humanoid&quot;)\n local character = player.Character\n if humanoid.Parent ~= character then\n humanoid:TakeDamage(damageAmount)\n end\n\n elseif hit and hit.Parent and hit:FindFirstChild(&quot;Health&quot;) then\n local health = hit:FindFirstChild(&quot;Health&quot;)\n if health then\n health.Value = health.Value - damageAmount \n if health.Value &lt;= 0 then\n hit:Destroy() \n end\n end\n end\n\n bullet:Destroy()\n connection:Disconnect()\n end)\n\n -- mark the bullet for cleanup\n game:GetService(&quot;Debris&quot;):AddItem(bullet, 5)\nend\n\n\n \n-- listen for when the client says they've fired a bullet\ngame.ReplicatedStorage.ShootEvent.OnServerEvent:Connect(function(player : Player, rayTarget : Vector3)\n local character = player.Character or player.CharacterAdded:Wait()\n local rightArm = character:FindFirstChild(&quot;ShootPart&quot;)\n local startPosition = rightArm.Position\n\n fireBullet(startPosition, rayTarget)\nend)\n</code></pre>\n<p>Hope this helps!</p>\n"^^ . "<p>To trigger a client event from the server, you need to use the player server ID, not his identifier.</p>\n<p>Also, you should “save” the source value because it can change during the event handler execution. For that, just make a new variable with that value (local _source = source) and use the new variable.</p>\n<pre class="lang-lua prettyprint-override"><code>RegisterNetEvent('ch_nui:kok')\nAddEventHandler('ch_nui:kok',function ()\n local _source = source\n print('2')\n local identifier = GetPlayerIdentifierByType(source,'license')\n TriggerClientEvent('ch_nui:bob',_source)\nend)\n</code></pre>\n<p>Here is the shortest way of doing it:</p>\n<pre class="lang-lua prettyprint-override"><code>RegisterNetEvent('ch_nui:kok',function ()\n TriggerClientEvent('ch_nui:bob', source)\nend)\n</code></pre>\n"^^ . "This works, thank you!"^^ . "Animation script Roblox Studio"^^ . . . "0"^^ . "1"^^ . . . . "0"^^ . "0"^^ . "3"^^ . "drawable"^^ . "1"^^ . "0"^^ . . . . "<p>You are trying to use regular expression instead of a Lua pattern with <code>gmatch</code>, which is a problem. Just FYI:</p>\n<ul>\n<li><code>.*?</code> - is a non-greedy pattern that looks like (almost) <code>.-</code> in Lua patterns (the difference is that <code>.</code> in Lua matches ALL characters including newline and carriage returns, while in regex, it needs specific option to enable matching line breaks)</li>\n<li><code>\\s</code> - a whitespace matching pattern looks like <code>%s</code> in Lus patterns</li>\n<li><code>{1,}</code> - one or more repetition must be written as <code>+</code> in Lua patterns, as limiting quantifiers are not supported.</li>\n</ul>\n<p>You can use</p>\n<pre class="lang-lua prettyprint-override"><code>&quot;(.-)&quot;%s+-%s\n</code></pre>\n<p><strong>NOTE</strong>: I removed the last <code>(.*)</code> because you only need the part in between the double quotes, <em>and</em> the <code>.*</code> will simply capture all text after the first double quoted substring.</p>\n<p><strong>Details</strong></p>\n<ul>\n<li><code>&quot;</code> - a <code>&quot;</code> char</li>\n<li><code>(.-)</code> - Capturing group 1: any zero or more chars (including line break chars), as few as possible</li>\n<li><code>&quot;</code> - a <code>&quot;</code> char</li>\n<li><code>%s+</code> - one or more whitespace chars</li>\n<li><code>-</code> - a hyphen</li>\n<li><code>%s</code> - a whitespace char.</li>\n</ul>\n<p>See the online <a href="https://ideone.com/OiOcH8" rel="nofollow noreferrer">Lua demo</a>:</p>\n<pre class="lang-lua prettyprint-override"><code>local s = [[Available configure presets:\n \n &quot;x64-debug&quot; - x64 Debug\n &quot;x64-release&quot; - x64 Release\n &quot;x86-debug&quot; - x86 Debug\n &quot;x86-release&quot; - x86 Release]]\n \nfor word in string.gmatch(s, [[&quot;(.-)&quot;%s+-%s]]) do\n print(word) \nend\n</code></pre>\n<p>Output:</p>\n<pre class="lang-none prettyprint-override"><code>x64-debug\nx64-release\nx86-debug\nx86-release\n</code></pre>\n<p>Now, <strong>if you need the part after <code>-</code></strong>, you can simply match any chars as few as possible till the newline after appending a newline to your input string:</p>\n<pre class="lang-lua prettyprint-override"><code>for word1,word2 in string.gmatch(s .. string.char(10), [[&quot;(.-)&quot;%s+-%s(.-)]] .. string.char(10)) do\n print(word1 .. &quot; &lt;&gt; &quot; .. word2)\nend\n</code></pre>\n<p>See <a href="https://ideone.com/8qibdq" rel="nofollow noreferrer">this Lua demo</a>:</p>\n<pre class="lang-lua prettyprint-override"><code>local s = [[Available configure presets:\n\n &quot;x64-debug&quot; - x64 Debug\n &quot;x64-release&quot; - x64 Release\n &quot;x86-debug&quot; - x86 Debug\n &quot;x86-release&quot; - x86 Release]]\n \nfor word1,word2 in string.gmatch(s .. string.char(10), [[&quot;(.-)&quot;%s+-%s(.-)]] .. string.char(10)) do\n print(word1 .. &quot; &lt;&gt; &quot; .. word2)\nend\n</code></pre>\n<p>Output:</p>\n<pre><code>x64-debug &lt;&gt; x64 Debug\nx64-release &lt;&gt; x64 Release\nx86-debug &lt;&gt; x86 Debug\nx86-release &lt;&gt; x86 Release\n</code></pre>\n"^^ . "table.insert not replacing the first nil position in the table"^^ . . . . "<p>I'm developing a Lua script to generate a multi-page PDF file containing tabular data. My script generates the PDF correctly and the logs show that all the pages are created correctly. However, when I open the PDF file, one of the pages (page 2) is not displayed. The content goes directly from page 1 to page 3.</p>\n<p>What I tried:\nChecked the script logs: everything indicates that page 2 has been generated and included.\nValidated the structure of PDF objects in the file: all objects (pages, references, xref) seem to be in place.\nChecked cross-reference structure (xref) and /Kids entries for page tree.</p>\n<p>local function creerPDF(fichierPDF, data)</p>\n<pre><code>local fichier = assert(io.open(fichierPDF, &quot;w&quot;))\nfichier:write(&quot;%PDF-1.4\\n&quot;)\n\nlocal pages = {}\nlocal kids = {}\nlocal positionY = 700\nlocal lignesParPage = 30\n\n\nlocal function nouvellePage()\n local pageObj = #pages * 2 + 3\n local contentObj = pageObj + 1\n table.insert(kids, pageObj .. &quot; 0 R&quot;)\n table.insert(pages, {page = pageObj, content = contentObj, stream = &quot;&quot;})\n positionY = 700\nend\n\n\nlocal function ajouterEnTete(page)\n local header = &quot;q\\n&quot;\n header = header .. &quot;BT /F1 12 Tf 20 820 Td (Programmeur : LumiArt-Studio) Tj ET\\n&quot;\n header = header .. &quot;BT /F1 12 Tf 20 800 Td (Date : &quot; .. os.date(&quot;%d/%m/%Y %H:%M&quot;) .. &quot;) Tj ET\\n&quot;\n header = header .. &quot;BT /F1 12 Tf 20 780 Td (Machine : TestMachine) Tj ET\\n&quot;\n header = header .. &quot;BT /F1 12 Tf 50 720 Td (ID) Tj ET\\n&quot;\n header = header .. &quot;BT /F1 12 Tf 150 720 Td (Type) Tj ET\\n&quot;\n header = header .. &quot;BT /F1 12 Tf 250 720 Td (Name) Tj ET\\n&quot;\n header = header .. &quot;BT /F1 12 Tf 350 720 Td (FixtureType) Tj ET\\n&quot;\n header = header .. &quot;BT /F1 12 Tf 450 720 Td (U.Addrs) Tj ET\\n&quot;\n header = header .. &quot;Q\\n&quot;\n page.stream = page.stream .. header\nend\n\n\nlocal function ajouterDonnee(page, ligne)\n local columnPositions = {50, 150, 250, 350, 450}\n local values = {ligne.id, ligne.idtype, ligne.name, ligne.fixturetype, ligne.uaddrs}\n for i, value in ipairs(values) do\n page.stream = page.stream .. string.format(&quot;BT /F1 10 Tf %d %d Td (%s) Tj ET\\n&quot;, columnPositions[i], positionY, tostring(value))\n end\n positionY = positionY - 20\n if positionY &lt; 100 then\n nouvellePage()\n ajouterEnTete(pages[#pages])\n end\nend\n\n\nlocal function ajouterPiedDePage(page, index, total)\n local footer = string.format(&quot;BT /F1 10 Tf 500 20 Td (Page %d sur %d) Tj ET\\n&quot;, index, total)\n page.stream = page.stream .. footer\nend\n\n\nnouvellePage()\najouterEnTete(pages[#pages])\nfor _, ligne in ipairs(data) do\n ajouterDonnee(pages[#pages], ligne)\nend\n\n\nlocal totalPages = #pages\nfor i, page in ipairs(pages) do\n ajouterPiedDePage(page, i, totalPages)\nend\n\n\nfor _, page in ipairs(pages) do\n fichier:write(string.format(&quot;%d 0 obj\\n&lt;&lt; /Type /Page /Parent 2 0 R /MediaBox [0 0 595 842] /Resources &lt;&lt; /Font &lt;&lt; /F1 5 0 R &gt;&gt; &gt;&gt; /Contents %d 0 R &gt;&gt;\\nendobj\\n&quot;, page.page, page.content))\n fichier:write(string.format(&quot;%d 0 obj\\n&lt;&lt; /Length %d &gt;&gt;\\nstream\\n%s\\nendstream\\nendobj\\n&quot;, page.content, #page.stream, page.stream))\nend\n\n\nfichier:write(&quot;2 0 obj\\n&lt;&lt; /Type /Pages /Kids [&quot;)\nfor _, kid in ipairs(kids) do\n fichier:write(kid .. &quot; &quot;)\nend\nfichier:write(string.format(&quot;] /Count %d &gt;&gt;\\nendobj\\n&quot;, #kids))\n\n\nfichier:write(&quot;1 0 obj\\n&lt;&lt; /Type /Catalog /Pages 2 0 R &gt;&gt;\\nendobj\\n&quot;)\n\n\nfichier:write(&quot;5 0 obj\\n&lt;&lt; /Type /Font /Subtype /Type1 /BaseFont /Helvetica &gt;&gt;\\nendobj\\n&quot;)\n\n\nlocal xrefStart = fichier:seek()\nfichier:write(&quot;xref\\n0 &quot; .. (#kids * 2 + 6) .. &quot;\\n0000000000 65535 f \\n&quot;)\nlocal offset = 9\nfor i = 1, (#kids * 2 + 4) do\n fichier:write(string.format(&quot;%010d 00000 n \\n&quot;, offset))\n offset = fichier:seek()\nend\n\n\nfichier:write(string.format(&quot;trailer\\n&lt;&lt; /Size %d /Root 1 0 R &gt;&gt;\\nstartxref\\n%d\\n%%EOF\\n&quot;, (#kids * 2 + 6), xrefStart))\n\nfichier:close()\n</code></pre>\n<p>end</p>\n<p>local data = {}\nfor i = 1, 200 do\ntable.insert(data, {id = i, idtype = &quot;Fixture&quot;, name = &quot;Fixture &quot; .. i, fixturetype = &quot;Type &quot; .. i, uaddrs = tostring(i * 100)})\nend</p>\n<p>creerPDF(&quot;output_debug_fixed.pdf&quot;, data)</p>\n"^^ . . "0"^^ . . . . "1"^^ . . . "I suspect it has to do with how you're actually using the script. Your script registers an event handler. The only way for it to repeat the message is if somehow after each message the event handler is registered again. So the question is, how do you actually register this entire script in WoW?"^^ . "Error calling a C# generic method from Lua script with NLua"^^ . . "visual-studio-debugging"^^ . "1"^^ . "0"^^ . "5"^^ . . . . . "<p>I'm trying to change the color of a button, which doesn't seem to work, aswell as adding an Image.\nFor the Image:\nI tried doing it with the IUPweb browser so it could load the image, it worked, however I dont really like that it still got the sidebar etc. so that's no option.\nAlso tried iup.LoadImage but it didn't work for me either.\nI preferebly use the iamges with links, however if there's no other option I can use Image Files also</p>\n<pre><code>require(&quot;iuplua&quot;)\n\nlocal screenWidth, screenHeight = 1920, 1080\nlocal windowWidth = screenWidth * 0.4\nlocal windowHeight = screenHeight * 0.3\n\nlocal Data = {\n [&quot;Industrialist&quot;] = {\n Image = &quot;https://letsenhance.io/static/8f5e523ee6b2479e26ecc91b9c25261e/1015f/MainAfter.jpg&quot;,\n ID = &quot;9192423027&quot;\n },\n [&quot;Engineer&quot;] = {\n Image = &quot;https://letsenhance.io/static/8f5e523ee6b2479e26ecc91b9c25261e/1015f/MainAfter.jpg&quot;,\n ID = &quot;9192423027&quot;\n },\n [&quot;Scientist&quot;] = {\n Image = &quot;https://letsenhance.io/static/8f5e523ee6b2479e26ecc91b9c25261e/1015f/MainAfter.jpg&quot;,\n ID = &quot;9192423027&quot;\n },\n}\n\nlocal Instances = {}\n\nfunction createInstance(Title, Data)\n local label = iup.label{\n title = Title,\n alignment = &quot;ACENTER&quot;,\n valign = &quot;TOP&quot;, \n halign = &quot;CENTER&quot;,\n fgcolor = &quot;255 255 255&quot;\n }\n \n local button = iup.button{\n title = &quot;Open&quot;,\n bgcolor = &quot;2 183 87&quot;,--&quot;#02b757&quot;\n alignment = &quot;ACENTER&quot;,\n size = &quot;100x30&quot;,\n action = function()\n local link = &quot;roblox://placeId=&quot; .. Data.ID\n os.execute('start &quot;&quot; &quot;' .. link .. '&quot;')\n end\n }\n \n local Image = iup.label{image = iup.LoadImage(&quot;Images/Industrialist.png&quot;)}\n --THIS DID NOT WORK\n \n -- Creating the container for the components\n local container = iup.vbox{\n label,\n Image,\n button,\n alignment = &quot;ACENTER&quot;,\n valign = &quot;CENTER&quot;,\n halign = &quot;CENTER&quot;,\n size = &quot;150x200&quot;,\n expand = &quot;YES&quot;\n }\n \n return container\nend\n\nfor i, v in pairs(Data) do\n table.insert(Instances, createInstance(i, v))\nend\n\nlocal gridBox = iup.gridbox{\n orientation = &quot;HORIZONTAL&quot;,\n numdiv = 3,\n alignment = &quot;ACENTER&quot;,\n expand = &quot;YES&quot;,\n table.unpack(Instances)\n}\n\nlocal dlg = iup.dialog{\n gridBox,\n title = &quot;Alchemister&quot;,\n size = windowWidth..&quot;x&quot;..windowHeight,\n bgcolor = &quot;17 18 22&quot;,\n resize = &quot;YES&quot;\n}\n\ndlg:show()\n\niup.MainLoop()\n\n</code></pre>\n"^^ . "Thanks a lot. It really solved my problem."^^ . "istio"^^ . . . . . "0"^^ . "Problem with a missing page when generating a PDF in Lua"^^ . . "<p>I am trying to implement getting the full path of the file on the cursor in the buffer of any file manager plugin. This is easy if you use a specific file manager API.<br />\nAs an example, in Netrw it would look like:</p>\n<pre class="lang-lua prettyprint-override"><code>local path = netrw_call('NetrwFile', vim.fn['netrw#Call']('NetrwGetWord'))\n</code></pre>\n<p>And in Oil.nvim, it would look like:</p>\n<pre class="lang-lua prettyprint-override"><code>local oil = require('oil')\nlocal path = oil.get_current_dir() .. oil.get_cursor_entry().name\n</code></pre>\n<p>While working on this implementation, I noticed that if you hover over a file displayed by Netrw or Oil.nvim and type the gx command, you can open that file with the system's default handler, independent of the location of the current directory.<br />\nSo I was curious if there might be a way to obtain the full path of a file without relying on a specific API as described above.</p>\n<p>After much research, I found the command <code>vim.fn.expand(&quot;%:p:h&quot;)</code>, but this did not work. As a test, I used Oil.nvim to open a specific directory on Windows (say <code>C:\\Windows</code>) and ran this command and got the following result:</p>\n<pre class="lang-lua prettyprint-override"><code>oil:///C/Windows\n</code></pre>\n<p>This differs from the result of executing a similar command on a regular buffer:</p>\n<pre class="lang-lua prettyprint-override"><code>C:\\Windows\n</code></pre>\n<p>I think I can implement it by handling exceptions, but I'm wondering if there might be a more efficient method.<br />\nIf anyone knows of a better method, I would be very grateful to hear it.</p>\n"^^ . . . "<p>The solution is to extract configuration files dependant code out of the init function and to initialize the fields member as depicted in the question below.\n<a href="https://stackoverflow.com/questions/75379622/how-to-add-an-array-of-fields-as-a-protofield-in-lua-dissector">How to add an array of fields as a ProtoField in Lua Dissector</a></p>\n"^^ . "how to implement the event loop in copas and how does it work?"^^ . . . . "1"^^ . . . . "contact-center"^^ . . . . . "oop"^^ . "mysql"^^ . "2"^^ . "<p>I am trying to build <a href="https://github.com/rochus-keller/Simula" rel="nofollow noreferrer">Simula67 parser</a>, in QT 5.14.2 in the Qt Creator. It depends on <a href="https://github.com/rochus-keller/LjTools" rel="nofollow noreferrer">LjTools</a>, and <a href="https://luajit.org/" rel="nofollow noreferrer">luajit</a>, I am using LuaJIT 2.0, running Kubuntu 22. I did have to modify LjTools and Simula to make them work in my exact setup.\nMy working directory is set up like this, in my home directory, in a directory called Simula67. I've already built LjTools without error, only warnings.</p>\n<pre><code>GuiTools LjTools Simula\n</code></pre>\n<p>I commented out the</p>\n<pre><code>include( ../LuaJIT/src/LuaJit.pri ){\n Libs += -ldl\n} else {\n LIBS += -lluajit\n}\n</code></pre>\n<p>and used the built in Qt library importer to import the external library libluajit.so</p>\n<pre><code>win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../LuaJIT-2.0/src/release/ -lluajit\nelse:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../LuaJIT-2.0/src/debug/ -lluajit\nelse:unix: LIBS += -L$$PWD/../../LuaJIT-2.0/src/ -lluajit\n\nINCLUDEPATH += $$PWD/../../LuaJIT-2.0/src\nDEPENDPATH += $$PWD/../../LuaJIT-2.0/src\n</code></pre>\n<p>In SimLjEditor.pro (from Simula) as well as the LjAsmEditor.pro and LjBcViewer.pro (from LjTools)</p>\n<p>Here is my error message:</p>\n<pre><code>/home/alex/Simula67/Simula/SimLjEditor.cpp:362: error: ‘isPacked’ is not a member of ‘Lua::JitComposer’\n 362 | if( Lua::JitComposer::isPacked(lnr) )\n | ^~~~~~~~\n</code></pre>\n<p>My interpretation of it is that isPacked isn't a thing in JitComposer, but I don't know what to do about it. I've searched this error before but I only get a few results relating to people having trouble with Lua in Roblox studio. I don't know much Lua at all, so I have no way of knowing how to tell if a quint32 is packed. If anybody knows of any other Simula parsers or way to run Simula67 I would love to know, I really want to try the 1st object oriented programming language but I don't have an IBM System/360, or the software for it.</p>\n"^^ . "0"^^ . . . . . "monogame"^^ . "1"^^ . . . "0"^^ . "I think it might be something like a [hypergeometric distribution](https://en.wikipedia.org/wiki/Hypergeometric_distribution), but I'm not very familiar with it."^^ . "please provide code section as a text not as an image"^^ . . . . . . "1"^^ . . . . "0"^^ . . . "0"^^ . "1"^^ . . "1"^^ . "0"^^ . "<p>Trying to make an engine that calls other language from lua code. And the problem that I stuck into is callbacks.\nConverting strings, ints and so on is easy, but what to do with functions?\nLua API has lua_isfunction to check that function argument is function, but how do I store it to call it later when called script needs it? There is lua_topointer, that can store function, but I don't see how to call that stored pointer.</p>\n"^^ . "1"^^ . "redis"^^ . "Can Lua define anonymous member functions?"^^ . . . . "Roblox: Function not looping or adding to the "money" value"^^ . . . . . . . . "1"^^ . . . "1"^^ . "3"^^ . . . "Any way to combine two tables in lua?"^^ . "1"^^ . . . "protocols"^^ . . "0"^^ . "freeswitch"^^ . . . . "0"^^ . . . "I am still confused after reading your update, I have 2 questions. **1** Is the algorithm for `prob` and `sum` in the `generateSlotIndex` function the result you expected? If not, please tell us what the original parking condition is. **2** What do the numbers in the diagram (the 2 nums of red and the bottom of blue) mean? I tested this function and for the case of 10/20, the result showed that the slot index of the first car should not exceed 11, so I don't understand what 18 is here."^^ . . "Lua serialize failing"^^ . "Lua os.getenv("UID") returns `nil` but environment variable it's already set"^^ . . "<p>I am having trouble passing a model through a remote event</p>\n<p>the model (tower) is stored originally in replicated storage before being cloned and moved a folder in the workspace\n(local script)</p>\n<pre><code>tower = game.ReplicatedStorage.Towers.Boxer:Clone()\n \ntower.Parent = workspace.Map.TowersToPlace\n</code></pre>\n<p>Then I pass it through the remote event.</p>\n<pre><code>print(tower) replicatedStorage.SpawnTowerEvent:FireServer(tower, mouse.Hit.Position)\nend)\n</code></pre>\n<p>The print line is printing the tower correctly but the server script is erroring saying the tower variable is nil\n(server script)</p>\n<pre><code>game.ReplicatedStorage.SpawnTowerEvent.OnServerEvent:Connect(function(plr, towerToPlace, pos)\n print(towerToPlace)\nend)\n</code></pre>\n<p>-- returns nil</p>\n<p>Anyone know why the variable is not being passed despite being defined correctly in the local script.</p>\n"^^ . . "@Kylaaa the thing is that if the car model is in replicatedstorage or in serverstorage - the script puts the character on driveseat not as it should - that is, a speedometer strip appears at the bottom and the inscription "speed", although in my car model everything is already installed and registered, all the plugins and all the scripts - that is, there is its own speed panel, etc.\n\nYou can check it yourself on a realistic car model from the toolbox from a-chassis"^^ . "0"^^ . "2"^^ . "aerospike"^^ . "0"^^ . "go"^^ . . "2"^^ . . . . "It is the same. See this: https://stackoverflow.com/questions/79179000/repacking-or-printing-unpacked-lua-tables/79179832#79179832."^^ . "0"^^ . . . "1"^^ . "Adding variable length int/float/string array fields to subtree in lua dissector"^^ . "There's no such thing as "common API for Vim file managers". The best scenario is when it's done as simple as "whole file path in every line of a buffer". Then it becomes trivial to get path under cursor. Otherwise, you need to rewrite your code every time. And, by the way, I just can't see how it may be useful to support all those different plugins at once. After all, they all do similar things. So just choose one you like most or write a new one by yourself if none fits you. It's not that hard and could be easier than supporting ton of them."^^ . . "1"^^ . . "The monitor is just one part limiting the set of possible resolutions. Did you check that the complete environment (graphics card/on-board graphics, driver) are able to use this resolution, for example by using your OS?"^^ . . "brush"^^ . "1"^^ . . "I would like to know how the gx command gets the file path on the file manager"^^ . . . . "0"^^ . . . . . . "0"^^ . . . "1"^^ . "<p>Just write a function:</p>\n<pre><code>local function nestedIndexOrNil(t, ...)\n for _, k in ipairs{...} do\n if not t then\n return nil\n end\n t = t[k]\n end\n return t\nend\n\nnestedIndexOrNil(a, 'b', 'c')\n</code></pre>\n"^^ . "2"^^ . . "0"^^ . . . "Problems with nvim setup for java development: LSP Client not found"^^ . . . "3"^^ . . . . "0"^^ . "<p>I currently have this (working) configuration in my neovim:</p>\n<pre><code> {\n &quot;nvim-telescope/telescope.nvim&quot;,\n dependencies = {\n ...\n &quot;jvgrootveld/telescope-zoxide&quot;,\n },\n config = function()\n -- First setup telescope\n local telescope = require(&quot;telescope&quot;)\n local builtin = require(&quot;telescope.builtin&quot;)\n\n telescope.setup({\n ...\n extensions = {\n zoxide = {\n mappings = {\n default = {\n keepinsert = true,\n action = function(selection)\n builtin.find_files({ cwd = selection.path }) -- the line in question\n end,\n },\n },\n },\n },\n })\n telescope.load_extension(&quot;zoxide&quot;)\n end,\n ...\n },\n</code></pre>\n<p>If I change the line in question to</p>\n<pre><code>telescope.builtin.find_files({ cwd = selection.path })\n</code></pre>\n<p>I get the following error:</p>\n<pre><code>E5108: Error executing lua: /home/sbeer/.config/nvim/lua/plugins/telescope.lua:38: attempt to index field 'builtin' (a nil value)\nstack traceback:\n /home/sbeer/.config/nvim/lua/plugins/telescope.lua:38: in function 'action'\n ...lescope-zoxide/lua/telescope/_extensions/zoxide/list.lua:86: in function 'run_replace_or_original'\n ...re/nvim/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'\n ...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:253: in function &lt;...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:252&gt;\n</code></pre>\n<p>What exactly is the difference between the two?</p>\n"^^ . . . "<p>if I have an x and y I want the following to print 6(without making a string or combining the numbers into one):</p>\n<pre><code>a = {}\na[{1, 2}] = 6\nprint(a[{1, 2}]) -- nil\n</code></pre>\n<p>unfortunately lua uses the address of the table as keys instead of the value and since the two <code>{1, 2}</code> tables have different addresses it prints <code>nil</code></p>\n<p>I've looked at the <a href="https://www.lua.org/pil/2.5.html" rel="nofollow noreferrer">lua book</a>, reddit and stack overflow without success.</p>\n<p>The following also doesn't work, because it only takes the first value of the unpacked table as the key:</p>\n<pre><code>a = {}\na[table.unpack({1, 2})] = 6\nprint(a[table.unpack({1, 2})]) -- 6\nprint(a[1]) -- 6\n</code></pre>\n<p>Is there a nice way to do this(again without making a string or combining the numbers)?</p>\n"^^ . "0"^^ . "0"^^ . "<p>I'm working on a simulation in Lua where I need to randomly assign cars to a set of slots based on probabilities. Specifically, I want the probability for each slot to be adjusted dynamically as the cars are assigned.</p>\n<p>Here’s the function I’ve implemented to calculate the probability for each slot index:</p>\n<pre class="lang-lua prettyprint-override"><code>local function generateSlotIndex(totalCars, totalSlots)\n local sum = 0\n local r = math.random() -- generate a random number\n local result\n for k = 1, totalSlots do\n local prob = 1\n -- calculate the probability for the current index\n for i = 1, k - 1 do\n prob = prob * (totalSlots - totalCars - i + 1) / (totalSlots - i + 1)\n end\n prob = prob * totalCars / (totalSlots - k + 1) -- adjust the probability for the k-th index\n sum = sum + prob -- accumulate the probability\n if r &lt;= sum and not result then\n result = k -- set result to k if random number is less than or equal to the accumulated probability\n end\n if sum &gt;= 1 then break end -- stop if accumulated probability reaches 1\n end\n return result\nend\n</code></pre>\n<p>The function <code>generateSlotIndex</code> generates a random index for a slot based on the number of remaining cars and remaining slots. I also have a function <code>getSlots</code> that runs the slot assignment process for all cars:</p>\n<pre class="lang-lua prettyprint-override"><code>local function getSlots(totalCars, totalSlots)\n local slotIndex = 0 -- initialize the slot index\n local restCars = totalCars -- remaining cars to assign\n local restSlots = totalSlots -- remaining slots to assign\n local slots = {} -- table to store the assigned slots\n for carIndex = 1, totalCars do\n local index = generateSlotIndex(restCars, restSlots) -- generate a random slot index\n slotIndex = slotIndex + index\n slots[slotIndex] = 1 -- assign the slot index to the list\n restCars = restCars - 1 -- decrease the number of remaining cars\n restSlots = restSlots - index -- decrease the number of remaining slots\n end\n return slots -- return the list of assigned slots\nend\n</code></pre>\n<p>The problem I am facing is ensuring that cars are distributed across the slots with the correct probabilistic weighting. In some cases, the slots do not get filled evenly or as expected based on the probability calculations. I would appreciate any feedback on how to improve or fix the distribution logic.</p>\n<p>Are there any edge cases I should consider when handling slot assignment?</p>\n<p>What changes should I make to the probability calculation to ensure more even distribution?</p>\n<p>Is there a better way to simulate this probabilistic assignment in Lua?</p>\n<p><strong>Update:</strong>\nWhen I say &quot;I want the probability for each slot to be adjusted dynamically as the cars are assigned,&quot; I mean that the probability of a car being assigned to a specific slot depends on the number of remaining cars and slots. For example:</p>\n<p>If there are 10 cars and 20 slots, the first car has a higher probability of being placed closer to the first slot.</p>\n<p>As more cars are assigned to slots, the probability for the remaining slots should decrease proportionally to the reduced number of cars and slots.</p>\n<p>By &quot;correct probabilistic weighting,&quot; I mean that the assignment of cars to slots should follow the desired distribution based on the constraints:</p>\n<p>Each car must occupy a slot, and no two cars can occupy the same slot.</p>\n<p>The assignment process should favor earlier slots for the first cars but gradually distribute the remaining cars across the remaining slots as slots fill up.</p>\n<p>I analyzed the results of the simulation by repeatedly running it and recording:</p>\n<p>Red: The distribution of cars across all slots.</p>\n<p>Blue: The slot index of the first car (the first slot occupied by any car, in sequential order).</p>\n<p>Please see the diagram (filling 20 slots with 10 cars):</p>\n<p><a href="https://i.sstatic.net/jybHsJSF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jybHsJSF.png" alt="probabitity" /></a>\nThe top diagram shows the slots after a million simulations, the bottom one shows the distribution of the first car in the sequence of slots.</p>\n"^^ . . "generate"^^ . "0"^^ . "Can you share the solution using a flag? It seems like that should work if done correctly."^^ . "1"^^ . "0"^^ . "<p>below is where the error may occur\nHere is my main.lua and I note the place where I think the error is. What I can't figure out is why this sentence will return a number value?\nI'm learning Downwell's effect and the tutorial link is here:<a href="https://github.com/a327ex/blog/issues/9" rel="nofollow noreferrer">https://github.com/a327ex/blog/issues/9</a></p>\n<pre><code>Object = require(&quot;classic&quot;)\nGameObject = require(&quot;GameObject&quot;)\nTimer = require 'hump/timer'\n\nfunction love.load()\n\n Game_objects = {}\n Game_object = createGameObject('GameObject',100, 100)\n\n --dealing with canvas\n main_canvas = love.graphics.newCanvas(320, 240)\n main_canvas:setFilter(&quot;nearest&quot;, &quot;nearest&quot;)\n love.window.setMode(960, 720)\n\n timer = Timer()\n--Here!\n timer.after(4, function() Game_object.dead = true end)\nend\nfunction love.update(dt)\n timer.update(dt)\n for i = #Game_objects, 1, -1 do\n Game_object = Game_objects[i]\n Game_object:update(dt)\n if Game_object.dead then\n table.remove(Game_objects, i)\n end\n end\nend\n\nfunction love.mousepressed(x,y,button)\n if button == 1 then\n Game_object.dead =true\n end\nend\n \nfunction love.draw()\n love.graphics.setCanvas(main_canvas)\n love.graphics.clear()\n for _, Game_object in ipairs(Game_objects) do\n Game_object:draw()\n end\n love.graphics.setCanvas()\n\n love.graphics.draw(main_canvas, 0, 0, 0, 3, 3)\nend\n\nfunction createGameObject(type,x, y, opts)\n local game_object = _G[type](x, y, opts)\n table.insert(Game_objects, game_object)\n return game_object -- return the instance in case we wanna do anything with it\nend\n</code></pre>\n<p>just dont know and it had took me 2 days. can anyone help me~ :(</p>\n"^^ . . . "0"^^ . . . . "<p>NO, it's impossible. <code>v0</code> and <code>v1</code> are always the same value.</p>\n<p>When running Lua script, the time <em>freezes</em>, which means a key expires the first time it's checked, otherwise it's never expired during the execution of the script.</p>\n"^^ . . . . . . . "random"^^ . . . . . . "<p>I come from a JS background and I am pretty new to lua and terminals, i have a basic terminal application. I wanted to understand how you would go about implementing let's say a progress bar that runs in a nonblocking way, right now the progress bar runs but you cannot do any tasks or add an input while the progress bar runs, I have been trying to implement it but i am honestly just confused, I wanted a functionality like this:</p>\n<pre><code>[==============]40%\npress 'q' to go back\n</code></pre>\n<p>You can switch between the menu while the progress bar runs.</p>\n<p>Here's the code for the main application and the progress bar ui file :</p>\n<p><strong>main.lua</strong></p>\n<pre><code>local sys = require(&quot;system&quot;)\nlocal UI = require(&quot;ui&quot;)\nlocal copas = require(&quot;copas&quot;)\n\nfunction displayMenu()\n print(&quot;=============&quot;)\n print(&quot;1. Check Time&quot;)\n print(&quot;2. Get Mono Time&quot;)\n print(&quot;3. Give Feedback&quot;)\n print(&quot;4. Progress Bar Demo&quot;)\n print(&quot;6. Exit&quot;)\n print(&quot;=============&quot;)\nend\n\nfunction sleep()\n local input = io.read()\n local gotInput = sys.readkey(input)\n print(gotInput)\nend\n\nfunction getTime()\n local time = sys.gettime()\n local date = os.date(&quot;Current Time: %Y-%m-%d %H:%M:%S&quot;, time)\n print(date)\nend\n\n\nfunction monoTime()\n local response = sys.monotime()\n print(response)\nend\n\nfunction UI.prompt(message)\n print(message .. &quot; (yes/no):&quot;)\n local response = io.read()\n if response == &quot;yes&quot; then\n return true\n else return false end\nend\n\nfunction uiPrompt()\n local response = UI.prompt(&quot;Do you like lua?&quot;)\n if response == true then \n print(&quot;Thats great!&quot;)\n else \n print(&quot;So sad to hear :(&quot;)\n end\nend\n\nwhile true do\n displayMenu()\n io.write(&quot;Select an Option: &quot;)\n local choice = tonumber(io.read())\n\n if choice == 1 then\n getTime()\n elseif choice == 2 then\n monoTime()\n elseif choice == 3 then\n uiPrompt()\n elseif choice == 4 then\n copas.addthread(\n function ()\n local total = 100\n for i=1, total do\n UI.progressBar(i, total)\n copas.pause(0.1)\n end\n print()\nend)\n elseif choice==6 then\n break\n end\nend\n\ncopas.loop()\n</code></pre>\n<p><strong>ui.lua</strong></p>\n<pre><code>\nUI={}\n\nfunction UI.progressBar(current, total)\n local widthOfBar = 50\n local progress = math.floor((current / total) * widthOfBar)\n local remaining = widthOfBar - progress\n local bar = &quot;[&quot; .. string.rep(&quot;=&quot;, progress) .. string.rep(&quot; &quot;, remaining) .. &quot;]&quot;\n io.write(&quot;\\r&quot; .. bar .. math.floor((current / total) * 100) .. &quot;%&quot;) -- carriage return for progress bar to stay on the same line\n io.flush()\nend\n\ncopas.loop()\n\nreturn UI\n</code></pre>\n<p>If anyone could explain and point out what i am doing wrong that would be great. One more thing, are there other better libraries for handling non-block functions Thanks!</p>\n"^^ . . . "1"^^ . "<p>Your Lua configuration for Neovim key mappings looks correct. However, the issue with <code>&lt;C-j&gt;</code> and <code>&lt;C-k&gt;</code> not working in insert mode is likely due to terminal settings or conflicts with Neovim's built-in keybindings.</p>\n<h3><strong>Possible Issues &amp; Fixes:</strong></h3>\n<h4><strong>1. Check Terminal Keybindings</strong></h4>\n<p>Some terminals (e.g., Alacritty, Kitty, or even default terminal emulators) might not send <code>&lt;C-j&gt;</code> and <code>&lt;C-k&gt;</code> correctly. You can check what keys are being sent using:</p>\n<pre class="lang-none prettyprint-override"><code>:imap &lt;C-j&gt;\n:imap &lt;C-k&gt;\n</code></pre>\n<p>If nothing appears, your terminal might be intercepting these keybindings.</p>\n<h4><strong>2. Disable Default <code>&lt;C-j&gt;</code> and <code>&lt;C-k&gt;</code> Mappings</strong></h4>\n<p>Neovim has built-in behavior for <code>&lt;C-j&gt;</code> and <code>&lt;C-k&gt;</code> in insert mode (e.g., <code>&lt;C-j&gt;</code> might trigger a snippet expansion in some setups). Try adding this to ensure they work as expected:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.api.nvim_del_keymap('i', '&lt;C-j&gt;')\nvim.api.nvim_del_keymap('i', '&lt;C-k&gt;')\n</code></pre>\n<p>Then reapply your mappings:</p>\n<pre class="lang-lua prettyprint-override"><code>map('i', '&lt;C-h&gt;', '&lt;Left&gt;')\nmap('i', '&lt;C-j&gt;', '&lt;Down&gt;')\nmap('i', '&lt;C-k&gt;', '&lt;Up&gt;')\nmap('i', '&lt;C-l&gt;', '&lt;Right&gt;')\n</code></pre>\n<h4><strong>3. Use <code>vim.keymap.set</code> Instead</strong></h4>\n<p>A more modern way to define key mappings in Neovim is using <code>vim.keymap.set</code>. Try replacing your mapping function with:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.keymap.set('i', '&lt;C-h&gt;', '&lt;Left&gt;', { noremap = true, silent = true })\nvim.keymap.set('i', '&lt;C-j&gt;', '&lt;Down&gt;', { noremap = true, silent = true })\nvim.keymap.set('i', '&lt;C-k&gt;', '&lt;Up&gt;', { noremap = true, silent = true })\nvim.keymap.set('i', '&lt;C-l&gt;', '&lt;Right&gt;', { noremap = true, silent = true })\n</code></pre>\n<h4><strong>4. Debug Terminal Input</strong></h4>\n<p>To ensure your terminal sends the correct keys, run this inside Neovim:</p>\n<pre class="lang-none prettyprint-override"><code>:map &lt;C-j&gt;\n:map &lt;C-k&gt;\n</code></pre>\n<p>If nothing appears, your terminal might not be passing <code>&lt;C-j&gt;</code> and <code>&lt;C-k&gt;</code> to Neovim.</p>\n<h4><strong>5. Alternative Keybindings</strong></h4>\n<p>If the issue persists, you can try different keybindings that are less likely to be intercepted:</p>\n<pre class="lang-lua prettyprint-override"><code>map('i', '&lt;C-n&gt;', '&lt;Down&gt;') -- Alternative for &lt;C-j&gt;\nmap('i', '&lt;C-p&gt;', '&lt;Up&gt;') -- Alternative for &lt;C-k&gt;\n</code></pre>\n<h4><strong>Conclusion</strong></h4>\n<p>If <code>&lt;C-j&gt;</code> and <code>&lt;C-k&gt;</code> still don’t work:</p>\n<ul>\n<li>Check if your terminal is capturing those keys.</li>\n<li>Try using <code>vim.keymap.set</code> instead of <code>vim.api.nvim_set_keymap</code>.</li>\n<li>Use <code>vim.api.nvim_del_keymap('i', '&lt;C-j&gt;')</code> before remapping.</li>\n<li>Use alternative key combinations like <code>&lt;C-n&gt;</code> and <code>&lt;C-p&gt;</code>.</li>\n</ul>\n"^^ . "0"^^ . "1"^^ . "`send-keys` will send the keys into the process that tmux is running, not tmux itself. So if you've got a `bind-key -n M-p` with some action, `send-keys` won't trigger that.\n\nIf that is the case, you'll likely need to put actual tmux command that does the action (runs `display-popup`?) in your `vim.fn.system` call."^^ . . "<p>In Lua 5.4, a <a href="https://lua.org/manual/5.4/manual.html#3.3.7" rel="nofollow noreferrer"><em>local declaration</em></a> may contain the <code>&lt;const&gt;</code> <em>attribute</em>, creating a constant variable.</p>\n<p>Attempting to reassign a constant variable throws an error:</p>\n<pre class="lang-lua prettyprint-override"><code>local foo &lt;const&gt; = 42\nfoo = 99 -- error: attempt to assign to const variable 'foo'\n</code></pre>\n<hr />\n<p><sup>Lua 5.4: <a href="https://lua.org/manual/5.4/manual.html#3.3.7" rel="nofollow noreferrer">3.3.7 – Local Declarations</a></sup></p>\n"^^ . "1"^^ . "<p>Recently in the game I've been working on, when I migrate servers to a new update or if the player rejoins immediately after leaving, <code>ProfileStore:LoadProfileAsync()</code> takes around a full minute load. It loads basically immediately in all other cases. This didn't start happening until very recently and I'm not sure what I've done to cause this as I haven't added any new data to be saved/loaded recently.</p>\n<p>As I'm pretty unfamiliar with how ProfileService works I'm wondering what the cause of this long load time could be and how I could go about fixing it.</p>\n<pre class="lang-lua prettyprint-override"><code>local Players = game:GetService(&quot;Players&quot;)\nlocal serverScriptService = game:GetService(&quot;ServerScriptService&quot;)\nlocal Template = require(serverScriptService.PlayerData.Template)\nlocal ProfileService = require(serverScriptService.Modules.ProfileService)\nlocal ProfileStore = ProfileService.GetProfileStore(&quot;Test&quot;, Template)\n\nlocal function PlayerAdded(player: Player)\n print(&quot;TEST1&quot;)\n local profile = ProfileStore:LoadProfileAsync(&quot;Player_&quot;..player.UserId)\n print(&quot;TEST2&quot;)\n -- Cut out a lot of code that I don't think is relevant\nend\n\nPlayers.PlayerAdded:Connect(PlayerAdded)\n</code></pre>\n<p>The first print fires as soon as the player joins, and the second doesn't fire until ~a minute after in the cases I mentioned above.</p>\n<pre class="lang-lua prettyprint-override"><code>Players.PlayerRemoving:Connect(function(player)\n local profile = Manager.Profiles[player]\n if not profile then return end\n profile:Release()\nend)\n\ngame:BindToClose(function()\n for _, profile in Manager.Profiles do\n profile:Release()\n end\nend)\n</code></pre>\n<p>I do have these functions to handle releasing profiles upon players leaving or the server closing.</p>\n"^^ . . . "2"^^ . . . "fivem"^^ . . . . . "How do I fix a bias when attempting to make a random colour in a Firealpaca brush script?"^^ . . "1"^^ . "0"^^ . . . "How to make a payload in Edge TX and send it with ELRS telemetry package to flight controller (Betaflight, MSP)?"^^ . "<p>I am making a game with Monogame and NLua, but running into an error.</p>\n<p>This is the Lua script, where the issue occurs on the third line, and stops before moving into the C# method:</p>\n<pre><code>function instant_growth.activate()\n local farmList = Environment:GetMapFeatures(&quot;farm&quot;)\n local farmTable = LsLua.ConvertToLuaTable(farmList) -- error here\n \n for i, farmObj in ipairs(farmTable) do\n farmObj.LuaData.growProgress = farm.growTime\n end\n\n return nil\nend\n</code></pre>\n<p>This is the generic C# method (inside of the static LsLua class):</p>\n<pre><code>public static LuaTable ConvertToLuaTable&lt;T&gt;(List&lt;T&gt; list)\n{\n LuaTable table = CreateEmptyTable();\n foreach (var item in list)\n {\n _addToTable.Call(table, null, item);\n }\n\n return table;\n}\n\n</code></pre>\n<p>And this is the error:</p>\n<pre><code>InvalidOperationException: Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.\n</code></pre>\n<p>The bizarre thing to me is, it works perfectly the first time, but activate the ability and run it again, it breaks. Re-initialising the Lua state works and prevents the issue, but I don't really want to be doing that.</p>\n<p>So even doing this breaks:</p>\n<pre><code>local farmList = Environment:GetMapFeatures(&quot;farm&quot;)\nlocal farmTable = LsLua.ConvertToLuaTable(farmList)\nfarmTable = LsLua.ConvertToLuaTable(farmList)\n</code></pre>\n<p>If I don't find a solution, I will probably just change the method so it is not generic, but any help would be greatly appreciated.</p>\n"^^ . . . . "evaluation"^^ . . "0"^^ . "Could you share the code that doesn't work? You've said that the code works when the cars are in the Workspace, but not in ReplicatedStorage. When you clone the car from the ReplicatedStorage, do you `wait` before placing the player in the seat?"^^ . . "0"^^ . . . "0"^^ . "<p>I'm attempting to parse some output from CMake, but I keep getting nil when I attempt to loop over all the matches.</p>\n<pre><code>local s = [[Available configure presets:\n\n &quot;x64-debug&quot; - x64 Debug\n &quot;x64-release&quot; - x64 Release\n &quot;x86-debug&quot; - x86 Debug\n &quot;x86-release&quot; - x86 Release]]\n \nfor word in string.gmatch(s, [[&quot;(.*?)&quot;\\s{1,}-\\s{1,}(.*)]]) do\n print(word) \nend\n</code></pre>\n<p>Expected output:</p>\n<pre><code>x64-debug\nx64 Debug\nx64-release\nx64 Release\n...\n</code></pre>\n<p>I'm not sure if I'm misunderstanding how string.gmatch works, or if my regex is just wrong for whatever flavor Lua uses (it seems to work for PHP: <a href="https://regex101.com/r/jP3jBk/1" rel="nofollow noreferrer">https://regex101.com/r/jP3jBk/1</a>)</p>\n<p>Here's the regex: <code>&quot;(.*?)&quot;\\s{1,}-\\s{1,}(.*)</code></p>\n"^^ . "0"^^ . . "0"^^ . "<p><strong>Edit:</strong> GitHub link: <a href="https://github.com/Unique-Digital-Resources/my-awesome-wm-config/blob/main/wibar/custom_tasklist.lua" rel="nofollow noreferrer">https://github.com/Unique-Digital-Resources/my-awesome-wm-config/blob/main/wibar/custom_tasklist.lua</a></p>\n<p>I am trying to create a custom widget using containers and layouts, <code>inner_layout</code> has two children, <code>clienticon</code> and <code>textbox</code> under it, however, function <code>create_client_widget</code> and function <code>create_client_widget</code> only displays the background shape only, without the <code>inner_layout</code>.</p>\n<p>when widget is <code>awful.widget.clienticon(c)</code> in <code>local icon</code>, the icon shows, as expected:</p>\n<p><a href="https://i.sstatic.net/jksfuzFd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jksfuzFd.png" alt="enter image description here" /></a></p>\n<pre><code> local icon = wibox.widget {\n {\n {\n {\n widget = awful.widget.clienticon(c), -- Use awful.widget.clienticon to get the client's icon\n },\n margins = 4, -- Margins around the icon\n widget = wibox.container.margin,\n },\n shape = gears.shape.circle, -- Shape of the background to circle\n bg = &quot;#FF0000&quot;, -- Background color of the circle\n widget = wibox.container.background,\n },\n margins = 1, -- Margins around the icon background\n widget = wibox.container.margin,\n } local icon = wibox.widget {\n {\n {\n {\n widget = awful.widget.clienticon(c), -- Use awful.widget.clienticon to get the client's icon\n },\n margins = 4, -- Margins around the icon\n widget = wibox.container.margin,\n },\n shape = gears.shape.circle, -- Shape of the background to circle\n bg = &quot;#FF0000&quot;, -- Background color of the circle\n widget = wibox.container.background,\n },\n margins = 1, -- Margins around the icon background\n widget = wibox.container.margin,\n }\n</code></pre>\n<p>but when widget is <code>inner_layout</code>, <code>clienticon</code> nor <code>textbox</code> displayed:</p>\n<p><a href="https://i.sstatic.net/KnwUPzNG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/KnwUPzNG.png" alt="enter image description here" /></a></p>\n<pre><code> local icon = wibox.widget {\n {\n {\n {\n widget = inner_layout, -- widget = awful.widget.clienticon(c), -- Use awful.widget.clienticon to get the client's icon\n },\n forced_width = 40,\n forced_height = 40,\n margins = 4, -- Margins around the icon\n widget = wibox.container.margin,\n },\n shape = gears.shape.circle, -- Shape of the background to circle\n bg = &quot;#FF0000&quot;, -- Background color of the circle\n widget = wibox.container.background,\n },\n margins = 1, -- Margins around the icon background\n widget = wibox.container.margin,\n } local icon = wibox.widget {\n {\n {\n {\n widget = inner_layout, -- widget = awful.widget.clienticon(c), -- Use awful.widget.clienticon to get the client's icon\n },\n forced_width = 40,\n forced_height = 40,\n margins = 4, -- Margins around the icon\n widget = wibox.container.margin,\n },\n shape = gears.shape.circle, -- Shape of the background to circle\n bg = &quot;#FF0000&quot;, -- Background color of the circle\n widget = wibox.container.background,\n },\n margins = 1, -- Margins around the icon background\n widget = wibox.container.margin,\n }\n</code></pre>\n<p>full code:</p>\n<pre><code>local awful = require(&quot;awful&quot;)\nlocal gears = require(&quot;gears&quot;)\nlocal wibox = require(&quot;wibox&quot;)\nlocal beautiful = require(&quot;beautiful&quot;)\n\n-- Function to create a custom client widget with mouse events\nlocal function create_client_widget(c)\n print(&quot;icon_name: &quot; , c.icon_name)\n print(&quot;class: &quot; , c.class)\n -- Create the icon widget\n local a_client_icon = wibox.widget{ \n widget = awful.widget.clienticon(c), \n }\n local a_small_shape = wibox.widget{\n {\n widget = wibox.widget.textbox,\n },\n shape = gears.shape.circle, -- Shape of the background to circle\n bg = &quot;#FF0000&quot;, -- Background color of the circle\n widget = wibox.container.background,\n }\n local inner_layout = wibox.widget {\n a_client_icon,\n a_small_shape,\n layout = wibox.layout.ratio.vertical,\n }\n \n inner_layout:set_widget_ratio(my_client_icon, 0.8)\n inner_layout:set_widget_ratio(my_small_shape, 0.2)\n -- inner_layout:adjust_ratio(2, 0.8, 0.2) -- Explicitly set and apply ratios\n -- inner_layout:add(my_client_icon)\n -- inner_layout:add(my_small_shape)\n -- inner_layout:set_widget_ratio(my_client_icon, 0.8)\n -- inner_layout:set_widget_ratio(my_small_shape, 0.2)\n\n local icon = wibox.widget {\n {\n {\n {\n widget = inner_layout, -- widget = awful.widget.clienticon(c), -- Use awful.widget.clienticon to get the client's icon\n },\n forced_width = 40,\n forced_height = 40,\n margins = 4, -- Margins around the icon\n widget = wibox.container.margin,\n },\n shape = gears.shape.circle, -- Shape of the background to circle\n bg = &quot;#FF0000&quot;, -- Background color of the circle\n widget = wibox.container.background,\n },\n margins = 1, -- Margins around the icon background\n widget = wibox.container.margin,\n }\n\n -- Reference to the outer background container for changing the color\n local outer_bg = icon.children[1] -- The outer container that holds the background and icon\n\n \n -- Add mouse events to the icon\n icon:buttons(gears.table.join(\n -- Left click to focus the client\n awful.button({}, 1, function()\n c:emit_signal(&quot;request::activate&quot;, &quot;tasklist&quot;, {raise = true})\n end),\n \n -- Right click to show a simple context menu (simplified for testing)\n awful.button({}, 3, function()\n print(&quot;Right-click detected on client: &quot; .. c.name)\n awful.menu({\n items = {\n { &quot;Open Terminal&quot;, terminal },\n { &quot;Restart&quot;, awesome.restart },\n { &quot;Quit&quot;, awesome.quit }\n }\n }):show()\n end)\n ))\n\n -- Optional: Change icon background on mouse hover\n icon:connect_signal(&quot;mouse::enter&quot;, function()\n outer_bg.bg = &quot;#00FF00&quot; -- Change background color of the outer container (circle) on hover\n end)\n\n icon:connect_signal(&quot;mouse::leave&quot;, function()\n outer_bg.bg = &quot;#FF0000&quot; -- Revert background color when mouse leaves\n end)\n\n return icon\nend\n\n\n-- Function to create custom tasklist with configurable order\nlocal function create_custom_tasklist(s, alignment, client_order)\n local a_client_order = client_order or &quot;first&quot; -- Default to &quot;first&quot;\n \n -- Configurable margin for tasklist\n local tasklist_margin = 4 -- tasklist height, Customize this value as needed\n\n -- Create the tasklist widget\n local tasklist_widget = wibox.widget {\n layout = wibox.layout.fixed.horizontal, -- Fixed horizontal layout for the icons\n }\n\n tasklist_widget.spacing = 10 -- Add spacing between each layout widgets.\n\n -- Style the tasklist with a background and rounded corners, including alignment\n local styled_tasklist = wibox.widget {\n {\n tasklist_widget, -- Tasklist with icons\n halign = alignment or &quot;center&quot;, -- Set alignment: &quot;left&quot;, &quot;center&quot;, or &quot;right&quot;\n widget = wibox.container.place, -- Align the entire tasklist\n },\n bg = &quot;#CCCCCC&quot;, -- Background color of the tasklist\n shape = gears.shape.rounded_rect, -- Shape for the tasklist\n widget = wibox.container.background,\n }\n\n -- Wrap the tasklist in a container with margins\n local parent_widget = wibox.widget {\n {\n styled_tasklist, -- The styled tasklist\n margins = tasklist_margin, -- Apply margins here\n widget = wibox.container.margin,\n },\n widget = wibox.container.background,\n }\n\n -- Update the tasklist with configurable client order\n local function update_tasklist()\n tasklist_widget:reset()\n\n local tag = s.selected_tag\n if tag then\n for _, c in ipairs(tag:clients()) do\n -- Create the client widget (icon)\n local icon = create_client_widget(c)\n\n -- Add the icon to the tasklist at the specified position (first or last)\n if a_client_order == &quot;first&quot; then\n tasklist_widget:insert(1, icon) -- Insert at the start (first)\n else\n tasklist_widget:add(icon) -- Add at the end (last)\n end\n\n -- -- Add spacing between icons\n -- if _ &lt; #tag:clients() then\n -- local spacer = wibox.widget {\n -- forced_width = 1, -- Space between icons\n -- layout = wibox.layout.fixed.horizontal,\n -- }\n -- tasklist_widget:add(spacer)\n -- end\n end\n end\n end\n\n -- Connect signals to update tasklist\n s:connect_signal(&quot;tag::history::update&quot;, update_tasklist)\n s:connect_signal(&quot;property::selected_tag&quot;, update_tasklist)\n client.connect_signal(&quot;manage&quot;, update_tasklist)\n client.connect_signal(&quot;unmanage&quot;, update_tasklist)\n client.connect_signal(&quot;property::icon&quot;, update_tasklist)\n client.connect_signal(&quot;property::name&quot;, update_tasklist)\n client.connect_signal(&quot;tagged&quot;, update_tasklist)\n client.connect_signal(&quot;untagged&quot;, update_tasklist)\n\n -- Trigger initial update\n update_tasklist()\n\n return parent_widget, tasklist_widget\nend\n\nreturn create_custom_tasklist\n\nlocal awful = require(&quot;awful&quot;)\nlocal gears = require(&quot;gears&quot;)\nlocal wibox = require(&quot;wibox&quot;)\nlocal beautiful = require(&quot;beautiful&quot;)\n\n\n-- Function to create a custom client widget with mouse events\nlocal function create_client_widget(c)\n print(&quot;icon_name: &quot; , c.icon_name)\n print(&quot;class: &quot; , c.class)\n -- Create the icon widget\n local a_client_icon = wibox.widget{ \n widget = awful.widget.clienticon(c), \n }\n local a_small_shape = wibox.widget{\n {\n widget = wibox.widget.textbox,\n },\n shape = gears.shape.circle, -- Shape of the background to circle\n bg = &quot;#FF0000&quot;, -- Background color of the circle\n widget = wibox.container.background,\n }\n local inner_layout = wibox.widget {\n a_client_icon,\n a_small_shape,\n layout = wibox.layout.ratio.vertical,\n }\n \n inner_layout:set_widget_ratio(my_client_icon, 0.8)\n inner_layout:set_widget_ratio(my_small_shape, 0.2)\n -- inner_layout:adjust_ratio(2, 0.8, 0.2) -- Explicitly set and apply ratios\n -- inner_layout:add(my_client_icon)\n -- inner_layout:add(my_small_shape)\n -- inner_layout:set_widget_ratio(my_client_icon, 0.8)\n -- inner_layout:set_widget_ratio(my_small_shape, 0.2)\n\n\n local icon = wibox.widget {\n {\n {\n {\n widget = inner_layout, -- widget = awful.widget.clienticon(c), -- Use awful.widget.clienticon to get the client's icon\n },\n forced_width = 40,\n forced_height = 40,\n margins = 4, -- Margins around the icon\n widget = wibox.container.margin,\n },\n shape = gears.shape.circle, -- Shape of the background to circle\n bg = &quot;#FF0000&quot;, -- Background color of the circle\n widget = wibox.container.background,\n },\n margins = 1, -- Margins around the icon background\n widget = wibox.container.margin,\n }\n\n\n -- Reference to the outer background container for changing the color\n local outer_bg = icon.children[1] -- The outer container that holds the background and icon\n\n\n \n -- Add mouse events to the icon\n icon:buttons(gears.table.join(\n -- Left click to focus the client\n awful.button({}, 1, function()\n c:emit_signal(&quot;request::activate&quot;, &quot;tasklist&quot;, {raise = true})\n end),\n \n -- Right click to show a simple context menu (simplified for testing)\n awful.button({}, 3, function()\n print(&quot;Right-click detected on client: &quot; .. c.name)\n awful.menu({\n items = {\n { &quot;Open Terminal&quot;, terminal },\n { &quot;Restart&quot;, awesome.restart },\n { &quot;Quit&quot;, awesome.quit }\n }\n }):show()\n end)\n ))\n\n\n -- Optional: Change icon background on mouse hover\n icon:connect_signal(&quot;mouse::enter&quot;, function()\n outer_bg.bg = &quot;#00FF00&quot; -- Change background color of the outer container (circle) on hover\n end)\n\n\n icon:connect_signal(&quot;mouse::leave&quot;, function()\n outer_bg.bg = &quot;#FF0000&quot; -- Revert background color when mouse leaves\n end)\n\n\n return icon\nend\n\n\n\n-- Function to create custom tasklist with configurable order\nlocal function create_custom_tasklist(s, alignment, client_order)\n local a_client_order = client_order or &quot;first&quot; -- Default to &quot;first&quot;\n \n -- Configurable margin for tasklist\n local tasklist_margin = 4 -- tasklist height, Customize this value as needed\n\n\n -- Create the tasklist widget\n local tasklist_widget = wibox.widget {\n layout = wibox.layout.fixed.horizontal, -- Fixed horizontal layout for the icons\n }\n\n\n tasklist_widget.spacing = 10 -- Add spacing between each layout widgets.\n\n\n -- Style the tasklist with a background and rounded corners, including alignment\n local styled_tasklist = wibox.widget {\n {\n tasklist_widget, -- Tasklist with icons\n halign = alignment or &quot;center&quot;, -- Set alignment: &quot;left&quot;, &quot;center&quot;, or &quot;right&quot;\n widget = wibox.container.place, -- Align the entire tasklist\n },\n bg = &quot;#CCCCCC&quot;, -- Background color of the tasklist\n shape = gears.shape.rounded_rect, -- Shape for the tasklist\n widget = wibox.container.background,\n }\n\n\n -- Wrap the tasklist in a container with margins\n local parent_widget = wibox.widget {\n {\n styled_tasklist, -- The styled tasklist\n margins = tasklist_margin, -- Apply margins here\n widget = wibox.container.margin,\n },\n widget = wibox.container.background,\n }\n\n\n -- Update the tasklist with configurable client order\n local function update_tasklist()\n tasklist_widget:reset()\n\n\n local tag = s.selected_tag\n if tag then\n for _, c in ipairs(tag:clients()) do\n -- Create the client widget (icon)\n local icon = create_client_widget(c)\n\n\n -- Add the icon to the tasklist at the specified position (first or last)\n if a_client_order == &quot;first&quot; then\n tasklist_widget:insert(1, icon) -- Insert at the start (first)\n else\n tasklist_widget:add(icon) -- Add at the end (last)\n end\n\n\n -- -- Add spacing between icons\n -- if _ &lt; #tag:clients() then\n -- local spacer = wibox.widget {\n -- forced_width = 1, -- Space between icons\n -- layout = wibox.layout.fixed.horizontal,\n -- }\n -- tasklist_widget:add(spacer)\n -- end\n end\n end\n end\n\n\n -- Connect signals to update tasklist\n s:connect_signal(&quot;tag::history::update&quot;, update_tasklist)\n s:connect_signal(&quot;property::selected_tag&quot;, update_tasklist)\n client.connect_signal(&quot;manage&quot;, update_tasklist)\n client.connect_signal(&quot;unmanage&quot;, update_tasklist)\n client.connect_signal(&quot;property::icon&quot;, update_tasklist)\n client.connect_signal(&quot;property::name&quot;, update_tasklist)\n client.connect_signal(&quot;tagged&quot;, update_tasklist)\n client.connect_signal(&quot;untagged&quot;, update_tasklist)\n\n\n -- Trigger initial update\n update_tasklist()\n\n\n return parent_widget, tasklist_widget\nend\n\n\nreturn create_custom_tasklist\n</code></pre>\n"^^ . . "1"^^ . "1"^^ . "0"^^ . . "Are you trying to duplicate the results? That looks like [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution)(2)? With the occupied slots not counted."^^ . "3"^^ . "0"^^ . . . "2"^^ . . . . . . . . "0"^^ . . "1"^^ . . "1"^^ . "0"^^ . . "1"^^ . "0"^^ . "`0` is an arbitrary value - we just need to pass any *number* to `getmetatable`/`setmetatable` to access the type's metatable. I'll add this information to the answer."^^ . . "3"^^ . . "lua-patterns"^^ . . "1"^^ . . "0"^^ . . "<p>I Have Use case for Aerospike where I have multiple Records like:</p>\n<pre><code>+--------+---------+\n| PK | signal |\n+--------+---------+\n| 123451 | 1 |\n| 102221 | 1.0816 |\n+--------+---------+\n</code></pre>\n<p>I have Service A running on VM fleet of ~1000 Vms, which read this signal value every 3 mins.\nNow this signal value also needs to be updated every 3 mins based on other real world values (x...y) in the scope of Service A. It can either go up, down every 3 mins, and also reset every 24 hrs.\nAlso all 1000 vms need to see the same updated value of signals at the same time.</p>\n<p>Now the ideal way might be to have a separate service (Service B) operating that updates this signal every 3 mins. But the dynamic values are difficult to recreate in any other service, and are not easily exported.</p>\n<p>So to do it in the Service A, I can follow a CAS(Check and Set) pattern, at every VM\nWhere I have a scheduler doing this every 3 mins interval synced to epoch:</p>\n<ol>\n<li>Read the Signals</li>\n<li>Compute updated signals</li>\n<li>Write back new compute Signals</li>\n</ol>\n<p>Now this is inefficient because best case all 1000 Service A vms will be writing back the same value to aerospike, ranging to worst case where I may have</p>\n<ol>\n<li>Write contention(Key busy) due to 1000 concurrent writes</li>\n<li>Different signals being written back due to edge cases of different dynamic values of X and Y in different contexts.</li>\n</ol>\n<p>Thought about using Write policy generation to achieve this where:</p>\n<ol>\n<li>I read all keys, preserve generation of all keys</li>\n<li>Compute all new keys.</li>\n<li>Write all new keys back, with match generation check on write policy</li>\n<li>Raad back final updated key (Is this needed?)</li>\n</ol>\n<p>Looks clumsy, so tried an UDF like this:</p>\n<pre><code>function updateSignal(rec, binName, someParamX, someParamY, hyperParameter, resetFlag)\n if aerospike:exists(rec) then\n local currentSignal = rec[binName]\n local geneneration = record.gen(rec)\n if (someParamX &gt; someParamY) then\n local multiplier = someFunction()\n local updatedSignal = currentSignal * multiplier\n rec[binName] = updatedSignal\n else\n rec[binName] = 1\n end \n aerospike:update(rec)\n else\n aerospike:create(rec)\n rec[binName] = 1\n aerospike:update(rec)\n end\n return rec[binName] -- Return the updated value\nend\n</code></pre>\n<p>Problem is that in the UDF context I don't really have any write gen checking ability, if I don't pass the write gen initially to the UDF.</p>\n<p>Also if I pass the write gen as part of the UDF call, I also need to return back the current value of the signal if the write fails due to gen check(collisions).\nSince I wont have the updated signal once inside the udf context if the record was updated from elsewhere. (Can this even happen? Read somewhere udfs lock the record? is it a Read lock/write lock?)</p>\n<p>Any way around this? Am I missing something?</p>\n"^^ . . "Lua does not use regexes, only simple patterns. Try `string.gmatch(s,'"(.-)"')`."^^ . . . "<p>I'm trying to make my first Roblox studio game and I ran into this problem:</p>\n<blockquote>\n<p>attempt to call missing method 'UpdateCharacter' of table</p>\n<p>attempt to call missing method 'Equip' of table</p>\n</blockquote>\n<p>Any function that is called from FistCombat even if it is declared. I attach the 3 scripts that I believe are the problem.</p>\n<pre><code>local RS = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal UIS = game:GetService(&quot;UserInputService&quot;)\n\nlocal Player = game:GetService(&quot;Players&quot;).LocalPlayer\nlocal Camera = workspace.CurrentCamera\nlocal GUI = Player.PlayerGui:WaitForChild(&quot;CombatGui&quot;)\nlocal Character = Player.Character or Player.CharacterAdded:Wait()\nlocal Humanoid\nlocal Backpack = Player.Backpack\n\nlocal CharacterConnections = {\n\n}\n\n\n--ReplicateRemote\nlocal ReplicateRemote = RS.Remotes.Replicate\n\n--CameraShaker\nlocal function ShakeCamera(ShakeCFrame)\n Camera.CFrame = Camera.CFrame * ShakeCFrame\nend\n\nlocal CameraShaker = require(RS.Modules.Auxillary.CameraShaker).new(Enum.RenderPriority.Camera.Value, ShakeCamera)\nCameraShaker:Start()\n\n--CooldownManager\nlocal CooldownManager = require(RS.Modules.Auxillary.CooldownManager).new(Player, GUI)\n\n--Status Manager\nlocal StatusManager = Character:WaitForChild(&quot;StatusFolder&quot;)\nlocal StatusManager = require(RS.Modules.Auxillary.StatusManager).new(Player)\n\nlocal AuxObjects = {\n [&quot;CameraShaker&quot;] = CameraShaker,\n [&quot;CooldownManager&quot;] = CooldownManager,\n [&quot;StatusManager&quot;] = StatusManager,\n}\n\n\n--Default current weapon to fist\nlocal BaseCombat = require(RS.Modules.Items.FistCombat).new(Player, AuxObjects)\nlocal CurrentItem = BaseCombat\nCurrentItem:Equip()\n\nfunction HandleInputs(UserInput, GPE)\n if GPE then return end\n --Convert UserInput into a String for ease of use\n local InputName = UserInput.KeyCode.Name\n if UserInput.UserInputType == Enum.UserInputType.MouseButton1 then\n InputName = &quot;M1&quot;\n elseif UserInput.UserInputType == Enum.UserInputType.MouseButton2 then\n InputName = &quot;M2&quot;\n end\n\n --Input Validation\n if CurrentItem.Keys[InputName] then\n if UserInput.UserInputState == Enum.UserInputState.Begin then\n CurrentItem[InputName](CurrentItem)\n elseif UserInput.UserInputState == Enum.UserInputState.End then\n CurrentItem[InputName..&quot;End&quot;](CurrentItem)\n end\n end\nend\n\nUIS.InputBegan:Connect(HandleInputs)\nUIS.InputEnded:Connect(HandleInputs)\n\n-- Super Simple Replicator\nlocal Modules = {}\nfor i, Item in pairs(RS.Modules.Items:GetChildren()) do\n Modules[Item.Name] = require(Item)\nend\n\nReplicateRemote.OnClientEvent:Connect(function(Args)\n Modules[Args.Module][Args.Action](Args)\nend)\n\n-------------------------------------\n--Inventory System\n\n--Connections\nlocal BackpackConnections = {}\nlocal BackpackCoreConnections = {}\n\nfunction AddItem(Tool)\n if Tool:IsA(&quot;Tool&quot;) and not BackpackConnections[Tool] then\n BackpackConnections[Tool] = {}\n BackpackConnections[Tool].Module = require(RS.Modules.Items[Tool.Name]).new(Player, AuxObjects)\n BackpackConnections[Tool].Equipped = Tool.Equipped:Connect(function()\n Currentitem:Unequip()\n Currentitem = BackpackConnections[Tool].Module\n Currentitem:Equip()\n end)\n \n BackpackConnections[Tool].Unequipped = Tool.Unequipped:Connect(function()\n if Character:FindFirstChildWhichIsA(&quot;Tool&quot;) == nil then\n Currentitem:Unequip()\n Currentitem = BaseCombat\n Currentitem:Equip()\n end\n end)\n end\nend\n\nfor i, OtherPlayer in pairs(game:GetService(&quot;Players&quot;):GetPlayers()) do\n if OtherPlayer ~= Player then\n if OtherPlayer.Character:FindFirstChildWhichIsA(&quot;Tool&quot;) then\n Modules[OtherPlayer.Character:FindFirstChildWhichIsA(&quot;Tool&quot;).Name].CreateModel({Character = OtherPlayer.Character})\n end\n end\nend\n\nfunction LoadCharacter(Char)\n Character = Char\n Humanoid = Char:WaitForChild(&quot;Humanoid&quot;)\n Humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, false)\n Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)\n \n Backpack = Player.Backpack\n BackpackCoreConnections.childAdded = Backpack.ChildAdded:Connect(function(Tool)\n if Tool:IsA(&quot;Tool&quot;) then\n AddItem(Tool)\n end\n end)\n \n BackpackCoreConnections.ChildRemoved = Backpack.ChildRemoved:Connect(function(Tool)\n if Tool:IsA(&quot;Tool&quot;) then\n if Tool.Parent ~= Character then\n BackpackConnections[Tool].Equipped:Disconnect()\n BackpackConnections[Tool].Unequipped:Disconnect()\n BackpackConnections[Tool].Module:Destroy()\n BackpackConnections[Tool] = nil\n end\n end\n end)\n \n for i,Tool in pairs(Backpack:GetChildren()) do\n AddItem(Tool)\n end\n \n CurrentItem = BaseCombat\n CurrentItem:Equip()\n \n CharacterConnections[&quot;Died&quot;] = Humanoid.Died:Connect(function()\n BackpackCoreConnections.childAdded:Disconnect()\n BackpackCoreConnections.ChildRemoved:Disconnect()\n --Make sure our Character inst attacking when dead\n CurrentItem:Lock()\n end)\n \n CurrentItem:UpdateCharacter()\n CurrentItem:Unlock() \nend\n\nPlayer.CharacterAdded:Connect(LoadCharacter)\nLoadCharacter(Character)\n</code></pre>\n<pre><code>local FistCombat = {}\nFistCombat._index = FistCombat\n\nlocal RF = game:GetService(&quot;ReplicatedFirst&quot;)\nlocal RS = game:GetService(&quot;ReplicatedStorage&quot;)\nlocal TS = game:GetService(&quot;TweenService&quot;)\n\nlocal ActionService = RS.Remotes.ActionService\nlocal ReplicateRemote = RS.Remotes.Replicate\n\nlocal Auxillary = require(RS.Modules.Auxillary.Auxillary)\n\nlocal Assets = RF.Assets.FistCombat\nlocal VFX = Assets.VFX\nlocal Sound = Assets.Sound\nlocal Animations = Assets.Animations\n\nlocal PunchTextures = {\n &quot;rbxassetid://&quot;,\n &quot;rbxassetid://&quot;,\n &quot;rbxassetid://&quot;,\n &quot;rbxassetid://&quot;,\n &quot;rbxassetid://&quot;,\n &quot;rbxassetid://&quot;,\n}\n\nlocal COMBOLENGTH = 5\nlocal COMBORESETLENGTH = 1\nlocal ITEMNAME = &quot;FistCombat&quot;\n\nfunction FistCombat.new(User, AuxObjects)\n local self = setmetatable({}, FistCombat)\n \n \n self.User = User\n self.Mouse = User:GetMouse()\n self.CooldownManager = AuxObjects.CooldownManager\n self.CameraShaker = AuxObjects.CameraShaker\n self.StatusManager = AuxObjects.StatusManager\n self.Character = User.Character\n \n self.Locked = false\n self.Equipped = false\n \n self.Status = {\n [&quot;Combo&quot;] = 1,\n [&quot;LastCombo&quot;] = 0,\n [&quot;Blocking&quot;] = false,\n [&quot;Action&quot;] = false,\n }\n \n self.Keys ={\n [&quot;M1&quot;] = {[&quot;Name&quot;] = &quot;Punch&quot;, [&quot;LayoutOrder&quot;] = 1 },\n [&quot;M2&quot;] = {[&quot;Name&quot;] = &quot;Heavy&quot;, [&quot;LayoutOrder&quot;] = 2 },\n [&quot;F&quot;] = {[&quot;Name&quot;] = &quot;Block&quot;, [&quot;LayoutOrder&quot;] = 3 },\n }\n \n self.Animations = {\n \n }\n \n self.CooldownManager:AddItem(&quot;FistCombat&quot;, self.Keys)\n \n return self\nend\n\nfunction FistCombat:Name()\n print(&quot;FistCombat&quot;) \nend\n\nfunction FistCombat:Equip()\n --Equip the item and load cooldown ui\n self.CooldownManager:LoadItem(&quot;FistCombat&quot;)\n self.Equipped = true \nend\n\nfunction FistCombat:M1()\n --CheckCooldown and other requirements\n if \n not self.CooldownManager:onCooldown(ITEMNAME, &quot;Punch&quot;)\n and self.Equipped\n and not self.Locked\n and not self.Status.Blocking\n and not self.Status.Action\n and not self.StatusManager:GetSatus().Stun\n and not self.CooldownManager.InAction\n then\n self.CooldownManager.SetAction(true)\n self.Status.Action = true\n \n if time() - self.Status.LastCombo &gt; COMBORESETLENGTH then\n self.Status.LastCombo = 1\n end \n \n self.Status.LastCombo = time()\n \n local Cooldown =.3\n if self.Status.Combo == 5 then\n Cooldown = 1\n end\n \n self.CoolDownManager:AddCooldown(ITEMNAME,&quot;Punch&quot;, Cooldown)\n \n self.Character.Humanoid.walkSpeed = 4\n \n --Move the Player\n local BV = Instance.new(&quot;BodyVelocity&quot;)\n BV.MaxForce = Vector3.new(999999,0,999999)\n BV.Velocity = self.Character.HumanoidRootPart.CFrame.LookVector * 25\n BV.Parent = self.Character.HumanoidRootPart\n \n task.delay(.1,function()\n BV:Destroy()\n end)\n \n --Play the animation\n local Animation = self.Character.Humanoid.Animator:LoadAnimation(Animations[&quot;M&quot;..self.Status.Combo])\n Animations:Play()\n \n --Create the effect\n local ReplicateArgs = {\n Module = &quot;FistCombat&quot;,\n Action = &quot;PunchEffect&quot;,\n Character = self.Character,\n Combo = self.Status.Combo,\n }\n FistCombat.PunchEffect(ReplicateArgs)\n ReplicateRemote:FireServer(ReplicateArgs)\n \n --Camera Shake\n self.CameraShaker:ShakeOnce(2,4,.2,.3)\n \n --Hitboxing\n local params = OverlapParams.new()\n params.FilterType = Enum.RaycastFilterType.Exclude\n params.FilerDescendantsInstances = {workspace.Map, workspace.FX, self.Character}\n \n local HitList = {}\n local HB = workspace.GetPartBundsInBox(self.character:GetPivot() * CFrame.new(0,0,-4), Vector3.new(4,4,6), params)\n \n for i, Part in pairs(HB) do\n if Part.Parent:FindFirstChild(&quot;Humanoid&quot;) and table.find(HitList, Part.Parent) == nil then\n table.insert(HitList, Part.Parent)\n \n local Highlght = Instance.new(&quot;Highlight&quot;, Part.Parent)\n Highlght.DepthMode = Enum.HighlightDepthMode.Occluded\n Highlght.FillColor = Color3.fromRGB(195,0,0)\n Highlght.FillTransparency = 0\n Highlght.OutlineTransparency = 1\n TS:Create(Highlght, TweenInfo.new(.4),{fillTransparency = 1}):Play()\n \n task.delay(.4, function()\n Highlght:Destroy()\n end)\n \n local ReplicateArgs = {\n Module = &quot;FistCombat&quot;,\n Action = &quot;HitEffect&quot;,\n Target = Part.Parent,\n Combo = self.Status.Combo,\n }\n FistCombat.HitEffect(ReplicateArgs)\n ReplicateRemote:FireServer(ReplicateArgs)\n \n if self.Status.Combo == 5 then\n local ReplicateArgs = {\n Module = &quot;FistCombat&quot;,\n Action = &quot;HeavyhitEffect&quot;,\n Target = Part.Parent,\n Character = self.Character,\n }\n FistCombat.HeavyHitEffect(ReplicateArgs)\n ReplicateRemote:FireServer(ReplicateArgs)\n end\n end\n end\n \n local ServerArgs = {\n [&quot;Module&quot;] = &quot;FistCombat&quot;,\n [&quot;Action&quot;] = &quot;hit&quot;,\n [&quot;HitList&quot;] = HitList,\n [&quot;Knockback&quot;] = self.Character.HumanoidRootPart.CFrame.LookVector *25,\n [&quot;Combo&quot;] = self.Status.Combo,\n }\n \n if self.Status.Combo == 5 then\n ServerArgs.Knockback *=3\n end\n \n ActionService:InvokeServer(ServerArgs)\n \n if self.Status.Combo == COMBOLENGTH then\n self.Status.Combo = 0\n end\n self.Status.Combo +=1\n \n task.wait(.3)\n self.Character.humanoid.WalkSpeed = 16\n self.Status.action = false\n self.CooldownManager:SetAction(false)\n end\nend\n\nfunction FistCombat.HitEffect(Args)\n local Target = Args.Target\n local Attachment = Instance.new(&quot;Attachment&quot;, Target.HumanoidRootPart)\n Attachment.Name = &quot;HitEffect&quot;\n \n if Target:GetAttribute(&quot;Blocking&quot;) then\n if Args.Combo == 5 then\n for i, ptc1 in pairs(VFX.BlockBreak:GetChildren()) do\n ptc1:Clone().Parent = Attachment\n end\n else\n for i, ptc1 in pairs(VFX.Block:GetChildren()) do\n ptc1:Clone().Parent = Attachment\n end\n end\n else\n for i, ptc1 in pairs(VFX.Hit:GetChildren()) do\n ptc1:Clone().Parent = Attachment\n end\n end\n \n Auxillary.Emit(Attachment)\n task.delay(1,function()\n Attachment:Destroy()\n end)\nend\n\nfunction FistCombat.HeavyHitEffect(Args)\n local Character = Args.Character\n local Target = Args.Target\n local Direction = Character.HumanoidRootPart.CFrame.LookVector\n \n local HeavyEffect = VFX.heavy:Clone()\n HeavyEffect.CFrame = CFrame.new(Target.HumanoidRootpart.Position, Character.HumanoidRootPart.Position) * CFrame.Angles(0,math.rad(180),0)\n HeavyEffect.Parent = workspace.FX\n Auxillary.Emit(HeavyEffect.Attachment)\n task.delay(2,function()\n HeavyEffect:Destroy()\n end)\n \n task.spawn(function()\n local Params = RaycastParams.new()\n Params.FilterType = Enum.RaycastFilterType.Include\n Params.FilterDescendantsInstances = {workspace.Map}\n for i = 1, 15 do\n local Result = workspace:Raycast(Target.HumanoidRootpart.Position, Vector3.new(0,-8,0), Params)\n if Result then\n local Dust = VFX.Dust:Clone()\n Dust.CFrame = CFrame.new(Target.HumanoidRootpart.Position, Direction)\n Dust.Position = Result.Position\n Dust.Dust.Enabled = true\n Dust.Parent = workspace.FX\n Dust.Dust.Color = ColorSequence.new{ColorSequenceKeypoint.new(0,Auxillary.GetColorFromRay(Result)), ColorSequenceKeypoint.new(1, Auxillary.GetColorFromRay(Result))}\n task.delay(.15, function()\n Dust.Dust.Enabled = false\n task.wait(4)\n Dust:Destroy()\n end) \n end\n task.wait(.03)\n end\n end)\nend\n\nfunction FistCombat.PunchEffect(Args)\n local Punch = VFX.Punch:Clone()\n local Weld = Auxillary.Weld(Args.Character.HumanoidRootPart, Punch, CFrame.new(), CFrame.new())\n local WeldC0 = CFrame.new()\n \n if Args.Combo == 1 then\n WeldC0 = CFrame.new(1,.6,-1) * CFrame.Angles(0,0,math.rad(190)) * CFrame.Angles(0,math.rad(100), 0)\n elseif Args.Combo == 2 then\n WeldC0 = CFrame.new(1,.6,-1) * CFrame.Angles(0,0,math.rad(-10)) * CFrame.Angles(0,math.rad(100), 0)\n elseif Args.Combo == 3 then\n WeldC0 = CFrame.new(1,.6,-1) * CFrame.Angles(0,0,math.rad(200)) * CFrame.Angles(0,math.rad(100), 0)\n elseif Args.Combo == 4 then\n WeldC0 = CFrame.new(1,.6,-1) * CFrame.Angles(0,0,math.rad(-15)) * CFrame.Angles(0,math.rad(100), 0)\n else\n for i, Particle in pairs(Punch.Trail:GetChildren()) do\n local ClonedParticle = Particle:Clone()\n ClonedParticle.Parent = Punch.Trail\n ClonedParticle.EmissionDirection = Enum.NormalId.Right\n end\n end\n \n Auxillary.Emit(Punch.Trail)\n Weld.C0 = WeldC0\n Punch.Parent = workspace.FX\n \n task.spawn(function()\n for i = 1, 6 do\n Punch.Mesh.TextureId = PunchTextures[i]\n wait()\n end\n Punch:Destroy()\n end)\n \n TS:Create(Weld, TweenInfo.new(.3, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out, 0, false,0),{C0 = Weld.C0 * CFrame.Angles(0,math.rad(-100),0)}):Play()\nend\n\nfunction FistCombat:M1End()\n \nend\n\nfunction FistCombat:M2()\n if \n not self.CooldownManager:OnCooldown(ITEMNAME, &quot;Heavy&quot;)\n and self.Equipped\n and not self.Locked\n and not self.Blocking\n and not self.Status.Action\n and not self.StatusManager:GetStatus().Stun\n and not self.CooldownManager.inAction\n then\n self.Status.Action = true\n self.CooldownManager:SetAction(true)\n self.CooldownManager:AddCooldown(ITEMNAME,&quot;Heavy&quot;, 1.5)\n \n self.Character.Humanoid.WalkSpeed = 4\n \n --Move the Player\n local BV = Instance.new(&quot;BodyVelociy&quot;)\n BV.MaxForce = Vector3.new(999999,0,999999)\n BV.Velocity = self.Character.humanoidRootPart.CFrame.LookVector * 25\n BV.Parent = self.Character.HumanoidRootPart\n \n task.delay(.1, function()\n BV:Destroy()\n end)\n \n --Play the animation\n local Animation = self.Character.Humanoid.Animator:LoadAnimation(Animations[&quot;M5&quot;])\n Animation:Play()\n \n --Create the Effect\n local ReplicateArgs = {\n Module = &quot;FistCombat&quot;,\n Action = &quot;Puncheffect&quot;,\n Character = self.Character,\n Combo = 5,\n } \n FistCombat.PunchEffect(ReplicateArgs)\n ReplicateRemote:FireServer(ReplicateArgs)\n \n --Camera Shake\n self.CameraShaker:ShakeOnce(2,4,0.2,0.3)\n \n --Hitboxing\n local Params = OverlapParams.new()\n Params.FilterType = Enum.RaycastFilterType.Exclude\n Params.FilterDescendantsInstances = {workspace.Map, workspace.FX, self.Character}\n\n local HitList = {}\n local HB = workspace:GetPartBoundsInBox(self.Character:GetPivot() * CFrame.new(0,0,-4), Vector3.new(4,4,6), Params)\n for i, Part in pairs(HB) do\n if Part.Parent:FindFirstChild(&quot;Humanoid&quot;) and table.find(HitList, Part.Parent) == nil then\n table.insert(HitList, Part.Parent)\n \n local Highlight = Instance.new(&quot;Highlight&quot;, Part.Parent)\n Highlight.DepthMode = Enum.HighlightDepthMode.Occluded\n Highlight.FillColor = Color3.fromRGB(195,0,0)\n Highlight.FillTransparency = 1\n Highlight.OutlineTransparency = 1\n TS:Create(Highlight, TweenInfo.new(.4), {FillTransparency = 1}):Play()\n \n task.delay(.4, function()\n Highlight:Destroy()\n end)\n \n local ReplicateArgs = {\n Module = &quot;FistCombat&quot;,\n Action = &quot;HitEffect&quot;,\n Target = Part.Parent,\n Combo = 5,\n }\n FistCombat.HitEffect(ReplicateArgs)\n ReplicateRemote:FireServer(ReplicateArgs)\n \n local ReplicateArgs = {\n Module = &quot;FistCombat&quot;,\n Action = &quot;HeavyEffect&quot;,\n Target = Part.Parent,\n Character = self.Character\n }\n FistCombat.HeavyHitEffect(ReplicateArgs)\n ReplicateRemote:FireServer(ReplicateArgs)\n end\n end\n \n --Fire to Server\n local ServerArgs = {\n [&quot;Module&quot;] = &quot;FistCombat&quot;,\n [&quot;Action&quot;] = &quot;hit&quot;,\n [&quot;HitList&quot;] = HitList,\n [&quot;Knockback&quot;] = self.Character.HumanoidRootPart.CFrame.LookVector *75,\n [&quot;Combo&quot;] = 5,\n }\n \n ActionService:InvokeServer(ServerArgs)\n \n \n task.wait(.3)\n self.Character.Humanoid.WalkSpeed = 16\n self.Status.Action = false\n self.CooldownManager:SetAction(false)\n \n end\nend\n\nfunction FistCombat:M2End()\n \nend\n\nfunction FistCombat:F()\n if \n not self.Status.Blocking\n and not self.Status.Action\n and not self.Satusmanager:GetSatus().Stun\n and not self.CooldownManager.InAction\n then\n self.CooldownManager:SetAction(true)\n self.Character.humanoid.WalkSpeed = 4\n self.Status.Blocking = true\n self.Animations.Blocking = self.Character.Humanoid.Animator:LoadAnimation(Animations.Block)\n self.Animations.Blocking:Play()\n local ServerArgs = {\n [&quot;Modules&quot;] = &quot;fistCombat&quot;,\n [&quot;Action&quot;] = &quot;Block&quot;,\n }\n ActionService:InvokeServer(ServerArgs)\n end\nend\n\nfunction FistCombat:FEnd()\n local ServerArgs = {\n [&quot;Modules&quot;] = &quot;fistCombat&quot;,\n [&quot;Action&quot;] = &quot;Unblock&quot;,\n }\n ActionService:InvokeServer(ServerArgs)\n self.Character.humanoid.WalkSpeed = 16\n self.Status.Blocking = false\n self.Animations.Blocking:Stop()\n self.CooldownManager:SetAction(false)\nend\n\n\nfunction FistCombat:Unequip()\n self.Equipped = false\n self:FEnd()\nend\n\n\nfunction FistCombat:Lock()\n self.Locked = true\nend\n\nfunction FistCombat:Unlock()\n self.Locked = false\nend\n\nfunction FistCombat:UpdateCharacter()\n self.Character = self.User.Character\nend\n\nfunction FistCombat:Destryoy()\n setmetatable(self, nil)\n table.clear(self)\n table.freeze(self)\nend\n\nreturn table.freeze(FistCombat)\n</code></pre>\n<pre><code>local CooldownManager = {}\nCooldownManager.__index = CooldownManager\n\nlocal RF = game:GetService(&quot;ReplicatedFirst&quot;)\nlocal TS = game:GetService(&quot;TweenService&quot;)\nlocal RS = game:GetService(&quot;RunService&quot;)\n\nlocal Assets = RF.Assets.UI.Cooldown\n\nfunction CooldownManager.new(User, GUI)\n local self = setmetatable({}, CooldownManager)\n self.GUI = GUI\n self.CooldownList = {}\n self.CurrentItem = nil\n self.InAction = false\n \n return self\nend\n\nfunction CooldownManager:AddCooldown(ItemName, Action, Length)\n local Cooldown = self.CooldownList[ItemName][Action]\n Cooldown.OnCooldown = true\n Cooldown.StartTime = time()\n Cooldown.Length = Length\n\n self.GUI.Main.Cooldowns[Action].BackgroundColor3 = Color3.fromRGB(144, 80, 80)\n TS:Create(self.GUI.Main.Cooldowns[Action], TweenInfo.new(Length, Enum.EasingStyle.Linear), { BackgroundColor3 = Color3.fromRGB(144, 144, 144) }):Play()\n Cooldown.Times += 1\n\n task.spawn(function()\n local StartTime = Cooldown.StartTime\n Cooldown.Con = RS.RenderStepped:Connect(function()\n if time() - StartTime &gt;= Length then\n self.GUI.Main.Cooldowns[Action].Time.Text = &quot;0&quot; .. &quot;s&quot; self.GUI.Main.Cooldowns[Action].Time.Text = &quot;&quot;\n Cooldown.Con:Disconnect()\n -- Update CurrentTimes within the loop\n Cooldown.Times = Cooldown.Times - 1\n if Cooldown.Times == 0 then\n Cooldown.OnCooldown = false\n end\n else\n self.GUI.Main.Cooldowns[Action].Time.Text = &quot;&quot; .. (math.round((Length - (time() - StartTime)) * 10) / 10) .. &quot;s&quot;\n end\n end)\n end)\nend\n\nfunction CooldownManager:AddItem(ItemName, Actions)\n self.CooldownList[ItemName] = {}\n for i, v in pairs(Actions) do\n self.CooldownList[ItemName][v.Name] = {Times = 0, OnCooldown = false, Key = i}\n end\nend\n\nfunction CooldownManager:OnCooldown(ItemName, Action)\n return self.CooldownList[ItemName][Action].OnCooldown\nend\n\nfunction CooldownManager:LoadItem(ItemName)\n if self.CurrentItem ~= nil then\n for i, Cooldown in pairs(self.CooldownList[self.CurrentItem]) do\n if Cooldown.Con then\n Cooldown.Con:Disconnect()\n end\n end\n end\n \n for i, v in pairs(self.GUI.Main.Cooldowns:GetChildren()) do\n if v:IsA(&quot;GuiBase&quot;) then\n v:Destroy()\n end\n end\n\n for i, Cooldown in pairs(self.CooldownList[ItemName]) do\n local UI = Assets.CooldownHolder:Clone()\n UI.LayoutOrder = Cooldown.LayoutOrder\n UI.Key.Text = Cooldown.Key\n UI.Time.Text = &quot;&quot;\n UI.ActionName.Text = i\n UI.Name = i\n UI.Parent = self.GUI.Main.Cooldowns\n UI.BackgroundColor3 = Color3.fromRGB(144,144,144)\n \n if Cooldown.StartTime then\n if time() - Cooldown.StartTime &lt; Cooldown.Length then\n self:AddCooldown(ItemName, i, Cooldown.Length - (time() - Cooldown.StartTime))\n else\n Cooldown.OnCooldown = false\n end\n end\n \n end\n self.CurrentItem = ItemName\nend\n\nfunction CooldownManager:SetAction(InAction)\n self.InAction = InAction\nend\n\n\nreturn CooldownManager\n\n</code></pre>\n<p>When it came out the first time I tried to comment on the code and I saw that it was not the only one, I checked the references but they are in the right place, I have been going through the code for many hours now, I am blind xD</p>\n"^^ . . "qt-creator"^^ . "JavaScript's proxy.apply handler in Lua"^^ . . . . "0"^^ . . "1"^^ . . . "0"^^ . . . . "1"^^ . "How to inherit both methods and metamethods in Lua"^^ . . . . . "Lua Debug Hook line events not catching all lines"^^ . . "You can create an "extend" function (e.g. [this one](https://github.com/jonstoler/class.lua/blob/master/class.lua)) to copy metamethods from the super class. Anyway you need to do this step."^^ . "-3"^^ . . . "2"^^ . . . . . . "nodemcu"^^ . "1"^^ . "1"^^ . . "1"^^ . . "1"^^ . . "0"^^ . . . . "0"^^ . . "1"^^ . . . "<blockquote>\n<p>When I'm going to compile &amp; dump, should I bind C functions before compile?</p>\n</blockquote>\n<p>No, just like how you can run luac to compile a single lua script.</p>\n<blockquote>\n<p>When I'm going to use the precompiled binary, do I need to bind C functions again, before loading the binary?</p>\n</blockquote>\n<p>Yes, but not before loading, but before running, so the only difference is that you can save compilation time.</p>\n"^^ . "Manhattan Voronoi Diagram: Resolving Ties When Sites Are on the Same Diagonal"^^ . "Abort script with same command as started with Lua in Logitech G HUB"^^ . "Its to avoid cyclical dependencies of shared ptr. But I dont get the problem Lua has with it. I'm completely new to Lua."^^ . . . . . "<p>Trying to load modules based on a value in a variable. Is this possible?</p>\n<pre><code>local moduletoload = &quot;login&quot; \nlocal mod_action = require moduletoload\n</code></pre>\n<p>Thanks</p>\n"^^ . . . . . "0"^^ . "IUPLua, can't change button color and can't add Image"^^ . . . "1"^^ . "0"^^ . "getenv"^^ . "visual-studio-code"^^ . . . "<p>I'm learning Lua, and set up a script in the Logitech software when I hit mouse button 9. I would like to abort this script when hitting the button again while running, but after multiple attempts, I haven't figured out how to. This is simply what I have skipping over the long string:</p>\n<pre><code>function OnEvent(event, arg)\n if event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 9 then\n\n--Skipping over string \n\n end\nend\n</code></pre>\n<p>I've tried setting global flags and a few other solutions but I can't seem to get it right.</p>\n"^^ . . "0"^^ . "Using love2d timer, bug reporting 'Error hump/timer.lua:78: attempt to index local 'self' (a number value) '"^^ . . "0"^^ . . . . "1"^^ . . "hardware"^^ . . . . . "0"^^ . . "3"^^ . . . . . "3"^^ . "What you could do is instead of wrapping in parentheses for readability, wrap it in an unpack. i.e. a, b = unpack({ \\n multiReturn() \\n}), this will allow you to split the function call onto a new line while keeping all arguments"^^ . . . . "0"^^ . . "1"^^ . "<p>Found the root cause.</p>\n<p>Redisson was adding extra characters while encoding <a href="https://redisson.pro/docs/data-and-services/data-serialization/?utm_source=chatgpt.com" rel="nofollow noreferrer">https://redisson.pro/docs/data-and-services/data-serialization/?utm_source=chatgpt.com</a></p>\n<p>Plain text codec works</p>\n<pre><code>config.setCodec(new StringCodec());\n config.useSingleServer()\n .setAddress(redisURL)\n .setConnectionPoolSize(30);\n RedissonClient redisson = Redisson.create(config);\n</code></pre>\n"^^ . . "0"^^ . "@gsck you are right, I can also do `a, b =\\ntext\\n:find( ...etc` . So pharenteses are not needed for code readability."^^ . "nope still not working"^^ . "<p>I'm trying to code a turret, shooting enemies when it gets in the range of the turret, and the code sometimes breaks giving me the error <code>Script:31: attempt to index nil with 'Humanoid'</code>\nThis happens rarely and only does so when a zombie dies.\nNot only that but it seems some of the bullets created seem to make way more damage than they really should.</p>\n<pre><code>head = script.Parent.PrimaryPart\n\nlocal function triggershoot(part)\n local beam = Instance.new(&quot;Part&quot;,script.Parent)\n\n beam.Anchored = true\n beam.CanCollide = false\n beam.Shape = &quot;Block&quot;\n beam.CFrame = head.CFrame\n beam.Size = Vector3.new(0.5,0.5,0.5)\n beam.Material = &quot;Plastic&quot;\n beam.BrickColor = BrickColor.new(&quot;Dark taupe&quot;)\n\n beam.CFrame = CFrame.lookAt(head.Position,part.Position)\n for i = 0, 50, 1 do\n wait()\n beam.CFrame = beam.CFrame + beam.CFrame.LookVector \n beam.Touched:Connect(function(plr)\n if plr.Parent:HasTag(&quot;enemy&quot;) then\n plr.Parent.Humanoid:TakeDamage(3)\n beam:Destroy()\n end\n end)\n end\nend\n\nwhile true do\n wait()\n local parts = workspace:GetPartsInPart(script.Parent.zone)\n for _, part in pairs(parts) do\n if part:HasTag(&quot;enemy&quot;) and part.Parent.Humanoid.Health &gt; 0 then\n\n local update = CFrame.lookAt(head.Position,part.Position)\n head.CFrame = update\n coroutine.wrap(triggershoot)(part)\n wait(1)\n end\n end\nend\n</code></pre>\n"^^ . . . . . . . . . . . . "1"^^ . . . . "1"^^ . "1"^^ . "0"^^ . . . . . "how could decode the "LOL!xxx" string like this. the lua code in vm env"^^ . . . . . "Lua: match pattern till the last digit occurence"^^ . "<p>Okay, thanks to Dmitry Meyer for helping me out. I wasn't thinking clearly about the simple example (which wasn't sending anything but just trying to trigger a large timeout). Once I fixed that, I was able to modify the example to something closer to what I was looking for. So, the modified location and <code>lua</code> script is this:</p>\n<pre><code>location /foo {\ncontent_by_lua_block {\n local tcp=ngx.socket.tcp()\n ngx.say(ngx.now())\n ngx.flush()\n tcp:connect(&quot;127.0.0.1&quot;, 12000)\n ngx.say(&quot;connect() did not block&quot;)\n ngx.flush()\n tcp:send('{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;method&quot;:&quot;get.identifier&quot;,&quot;id&quot;:1}\\r\\n')\n local data, err = tcp:receive()\n ngx.say(&quot;receive() did not block: data = &quot;, data)\n if err then\n ngx.say(&quot;error = &quot;, err)\n end\n ngx.flush()\n ngx.update_time()\n ngx.say(ngx.now())\n ngx.flush()\n}\n</code></pre>\n<p>where port 16000 is the port of my backend JSON-RPC process. I triggered the location with <code>curl</code> and got what I was hoping for:</p>\n<pre><code>rlott@1022rdnote04:~/testing/MAG-9214/njs-exps$ curl -k https://192.168.56.220/foo\n1741016175.722\nconnect() did not block\nreceive() did not block: data = {&quot;id&quot;:1,&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;result&quot;:&quot;94e2741e-217f-45c3-902c-4883864fd834&quot;}\n1741016175.723\n</code></pre>\n<p>The main issue with the TCP FIN not and the hang was not <code>lua</code> related but JSON-RPC related. My server needed the correct ending delimiter (i.e. <code>\\r\\n</code>) and was waiting for it prior to sending the response back.</p>\n"^^ . "0"^^ . "markdown"^^ . . . "As explain in [doc](https://premake.github.io/docs/Tokens/#path-in-commands), path in command should be enclosed by `%[..]`"^^ . "escaping"^^ . . . . "mediawiki"^^ . . . "<p>I have got a server written in C# dotnet and am trying to add Scripting Integration Lua to it. My issue is trying to add SQLite and MySQL. I'm using</p>\n<p><code>luarocks install luasql-sqlite3</code> to add it but it's throwing an error: <br><br></p>\n<blockquote>\n<p>Error: Could not find expected file sqlite3.h for SQLITE -- you may have to install SQLITE in your system and/or set the SQLITE_DIR variable</p>\n</blockquote>\n<p><a href="https://i.sstatic.net/3BOEEElD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3BOEEElD.png" alt="enter image description here" /></a></p>\n<p>I've added <code>SQLITE_DIR</code> in Environment Variable to <code>C:\\sqlite</code>, inside that folder contains sqlite3.h, sqlite3.def, sqlite3.dll, and other sqlite3 files, and if I write <code>sqlite3</code> in the CMD it runs SQLite! <br></p>\n<p>CMD showing SQLITE running through CMD using sqlite3\n<a href="https://i.sstatic.net/GPHIYnhQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/GPHIYnhQ.png" alt="enter image description here" /></a>\n<br><br>\nNote that I tried using<br>\n<code>luarocks install luasql-sqlite3 SQLITE_VAR=&quot;C:/sqlite&quot;</code> <br>\nAdd the sqlite3 files to <code>LUA/5.1/include</code> <br></p>\n<p>I want to be able to use MySQL and SQLite in Lua within the C# project that I'm doing.</p>\n"^^ . . . . "3"^^ . "0"^^ . "0"^^ . "1"^^ . . . . . . "1"^^ . "In Neovim, is there a way of set a keybind that allows to hold <leader> and press another key multiple times?"^^ . "Platform-neutral line ending for io.stderr::write"^^ . "<p>The solution, <a href="https://stackoverflow.com/questions/25614911/osm-data-slightly-distorted-flat-projection/">Mercator projection</a>:</p>\n<pre class="lang-lua prettyprint-override"><code>local function mercatorY(lat)\n local radLat = math.rad(lat)\n return math.deg(math.log (math.tan(radLat) + 1/math.cos(radLat)))\nend\n</code></pre>\n<p>And it will be called as</p>\n<pre class="lang-lua prettyprint-override"><code> local x = tonumber(nodeStr:match('lon=&quot;(.-)&quot;')) -- X\n local y = mercatorY(tonumber(nodeStr:match('lat=&quot;(.-)&quot;'))) -- new code\n</code></pre>\n<p>and</p>\n<pre class="lang-lua prettyprint-override"><code> local minY = mercatorY(tonumber(minLat))\n local maxY = mercatorY(tonumber(maxLat)) \n</code></pre>\n"^^ . . . "Ah ok I missed that, thank you very much. Ill try this."^^ . . "4"^^ . . . "0"^^ . . . . "Windows pipe hangs when fread on it"^^ . "0"^^ . . . "0"^^ . . . . . "Lua: Toggling the primary click in G Hub doesn't work"^^ . . . . . . . . "3"^^ . . "0"^^ . "1"^^ . . . . "1"^^ . "0"^^ . "1"^^ . . "<p>I am experiencing a very strange error in Lua/Love2D code where for-loop index exceeds the maximum limit. The initial problem arose from Geom.segmentSegmentIntersection() having passed nil as argument and throwing an error of attempt to perform arithmetic on nil. As I couldn't to narrow down the cause I have added extra if with logging to detect this situation. To my surprise it seems that loop iterator <code>i</code> somehow can exceed loop limit <code>vertexCount</code>. The code runs on a single thread without coroutines, and all <code>polygon</code> tables are not modified once object is created. Problem appears at random and for some reason I cannot recreate it, even with same segment coordinates and the exact same polygon.</p>\n<p>I could keep the check and break the loop forcefully but that just seems wrong.</p>\n<p>Here's the code and caught output:</p>\n<pre class="lang-lua prettyprint-override"><code>-- Checks if a line segment intersects with a polygon.\n-- Parameters:\n-- x, y: Starting point coordinates of the segment.\n-- x2, y2: Ending point coordinates of the segment.\n-- polygon: A table of coordinates defining the polygon as a series of points {x1, y1, x2, y2, ..., xn, yn}.\n-- The polygon is assumed to be closed, where the last point connects back to the first point.\n-- Returns:\n-- intersects: A boolean value; true if the segment intersects the polygon, false otherwise.\n-- ix, iy: Coordinates of the intersection point, if an intersection occurs.\nGeom.isIntersectionSegmentPolygon = function(x, y, x2, y2, polygon)\n -- TODO: sometimes p1x passed to segmentSegmentIntersection is nil for some reason, this should allow to debug this\n Geom._ix = x\n Geom._iy = y\n Geom._ix2 = x2\n Geom._iy2 = y2\n Geom._ipolygon = polygon\n\n local vertexCount = #polygon\n local p0x = polygon[vertexCount - 1]\n local p0y = polygon[vertexCount]\n \n for i = 1, vertexCount, 2 do\n local p1x = polygon[i]\n local p1y = polygon[i + 1]\n -- TODO remove this\n if p1x==nil or p1y==nil or i&gt;vertexCount then\n fail(&quot;isIntersectionSegmentPolygon error, index&quot;, i, &quot;; vertexCount&quot;, vertexCount)\n fail(&quot;p1x&quot;,p1x)\n fail(&quot;p1y&quot;,p1y)\n log(x, y, x2, y2)\n log(&quot;polygon size:&quot;,#polygon,&quot;and elements:&quot;)\n for ii=1,vertexCount do log(ii,polygon[ii]) end\n logtab(polygon)\n for _,a in pairs(Actor.actors) do if a.polygon==Geom._ipolygon then log(a.id,a.name,a.__type) end end\n fail(&quot;----&quot;)\n end\n local ix, iy, intersects = Geom.segmentSegmentIntersection(x, y, x2, y2, p0x, p0y, p1x, p1y)\n if intersects then\n return true, ix, iy\n end\n p0x = p1x\n p0y = p1y\n end\n return false, nil, nil\nend\n</code></pre>\n<p>the output</p>\n<pre><code>isIntersectionSegmentPolygon error, index 9 ; vertexCount 8\np1x nil\np1y nil\n-7359.7282151011 -4523.1013367583 -7427.732922483 -4587.5428777841\npolygon size: 8 and elements:\n1 -7478.3615612719\n2 -4713.7197332234\n3 -7421.2353293006\n4 -4588.2516139988\n5 -7381.6384387281\n6 -4606.2802667766\n7 -7438.7646706994\n8 -4731.7483860012\n{-7478.36156,-4713.71973,-7421.23533,-4588.25161,-7381.63844,-4606.28027,-7438.76467,-4731.74839}\n8198 nil house\n----\n----\n</code></pre>\n"^^ . . . . "0"^^ . . "0"^^ . . "Envoy JWT Auth Filter Fails When Placed After Lua Filter"^^ . . "1"^^ . "1"^^ . . . "racing"^^ . "premake"^^ . . "If I run [lua5_1_5_linux_64_generic]$ ./lua, I get Segmentation fault."^^ . . . "1"^^ . . . "0"^^ . . . . . . "Thanks so much! Such a small thing which kept me busy for days...! Thanks a lot :)"^^ . "Layers display and movement in Love2D (Lua)"^^ . . "0"^^ . "1"^^ . . . . "<p>I'm using Pandoc to convert a Latex project to Markdown (to display it via Dokusaurus).\nI would like to define certain sections inside the Latex text that are ignored when compiled as a Pdf, but are kept when converted to markdown</p>\n<p>I'm thinking of something like this:</p>\n<pre class="lang-tex prettyprint-override"><code>% This config is only relevant for dokusuarus and must not be present in the Pdf\n\\begin{markdown-only}\n---\ntitle: Foobar42\n---\n\\end{markdown-only}\n\n\\section{Section 1}\nLorem Ipsum dolor sit amet.\n</code></pre>\n<p>Resulting Latex PDF:</p>\n<blockquote>\n<p><strong>Section 1</strong></p>\n<p>Lorem Ipsum dolor sit amet.</p>\n</blockquote>\n<p>Resulting markdown after conversion with pandoc:</p>\n<pre class="lang-md prettyprint-override"><code>---\ntitle: Foobar42\n---\n\n# Section 1\nLorem Ipsum dolor sit amet.\n</code></pre>\n<p>How can I achieve this?\nI've played around with custom Latex commands and pandoc Lua-Filters. But it seems pandoc is too smart and ignores everything that would not end up in the Latex pdf.</p>\n"^^ . . "How to delete clones - Roblox Studio?"^^ . "4"^^ . "0"^^ . "0"^^ . "Too broad. What is the c# code you are having trouble converting?"^^ . "Luarocks install luafilesystem: lua.lib does not match Lua version"^^ . "Logitech G HUB Lua toggle script"^^ . "cl"^^ . . "Polyline Curvature Combs in Lua, Love2D"^^ . . "2"^^ . . . . . "2"^^ . "3"^^ . "Why is this post build command not working when trying to copy the SDL3.dll to the same folder as the exe (premake)"^^ . "Could you please add an example that shows what exactly you are trying capture around {}, and if allman-style, the relevant context on the line above?"^^ . . "1"^^ . "<p><code>table.insert</code> needs a value to insert into the table, but <code>[t_header[j]] = t_line[j]</code> is not a value; this looks a like a misapplication of table constructor syntax. In any case this is a syntax violation: you can only use table constructor syntax in a table constructor. It sort of <em>looks</em> like an assignment statement, which might confuse someone who comes from C which has assignment expressions which evaluate to the value of the assignment.</p>\n<p>The OP code could most simply be fixed by changing:</p>\n<pre class="lang-lua prettyprint-override"><code>table.insert(t_row, [t_header[j]] = t_line[j])\n</code></pre>\n<p>to:</p>\n<pre class="lang-lua prettyprint-override"><code>t_row[t_header[j]] = t_line[j]\n</code></pre>\n<p>This sets the fields of <code>t_row</code> to the right values before inserting the rows into the <code>t_target</code> table. There is no need for <code>table.insert</code> here. To complete the fix, the line <code>local t_row = {}</code> would also need to be moved inside the outer loop so that a new row table is created for each line.</p>\n<p>Still, the design of the posted code seems a little more complicated than it needs to be. Here is an adjusted version that uses the OP posted <code>split</code> function. The <code>parse_csv</code> function parses an input file into a table. Here the iterator returned by <code>io.lines</code> is saved in <code>lines</code> and called once to get the headers first, then the iterator is called in a loop to get the remainder of the lines from the file.</p>\n<p>I have added a simple <code>csv_dump</code> function to print the contents of the parsed csv table.</p>\n<pre class="lang-lua prettyprint-override"><code>function parse_csv(f)\n local parsed_csv = {}\n local lines = io.lines(f)\n local labels = split(lines(), &quot;,&quot;)\n for line in lines do\n local t_line = split(line, &quot;,&quot;)\n local t_row = {}\n for k, v in ipairs(t_line) do\n t_row[labels[k]] = v\n end\n table.insert(parsed_csv, t_row)\n end\n return parsed_csv\nend\n\nfunction csv_dump(t)\n for i, row in ipairs(t) do\n io.write(i)\n io.write(&quot; { &quot;)\n for k, v in pairs(row) do\n io.write(k, &quot;=&quot;, v, &quot; &quot;)\n end\n print(&quot;}&quot;)\n end\nend\n</code></pre>\n<p>Sample usage:</p>\n<pre class="lang-none prettyprint-override"><code>&gt; parsed = parse_csv('csv_test.txt')\n&gt; csv_dump(parsed)\n1 { &quot;col3&quot;=&quot;6.5&quot; &quot;col2&quot;=&quot;ab&quot; &quot;col1&quot;=&quot;1&quot; }\n2 { &quot;col3&quot;=&quot;9.7&quot; &quot;col2&quot;=&quot;df&quot; &quot;col1&quot;=&quot;4&quot; }\n</code></pre>\n"^^ . . . "2"^^ . "0"^^ . "0"^^ . "lambda"^^ . . "0"^^ . "game-development"^^ . "2"^^ . . . "Try https://onecompiler.com/lua/43azfnehv"^^ . "0"^^ . "geometry"^^ . . . . . . . "1"^^ . "0"^^ . . "1"^^ . "-2"^^ . . . "0"^^ . "0"^^ . . . . . . . "Overwritten? Do you mean *overridden?*"^^ . . "for matching floating value like `16.9` use pattern `([%d%.]+)` , square brackets mean a set of characters, in our case possibly consisting of numbers and dots"^^ . "<p>I'm very new to using the <code>local sock = ngx.socket.tcp()</code> call that is provided by the nginx lua packages provided on Ubuntu Noble (i.e. the <code>libnginx-mod-http-lua</code> package). I've been able to get some success in opening a socket and writing out some data. But, based on my <code>tcpdump</code> analysis and other cues, the <code>sock:send()</code> operation works but I don't get any data back. My current theory is that <code>nginx</code> somehow prevents the ACK from the <code>sock:connect()</code> from being received by the <code>lua</code> block.</p>\n<p>In order to simplify things, I decided to reproduce this <a href="https://github.com/openresty/lua-nginx-module/issues/1141#issue-251245487" rel="nofollow noreferrer">simple example</a> to make sure that I'm doing things correctly. When I make up my own version of this, it hangs on the <code>receive()</code> call.</p>\n<p>Here is my setup:</p>\n<ul>\n<li>Ubuntu Noble</li>\n<li>Relevant <code>lua</code> packages:\n<ul>\n<li>libluajit2-5.1-2: 2.1-20230410-1build1</li>\n<li>libluajit2-5.1-common: 2.1-20230410-1build1</li>\n<li>libnginx-mod-http-lua: 1:0.10.26-2</li>\n<li>libnginx-mod-http-ndk: 1:0.3.3-1build1</li>\n<li>libnginx-mod-stream-js: 0.8.2-1ubuntu1</li>\n<li>lua-resty-core: 0.1.28-2</li>\n<li>lua-resty-lrucache: 0.13-10</li>\n</ul>\n</li>\n<li><code>nginx</code> version: 1.24.0-2ubuntu7.1</li>\n<li><code>nginx</code> and <code>nc</code> are running on a VirtualBox VM, <code>curl</code> is being run on my main development computer outside the VM.</li>\n</ul>\n<p>Here's the code snippets I'm using and their output:</p>\n<p><code>nginx</code> test location:</p>\n<pre><code>location /foo {\n content_by_lua_block {\n local tcp=ngx.socket.tcp()\n ngx.say(ngx.now())\n ngx.flush()\n tcp:connect(&quot;127.0.0.1&quot;, 8000)\n ngx.say(&quot;connect() did not block&quot;)\n ngx.flush()\n local data, err = tcp:receive(1)\n ngx.say(&quot;receive() did not block&quot;)\n ngx.say(err)\n ngx.flush()\n ngx.update_time()\n ngx.say(ngx.now())\n ngx.flush()\n }\n}\n</code></pre>\n<p><code>curl</code> invocation (which I Ctrl+C b/c it hangs):</p>\n<pre><code>rlott@1022rdnote04:~/testing$ curl -k https://192.168.56.220/foo\n1740693455.69\nconnect() did not block\n^C\nrlott@1022rdnote04:~/testing$\n</code></pre>\n<p><code>nc</code> running on port 8000 (doing nothing):</p>\n<pre><code>etservice@noble:~$ nc -l 8000 -k\n\n</code></pre>\n<p>Errors I see in <code>/var/log/nginx/error.log</code> (eventually):</p>\n<pre><code>2025/02/27 16:58:35 [error] 608728#608728: *101 lua tcp socket read timed out, client: 192.168.56.1, server: , request: &quot;GET /foo HTTP/1.1&quot;, host: &quot;192.168.56.220&quot;\n2025/02/27 16:58:35 [info] 608728#608728: *101 client 192.168.56.1 closed keepalive connection\n</code></pre>\n<p>So, the $1M question is what is the secret to using <code>nginx.socket.tcp()</code> successfully in this way?</p>\n<p>Again, I did another example where I sent a JSON-RPC message to one of my services and <code>tcpdump</code> shows me that the data got there, but that it hangs on the <code>sock:receive()</code>. The only difference between my message and a bonafide client sending the same message seems to be something having to do with the &quot;Conversation completeness&quot; (taken from my Wireshark analysis). In the Wireshark analysis, the only 2 things that I could see that were different were:</p>\n<ol>\n<li>My message didn have a TCP FIN flag set</li>\n<li>The bonafide client's JSON-RPC message had a larger data size than mine.</li>\n</ol>\n<p>So, I'm kinda stumped. Any insight would be appreciated.</p>\n"^^ . . "Keep a copy of the spawning block in ReplicatedStorage and write a spawning script in ServerScriptService that clones the block into the Workspace"^^ . . . "0"^^ . "0"^^ . . . . "0"^^ . "HI. i had a part like that what you mean. It work perfectly. Didnt work only script which turn it on"^^ . . "0"^^ . . . . "<p>I'm trying to detect if any part of a vehicle model overlaps an objective marker. My script currently uses a box cast to check if the object (which has &quot;vehicle&quot; in its description) is on the objective:</p>\n<pre><code>local hits = Physics.cast({\n origin = center,\n direction = Vector(0,1,0),\n type = 3, -- Box cast\n size = Vector(objectiveRadius * 2, verticalLimit, objectiveRadius * 2),\n orientation = Vector(0,0,0),\n max_distance= 0,\n debug = false\n})\n\nfor _, hit in ipairs(hits) do\n local obj = hit.hit_object\n if obj ~= self then\n local desc = (obj.getDescription() or &quot;&quot;):lower()\n if desc:find(&quot;vehicle&quot;) then\n local ocVal = parseOC(obj)\n local owner = obj.getGMNotes() or &quot;&quot;\n -- assign ocVal to Red/Blue, etc.\n end\n end\nend\n</code></pre>\n<p>However, this cast only checks against the object’s collider. I need the cast to use the object's actual mesh so that any part of the visual model (for example, an extended wing or turret) counts as overlapping the objective—even if the collider doesn't extend that far.\nIs there any method in Tabletop Simulator to perform a Physics.cast against an object's rendered mesh rather than its collider? If not, what are the alternatives to achieve this behavior?</p>\n"^^ . . "0"^^ . . . "0"^^ . "1"^^ . "<p>I have this function that takes a string (s) and returns a table depending on what I entered.</p>\n<pre><code>function String2Faction(s)\n if s == &quot;Nomads&quot; then\n return Faction_Nomads\n elseif s == &quot;Bandits&quot; then\n return Faction_Bandits\n elseif s == &quot;Military&quot; then\n return Faction_Military\n elseif s == &quot;WEM&quot; then\n return Faction_WEM\n elseif s == &quot;ECK&quot; then\n return Faction_ECK\n end\nend\n</code></pre>\n<p>Now, that's certainly a solution! But I was wondering if there was a different solution that wasn't tedious and annoying?</p>\n<p>Edit, Solved: You can do everything above by simply writing</p>\n<pre><code>local options = {\n [&quot;A&quot;] = table1,\n [&quot;B&quot;] = table2,\n [&quot;C&quot;] = table3\n}\nreturn options[variable]\n</code></pre>\n<p>very easy</p>\n"^^ . "1"^^ . "1"^^ . . . . . . . . . . . . . "0"^^ . "1"^^ . "0"^^ . "pls don't just use any pre config like lazy for nvim, neovim is more than just an editor. try to explore yourself. there is amazing plugin environment for neovim so explore them rather than just copying and pasting someone's pre config"^^ . . . "lua"^^ . . . "<p>Source code used here: <a href="https://github.com/omrilevia/lua-iso" rel="nofollow noreferrer">https://github.com/omrilevia/lua-iso</a></p>\n<p>I've been playing around mapping screen coordinates to isometric coordinates and vice versa, following this tutorial: <a href="https://pikuma.com/blog/isometric-projection-in-games" rel="nofollow noreferrer">https://pikuma.com/blog/isometric-projection-in-games</a></p>\n<p>I have some basic vec2 and mat2 classes which know how to do dot products, scaling, transforms, and inverses:</p>\n<pre><code> Vec2 = Object:extend()\n \n function Vec2:new(x, y)\n self.x = x\n self.y = y\n end\n \n function Vec2:dot(vec)\n return self.x * vec.x + self.y * vec.y\n end\n \n function Vec2:scale(scalar)\n self.x = scalar * self.x\n self.y = scalar * self.y\n return self\n end\n</code></pre>\n<p>And the Mat2 class: (sorry for the terminology, I come from Java world)</p>\n<pre><code>Mat2 = Object:extend()\n\nfunction Mat2:new(vec1, vec2)\n self.vec1 = vec1\n self.vec2 = vec2\nend\n\nfunction Mat2:transform(vec)\n local xPrime = self.vec1:dot(vec)\n local yPrime = self.vec2:dot(vec)\n\n return Vec2(xPrime, yPrime)\nend\n\nfunction Mat2:scale(scalar)\n self.vec1 = self.vec1:scale(scalar)\n self.vec2 = self.vec2:scale(scalar)\n return self\nend\n\nfunction Mat2:inverse()\n --[[d -b]]\n --[[-c a]] \n return Mat2(Vec2(self.vec2.y, -self.vec1.y), Vec2(-self.vec2.x, self.vec1.x))\n :scale(1 / ((self.vec1.x * self.vec2.y) - (self.vec1.y * self.vec2.x)))\nend\n</code></pre>\n<p>Here is the &quot;Iso&quot; class I use to transform from a game coordinate to a screen coord:</p>\n<pre><code>Iso = Mat2:extend()\n\nfunction Iso:new(tileWidth, tileHeight)\n Iso.super:new(Vec2(1/2, -1/2):scale(tileWidth), Vec2(1/2, 1/2):scale(tileHeight))\nend\n\nfunction Iso:transform(vec)\n return Iso.super:transform(vec)\nend\n\nfunction Iso:scale(scalar)\n return Iso.super:scale(scalar)\nend\n\nfunction Iso:inverse()\n return Iso.super:inverse()\nend\n</code></pre>\n<p>That's the math stuff. As far as drawing tiles on the screen, I have a &quot;Grid&quot; class which arranges tiles in a 2d table, and tells them their game coordinate like (1, 1) up to (10, 10).</p>\n<p>The tiles themselves know how to draw themselves on the screen:</p>\n<pre><code>require &quot;src.model.GameObject&quot;\nrequire &quot;src.math2d.iso&quot;\nTile = GameObject:extend()\n\nfunction Tile:new(texId, pos)\n --texId 7 is broken\n if texId == 6 then\n texId = texId + 1\n end\n local constants = Constants()\n Tile.super.new(self, texId, pos)\n self.tilePath = constants.TILE_ASSET_PATH .. &quot;tile-&quot; .. texId .. &quot;.png&quot;\n print(self.isDirty)\nend\n\nfunction Tile:load()\n self.image = love.graphics.newImage(self.tilePath)\nend\n\nfunction Tile:update(dt)\nend\n\nfunction Tile:draw()\n local constants = Constants()\n -- transform the tile's position to isometric coords\n local zOffset = constants.MAX_TILE_HEIGHT - self.image:getHeight()\n\n local iso = Iso(constants.TILE_WIDTH, constants.TILE_HEIGHT)\n local vecIso = iso:transform(self.pos)\n print(iso:inverse():transform(vecIso).x)\n\n love.graphics.draw(self.image, constants.X_OFFSET + vecIso.x, constants.Y_OFFSET + vecIso.y + zOffset)\nend\n</code></pre>\n<p>All of this works nicely according to the tutorial, and I'm able to get a nice looking tile grid:\n<a href="https://i.sstatic.net/wjx63XwY.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wjx63XwY.png" alt="enter image description here" /></a></p>\n<p>I added a function to turn the given screen coordinate back into a game coordinate by taking the screen coordinate, subtracting off the x and y offset (not sure about the effect of the zOffset by the varying image heights), and transforming that vector by the inverse of the Iso matrix:</p>\n<pre><code> function Screen:getGameCoordAt(pos)\n local constants = Constants()\n -- pos is isometric screen cord.\n -- perform inverse transform on pos, and reverse x and y offsets. \n local iso = Iso(constants.TILE_WIDTH, constants.TILE_HEIGHT)\n return iso:inverse():transform(Vec2(pos.x - constants.X_OFFSET, pos.y - constants.Y_OFFSET))\nend\n</code></pre>\n<p>Using this function, during the Grid update, I check to see if a current game coordinate is highlighted, and if so, I try to turn off that tile. In order to get the current tile that's highlighted, I take a math.floor() of transformed screen coordinates.\nThe interesting thing is, I only get it to work nicely if I subtract 1 from the returned x game coordinate:</p>\n<pre><code>function Grid:update(dt)\n local constants = Constants()\n local mouse = Mouse()\n local screen = Screen()\n local gameCoord = screen:getGameCoordAt(mouse:getPos())\n local gridCoord = Vec2(math.floor(gameCoord.x) - 1, math.floor(gameCoord.y))\n if gridCoord.x &gt;= 1 and gridCoord.x &lt;= constants.GRID_SIZE then\n self.highlighted = self.grid[gridCoord.x][gridCoord.y]\n end\nend\n</code></pre>\n<p>Example:\n<a href="https://i.sstatic.net/Hbw0P8Oy.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Hbw0P8Oy.png" alt="enter image description here" /></a></p>\n<p>The origin seems to begin at (2, 1) rather (1, 1). I tried removing the code which adds in the height of the tiles, but it didn't seem to do the trick. Understandably this could be what's causing it since I'm only subtracting the xOffset and yOffset from the screen coord, but not the zOffset, since I don't know what the zOffset of the current tile is.</p>\n<p>So my question is, why? Subtracting 1 from the transformed and floored screen coordinate beautifully matches the current tile's game coordinate but I'm having trouble wrapping my head around the cause.</p>\n<p>Edit:\nI forgot to realize that images in love are drawn in such a way where their position is defined by the left corner of the image. I played around with constant image height tiles to remove the zOffset variability, and when I draw the tiles, I just smidge them to the left by tileWidth/2, so the origin of the game coordinates begins at the &quot;tip&quot; of the isometric diamond:</p>\n<pre><code>function Tile:draw()\n local constants = Constants()\n -- transform the tile's position to isometric coords\n local zOffset = constants.MAX_TILE_HEIGHT - self.image:getHeight()\n\n local iso = Iso(constants.TILE_WIDTH, constants.TILE_HEIGHT)\n local vecIso = iso:transform(self.pos)\n assert(iso:inverse():transform(vecIso).x == self.pos.x)\n assert(iso:inverse():transform(vecIso).y == self.pos.y)\n\n love.graphics.draw(self.image, constants.X_OFFSET + vecIso.x - constants.TILE_WIDTH/2, constants.Y_OFFSET + vecIso.y)\nend\n</code></pre>\n<p>I also added in some asserts to verify the transform is in fact working. Now when hovering over the tip of an isometric tile, it will map neatly the tile's game coordinate:\n<a href="https://i.sstatic.net/TpIi6rTJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TpIi6rTJ.png" alt="enter image description here" /></a></p>\n<p>Extending further, I was able to get it to work pretty well with images of different heights offsetting the screen coordinate's y position by the difference between the tile height and the max image height:</p>\n<pre><code>function Screen:getGameCoordAt(pos)\n local constants = Constants()\n -- pos is isometric screen cord.\n -- perform inverse transform on pos, and reverse x and y offsets. \n local iso = Iso(constants.TILE_WIDTH, constants.TILE_HEIGHT)\n local transformed = iso:inverse():transform(Vec2(pos.x - constants.X_OFFSET, pos.y - constants.Y_OFFSET - \n constants.MAX_TILE_HEIGHT + constants.TILE_HEIGHT))\n return Vec2(transformed.x, transformed.y)\nend\n</code></pre>\n<p>It's not perfect, but it highlights tiles pretty well. Going forward, it looks like it makes the most sense to use images of fixed height.</p>\n"^^ . "Right after you call CreateProcess and it succeeds, try to add these instructions to your source code: `CloseHandle(g_hChildStd_OUT_Wr); CloseHandle(g_hChildStd_IN_Rd);`. The reason why you should do that is explained on the [link](https://learn.microsoft.com/en-us/windows/win32/procthread/creating-a-child-process-with-redirected-input-and-output) that you provided on the post."^^ . "lua-ngx-module"^^ . . "2"^^ . . "0"^^ . . "Suggestion was good but didn't solve the problem. using prints I figured out the touched function was being activated on every body part. If both the torso and arm would collide with the bullet it would do twice the damage. But I can't figure out how to fix this problem"^^ . . "0"^^ . "key-bindings"^^ . . . "Because `Engine.run` is nil when you set it to `Engine.__call`."^^ . . "0"^^ . "1"^^ . . . . . "4"^^ . . "The [palette that you linked](https://i.sstatic.net/v04pj8o7.png) is not the one that is created by `clrtbl`. The former starts from redish coliurs, the latter, with blueish."^^ . . "1"^^ . . . . "2"^^ . "0"^^ . "<p>The easiest way to remove everything with one line would be to put all of the clones into a <code>Folder</code> in the Workspace. Then when you click the button, you fire a RemoteEvent to tell the server to simply destroy the Folder and/or all of its children.</p>\n<p>So try something like this :</p>\n<ol>\n<li>Have your spawner block create a Folder for all of its clones in the Workspace called <code>LagFolder</code></li>\n<li>Create a RemoteEvent in ReplicatedStorage called <code>DestroyLagFolder</code></li>\n<li>Have the LocalScript that listens to your your mouse button events fire the RemoteEvent.</li>\n</ol>\n<pre class="lang-lua prettyprint-override"><code>local DestroyLagFolderEvent : RemoteEvent = game.ReplicatedStorage.DestroyLagFolder\n\nscript.Parent.MouseButton1Up:Connect(function()\n -- tell the server to destroy all the spawned clones\n DestroyLagFolderEvent:FireServer()\nend)\n</code></pre>\n<ol start="4">\n<li>Have the part spawner Script listen for when the RemoteEvent event gets fired.</li>\n</ol>\n<pre class="lang-lua prettyprint-override"><code>local PART_SPAWN_TIME = 1 --second\n\n-- create a place for all of the clones to go\nlocal LagFolder = Instance.new(&quot;Folder&quot;)\nLagFolder.Parent = game.Workspace\n\n-- listen for when the event fires to clean up all of the clones and the spawner\nlocal DestroyLagFolderEvent : RemoteEvent = game.ReplicatedStorage.DestroyLagFolder\nDestroyLagFolderEvent.OnServerEvent:Connect(function(player)\n LagFolder:Destroy()\n script.Parent:Destroy()\nend)\n\n-- start creating clones\nwhile wait(PART_SPAWN_TIME) do\n local clonepart = script.Parent:Clone()\n clonepart.Parent = LagFolder\n clonepart.Anchored = false\nend\n</code></pre>\n"^^ . . . "1"^^ . . . . . . . "0"^^ . . . . . . "combinatorics"^^ . "<p>I'm trying to use Lua scripts inside of my C++ application using sol library, but I have some problems with passing a C++ structure to Lua. My last attempt is that:</p>\n<pre class="lang-cpp prettyprint-override"><code> sol::state _interpreter;\n _interpreter.open_libraries(sol::lib::base, sol::lib::math);\n\n _interpreter.new_usertype&lt;PriceData&gt;\n (\n &quot;PriceData&quot;,\n sol::constructors&lt;PriceData(PriceData pd)&gt;(),\n &quot;best_bid&quot;, &amp;PriceData::best_bid,\n &quot;best_ask&quot;, &amp;PriceData::best_ask\n );\n\n std::string script = R&quot;(\n function check_condition(price_update)\n print(price_update)\n return true\n end\n )&quot;;\n\n auto load_result = _interpreter.load(script);\n\n if (!load_result.valid())\n throw std::runtime_error(std::format(&quot;Failed to load condition inspector. Error: {}&quot;, sol::error{load_result}.what()));\n\n auto f = load_result.get&lt;sol::function&gt;();\n\n PriceData pd(106.0, 107.0);\n \n f(pd)\n\n</code></pre>\n<p>The struct delcared like this.</p>\n<pre class="lang-cpp prettyprint-override"><code>struct PriceData\n{\n double best_bid = 0.0;\n double best_ask = 0.0;\n};\n\ninline bool operator == (const PriceData&amp; lhs, const PriceData&amp; rhs)\n{\n return lhs.best_bid == rhs.best_bid &amp;&amp; lhs.best_ask == rhs.best_ask;\n}\n</code></pre>\n<p>I tried adding all of constructors to this struct in order to checkm if Lua just can't construct it, but unfourtunately nothing worked for me and i'm getting the same error every time.</p>\n<pre><code>[sol2] An error occurred and panic has been invoked: stack index 2, expected userdata, received no value: value is not a valid userdata \nunknown file: Failure\nC++ exception with description &quot;lua: error: stack index 2, expected userdata, received no value: value is not a valid userdata &quot; thrown in the test body.\n</code></pre>\n<p>What am i doing wrong?</p>\n"^^ . "2"^^ . . . . . "Why is my OSM map rendering squished in Love2D?"^^ . . . . "2"^^ . "0"^^ . "luarocks"^^ . . . . "<p>My script in G Hub looks like the follows:</p>\n<pre class="lang-lua prettyprint-override"><code>function OnEvent(event, arg)\n if (event == &quot;G_PRESSED&quot; and arg == 7) then\n if not IsMouseButtonPressed(1) then\n PressMouseButton(1);\n OutputLCDMessage(&quot;Button 1 toggle on.&quot;);\n else\n ReleaseMouseButton(1);\n OutputLCDMessage(&quot;Button 1 toggle off.&quot;);\n end\n end\nend\n</code></pre>\n<p>However, it doesn't seem like anything happens when I press G7. Did I do anything wrong?</p>\n"^^ . "@Jax, there's no _"all of the callbacks"_, you ONLY invoked one callback "Slider1Callback"."^^ . . "1"^^ . . . . "<p>Use the <code>string.format()</code> function to add the newline as <code>\\n</code>, also make print warnings a function to be future-safe:</p>\n<pre class="lang-lua prettyprint-override"><code>local pagetitle\n\nlocal function print_warning(msg)\n io.stderr:write(string.format('WARNING: %s\\n', msg))\nend\n\nfunction Header(header)\n if not pagetitle and header.level == 1 then\n pagetitle = pandoc.utils.stringify(header)\n end\nend\n\nfunction Meta(meta)\n if not meta.pagetitle then\n if pagetitle then\n meta.pagetitle = pagetitle\n else\n print_warning('h1 missing, defaulting HTML pagetitle to input filename.')\n meta.pagetitle = PANDOC_STATE.input_files[1]\n end\n return meta\n end\nend\n</code></pre>\n<p>While writing the question, I figured out an answer myself after finding a <a href="https://www.programming-idioms.org/idiom/59/write-to-standard-error-stream/1665/lua" rel="nofollow noreferrer" title="Write to standard error stream, in Lua">matching programming idom</a>.</p>\n"^^ . . "0"^^ . . "equalizer"^^ . . . . . . "2"^^ . . "OSRM - profile.lua - explanation of sets used"^^ . . . . . . "0"^^ . . "1"^^ . . . . . "1"^^ . . "0"^^ . . "0"^^ . "<p>I want to modify the Transparency value of each instance of a collision group, named Obstaculos1, but I don't know how.</p>\n<p>I've tried doing it by registering the group with something like this:</p>\n<pre><code>for key, value in pairs(PhysicsService:GetRegisteredCollisionGroup(&quot;Obstaculos1&quot;):GetChildren()) do\nvalue.Transparency = 0\nend\n</code></pre>\n<p>But that didn't work.</p>\n<p>I also tried to do it indexing the group in a weird way that I thought of:</p>\n<pre><code>for key, value in pairs(PhysicsService.Obstaculos1:GetChildren()) do\nvalue.Transparency = 0\nend\n</code></pre>\n<p>But that didn't work either.</p>\n<p>I'm completely dry right now. Any help is welcomed.</p>\n"^^ . "4"^^ . . . . "0"^^ . . . . . . . . "0"^^ . . . . . . . . "-1"^^ . "0"^^ . . "0"^^ . . . . . . . . . . "0"^^ . . "5"^^ . "<p>I need to match a string till the last digit occurence in Lua.</p>\n<p>I tried <code>.*(%d+)</code> and <code>.*(%d)+</code> patterns but they don't work</p>\n<pre class="lang-lua prettyprint-override"><code>local s = &quot;HJFverhs.1.iufbgej&quot;\nlocal p1 = &quot;.*(%d+)&quot;\nlocal p2 = &quot;.*(%d)+&quot;\nlocal s1 = s:match(p1) -- 1\nlocal s2 = s:match(p2) -- nil\n</code></pre>\n<p>I want <code>HJFverhs.1</code> to be returned</p>\n"^^ . "Invalid size error message from Afree function in LuaJIT"^^ . "I'm confused by the square brackets and how to get them into d1, m1, s1 = string.match(lat, '(%d+)°(%d+)\\'(%d+)"'). local d1, m1, s1 = string.match(lat, '[%d%]°[%d%]\\'[%d%]"')"^^ . . . "I stumbled on wrapping the input dms in [[]] and it seems to work and would be easy for me to add to front and back of input string."^^ . . . . "1"^^ . . "windows64"^^ . "<p>We use LuaJIT 2.1 to run a Lua service on Linux.\nWe see in the system logs in /var/log/messages that the service crashes from time to time with the following error message:</p>\n<pre><code>bash[&lt;pid&gt;]: Afree(): invalid size\n</code></pre>\n<p>afree is mentioned in <a href="https://github.com/LuaJIT/LuaJIT/blob/v2.1/src/lj_asm.c" rel="nofollow noreferrer">https://github.com/LuaJIT/LuaJIT/blob/v2.1/src/lj_asm.c</a></p>\n<p>Any idea why this error happens?</p>\n<p>Thanks</p>\n"^^ . . . . . . "0"^^ . "1"^^ . . "3"^^ . . . . "1"^^ . . . "1"^^ . . . . "0"^^ . "2"^^ . "csv"^^ . . . "1"^^ . "You are right. Thank you"^^ . . . . "0"^^ . . "<p>On nixos, I need an environment with lua to develop a C application that interfaces the lua shared libraries, which compiled fine yesterday, but can't any longer because the shell.nix environment doesn't work.</p>\n<p><code>nix-shell -p lua</code> fails with this error:</p>\n<pre><code>_addToLuaPath called for dir /nix/store/wnl9qpnhayry14lhcbdafhadsjwsdr6p-patchelf-0.15.0\n[ble: exit 127]\n</code></pre>\n<p>(The second line is just because I'm using <a href="https://github.com/akinomyoga/ble.sh" rel="nofollow noreferrer">blesh</a>, so I don't think it has anything to do with nix)<br />\nIncidentally nix-shell works fine with anything other than lua, but other lua versions fail with the same error. (I tried lua5_4_compat)</p>\n<p><code>nix-shell --pure -p lua</code> works as expected and I can run lua, so I thought it might be a conflicting package. So I removed lua from configuration.nix and ran nix-collect-garbage, even rebooted, however the issue still persists.</p>\n<p>Putting it back into configuration.nix also works as expected, and I can run lua.</p>\n<p>The strangest part is that everything worked perfectly as expected yesterday but stopped working today. The only consequential thing I've done since then I think is add a library to nix-ld, but I tried removing that and the issue persists.</p>\n<p>I'm out of ideas, and any insights would be much appreciated!</p>\n<pre><code>$lua -v\nLua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio\n$nix --version \nnix (Nix) 2.24.12```\n</code></pre>\n"^^ . "1"^^ . . . . "2"^^ . . . "0"^^ . . "3"^^ . . "4"^^ . . . . . "0"^^ . . "<p>Each <code>i</code> is local to their iteration but so is each of the function declarations. They refer to their corresponding <code>i</code>. Even if the function didn't return <code>i</code> but a constant, like for example</p>\n<pre><code>table = {}\nfor i=1,2 do \n table[i] = function() \n return 5\n end\nend\nprint( table[1] )\nprint( table[2] )\nprint( table[1] == table[2] ) -- false\n</code></pre>\n<p>you will see that the prints will be different. (I removed the <code>()</code> part in the print so you can see the memory address to the functions)</p>\n"^^ . . . . . "0"^^ . "0"^^ . . "lua_ls not working when opening .lua file from startup"^^ . . "Explained [here](http://lua-users.org/wiki/TernaryOperator). It's also doesn't mimic a ternary operator exactly, there are pitfalls with using this construction."^^ . "3"^^ . . . "1"^^ . . "@gsck What? This doesn't seem to work with `a, b = unpack({text:find("e")})`"^^ . "sockets"^^ . . . "1"^^ . . . . . . . . "How does the `(…) and (…) or (…)` idiom mimic a ternary operator in Lua?"^^ . . "<p>The bytecode is almost identical in both cases (using Lua 5.4.7):</p>\n<pre><code>% cat 1\nlocal a,b\nrepeat \n a()\nuntil b()\n\n% luac -l 1\nmain &lt;1:0,0&gt; (9 instructions at 0x7f842d406230)\n0+ params, 3 slots, 1 upvalue, 2 locals, 0 constants, 0 functions\n 1 [1] VARARGPREP 0\n 2 [1] LOADNIL 0 1 ; 2 out\n 3 [3] MOVE 2 0\n 4 [3] CALL 2 1 1 ; 0 in 0 out\n 5 [4] MOVE 2 1\n 6 [4] CALL 2 1 2 ; 0 in 1 out\n 7 [4] TEST 2 0\n 8 [4] JMP -6 ; to 3\n 9 [4] RETURN 2 1 1 ; 0 out\n\n% cat 2\nlocal a,b\nwhile true do\n a()\n if b() then break end\nend\n\n% luac -l 2\nmain &lt;2:0,0&gt; (10 instructions at 0x7fa46dc06230)\n0+ params, 3 slots, 1 upvalue, 2 locals, 0 constants, 0 functions\n 1 [1] VARARGPREP 0\n 2 [1] LOADNIL 0 1 ; 2 out\n 3 [3] MOVE 2 0\n 4 [3] CALL 2 1 1 ; 0 in 0 out\n 5 [4] MOVE 2 1\n 6 [4] CALL 2 1 2 ; 0 in 1 out\n 7 [4] TEST 2 1\n 8 [4] JMP 1 ; to 10\n 9 [4] JMP -7 ; to 3\n 10 [5] RETURN 2 1 1 ; 0 out\n</code></pre>\n"^^ . "0"^^ . . "Redisson with Redis function is adding a special character while sending the input"^^ . "0"^^ . "What is the meaning/solution for this error installing lua with nix-shell"^^ . "0"^^ . . "0"^^ . "1"^^ . "2"^^ . . "0"^^ . . "1"^^ . "Lua error: Internal error: The interpreter has terminated with signal "11""^^ . . "0"^^ . . "`terminalColors = { 0,17 = true },` ? `17=true` ? and your syntax for the `overrides` function is bad"^^ . . . . . "1"^^ . . "<p>_Version returns Lua 5.4\nI have installed /actboy168 extensions and would like to debug in 5.2\nHow do I force visual studio code to use 5.2?\nas can be seen below lua52 exists on my pc actboy168\n.vscode\\extensions\\actboy168.lua-debug-2.0.11-win32-x64\\runtime\\win32-ia32\\lua52\nI'm wondering where the system knows to look for the 5.4 exe so I can change the default.</p>\n<p>my launch.json file is shown below.</p>\n<pre><code>{\n // Use IntelliSense to learn about possible attributes.\n // Hover to view descriptions of existing attributes.\n // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\n &quot;version&quot;: &quot;0.2.0&quot;,\n &quot;configurations&quot;: [\n \n {\n &quot;arg&quot;: [],\n &quot;name&quot;: &quot;launch&quot;,\n //&quot;program&quot;: &quot;${workspaceFolder}/main.lua&quot;,\n &quot;program&quot;: &quot;${workspaceFolder}/main Dm.lua&quot;,\n &quot;request&quot;: &quot;launch&quot;,\n &quot;stopOnEntry&quot;: true,\n &quot;type&quot;: &quot;lua&quot;\n },\n {\n &quot;name&quot;: &quot;Debug Lua Interpreter&quot;,\n &quot;type&quot;: &quot;lua-local&quot;,\n &quot;request&quot;: &quot;launch&quot;,\n &quot;program&quot;: {\n &quot;lua&quot;: &quot;lua&quot;,\n &quot;file&quot;: &quot;${file}&quot;\n }\n },\n {\n &quot;name&quot;: &quot;Debug Custom Lua Environment&quot;,\n &quot;type&quot;: &quot;lua-local&quot;,\n &quot;request&quot;: &quot;launch&quot;,\n &quot;program&quot;: {\n &quot;command&quot;: &quot;command&quot;\n },\n &quot;args&quot;: []\n }\n ]\n}\n</code></pre>\n"^^ . . . . . "0"^^ . . "0"^^ . . . . . . "0"^^ . . "qsys"^^ . . . "0"^^ . "1"^^ . "<p>In Lua, are these two snippets exactly equivalent?</p>\n<pre><code>repeat \n ...\nuntil &lt;condition&gt;\n\n\nwhile true do\n ...\n if &lt;condition&gt; then break end\nend\n</code></pre>\n<p>At first glance they seem to be equivalent - and I believe they are even in corner cases, for example:</p>\n<ul>\n<li><p>Lua evaluates <code>until &lt;condition&gt;</code> in the scope of the loop body. (Unlike in C, where a similar pair of <code>do</code>/<code>while</code> and <code>while</code> loops would not be equivalent because C evaluates the condition in the outer scope.)</p>\n</li>\n<li><p>Lua doesn't have <code>continue</code>, which would jump to <code>until &lt;condition&gt;</code> in the first loop and <code>while true</code> in the second.</p>\n</li>\n</ul>\n<p>However, are there any other corner cases where they behave differently? Or are they exactly equivalent?</p>\n"^^ . "1"^^ . "0"^^ . "2"^^ . . . . . "0"^^ . . . . . . . "1"^^ . "0"^^ . . . . "1"^^ . "logitech"^^ . "0"^^ . "Is the ngx.socket.tcp() call limited in any way when called from an nginx location context?"^^ . "3"^^ . . "Please provide the code that, when copied into an editor and executed, causes the error or problematic behavior."^^ . "3"^^ . . "use `[%d%.]+` instead of `%d+`"^^ . "The order of C array is important. You can go from any lower index to any higher index [from "a" to "b" which results in "ab" or "b" to "e" which gives "be" for example], but you cannot go from higher index to lower index [from "b" to "a" etc.]. The same rule applies to all higher C combinations ["abc" is correct, but "cab" is incorrect and so on.]."^^ . "1"^^ . . . "0"^^ . . . . "0"^^ . . . . . "1"^^ . "0"^^ . "0"^^ . "0"^^ . . . . "json-rpc"^^ . "mod-rewrite"^^ . . "0"^^ . "4"^^ . . . . . . "0"^^ . . . . . . . . . "0"^^ . . . "c"^^ . . "Closure over numeric for-loop variable in Lua"^^ . "2"^^ . "0"^^ . "c++"^^ . . "4"^^ . . . . "0"^^ . . . . . . . . "You can add the solution as an answer to your own question."^^ . . "html tag auto suggest not working on my nvim lazy config"^^ . . . . . . "<p>I am trying to install luafilesystem.dll 64-bit version for my neovim lua script (I assume that I need 64-bit version because Neovim is 64-bit, correct me if I'm wrong)</p>\n<p>I couldn't find precompiled 64-bit version of lua 5.4 that had a static library (lua.lib) so I'm trying to compile the source files by myself.</p>\n<p>I downloaded 5.4.2 source files (+ Windows x64 executables and DLL) from: <a href="https://luabinaries.sourceforge.net/download.html" rel="nofollow noreferrer">https://luabinaries.sourceforge.net/download.html</a></p>\n<p>Here is the Lua64 directory where the files are located:</p>\n<pre><code>cd in cmd at 23:13:22\nC:\\Lua64\n\ntree /f in cmd at 23:01:02\nFolder PATH listing\nVolume serial number is B245-895E\nC:.\n│ lua.exe\n│ lua54.dll\n│ luac54.exe\n│ wlua54.exe\n│\n├───include\n│ lauxlib.h\n│ lua.h\n│ lua.hpp\n│ luaconf.h\n│ lualib.h\n│\n└───src\n config.mak\n lapi.c\n lapi.h\n lauxlib.c\n lauxlib.h\n lbaselib.c\n lcode.c\n lcode.h\n lcorolib.c\n lctype.c\n lctype.h\n ldblib.c\n ldebug.c\n ldebug.h\n ldo.c\n ldo.h\n ldump.c\n lfunc.c\n lfunc.h\n lgc.c\n lgc.h\n linit.c\n liolib.c\n ljumptab.h\n llex.c\n llex.h\n llimits.h\n lmathlib.c\n lmem.c\n lmem.h\n loadlib.c\n lobject.c\n lobject.h\n lopcodes.c\n lopcodes.h\n lopnames.h\n loslib.c\n lparser.c\n lparser.h\n lprefix.h\n lstate.c\n lstate.h\n lstring.c\n lstring.h\n lstrlib.c\n ltable.c\n ltable.h\n ltablib.c\n ltm.c\n ltm.h\n lua.c\n lua.h\n lua.hpp\n lua.ico\n lua.mak\n lua.rc\n lua54.def\n luac.c\n luac.mak\n luaconf.h\n lualib.h\n lua_conf.mak\n lua_dll.rc\n lua_simple.rc\n lundump.c\n lundump.h\n lutf8lib.c\n lvm.c\n lvm.h\n lzio.c\n lzio.h\n Makefile\n Makefile.tecmake\n make_uname\n make_uname.bat\n tecmake.mak\n tecmakewin.mak\n wlua.mak\n wlua.rc\n wlua_x64.manifest\n wlua_x86.manifest\n wmain.c\n</code></pre>\n<p>Compiled the files with the following commands:</p>\n<pre><code>cl /Iinclude /O2 /c src\\lapi.c src\\lauxlib.c src\\lstate.c src\\lfunc.c src\\lgc.c src\\lstring.c src\\lvm.c src\\lzio.c\nlib /OUT:lua.lib src\\*.obj\n</code></pre>\n<p>When trying to install luafilesystem using luarocks, I get the following error:</p>\n<pre><code>luarocks install luafilesystem in cmd at 22:46:54\nInstalling https://luarocks.org/luafilesystem-1.8.0-1.src.rock\n\nluafilesystem 1.8.0-1 depends on lua &gt;= 5.1 (5.4-1 provided by VM: success)\n\nError: Build error: Lua library at C:\\Lua64\\lua.lib does not match Lua version 5.4. You can use `luarocks config variables.LUA_LIBDIR &lt;path&gt;` to set the correct location.\n</code></pre>\n<p>luarocks config variables.LUA_LIBDIR is correctly set to &quot;C:\\Lua64&quot;</p>\n<p>lua.h header file has lua version defines as 5.4.2:</p>\n<pre><code>lua -v in cmd at 23:14:33\nLua 5.4.2 Copyright (C) 1994-2020 Lua.org, PUC-Rio\n\ntype lua.h | findstr &quot;#define LUA_VERSION&quot; in cmd at 23:09:52\n#define lua_h\n#define LUA_VERSION_MAJOR &quot;5&quot;\n#define LUA_VERSION_MINOR &quot;4&quot;\n#define LUA_VERSION_RELEASE &quot;2&quot;\n</code></pre>\n<p>What could be wrong?</p>\n"^^ . . . . . "Are you using LuaRocks on Windows? Dealing with modules that have C dependencies in that environment is challenging at times. On Ubuntu/Debian Linux I would recommend to `sudo apt-get install libsqlite3-dev`"^^ . . . . "0"^^ . . "luajit"^^ . . . . . "1"^^ . "<p>Try moving the touch event function outside the for loop.</p>\n<pre class="lang-lua prettyprint-override"><code>head = script.Parent.PrimaryPart\n\nlocal function triggershoot(part)\n local beam = Instance.new(&quot;Part&quot;,script.Parent)\n\n beam.Anchored = true\n beam.CanCollide = false\n beam.Shape = &quot;Block&quot;\n beam.CFrame = head.CFrame\n beam.Size = Vector3.new(0.5,0.5,0.5)\n beam.Material = &quot;Plastic&quot;\n beam.BrickColor = BrickColor.new(&quot;Dark taupe&quot;)\n\n beam.CFrame = CFrame.lookAt(head.Position,part.Position)\n beam.Touched:Connect(function(plr)\n local char=plr.Parent\n local hum=char and char:FindFirstChildOfClass&quot;Humanoid&quot;\n if char:HasTag(&quot;enemy&quot;) then\n hum:TakeDamage(3)\n beam:Destroy()\n end\n end)\n for i = 0, 50, 1 do\n wait()\n beam.CFrame = beam.CFrame + beam.CFrame.LookVector \n end\n beam:Destroy()\nend\nwhile true do\n wait()\n local parts = workspace:GetPartsInPart(script.Parent.zone)\n for _, part in ipairs(parts) do\n local h=part.Parent;h=h and h:FindFirstChildOfClass&quot;Humanoid&quot;\n if part:HasTag&quot;enemy&quot;and h and h.Health &gt; 0 then\n local update = CFrame.lookAt(head.Position,part.Position)\n head.CFrame = update\n coroutine.wrap(triggershoot)(part)\n wait(1)\n break\n end\n end\nend\n</code></pre>\n"^^ . "NAudio/bass.net with VB.net: (or lua) how to read peaks (FFT)"^^ . "1"^^ . "parentheses"^^ . "0"^^ . . . . . "0"^^ . . . . . "0"^^ . . . "boolean-logic"^^ . "1"^^ . . . . . . "1"^^ . "<p>to answer your first question, use bodyVelocity, This is great for controlling the speed of a vehicle smoothly. You can gradually increase and decrease the velocity over time, but do note that bodyVelocity is experimental, and can be difficult at some times.</p>\n<p>Next question, Interpolation**:** Use a method like Lerp (linear interpolation) to gradually change the speed. This will help make the boost feel smoother.</p>\n<p>3rd question, here is my drafted script for the problem,</p>\n<pre><code>local UserInputService = game:GetService(&quot;UserInputService&quot;)\nlocal boostActive = false\n\nUserInputService.InputBegan:Connect(function(input)\n if input.KeyCode == Enum.KeyCode.LeftShift then\n boostActive = true\n end\nend)\n\nUserInputService.InputEnded:Connect(function(input)\n if input.KeyCode == Enum.KeyCode.LeftShift then\n boostActive = false\n end\nend)\n</code></pre>\n"^^ . "1"^^ . . "<p>I'm using Neovim and want to use <a href="https://github.com/neovim/neovim/blob/6982106f8ca5ceaa00c9909e64cc94d2794b9143/runtime/doc/options.txt#L3821-L3919" rel="nofollow noreferrer">listchars</a> to replace certain Unicode code points, such as <a href="https://www.compart.com/en/unicode/U+3000" rel="nofollow noreferrer">U+3000</a> (Ideographic Space) with <a href="https://www.compart.com/en/unicode/U+2B1C" rel="nofollow noreferrer">U+2B1C</a> (White Large Square).</p>\n<pre class="lang-lua prettyprint-override"><code>vim.opt.listchars = {\n tab = '→ ',\n -- space = '•',\n trail = '·',\n -- extends = '&gt;',\n -- precedes = '&lt;',\n -- eol = '⏎',\n nbsp = ' ',\n -- ['U+3000'] = '⬜' -- Ineffective\n}\n</code></pre>\n<p>Is there a way to achieve this or make it easier to recognize?</p>\n"^^ . . . "1"^^ . . . "How can i pass data structure from C++ to Lua?"^^ . . "How do I convert 52°52'16.9"N 0°46'43.5"W to DMS (Degress Minutes Seconds) to DEG ((decimal) Degrees) in Lua?"^^ . . "-1"^^ . "pandoc"^^ . . . . . . . "0"^^ . . . "0"^^ . "1"^^ . . . . "I think you want [raw blocks](https://pandoc.org/MANUAL#generic-raw-attribute) with `markdown` as the raw format. The `raw_attribute` extension is enabled by default."^^ . . "2"^^ . "0"^^ . . . . . "1"^^ . . . "<p>The following code generates a palette as a two-dimentional Lua table:</p>\n<pre class="lang-lua prettyprint-override"><code>local abs, floor = math.abs, math.floor\n\n-- https://www.rapidtables.com/convert/color/hsv-to-rgb.html\nlocal function hsv2rgb (h, s, v)\n local c = s * v\n local x = c * (1 - abs ((h / 60) % 2 - 1))\n local m = v - c\n local cases = {\n { c, x, 0 }, -- h ∈ [0°; 60°)\n { x, c, 0 }, -- h ∈ [60°; 120°)\n { 0, c, x }, -- h ∈ [120°; 180°)\n { 0, x, c }, -- h ∈ [180°; 240°)\n { x, 0, c }, -- h ∈ [240°; 300°)\n { c, 0, x } -- h ∈ [300°; 360°)\n }\n local rgb = {}\n for _, colour in ipairs (cases [floor (h / 60) + 1]) do\n rgb [#rgb + 1] = (colour + m) * 255\n end\n return rgb\nend\n\nlocal function palette (v_start, v_end, v_step, h_start, h_step)\n local h_steps = floor (360 / abs (h_step))\n local plt = {}\n for v = v_start, v_end, v_step do\n local gray = (v - v_start) / (v_end - v_start)\n local s = 1\n -- Excessive brightness reduces saturation:\n if v &gt; 1 then\n s = s - (v - 1)\n v = 1\n end\n local row = {}\n for h = h_start, h_start + h_step * (h_steps - 1), h_step do\n row [#row + 1] = hsv2rgb (h % 360, s, v)\n end\n -- Grays:\n row [#row + 1] = hsv2rgb (0, 0, gray)\n plt [#plt + 1] = row\n end\n return plt\nend\n\nlocal as_linked = palette (0.2, 1.8, 0.2, 0, 30)\nlocal as_in_clrtbl = palette (0.2, 1.8, 0.2, 240, -30)\n\n</code></pre>\n<p>The idea is that all colours in one column have the same hue; and all rows, the same brightness, and when it reaches 100%, saturation will begin to reduce. Then the colour's HSV coordinates are converted to RGB by <code>hsv2rgb()</code>. The gray column is produced by a special rule, with increasing brightness.</p>\n<p><code>palette()</code> gets parametres:</p>\n<ul>\n<li><code>v_start</code> — brightness of the top row; in [0; 1],</li>\n<li><code>v_end</code> — brightness of the bottom row; in [0; 1],</li>\n<li><code>v_step</code> — brightness increment; in (0, 1],</li>\n<li><code>h_start</code> — hue of the first column; in [0, 360), 0 meaning red, 180, cyan,</li>\n<li><code>h_step</code> — hue increment; in (-360, 360), positive meaning red to violet, negative, violet to red.</li>\n</ul>\n<p><code>palette (0.2, 1.8, 0.2, 0, 30)</code> will produce approximately <a href="https://stackoverflow.com">the table that you linked</a>.</p>\n<p><code>palette (0.2, 1.8, 0.2, 240, -30)</code> will produce the table defined by <code>clrtbl</code>.</p>\n<p><a href="https://traditio.wiki/Module:Test/palette/doc" rel="nofollow noreferrer">This page</a> shows different variants of the generated palette. Cells' background is the generated color; the colour of the circle is the corresponding colour from <code>clrtbl</code>. The upper left or right is approximately what is linked, the bottom left is exactly <code>clrtbl</code>.</p>\n"^^ . "0"^^ . "0"^^ . "0"^^ . . . . . "0"^^ . . . . "<p>In lua I want to get every possible combination of every possible combination of whole strings in array... Let me explain what I mean by that.\nLet's say that we got an array C = { &quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;}.\nI want to get this result:</p>\n<pre><code> output = {\n { &quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;};\n { &quot;ab&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e};\n { &quot;ac&quot;, &quot;b&quot;, &quot;d&quot;, &quot;e&quot; };\n { &quot;abc&quot;, &quot;d&quot;, &quot;e&quot;};\n { &quot;aeb&quot;, &quot;d&quot;, &quot;c&quot;};\n { &quot;a&quot;, &quot;bde&quot;, &quot;c&quot;};\n { &quot;ab&quot;, &quot;cd&quot;, &quot;e&quot;};\n { &quot;a&quot;, &quot;bcd&quot;, &quot;e&quot; };\n { &quot;acd&quot;, &quot;b&quot;, &quot;e};\n { &quot;ac&quot;, &quot;bd&quot;, &quot;e&quot;};\n { &quot;abc&quot;, &quot;de&quot;};\n { &quot;abcd&quot;, &quot;e&quot;};\n { &quot;acd&quot;, &quot;be&quot;}\n { &quot;ac&quot; &quot;bde&quot;};\n ...and so on until\n {&quot;abcde&quot;};\n }\n</code></pre>\n<p>So every WHOLE string from C array is combine with every other whole string - and the higher combinations of this combinations combine with every other - and so on - giving ONLY UNIQUE combinations without repeating any element - which differs it from &quot;superpermutation&quot; because any combo must be &quot;first unique&quot;[so to speak] - so &quot;ab&quot; or &quot;abc&quot;, but no &quot;ba&quot;, &quot;aba&quot;, &quot;bab&quot;, &quot;bac&quot; etc. .</p>\n<p>To be perfectly honest i cannot get a grip on this problem. Maybe someone have an idea how to solve this?</p>\n<p>What i tried so far was to get basic permutations for C array by below function:</p>\n<pre><code> local function getPermuations(array)\n local wrap, yield, board = coroutine.wrap, coroutine.yield, {};\n local function append (t, new)\n local clone = {}\n for _, item in ipairs (t) do\n clone [#clone + 1] = item\n end\n clone [#clone + 1] = new\n return clone\n end\n local function permutate (tbl, sub, min)\n sub = sub or {}\n min = min or 1\n return wrap (function ()\n if #sub &gt; lim then\n yield (sub);\n end\n if #sub &lt; #tbl then\n for i = min, #tbl do\n for combo in permutate (tbl, append (sub, tbl [i]), i + 1) do\n yield (combo)\n end\n end\n end\n end)\n end\n for combo in permutate(array) do\n --table.sort( combo, self.sortAlphabetical )\n table.insert(board, combo);\n end\n\n return board;\n end\n</code></pre>\n<p>It returns table of arrays each holding one permutation. After that i tried to write a recurrent function that takes rests of elements from C for each returned array and permutate them as well and so on. So it is basically something like &quot;super non repeating permutation&quot;. But i couldn't get this to work:</p>\n<pre><code>local function getRest(str, inh)\n local backbone, rest = {}, {};\n for k,v in ipairs(C) do\n backbone[v] = true;\n end\n for key in pairs(inh) do\n for k,v in ipairs(C) do\n if string.find(key, v) then backbone[v] = nil; end\n end;\n end;\n for _, e in ipairs(C) do\n if string.find(str, e) then backbone[e] = nil; end\n end\n if next(backbone) then\n for obj in pairs(backbone) do\n table.insert(rest, obj)\n end\n table.sort(rest, function(a, b)\n return string.lower(a) &lt; string.lower(b)\n end)\n end \n return rest;\nend;\nlocal mainBoard = {};\nlocal function superpermutation(permutation, inheritance)\n inheritance = inheritance or {};\n local px = getPermuations(permutation);\n for _, array in ipairs(px) do\n local r = getRest(table.concat(array), inheritance);\n if #r&gt;1 then\n inheritance[table.concat(array)] = true;\n superpermutation(r, inheritance);\n elseif next(inheritance) then\n local m = {};\n for k in pairs(inheritance) do\n table.insert(m, {k})\n end;\n if r and r[1] then\n table.insert(m, {r[1]})\n end\n table.insert(mainBoard, m)\n end;\n end\n return\nend;\nsuperpermutation(C);\nfor index, superarray in ipairs(mainBoard) do\n local str = &quot;&quot;;\n for _, array in ipairs(superarray) do\n str = str..&quot;(&quot;..table.concat( array )..&quot;)&quot;\n end\n print(str)\nend\n</code></pre>\n"^^ . . . "<p>I've never programmed in lua before and I'm trying to set a colorscheme for neovim, but when I paste the theme configuration, I'm getting this error(on the post title), seems like a syntax error, but I'm not sure. I'm using Tilix as terminal on Ubuntu with packer as package manager.</p>\n<p>Here's the adapted config:</p>\n<pre><code>require('kanagawa').setup({\n compile = false, -- enable compiling the colorscheme\n undercurl = true, -- enable undercurls\n commentStyle = { italic = true },\n functionStyle = {},\n keywordStyle = { italic = true},\n statementStyle = { bold = true },\n typeStyle = {},\n transparent = true, -- do not set background color \n dimInactive = false, -- dim inactive window `:h hl-NormalNC`\n terminalColors = { 0,17 = true }, -- define vim.g.terminal_color_{0,17}\n colors = { -- add/modify theme and palette colors\n palette = {},\n theme = { wave = {}, lotus = {}, dragon = {}, all = {} },\n },\n overrides = function(colors) -- add/modify highlights\n return {}\n theme = &quot;wave&quot;, -- Load &quot;wave&quot; theme when 'background' option is not set\n background = {dark = &quot;dragon&quot;} \n end \n\nvim.cmd(&quot;colorscheme kanagawa&quot;)\n</code></pre>\n<p>and here is what the creators made on github</p>\n<pre><code>-- Default options:\nrequire('kanagawa').setup({\n compile = false, -- enable compiling the colorscheme\n undercurl = true, -- enable undercurls\n commentStyle = { italic = true },\n functionStyle = {},\n keywordStyle = { italic = true},\n statementStyle = { bold = true },\n typeStyle = {},\n transparent = false, -- do not set background color\n dimInactive = false, -- dim inactive window `:h hl-NormalNC`\n terminalColors = true, -- define vim.g.terminal_color_{0,17}\n colors = { -- add/modify theme and palette colors\n palette = {},\n theme = { wave = {}, lotus = {}, dragon = {}, all = {} },\n },\n overrides = function(colors) -- add/modify highlights\n return {}\n end,\n theme = &quot;wave&quot;, -- Load &quot;wave&quot; theme when 'background' option is not set\n background = { -- map the value of 'background' option to a theme\n dark = &quot;wave&quot;, -- try &quot;dragon&quot; !\n light = &quot;lotus&quot;\n },\n})\n\n-- setup must be called before loading\nvim.cmd(&quot;colorscheme kanagawa&quot;)\n</code></pre>\n"^^ . . . "1"^^ . "0"^^ . . . "0"^^ . . . "<p>I want to build a lag game and I want that when you click a button, all the clones of the part will be gone but when I script it, it's not working.\nThis code is for cloning the part (this is a normal script in a part):</p>\n<pre><code>while true do\n wait()\n local clonepart = script.Parent:Clone()\n clonepart.Parent = game.Workspace\n clonepart.Anchored = false\nend\n\n</code></pre>\n<p>This is the code for deleting (a local script in a Text button GUI):</p>\n<pre><code>local part = game.Workspace.cloner\n\nscript.Parent.MouseButton1Up:Connect(function()\n part:Destroy()\nend)\n</code></pre>\n<p>It is removing the part which is making the clones.</p>\n"^^ . "thanks Kylaaa but I want part to start cloning again after it gets deleted"^^ . "0"^^ . "0"^^ . "body_file doesnt exist even tho get_body_file returns a filename"^^ . . . . . . "Why did you add `^` before `|`?"^^ . "I can't reproduce. Even after I catch the error, and game enters different error handler, where I can still execute remote lua commands from external tool it wont happen again. Even for the exact same parameters and the same polygon table."^^ . . . . "0"^^ . . "You are Sir my personal savior - this is exactly how it should look and work. I didn't even know that the notion of partitioning means exactly this - somehow i forgot about original mathematical meaning of this terminology. This is just amazing - thank you."^^ . . "You could just use a Tween on the Torque property."^^ . . . "0"^^ . . . . . "A neovim lua function to select around an allman-style block"^^ . "0"^^ . "1"^^ . "0"^^ . "<p>Your problem can be solved by partitioning algorithm, such as <a href="https://www.geeksforgeeks.org/generate-all-partition-of-a-set/" rel="nofollow noreferrer">Generate all partition of a set</a>.\nThe solution is implemented by using recursion to generate all possible partitions of the given set <strong>C</strong>. Here is the <strong>LUA</strong> implementation:</p>\n<pre><code>-- Function to generate all partitions of a set\nlocal function generatePartitions(input, index, currentPartition, result)\n if index == #input then\n -- Convert the current partition to the desired format\n local partition = {}\n for _, group in ipairs(currentPartition) do\n table.insert(partition, table.concat(group, &quot;&quot;))\n end\n table.insert(result, partition)\n else\n -- Add the current element to each existing group in the partition\n for i = 1, #currentPartition do\n table.insert(currentPartition[i], input[index + 1])\n generatePartitions(input, index + 1, currentPartition, result)\n table.remove(currentPartition[i]) -- backtrack\n end\n\n -- Create a new group with the current element\n local newGroup = {input[index + 1]}\n table.insert(currentPartition, newGroup)\n generatePartitions(input, index + 1, currentPartition, result)\n table.remove(currentPartition) -- backtrack\n end\nend\n\n\nlocal input = {&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;d&quot;, &quot;e&quot;}\nlocal results = {}\ngeneratePartitions(input, 0, {}, results)\n\n-- Print all results\nfor _, result in ipairs(results) do\n print(&quot;{&quot; .. table.concat(result, &quot;, &quot;) .. &quot;}&quot;)\nend\n\n</code></pre>\n<p>Here is the output for your specific set C:</p>\n<pre><code>{abcde}\n{abcd, e}\n{abce, d}\n{abc, de}\n{abc, d, e}\n{abde, c}\n{abd, ce}\n{abd, c, e}\n{abe, cd}\n{ab, cde}\n{ab, cd, e}\n{abe, c, d}\n{ab, ce, d}\n{ab, c, de}\n{ab, c, d, e}\n{acde, b}\n{acd, be}\n{acd, b, e}\n{ace, bd}\n{ac, bde}\n{ac, bd, e}\n{ace, b, d}\n{ac, be, d}\n{ac, b, de}\n{ac, b, d, e}\n{ade, bc}\n{ad, bce}\n{ad, bc, e}\n{ae, bcd}\n{a, bcde}\n{a, bcd, e}\n{ae, bc, d}\n{a, bce, d}\n{a, bc, de}\n{a, bc, d, e}\n{ade, b, c}\n{ad, be, c}\n{ad, b, ce}\n{ad, b, c, e}\n{ae, bd, c}\n{a, bde, c}\n{a, bd, ce}\n{a, bd, c, e}\n{ae, b, cd}\n{a, be, cd}\n{a, b, cde}\n{a, b, cd, e}\n{ae, b, c, d}\n{a, be, c, d}\n{a, b, ce, d}\n{a, b, c, de}\n{a, b, c, d, e}\n</code></pre>\n"^^ . "0"^^ . . "0"^^ . . . . . "0"^^ . . "semantic-mediawiki"^^ . . . . . "algorithm"^^ . "0"^^ . "terminal"^^ . "0"^^ . . . . . "1"^^ . "How do I modify the value of each instance of a collision group?"^^ . . "0"^^ . "mercator"^^ . . . . "getting every combination of every combination of strings in array"^^ . "nevermind. it seems you were correct. Thank you!"^^ . . . . "0"^^ . . "0"^^ . "0"^^ . "1"^^ . . . "tabletop-simulator"^^ . . "Changed CL to x64 with vcvars64.bat, compiled c files into object files with /favor:AMD64 flag and generated the lua.lib with /MACHINE:X64 flag. Now dumpbin shows that lua.lib is 8664 machine (x64) but error about lua versions not matching still persists"^^ . "luau"^^ . "0"^^ . . "0"^^ . "<p>Foreword: I have never coded in LUA before so my code probably sucks and I'm probably doing something wrong.</p>\n<p>I recently discovered the G-Shift function of LG mice, and decided to move my auto clicker to a G-Shift bound button (G-Shift + DPI-Shift (aka button 9 and button 6)). I also heard that creating an LUA script would make my auto clicker far faster than using their macros (not sure if that is true or not).</p>\n<p>I went into my default profile and quickly coded up an auto clicker, but it didnt work. After a bunch of research and some help (mainly gemini and phind) I settled on this amalgamation:</p>\n<pre class="lang-none prettyprint-override"><code>local gShiftPressed = false\nlocal dpiShiftPressed = false\nlocal autoclicking = false    \n\nfunction OnEvent(event, arg)\n  --[[OutputLogMessage(&quot;Event: &quot;..event..&quot; Arg: &quot;..arg..&quot;&quot;)\n  Mouse Button 9 = GShift\n  Mouse Button 6 = DPI Shift--]]\n\n  \n\n \n\n  if (event == &quot;MOUSE_BUTTON_PRESSED&quot;) then\n    if (arg == 9) then\n      gShiftPressed = true\n    elseif (arg == 6) then\n      dpiShiftPressed = true\n    end\n  elseif (event == &quot;MOUSE_BUTTON_RELEASED&quot;) then\n    if (arg == 9) then\n      gShiftPressed = false\n    elseif (arg == 6) then\n      dpiShiftPressed = false\n    end\n  end\n  \n  \n  \n  \n\n  if(gShiftPressed and dpiShiftPressed and not autoclicking) then\n    autoclicking = true\n    while(autoclicking == true) do\n      PressAndReleaseMouseButton(1)\n      if(not gShiftPressed and not dpiShiftPressed) then\n        autoclicking = false\n      end\n    end\n  end\nend\n</code></pre>\n<p>I have 2 problems now:</p>\n<p>1.) LG Ghub says I have a syntax error (I feel like I dont, but who knows)</p>\n<p>2.) When my code was working, it would click continuously but never stop when i wanted it to</p>\n<p>I tried thinking of an async solution, but i dont think Ghub supports Async coding</p>\n"^^ . "2"^^ . . "1"^^ . . . "<p>Early Lua manual has an <a href="https://www.lua.org/manual/5.1/manual.html#2.4.5" rel="nofollow noreferrer">equivalent code</a> for the for statement:</p>\n<pre><code>for v = e1, e2, e3 do block end\n\n-- is equivalent to the code: \n\ndo\n local var, limit, step = tonumber(e1), tonumber(e2), tonumber(e3)\n if not (var and limit and step) then error() end\n while (step &gt; 0 and var &lt;= limit) or (step &lt;= 0 and var &gt;= limit) do\n local v = var\n block\n var = var + step\n end\nend\n</code></pre>\n<p>It can be seen that the loop variable <code>v</code> is declared at the beginning of each iteration, in other words, the loop variable for each iteration is independent.</p>\n"^^ . . "1"^^ . "<p>I have a file, something of this sort (CSV, TSV: delimited text):</p>\n<pre><code>&quot;col1&quot;,&quot;col2&quot;,&quot;col3&quot;\n&quot;1&quot;,&quot;ab&quot;,&quot;6.5&quot;\n&quot;4&quot;,&quot;df&quot;,&quot;9.7&quot;\n\n</code></pre>\n<p>I would like to read it to the Lua's table with named fields (like Python's list of dictionaries).\nSomething of this sort:</p>\n<pre><code>{\n {'col1'='1', 'col2'='ab', 'col3'='6.5'},\n {'col1'='4', 'col2'='df', 'col3'='9.7'}\n}\n</code></pre>\n<p>In the end I should be able to access the data in the following way:</p>\n<pre><code>t[1].col1\nt[1].col2\nor\nt[2].col3\n</code></pre>\n<p>I cannot get my head around Lua's syntax on this matter.\nUnfortunately various modules working with CSV are not really usable for me in this case. Because it will not be supported by application. It should be Lua's simple solution.\nHere is my attempt, but it does not work.</p>\n<pre><code> local function split(str, sep)\n local t={}\n for s in string.gmatch(str, &quot;([^&quot;..sep..&quot;]+)&quot;) do\n table.insert(t,s)\n end\n return t\n end\n\n local t_line = {}\n local t_row = {}\n local t_header = {}\n local t_target = {}\n local i = 1\n for line in io.lines('some_file.txt') do\n t_line = split(line, ',')\n for j=1, #t_line do\n if i == 1 then -- first line of the file\n -- read header into table\n table.insert(t_header, t_line[j])\n else\n -- this suppose to tell that t_header[j] is the key\n -- and t_line[j] is its value\n table.insert(t_row, [t_header[j]] = t_line[j])\n end\n end\n -- here I add table as a row into main table\n if i &gt; 1 then\n table.insert(t_target, t_row)\n end\n i = i + 1\n end\n\n</code></pre>\n<p>This part does not work:</p>\n<pre><code>table.insert(t_row, [t_header[j]] = t_line[j])\n\n</code></pre>\n<p>Execution of the script throws an error:</p>\n<pre><code>lua: ./example_10.lua:28: unexpected symbol near '['\n\n</code></pre>\n<p>but I tried to remove square brackets and it starts complaining about equal sign.\nHere is the way that line works:</p>\n<pre><code>table.insert(t_row, t_line[j])\n</code></pre>\n<p>but then I will not able to call element by key name only by index.\nHow to add value to the table and name the key by column name?</p>\n"^^ . . "3"^^ . . . . "<p>Currently, it seems <strong>no</strong> way to arbitrarily replace any Unicode character using <a href="https://github.com/neovim/neovim/blob/6982106f8ca5ceaa00c9909e64cc94d2794b9143/runtime/doc/options.txt#L3821-L3919" rel="nofollow noreferrer">listchars</a> (<a href="https://github.com/neovim/neovim/issues/22071" rel="nofollow noreferrer">issues:22017</a>)</p>\n<p>You can consider using <a href="https://github.com/neovim/neovim/blob/6982106f8ca5ceaa00c9909e64cc94d2794b9143/runtime/doc/api.txt#L3368-L3434" rel="nofollow noreferrer">nvim_create_autocmd</a> to target specific events {<code>BufRead</code>, ...} to change the color of specific content to make it more noticeable</p>\n<pre class="lang-lua prettyprint-override"><code>vim.api.nvim_create_autocmd(\n { &quot;BufRead&quot;, &quot;BufNewFile&quot; },\n {\n group = vim.api.nvim_create_augroup(&quot;HighlightFullWidthSpace&quot;, {}),\n pattern = &quot;*&quot;,\n callback = function()\n local groupNameCJKSpace = &quot;CJKFullWidthSpace&quot;\n vim.fn.matchadd(groupNameCJKSpace, ' ') -- Create group mapping: Match the special symbol U+3000\n -- vim.fn.matchadd(groupNameCJKSpace, 'A') -- If you want to apply this color to other content, you can add multiple matchadd\n\n -- Set highlighting for this group\n vim.api.nvim_set_hl(0, groupNameCJKSpace, {\n bg = &quot;#a6a6a6&quot;, -- Background color\n fg = 'white', -- Foreground color\n -- You can also add other attributes, such as:\n -- bold = true,\n -- italic = true,\n -- underline = true\n })\n\n -- (Another example below)\n local groupNameTODO = &quot;myTODO&quot;\n vim.fn.matchadd(groupNameTODO, 'TODO .*')\n vim.api.nvim_set_hl(0, groupNameTODO, { fg = &quot;#8bb33d&quot;, italic = true })\n end\n }\n)\n</code></pre>\n<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false" data-babel-preset-react="false" data-babel-preset-ts="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p style="background-color:#a6a6a6;color:white"&gt;#a6a6a6&lt;/span&gt;\n&lt;p style="color:#8bb33d"&gt;&lt;i&gt;#8bb33d italic&lt;/i&gt;&lt;/span&gt;</code></pre>\r\n</div>\r\n</div>\r\n</p>\n<p><a href="https://i.sstatic.net/gwujD3FI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gwujD3FI.png" alt="enter image description here" /></a></p>\n"^^ . . "0"^^ . . . . . . . "Here is a canonical question: https://stackoverflow.com/questions/41585078/how-do-i-read-and-write-csv-files"^^ . "1"^^ . "1"^^ . . . "even if i am not calling set_body_data, it still ends up deleting the file. I commented everything out beside the read. With read it gets deleted, without it stays"^^ . "1"^^ . . . . . . "Your algorithm is wrong. Very roughly `for i = 0, 5 shade = base_colour*i` and then it adds a shade of grey to each colour `for i=6, 8 shade = base_colour + 0x333333` using bytewise saturated arithmetic so that overflows do not propogate into adjacent colours."^^ . . . . "-1"^^ . "naudio"^^ . . . ".net"^^ . "0"^^ . . . . . . "1"^^ . . "If I set '$wgScribuntoEngineConf['luastandalone']['luaPath'] to (whatever)/lua5_1_5_linux_64_generic', I get 'interpreter exited with status 126.' The error file says 'cannot execute: Is a directory'. \n\nIf I set '$wgScribuntoEngineConf['luastandalone']['luaPath'] to (whatever)/lua5_1_5_linux_64_generic/lua', I get 'interpreter has terminated with signal "11". The error file still says 'cannot execute: Is a directory'.\n\nThe version running in extensions/Scribunto/includes/Engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic is Lua 5.3.4. I thought it was supposed to be 5.1.5?"^^ . "boolean-operations"^^ . . . "Customizing and Color-Highlighting Specific Unicode Characters in Neovim"^^ . . . . "2"^^ . "<p>Better context? Only suggestion I have is to simply change <code>MouseButton1Up</code> to <code>MouseButton1Down</code>.</p>\n"^^ . . . "0"^^ . . . "5"^^ . "0"^^ . "1"^^ . "This is missing necessary code to reproduce the error."^^ . . . . . "3"^^ . . "0"^^ . "0"^^ . . . . "1"^^ . . . "named"^^ . . "1"^^ . . . . . . "0"^^ . . "0"^^ . "love2d"^^ . . . . "0"^^ . "2"^^ . "<p>Since toggle not stop the macro at same time you hit the button (it's continue the full macro until last command), i find this script that are working, but i want mix more 4 mouse buttons on this:</p>\n<pre class="lang-lua prettyprint-override"><code>function OnEvent(event, arg, family)\n OutputLogMessage(&quot;clicked event = %s, arg = %s\\n&quot;, event, arg);\n if ( event == &quot;MOUSE_BUTTON_PRESSED&quot; and arg == 5 ) then\n ToggleState = not ToggleState\n\n if ToggleState then\n PlayMacro(&quot;MACRO 1&quot;);\n else\n AbortMacro()\n end\n end\nend\n</code></pre>\n<p>this one are set to my mouse G5 run the MACRO 1</p>\n<p>Is possible add also G6 to run MACRO 2 + G4 to run MACRO 3 + G10 to run MACRO 4 and G11 to run MACRO 5 on this!?</p>\n<p>I'm really upset because i left a Corsair mouse that work perfect the toggle function to get this G502 X PLUS and now i can't get my macros working like ICUE do</p>\n"^^ . "1"^^ . "element"^^ . . "0"^^ . "What are you expecting to receive from `nc`? It sends nothing. Try with simple echo server: `socat -v tcp-l:8000,fork exec:'/bin/cat'` instead and send something before `tcp:receive(1)`, e.g., with `tcp:send("foobar")` `:receive` will return `f`."^^ . "<p>Redis func is registered having the body</p>\n<pre><code>redis.register_function('eval_resources', function(keys, args)\n return type(args[1]) .. &quot; &quot; .. args[1]\nend)\n</code></pre>\n<p>Caller's code</p>\n<pre><code> Object[] argsList = {&quot;123&quot;, &quot;abc&quot;};\n String res2 = function.call(\n FunctionMode.WRITE,\n &quot;eval_resources&quot;,\n FunctionResult.STRING,\n Collections.emptyList(),\n argsList);\n</code></pre>\n<p>Response I am getting\n<code>string 12�</code></p>\n<p>Due to this encoding issue, I am not able to parse integer as an input inside Lua script.</p>\n<p>I tried removing the end character, still the input cannot be parsed to integer.</p>\n<pre><code>redis.register_function('eval_resources', function(keys, args)\n local actual_val = tostring(string.sub(args[1], 1, 2))\n local numericalVal = tonumber(actual_val)\n return type(actual_val) .. &quot; &quot; .. actual_val .. &quot; type of num -&gt;&quot; .. type(numericalVal)\nend)\n</code></pre>\n<p>This is working perfectly with redis-cli.</p>\n"^^ . . . . . . . . . . . "map-projections"^^ . . "5"^^ . "How to find the position of a player in roblox"^^ . "Alexander Mashin, your code worked perfectly fine. I'm not a respected enough member to give you credit. I guess I can do that in the future. Thanks for all those calculations and your code example."^^ . "1"^^ . . . . "0"^^ . "This answer does not address the issue of deleting objects. [MouseButton1Down](https://create.roblox.com/docs/reference/engine/classes/GuiButton#MouseButton1Down) is just another way to detect user input."^^ . . "<p>This was something that I wanted to see if I could do but I don't have enough information to be able to do it and wanted to see if somebody would be able to help me.</p>\n<p>There's this auto tracker script for a new mod that's recently come out for Sm64 located here. <a href="https://github.com/WaffleSmacker/IronMarioTracker/releases/tag/v1.1.1" rel="nofollow noreferrer">https://github.com/WaffleSmacker/IronMarioTracker/releases/tag/v1.1.1</a></p>\n<p>The problem is it only currently works with bizhawks Lua API. I did however find this, <a href="https://github.com/OoTMM/Project64-EM/releases/tag/v1.0.3" rel="nofollow noreferrer">https://github.com/OoTMM/Project64-EM/releases/tag/v1.0.3</a> and wanted to try and get it to work on that one which has lua script function in it and failed (I do to not have enough information about that api)</p>\n<p>How would I go about figuring that out.</p>\n<p>I tried messing around with some of the functions to see if I could get it to run but failed. What I kind of expected was for it to do what it already did but on that PJ64 fork..</p>\n"^^ . . "calling for an external scripts from lua program on Windows"^^ . . "openstreetmap"^^ . "2"^^ . . "do-while"^^ . . "In Lua, is `repeat ... until condition` equivalent to `while true ... if condition break`?"^^ . . "6"^^ . . . . . . "0"^^ . . . . . "I understand, I want to work this solution on 'Windows'. For now I linked C# database methods to Lua and it's working, but I doubt it will be efficient, thus the reason why I wanted to find a way to keep it independent."^^ . "0"^^ . . . . "vb.net"^^ . . . "I have a part. there are 2 similar scripts in it, which are activated by the same method - “touching the part”. this script should enable GUI and the other one should teleport. as soon as I run the test, the first time everything works perfectly, but in the rest of the repetitions in this session it doesn't work. And even if these 2 different codes are in 1 script. That is, both pieces of code will be executed in 1 script, but only the teleport will work."^^ . "0"^^ . . . "lua: attempt to call field 'run' (a table value)"^^ . . . . "0"^^ . "0"^^ . . . "<p>Considering the following example of key binding in nvim init file:</p>\n<pre><code>vim.keymap.set(\n 'n',\n '&lt;leader&gt;x',\n function()\n print('megatron')\n end )\n</code></pre>\n<p>Let's assume my leader is space ' '.</p>\n<p>If I press <code>x</code> it works the first time. But I would like to continue to hold down <code> </code> (space), while I press again <code>x</code>, printing 'megatron' multiple times. Instead, starting from the second time, it begins to delete chars (as if I would have been pressed only <code>x</code>).</p>\n<p>I would like to know if there is a way to map a function to holding space and press a char multiple times.</p>\n"^^ . "Is it possible to create the algorithm in the table with code?"^^ . . "Definitely only with 5.1. But the versions 5.1, 5.2, 5.3 and 5.4 can easily peacefully coexist.\n\nBut insead, try setting `$wgScribuntoEngineConf['luastandalone']['luaPath'] = '/mediawiki-1.41.4/extensions/Scribunto/includes/Engines/LuaStandalone/binaries/lua';`.\n\nAn entirely different solution is to get php-luasandbox mod, enable it in `php.ini` and set `$wgScribuntoDefaultEngine = 'luasandbox';`."^^ . "0"^^ . "3"^^ . . . . . "0"^^ . "What do you propose I do to reproduce it?"^^ . . "Dotnet, C#, Scripting Integration to Lua, can't add sqlite to Lua"^^ . "<p>local a=tonumber;local b=string.byte;local c=string.char;local d=string.sub;local e=string.gsub;local f=string.rep;local g=table.concat;local h=table.insert;local i=math.ldexp;local j=getfenv or function()return <em>ENV end;local k=setmetatable;local l=pcall;local m=select;local n=unpack or table.unpack;local o=tonumber;local function p(q,r,...)local s=1;local t;q=e(d(q,5),&quot;..&quot;,function(u)if b(u,2)==81 then t=a(d(u,1,1))return&quot;&quot;else local v=c(a(u,16))if t then local w=f(v,t)t=nil;return w else return v end end end)local function x(y,z,A)if A then local B=y/2^(z-1)%2^(A-1-(z-1)+1)return B-B%1 else local C=2^(z-1)return y%(C+C)&gt;=C and 1 or 0 end end;local function D()local v=b(q,s,s)s=s+1;return v end;local function E()local v,w=b(q,s,s+2)s=s+2;return w<em>256+v end;local function F()local v,w,G,H=b(q,s,s+3)s=s+4;return H</em>16777216+G<em>65536+w</em>256+v end;local function I()local J=F()local K=F()local L=1;local M=x(K,1,20)<em>2^32+J;local N=x(K,21,31)local O=x(K,32)==1 and-1 or 1;if N==0 then if M==0 then return O</em>0 else N=1;L=0 end elseif N==2047 then return M==0 and O<em>1/0 or O</em>NaN end;return i(O,N-1023)*(L+M/2^52)end;local function P(Q)local R;if not Q then Q=F()if Q==0 then return&quot;&quot;end end;R=d(q,s,s+Q-1)s=s+Q;local S={}for T=1,#R do S[T]=c(b(d(R,T,T)))end;return g(S)end;local U=F;local function V(...)return{...},m(&quot;#&quot;,...)end;local function W()local X={}local Y={}local Z={}local <em>={X,Y,nil,Z}local a0=F()local a1={}for T=1,a0 do local a2=D()local a3;if a2==1 then a3=D()~=0 elseif a2==2 then a3=I()elseif a2==3 then a3=P()end;a1[T]=a3 end;</em>[3]=D()for T=1,F()do local a4=D()if x(a4,1,1)==0 then local a2=x(a4,2,3)local a5=x(a4,4,6)local a6={E(),E(),nil,nil}if a2==0 then a6[3]=E()a6[4]=E()elseif a2==1 then a6[3]=F()elseif a2==2 then a6[3]=F()-2^16 elseif a2==3 then a6[3]=F()-2^16;a6[4]=E()end;if x(a5,1,1)==1 then a6[2]=a1[a6[2]]end;if x(a5,2,2)==1 then a6[3]=a1[a6[3]]end;if x(a5,3,3)==1 then a6[4]=a1[a6[4]]end;X[T]=a6 end end;for T=1,F()do Y[T-1]=W()end;return _ end;local function a7(</em>,a8,a9)local aa=<em>[1]local ab=</em>[2]local ac=_[3]return function(...)local aa=aa;local ab=ab;local ac=ac;local V=V;local ad=1;local ae=-1;local af={}local ag={...}local ah=m(&quot;#&quot;,...)-1;local ai={}local aj={}for T=0,ah do if T&gt;=ac then af[T-ac]=ag[T+1]else aj[T]=ag[T+1]end end;local ak=ah-ac+1;local a6;local al;while true do a6=aa[ad]al=a6[1]if al&lt;=14 then if al&lt;=6 then if al&lt;=2 then if al&lt;=0 then local am;local an;local ao;aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]][a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]ad=ad+1;a6=aa[ad]aj[a6[2]]={}ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]an=aj[ao]am=a6[3]for T=1,am do an[T]=aj[ao+T]end elseif al&gt;1 then local ao=a6[2]local an=aj[ao]for T=ao+1,a6[3]do h(an,aj[T])end else aj[a6[2]]=a8[a6[3]]end elseif al&lt;=4 then if al&gt;3 then ad=a6[3]else aj[a6[2]][a6[3]]=aj[a6[4]]end elseif al==5 then aj[a6[2]]=a7(ab[a6[3]],nil,a9)else local ao=a6[2]local ap=aj[ao+2]local aq=aj[ao]+ap;aj[ao]=aq;if ap&gt;0 then if aq&lt;=aj[ao+1]then ad=a6[3]aj[ao+3]=aq end elseif aq&gt;=aj[ao+1]then ad=a6[3]aj[ao+3]=aq end end elseif al&lt;=10 then if al&lt;=8 then if al&gt;7 then aj[a6[2]]=aj[a6[3]]+aj[a6[4]]else local ao;aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]aj[ao]=ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]][a6[4]]ad=ad+1;a6=aa[ad]do return aj[a6[2]]end;ad=ad+1;a6=aa[ad]do return end end elseif al&gt;9 then local ao=a6[2]local am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]else local ao=a6[2]aj[ao]=ajaoend elseif al&lt;=12 then if al&gt;11 then local ao=a6[2]do return n(aj,ao,ao+a6[3])end else aj[a6[2]]=a9[a6[3]]end elseif al&gt;13 then aj[a6[2]]=aj[a6[3]]else local ao;aj[a6[2]]=a8[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]aj[ao]=ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]][a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]][a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]][a6[4]]ad=ad+1;a6=aa[ad]if aj[a6[2]]==a6[4]then ad=ad+1 else ad=a6[3]end end elseif al&lt;=22 then if al&lt;=18 then if al&lt;=16 then if al==15 then local ar=ab[a6[3]]local as;local at={}as=k({},{__index=function(au,av)local aw=at[av]return aw[1][aw[2]]end,__newindex=function(au,av,ax)local aw=at[av]aw[1][aw[2]]=ax end})for T=1,a6[4]do ad=ad+1;local ay=aa[ad]if ay[1]==14 then at[T-1]={aj,ay[3]}else at[T-1]={a8,ay[3]}end;ai[#ai+1]=at end;aj[a6[2]]=a7(ar,as,a9)else aj[a6[2]]=aj[a6[3]]/a6[4]end elseif al&gt;17 then local ao=a6[2]local an=aj[ao]local am=a6[3]for T=1,am do an[T]=aj[ao+T]end else do return end end elseif al&lt;=20 then if al==19 then local ao=a6[2]ajaoelseif aj[a6[2]]==a6[4]then ad=ad+1 else ad=a6[3]end elseif al==21 then local am;local ao;aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]ajaoad=ad+1;a6=aa[ad]aj[a6[2]]=a9[a6[3]]ad=ad+1;a6=aa[ad]ao=a6[2]am=aj[a6[3]]aj[ao+1]=am;aj[ao]=am[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]ajaoad=ad+1;a6=aa[ad]do return end else local ao=a6[2]local aq=aj[ao]local ap=aj[ao+2]if ap&gt;0 then if aq&gt;aj[ao+1]then ad=a6[3]else aj[ao+3]=aq end elseif aq&lt;aj[ao+1]then ad=a6[3]else aj[ao+3]=aq end end elseif al&lt;=26 then if al&lt;=24 then if al&gt;23 then local ao=a6[2]aj[ao]=ajaoelse aj[a6[2]]=a6[3]end elseif al&gt;25 then do return aj[a6[2]]end else aj[a6[2]]={}end elseif al&lt;=28 then if al&gt;27 then local ao;aj[a6[2]]=aj[a6[3]]+aj[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]/a6[4]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]*a6[4]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]+aj[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]/a6[4]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]*a6[4]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]+aj[a6[4]]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]/a6[4]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]do return n(aj,ao,ao+a6[3])end;ad=ad+1;a6=aa[ad]do return end else aj[a6[2]]=aj[a6[3]][a6[4]]end elseif al==29 then aj[a6[2]]=aj[a6[3]]*a6[4]else local ap;local aq;local ao;aj[a6[2]]={}ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]aj[a6[2]]=aj[a6[3]]ad=ad+1;a6=aa[ad]aj[a6[2]]=a6[3]ad=ad+1;a6=aa[ad]ao=a6[2]aq=aj[ao]ap=aj[ao+2]if ap&gt;0 then if aq&gt;aj[ao+1]then ad=a6[3]else aj[ao+3]=aq end elseif aq&lt;aj[ao+1]then ad=a6[3]else aj[ao+3]=aq end end;ad=ad+1 end end end;return a7(W(),{},r)(...)end;return p(&quot;LOL!043Q00030B3Q00546869726B4F6E656B6579030A3Q0043726561744C4A434D44030E3Q0047656E6572617465436F6C6F7273030B3Q00436F6C6F724F2Q66536574000C3Q00120B3Q00013Q00020500015Q0010033Q000200010002053Q00013Q00120B000100013Q000205000200023Q00100300010003000200120B000100013Q00060F00020003000100012Q000E7Q0010030001000400022Q00113Q00013Q00043Q001E3Q00030B3Q00546869726B4F6E656B657903133Q00526567697374657243686174436F2Q6D616E6403093Q004C4A5F546F2Q676C6503093Q00436D64542Q6F676C6503083Q004C4A5F506175736503083Q00436D64506175736503083Q004C4A5F537461727403083Q00436D64537461727403053Q004C4A5F4344030B3Q00436D64432Q6F6C446F776E03093Q004C4A5F43445F4F2Q46030E3Q00436D64432Q6F6C446F776E4F2Q4603083Q004C4A5F43445F4F4E030D3Q00436D64432Q6F6C446F776E4F4E03063Q004C4A5F434432030C3Q00436D64432Q6F6C446F776E32030A3Q004C4A5F4344325F4F2Q46030F3Q00436D64432Q6F6C446F776E4F2Q463203093Q004C4A5F4344325F4F4E030E3Q00436D64432Q6F6C446F776E4F4E32030A3Q004C4A5F444F545343414E03073Q00444F545343414E030D3Q004C4A5F444F545343414E5F4F4E03093Q00444F545343414E4F4E030E3Q004C4A5F444F545343414E5F4F2Q46030A3Q00444F545343414E4F2Q4603063Q004C4A5F48696403063Q00436D6448696403093Q004C4A5F546172676574030D3Q00436D645461726765744D6F646501473Q001215000100013Q00202Q00010001000200122Q000300033Q00122Q000400046Q00010004000100122Q000100013Q00202Q00010001000200122Q000300053Q00122Q000400066Q00010004000100122Q000100013Q00202Q00010001000200122Q000300073Q00122Q000400086Q00010004000100122Q000100013Q00202Q00010001000200122Q000300093Q00122Q0004000A6Q00010004000100122Q000100013Q00202Q00010001000200122Q0003000B3Q00122Q0004000C6Q00010004000100122Q000100013Q00202Q00010001000200122Q0003000D3Q00122Q0004000E6Q00010004000100122Q000100013Q00202Q00010001000200122Q0003000F3Q00122Q000400106Q00010004000100122Q000100013Q00202Q00010001000200122Q000300113Q00122Q000400126Q00010004000100122Q000100013Q00202Q00010001000200122Q000300133Q00122Q000400146Q00010004000100122Q000100013Q00202Q00010001000200122Q000300153Q00122Q000400166Q00010004000100122Q000100013Q00202Q00010001000200122Q000300173Q00122Q000400186Q00010004000100122Q000100013Q00202Q00010001000200122Q000300193Q00122Q0004001A6Q00010004000100122Q000100013Q00202Q00010001000200122Q0003001B3Q00122Q0004001C6Q00010004000100122Q000100013Q00202Q00010001000200122Q0003001D3Q00122Q0004001E6Q0001000400016Q00017Q00033Q0003043Q006461746503023Q002A742Q033Q0064617900063Q0012073Q00013Q00122Q000100028Q0002000200202Q00013Q00034Q000100028Q00017Q00043Q00026Q00F03F025Q00E06F4003053Q007461626C6503063Q00696E7365727402134Q001E00025Q00122Q000300016Q000400013Q00122Q000500013Q00042Q00030011000100201000070006000200122Q000800033Q00202Q0008000800044Q000900026Q000A00046Q000B00076Q000C00076Q000D00073Q00122Q000E00016Q000A000400012Q00130008000A00010004060003000500012Q001A000200024Q00113Q00017Q00063Q00026Q00F03F027Q0040026Q00084000028Q00025Q00E06F40021B4Q000D00028Q00020001000200202Q00030001000100202Q00040001000200202Q00050001000300262Q0003000C00010004002Q043Q000C0001001217000600053Q001217000700053Q001217000800053Q001217000900014Q000C000600033Q00201D0006000300062Q001C00060006000200202Q00030006000600202Q0006000400064Q00060006000200202Q00040006000600202Q0006000500064Q00060006000200202Q0005000600064Q000600036Q000700046Q000800053Q00122Q000900016Q000600038Q00017Q00&quot;,j(),...)</p>\n"^^ . . . . . "reading delimited text file into Lua table"^^ . . "0"^^ . . "1"^^ . . "0"^^ . . . . . "partition"^^ . . . . "2"^^ . . . . . . "lua script worked perfectly too."^^ . "0"^^ . "1"^^ . "2d-games"^^ . "<ul>\n<li><p>When calling a command from <code>cmd.exe</code> / a batch file, metacharacters such as <code>|</code> only need escaping as <code>^|</code> if they are <em>outside</em> of (what <code>cmd.exe</code> sees as) <code>&quot;...&quot;</code>-enclosed strings.</p>\n</li>\n<li><p>Since you're passing the PowerShell code to execute via the <code>-Command</code> parameter to <a href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_powershell_exe" rel="nofollow noreferrer"><code>powershell.exe</code></a>, the Windows PowerShell CLI, enclosed in <code>&quot;...&quot;</code>, you must therefore <em>not</em> use <code>^</code>-escaping (as the <code>^</code> chars. would then be passed through to PowerShell and break the command):</p>\n</li>\n</ul>\n\n<pre class="lang-lua prettyprint-override"><code>-- ^ instances removed\nos.execute(&quot;powershell -Command \\&quot;Get-WmiObject Win32_Process | Where-Object { $_.ParentProcessId -eq &quot; .. pid .. &quot; } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }\\&quot;&quot;)\n</code></pre>\n"^^ . "<pre><code>old_saving_throw = &quot;IF(not SavingThrow(Ability.Constitution, 12,AdvantageOnPoisoned(),DisadvantageOnPoisoned())):ApplyStatus(STUNNED,100, 2)&quot;\nold_params = &quot;Ability.Constitution, 12,AdvantageOnPoisoned(),DisadvantageOnPoisoned()&quot;\nnew_params = &quot;Ability.Constitution, 12, AdvantageOnPoisoned() | AdvantageOnStunned(), DisadvantageOnPoisoned() | DisadvantageOnStunned()&quot;\n\nlocal modified_saving_throw = string.gsub(old_saving_throw, old_params, new_params)\nprint(&quot;Modified string: &quot;, modified_saving_throw)\n</code></pre>\n<p>This code should replace the substring 'old_params' in 'modified_saving_throw' with 'new_params', so that the expected result of the print is this:</p>\n<pre><code>&quot;IF(not SavingThrow(Ability.Constitution, 12, AdvantageOnPoisoned() | AdvantageOnStunned(), DisadvantageOnPoisoned() | DisadvantageOnStunned())):ApplyStatus(STUNNED,100, 2)&quot;\n</code></pre>\n<p>But instead it is not modified at all, even though the substring 'old_params' does exist (I have tried string.find just to be sure and it returns true)</p>\n"^^ . . . "0"^^ . . . "0"^^ . "0"^^ . "0"^^ . . . "1"^^ . "0"^^ . . . "<p>I have a question about Lua, closures and local variables.</p>\n<p>From my understanding, the loop variable in a numerical for-loop is implicitly local so I was expecting the following code to behave identical.</p>\n<pre><code>local a = 1\nt1 = function()\n return a\nend\na = 2\nt2 = function()\n return a\nend\nprint( t1() )\nprint( t2() )\n\ntable = {}\nfor i=1,2 do \n table[i] = function() \n return i\n end\nend\nprint( table[1]() )\nprint( table[2]() )\n</code></pre>\n<p>To my surprise, it did not. Why does the code print</p>\n<pre><code>2\n2\n1\n2\n</code></pre>\n<p>and not</p>\n<pre><code>2\n2\n2\n2\n</code></pre>\n<p>?</p>\n"^^ . . "1"^^ . . "0"^^ . "<p>It sounds like you may not need to as long as you're executing <code>loadstring</code> server-side (if someone is overriding your loadstring at that point they already have the keys to the kingdom)</p>\n<p>Nearest thing you can get is namespacing your function to a table and overriding <code>__newindex</code></p>\n<pre><code>local l = {}\n\nlocal set = false\nl = setmetatable(l, {\n __newindex = function(t, key, value)\n if key == 'oadstring' then\n if set == false then\n set = true\n t[k] = value\n else\n print('stop!')\n end\n end\n end\n})\n\nfunction l.oadstring() end # Set once\n\nfunction l.oadstring() print('overridden') end\n# stop!\nl.oadstring = function() print('overridden') end\n# stop!\n</code></pre>\n<p>At which point someone would have to replace the <code>l</code> table to redefine the function and inject their version in every file that relies on it without breaking anything (but, again, I don't think you need to do this).</p>\n"^^ . . "0"^^ . "<p>I am trying to implement a screen transition effect in Crank Storyboard using Lua. The goal is to play an animation first and then switch to the target screen. However, when I run my script, the animation does not play—it directly switches to the next screen.</p>\n<p>Here's the code I am using:</p>\n<pre class="lang-lua prettyprint-override"><code>Copy\nEdit\nfunction hide_info_layer(screen)\n if screen then\n gre.set_layer_attrs_global(screen, { hidden = 1 })\n else\n print(&quot;Error: screen is nil in hide_info_layer&quot;)\n end\nend\n\nfunction screen_transition(target_screen)\n if target_screen then\n print(&quot;Transitioning to:&quot;, target_screen)\n gre.set_value(&quot;target_sc&quot;, target_screen)\n gre.send_event(&quot;gre.load_screen&quot;, target_screen) -- Directly load the screen\n else\n print(&quot;Error: target_screen is nil in screen_transition&quot;)\n end\nend\n\nfunction cb_presstart_button(mapargs)\n local current_screen = mapargs.context_screen\n local control = mapargs.context_control\n\n -- Fetch correct screen name\n local target_screen = gre.get_value(string.format(&quot;%s.screen_name1&quot;, control))\n\n print(&quot;Current Screen:&quot;, current_screen)\n print(&quot;Target Screen:&quot;, target_screen)\n\n if current_screen == target_screen then\n print(&quot;Already on target screen, no transition needed&quot;)\n return\n end\n\n hide_info_layer(current_screen)\n\n if current_screen == &quot;start&quot; then\n gre.set_value(&quot;target_sc&quot;, target_screen)\n print(&quot;Triggering animation: punch_NewAnimation&quot;)\n gre.animation_trigger(&quot;punch_NewAnimation&quot;)\n else\n print(&quot;Calling screen_transition&quot;)\n screen_transition(target_screen)\n end\nend\n</code></pre>\n<p>Observed Behavior:\nThe animation <code>punch_NewAnimation</code> does not play when transitioning between screens.</p>\n<p>The screen changes immediately after calling <code>gre.animation_trigger()</code>, skipping the animation effect.</p>\n<p>The console prints the expected logs but does not execute the animation before the screen transition.</p>\n<p>Attempts to Resolve:</p>\n<ol>\n<li><p>Delaying Screen Change Until Animation Ends</p>\n</li>\n<li><p>I tried adding a delay after triggering the animation but didn't find a direct way to ensure the transition happens only after the animation completes.</p>\n</li>\n<li><p>Using Animation Callbacks</p>\n</li>\n<li><p>I attempted to listen for an animation event before triggering the screen change but couldn't find a working solution.</p>\n</li>\n</ol>\n<p>Expected Behavior:\nThe animation (<code>punch_NewAnimation</code>) should play completely.</p>\n<p>After the animation finishes, the screen should transition to <code>target_screen</code>.</p>\n<p>Question:\nHow can I ensure that the animation plays fully before transitioning to the next screen? Is there a way to use animation callbacks or events to handle this properly in Crank Storyboard?</p>\n"^^ . . . . . . "1"^^ . "0"^^ . "<p>After David's explanation. Here is the better version of the code:</p>\n<pre><code>local fs = 'D:\\\\proj\\\\qlua100\\\\app\\\\data\\\\source\\\\orders_daily.csv'\nlocal fd = 'D:\\\\proj\\\\qlua100\\\\app\\\\data\\\\source\\\\orders_daily.xlsx'\nlocal command = '&quot;&quot;csv2xls.cmd&quot; -fs '..fs..' -fd '..fd..' --zoom 90&quot;'\nos.execute(command)\n\n</code></pre>\n<p>I replaced double square brackets with single quotes and added escapes for slashes.\nNow it is possible to use variables.\nDouble quotes are the property of Windows CMD interpreter and must be used in this way. As far as I understand they separate the command and its parameters.\nThis version is much better to my eyes.\nThank you David for your help.</p>\n"^^ . "telescope.nvim"^^ . "-5"^^ . . . . . "0"^^ . "string"^^ . . . . "-1"^^ . "0"^^ . . . "1"^^ . "This question looks like an LLM wrote it."^^ . "0"^^ . . . . . "argument-unpacking"^^ . . . . . . "It looks like the double square brackets are another way of specifying string literals: https://www.lua.org/pil/2.4.html Particularly when those literals should span multiple lines or may contain quote characters or may contain escape sequences which shouldn't be evaluated (and are just part of the string)."^^ . . . . "nginx"^^ . . . . "0"^^ . . . "0"^^ . "1"^^ . "<p>I'm working on drawing an EQ curve using Lua and the EzSVG library, based on 8 bandpoints and filters. However, the EQ curve isn't rendering as expected, and I'm unsure how to base the calculations for the curve properly. I don't have much experience with audio processing or equalizers, so I need help understanding how to calculate the curve based on the bandpoints and filters.</p>\n<p>Here’s the core of my implementation:</p>\n<pre><code>local Props = Properties[&quot;Channel Count&quot;].Value\nCurrentChannel = 1\nSelectedBandPoint = 1\nlocal Channels = {}\n\nfor i = 1, Props do\n local channel = {\n Name = &quot;Channel &quot; .. i,\n Display = &quot;&quot;,\n High_PassFilter = 20,\n Low_PassFilter = 20000,\n LinkGroup = nil,\n Bandpoints = {},\n Filters = {}\n }\n\n table.insert(channel.Bandpoints, {freq = 23.3, gain = 0, BW = 1.0,fill=&quot;#996633&quot;, offcolor=&quot;#472E16&quot;})\n table.insert(channel.Bandpoints, {freq = 54.1, gain = 0, BW = 1.0,fill=&quot;#FF0000&quot;, offcolor=&quot;#7C0000&quot;})\n table.insert(channel.Bandpoints, {freq = 126, gain = 0, BW = 1.0,fill=&quot;#FF9900&quot;, offcolor=&quot;#7C4700&quot;})\n table.insert(channel.Bandpoints, {freq = 293, gain = 0, BW = 1.0,fill=&quot;#FFFF00&quot;, offcolor=&quot;#7C7C00&quot;})\n table.insert(channel.Bandpoints, {freq = 682, gain = 0, BW = 1.0,fill=&quot;#00FF00&quot;, offcolor=&quot;#007C00&quot;})\n table.insert(channel.Bandpoints, {freq = 1590, gain = 0, BW = 1.0,fill=&quot;#0000FF&quot;, offcolor=&quot;#00007C&quot;})\n table.insert(channel.Bandpoints, {freq = 3690, gain = 0, BW = 1.0,fill=&quot;#FF00FF&quot;, offcolor=&quot;#7C007C&quot;})\n table.insert(channel.Bandpoints, {freq = 8600, gain = 0, BW = 1.0,fill=&quot;#CCCCCC&quot;, offcolor=&quot;#626262&quot;})\n\n --[High-Pass Filter]--\n table.insert(channel.Filters, {freq = 20, gain = -6, fill=&quot;#000000&quot;})\n\n --[Low-Pass Filter]--\n table.insert(channel.Filters, {freq = 20000, gain = -6, fill=&quot;#000000&quot;})\n\n table.insert(Channels, channel)\nend\n\n function draw()\n local doc = EzSVG.Document(1045, 598) -- SVG canvas size\n\n local grid_left = 64.686971 -- Leftmost grid line\n local grid_right = 1044.5671 -- Rightmost grid line\n local grid_top = 26.333343 -- Topmost grid line\n local grid_bottom = 586.12834 -- Bottommost grid line\n\n local BackgroundGroup = EzSVG.Group()\n EzSVG.setStyle({\n stroke_width = 1.73,\n stroke = Controls[&quot;Colors Background&quot;].String,\n fill = Controls[&quot;Colors Background&quot;].String\n })\n doc:add(BackgroundGroup)\n\n local function get_x_position(freq)\n local min_freq = 20 \n local max_freq = 20000\n\n local x_pos = grid_left + (math.log(freq) - math.log(min_freq)) / (math.log(max_freq) - math.log(min_freq)) * (grid_right - grid_left)\n return x_pos\n end\n\n local function get_y_position(gain)\n local min_gain = 20\n local max_gain = -20\n\n local y_pos = grid_top + ((gain - min_gain) / (max_gain - min_gain)) * (grid_bottom - grid_top)\n return y_pos\n end\n\n\n if Controls[&quot;Show Grid&quot;].Value == 1.0 then\n local GridGroup = EzSVG.Group()\n EzSVG.setStyle({\n stroke_width = 1.73,\n stroke = Controls[&quot;Colors Grid&quot;].String\n })\n \n -- Vertical grid lines\n local vertical_positions = {1044.5671, 547.17588, 64.686971, 122.15287, 162.98117, \n 194.62317, 220.54914, 242.3923, 261.37748, 278.01503, 293.01945, \n 391.31368, 448.77957, 489.60792, 521.24988, 569.01904, 588.00422, \n 604.64177, 619.64619, 717.94042, 775.40631, 816.23465, 847.87662, \n 873.80262, 895.64578, 914.63096, 931.26851, 946.27293 }\n\n for _, x in ipairs(vertical_positions) do\n GridGroup:add(EzSVG.Line(x, 25.822773, x, 586.63892))\n end\n\n -- Horizontal grid lines\n local horizontal_positions = {26.333343, 96.282193, 166.23103, 236.282, \n 306.23083, 376.17968, 446.23065, 516.17949, 586.12834}\n\n for _, y in ipairs(horizontal_positions) do\n GridGroup:add(EzSVG.Line(63.666271, y, 1045.5879, y))\n end\n doc:add(GridGroup)\n end \n\n if Controls[&quot;Show Band Points&quot;].Value == 1.0 then\n local BandPointsGroup = EzSVG.Group()\n local bandpoint_radius = 9\n local bandpoint_radius_selected = 11\n\n for i, point in ipairs(Channels[CurrentChannel].Bandpoints) do\n local x_pos = get_x_position(point.freq)\n local y_pos = get_y_position(point.gain)-- grid_top + (graph_height / 2)\n\n local radius = (i == SelectedBandPoint) and bandpoint_radius_selected or bandpoint_radius\n\n if x_pos then\n local circle = EzSVG.Circle(x_pos, y_pos, radius, {\n fill = point.fill,\n stroke = Controls[&quot;Colors Labels&quot;].String,\n stroke_width = 1.5\n })\n BandPointsGroup:add(circle)\n end\n end\n\n for _, filter in ipairs(Channels[CurrentChannel].Filters) do\n local x_pos = get_x_position(filter.freq)\n local y_pos = get_y_position(filter.gain)\n\n if x_pos then\n local circle = EzSVG.Circle(x_pos, y_pos, bandpoint_radius, {\n fill = filter.fill,\n stroke = Controls[&quot;Colors Labels&quot;].String,\n stroke_width = 1.5\n })\n BandPointsGroup:add(circle)\n end\n end\n doc:add(BandPointsGroup)\n end\n\n if Controls[&quot;Show EQ Curve&quot;].Value == 1.0 then\n local EQCurveGroup = EzSVG.Group()\n local path = EzSVG.Path({\n stroke = Controls[&quot;Colors EQ Curve&quot;].String,\n stroke_width = 2,\n fill = Controls[&quot;Colors EQ Curve&quot;].String,\n fill_opacity = &quot;0.2&quot;\n })\n \n local graph_width = grid_right - grid_left\n local graph_height = grid_bottom - grid_top\n local x_offset = grid_left\n local y_offset = grid_top\n \n local min_freq = 20\n local max_freq = 20000\n local num_points = 150\n \n \n local function interpolate_gain(freq)\n local points = {} \n \n for _, bp in ipairs(Channels[CurrentChannel].Bandpoints) do\n table.insert(points, bp)\n end\n for _, filter in ipairs(Channels[CurrentChannel].Filters) do\n table.insert(points, filter)\n end\n \n table.sort(points, function(a, b) return a.freq &lt; b.freq end)\n \n local HPF = Channels[CurrentChannel].Filters[1] \n local LPF = Channels[CurrentChannel].Filters[2]\n \n if freq &lt; HPF.freq then\n local alpha = 0.05 -- Controls steepness\n return HPF.gain * math.exp(-alpha * (HPF.freq - freq))\n end\n \n if freq &gt; LPF.freq then\n local alpha = 0.05\n return LPF.gain * math.exp(-alpha * (freq - LPF.freq))\n end\n \n local prev, next = points[1], points[#points]\n for i = 1, #points - 1 do\n if points[i].freq &lt;= freq and points[i + 1].freq &gt;= freq then\n prev = points[i]\n next = points[i + 1]\n break\n end\n end\n \n local t = (math.log(freq) - math.log(prev.freq)) / (math.log(next.freq) - math.log(prev.freq))\n return prev.gain * (1 - t) + next.gain * t\n end\n\n path:moveToA(get_x_position(0),get_y_position(-6))\n path:lineToA(get_x_position(0),get_y_position(-6))\n\n for i = 0, num_points do\n local freq = min_freq * ((max_freq / min_freq) ^ (i / num_points)) \n local gain = interpolate_gain(freq)\n \n local x_pos = x_offset + ((math.log(freq) - math.log(min_freq)) / (math.log(max_freq) - math.log(min_freq))) * graph_width\n local y_pos = y_offset + ((1 - ((gain + 18) / 36)) * graph_height)\n \n if i == 0 then\n path:moveToA(x_pos, y_pos)\n else\n path:lineToA(x_pos, y_pos)\n end\n end\n \n EQCurveGroup:add(path)\n doc:add(EQCurveGroup)\n end\n\n if Controls[&quot;Show Axes&quot;].Value == 1.0 then\n local BandLabelsGroup = EzSVG.Group()\n doc:add(BandLabelsGroup)\n end\n\n return doc:toString(&quot;Design\\\\eq-graph.svg&quot;)\nend\n</code></pre>\n<p>Result:\n<a href="https://i.sstatic.net/XvrUzUcg.png" rel="nofollow noreferrer">myEQCurve</a></p>\n<p>What I'm trying to create:\n<a href="https://i.sstatic.net/XIBTpIRc.png" rel="nofollow noreferrer">endgoal</a></p>\n"^^ . "0"^^ . . . "0"^^ . "1"^^ . "0"^^ . "<p>I'm trying to create a neovim function which selects around <code>{}</code>, plus relevant context on the line above if allman-style.</p>\n<p>For what I've tried: In my mind, I have this series of steps</p>\n<ol>\n<li>Find the opening { by simulating <code>F{</code> in normal mode</li>\n<li>Jump to the matching } by simulating <code>%</code></li>\n<li>Begin a visual selection by simulating pressing <code>v</code></li>\n<li>Jump back to the opening { by simulating <code>%</code> again</li>\n<li>If the topmost line is the first line of the file, return</li>\n<li>If the resulting selection spans only 1 line, return</li>\n<li>If the topmost line does not match the regex <code>^\\s*{\\s*$</code>, return</li>\n<li>Check the content of the line above the topmost line</li>\n<li>IF the line above the topmost line contains a semicolon, select up to it by simulating <code>T;</code></li>\n<li>ELSE, select the entire line by simulating <code>k_</code></li>\n</ol>\n<p>My problem seems to arise when I try to get the number and content of lines. No matter where in the sequence I do this, it seems that the current line will always be regarded as the line on which I started, not the line where the cursor is (or rather, should be). In other words, calling <code>vim.cmd(&quot;normal! F{&quot;)</code> and then asking for <code>vim.api.nvim_get_current_line()</code> will not neccesarily give me the line on which &quot;{&quot; appears, but rather the line on which I started at the beginning of invoking the function.</p>\n<p>In case it matters, I'm invoking the function with the keybind <code>&lt;leader&gt;{</code>, declared like so:</p>\n<pre class="lang-lua prettyprint-override"><code>vim.keymap.set(&quot;n&quot;, &quot;&lt;leader&gt;{&quot;, select_allman, { noremap = true, silent = true })\n</code></pre>\n<p>An early implementation of the code, stopping where I got stuck at querying line content:</p>\n<pre class="lang-lua prettyprint-override"><code>local function select_allman()\n\n vim.cmd(&quot;normal! F{%v%&quot;)\n\n local start_line = vim.fn.line(&quot;'&lt;&quot;)\n local end_line = vim.fn.line(&quot;'&gt;&quot;)\n\n if start_line == end_line then\n -- we always return here because start_line and end_line are the line where we started invoking the function\n return\n end\n\n local line_content = vim.fn.getline(start_line)\n \n if not string.match(line_content, &quot;^%s*{%s*$&quot;) then\n -- we always return here since line_content is where we started, not the line above {\n return\n end\n\n -- here we'd select another line above or back to after ; etc\nend\n</code></pre>\n<p>Is there something I'm missing while trying to get the current line numbers and/or content, or perhaps is my entire idea for how to implement this off-base?</p>\n"^^ . . . . "0"^^ . . . . . . . "closures"^^ . . . . . "1"^^ . . . . . . "0"^^ . . . . . . . . "while-loop"^^ . . . "1"^^ . . "<p>I haven't yet wrapped my head around it all the way, but I think I have got it figured out. I do believe that this is the solution:</p>\n<pre><code>function Screen:getGameCoordAt(pos)\n local constants = Constants()\n -- pos is isometric screen cord.\n -- perform inverse transform on pos, and reverse x and y offsets. \n local iso = Iso(constants.TILE_WIDTH, constants.TILE_HEIGHT)\n local transformed = iso:inverse():transform(Vec2(pos.x - constants.X_OFFSET, pos.y - constants.Y_OFFSET - \n constants.MAX_TILE_HEIGHT + constants.TILE_HEIGHT))\n return Vec2(transformed.x, transformed.y)\nend\n</code></pre>\n<p>Whenever the tiles are drawn, their game coords are transformed to iso, and they are given a base x and y offset. No problem if all the images and tiles are the same height. When we map them back, we just subtract off the offsets first.</p>\n<p>But since there are tiles of different heights, they are given a zIndex, or zOffset. The higher the zOffset, the &quot;lower&quot; they are on the screen, since +y goes down:</p>\n<pre><code>function Tile:draw()\n local constants = Constants()\n -- transform the tile's position to isometric coords\n local zOffset = constants.MAX_TILE_HEIGHT - self.image:getHeight()\n\n local iso = Iso(constants.TILE_WIDTH, constants.TILE_HEIGHT)\n local vecIso = iso:transform(self.pos)\n assert(iso:inverse():transform(vecIso).x == self.pos.x)\n assert(iso:inverse():transform(vecIso).y == self.pos.y)\n\n -- scoot the image to the left by TILE_WIDTH/2, so that the center of the image lies on the origin. \n love.graphics.draw(self.image, constants.X_OFFSET + vecIso.x - constants.TILE_WIDTH/2, constants.Y_OFFSET + vecIso.y + zOffset)\nend\n</code></pre>\n<p>The zOffset is the difference between the base tile height, and the max tile height. Shorter tiles are pushed down by a maximum of MAX_TILE_HEIGHT - TILE_HEIGHT, and the tallest tiles have a zOffset of 0.</p>\n<p>To get map the current screen coord to the correct base tile coord, we have to subtract the entirety of the zOffset and add back on the min tile height, and the cursor will align perfectly with the base of tile. This is great because the mapping only needs to know the minimum and maximum tile height.</p>\n<p>Hopefully this makes sense, leave me a comment if I missed anything.</p>\n"^^ . "@Gimby well put. 1-based arrays are quite jarring. I had to do away with it after adding support for negative indices. So now in my grid update, if any tiles were added or removed, i sort the tiles for proper draw order and iterate over pairs() instead of ipairs()."^^ . . . . . "0"^^ . . . . . "svg"^^ . . . "<p>I got a problem where in my output it shows this:</p>\n<blockquote>\n<p>ServerScriptService.Main.Mob:28: attempt to index number with 'Spawner'</p>\n</blockquote>\n<p>This is my code:</p>\n<pre><code>local ServerStorage = game:GetService(&quot;ServerStorage&quot;)\nlocal mob = {}\n\nfunction mob.Move(mob, map)\n -- Get the zombie's Humanoid\n local zombieHumanoid = script.Parent.Humanoid\n\n -- Create a function to check if the zombie is dead\n local function isZombieDead()\n return zombieHumanoid.Health &lt;= 0\n end\n\n -- Connect the Humanoid's Died event to the function\n zombieHumanoid.Died:Connect()\n -- Destroy the zombie when it's dead\n script.Parent:Destroy()\n\n\nend\n\nfunction mob.Spawn(name, quantity, map)\n local mobExists = game.ServerStorage.Mobs:FindFirstChild(name)\n\n if mobExists then\n for i=1 , quantity do\n task.wait(0.5)\n local newMob = mobExists:Clone()\n newMob.HumanoidRootPart.CFrame = map.Spawner.CFrame\n newMob.Parent = map.Mob\n\n coroutine.wrap(mob.Move)(newMob, map)\n end\n\n else\n warn(&quot;Requested mob does not exist:&quot;, name)\n end\nend\n\nreturn mob\n\n</code></pre>\n<p>Can someone help me??</p>\n<p>I tried to look for the solution but I didn't find a number with Spawner</p>\n"^^ . "Hi, I think it only run once because it get the player’s character, and make a GUI enabled, but I don’t think it’s getting disabled at any time, i’d recommand to make a part to disable it, and test the other part again. Hope this help !"^^ . "1"^^ . . . . . . "I think the problem is you have to make sure Mason loads before everything else. You can simply do it by modifying: `{ "williamboman/mason.nvim", opts = {} }`"^^ . . "When I do `Car.run = Engine(Car)` , a new table is created with its metatable being `Engine` and `Engine.__index = Engine`. So it should be able to access `Engine.run`."^^ . . . "<p>Trying to kill some child processes (given parent pid) from within a lua script. Found solution using <code>wmic</code> but prefer using powershell.</p>\n<p>I can run each of these powershell commands in a standard windows <code>cmd.exe</code> and they all behave as expected.</p>\n<pre><code>powershell -Command &quot;Get-WmiObject Win32_Process | Where-Object { $_.ParentProcessId -eq 311 } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }&quot;\n\ncmd /c &quot;powershell -Command Get-WmiObject Win32_Process ^| Where-Object { $_.ParentProcessId -eq 311 } ^| ForEach-Object { Stop-Process -Id $_.ProcessId -Force }&quot;\n\nset PARENT_PID=311 &amp;&amp; powershell -NoProfile -ExecutionPolicy Bypass -Command &quot;$parentPID = [int]$env:PARENT_PID; Get-WmiObject Win32_Process | Where-Object { $_.ParentProcessId -eq $parentPID } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }&quot;\n</code></pre>\n<p>Each one is essentially the same command as I got more desperate trying to find a variation that would work in lua. However, of course, when trying to run any of them from within a LUA script I cannot get them to work. The command 'windows' pass by very fast and do not appear to have any text in them:</p>\n<pre><code>os.execute(&quot;powershell -Command \\&quot;Get-WmiObject Win32_Process | Where-Object { $_.ParentProcessId -eq &quot; .. pid .. &quot; } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }\\&quot;&quot;)\n\nos.execute(&quot;powershell -Command \\&quot;Get-WmiObject Win32_Process ^| Where-Object { $_.ParentProcessId -eq &quot; .. pid .. &quot; } ^| ForEach-Object { Stop-Process -Id $_.ProcessId -Force }\\&quot;&quot;)\n\nos.execute(&quot;set PARENT_PID=&quot; .. pid .. &quot; &amp;&amp; powershell -NoProfile -ExecutionPolicy Bypass -Command \\&quot;$parentPID = [int]$env:PARENT_PID; Get-WmiObject Win32_Process ^| Where-Object { $_.ParentProcessId -eq $parentPID } ^| ForEach-Object { Stop-Process -Id $_.ProcessId -Force }\\&quot;&quot;)\n</code></pre>\n<p>Any tips on escaping the commands or general troubleshooting methods?</p>\n<p>UPDATE:</p>\n<p>The provided answer is the correct way to solve the problem in question. Turns out I had another problem which was actually causing my command to fail (debugging late at night not a good idea)</p>\n<p>Big piece of advice when having trouble escaping characters being sent to a shell command. WRITE IT TO A BATCH FILE FIRST TO MAKE ABSOLUTELY SURE THE FORMATTING IS CORRECT!</p>\n<p>Anyways it ended up being something simple - my pid variable that I passed into the call had a newline in it! Trouble was I didn't see this in my debug log because I guess vlc strips them out. I did not notice this until first trying to write the contents of the command to a batch file. I later sanitized the pid variable and sure enough all good. My troubleshooting code for reference.</p>\n<pre><code> local sanitized_pid = job_pid:gsub(&quot;%s+&quot;, &quot;&quot;)\n local batch_file = system_directory .. &quot;\\\\abort_job.bat&quot;\n local batch_content = &quot;powershell -Command \\&quot;Get-WmiObject Win32_Process | Where-Object { $_.ParentProcessId -eq &quot; .. sanitized_pid .. &quot; } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }\\&quot;\\n&quot;\n local file = io.open(batch_file, &quot;w&quot;)\n if file then\n file:write(batch_content)\n file:close()\n os.execute(batch_file)\n else\n vlc.msg.err(&quot;Failed to create batch file for aborting job.&quot;)\n end\n</code></pre>\n"^^ . . . "Lua Love: Mapping from isometric screen coordinates to game coordinates results in "off by one" x-coord"^^ . "1"^^ . . "How to apply speed boosts dynamically in a Roblox racing game using Lua?"^^ . . . . . . . "Correct me if I misunderstood the problem. Essentially you have `n-1` between-the-letters positions where you may place a comma, and you want all possible arrangements of them. All you need is a simple binary counter."^^ . "windows"^^ . . "1"^^ . . . "0"^^ . "0"^^ . . "<p>Use the <code>\\'</code> to escape the sequence:</p>\n<pre class="lang-lua prettyprint-override"><code>local dms = '52°52\\'16.9&quot;N'\nprint (dms)\nlocal degrees, minutes, seconds, direction = dms:match('(%d+)%D+(%d+)%D+(%d+%.?%d*)%D*([NSEW])')\nprint (degrees, minutes, seconds, direction)\nlocal decimal = tonumber(degrees) + tonumber(minutes) / 60 + tonumber(seconds) / 60^2\n\nif direction == 'S' or direction == 'W' then\n print (-decimal)\nelse\n print (decimal) -- positive\nend\n</code></pre>\n<pre><code>52°52'16.9&quot;N\n52 52 16.9 N\n52.871361111111\n</code></pre>\n"^^ . . . "0"^^ . . "-1"^^ . . . . . . "2"^^ . . "1"^^ . "Just try to provide more code by editing the post. We can't really help unless we know more about your script. How do you clone it? How do you put that delete script in? Where are they?"^^ . . . . . . "Thank you for the clarification. I just found 2 workarounds:\n1) use an Identity function `function ID(...) return ... end` and then `a, b = ID(\\ntext\\n:find('pollo')\\n)` works.\n2) `a, b = text:\\nfind('pollo')` since `:` allows to continue to next line."^^ . "0"^^ . . "3"^^ . . . . "<p>There is a great explanation of how to do this with 48°12'30&quot; N 16°22'28&quot; E or Zurich: dms: 47°21'7&quot; N 8°30'37&quot; E\nAt <a href="https://stackoverflow.com/questions/19085239/how-to-convert-gps-coordinates-to-decimal-in-lua">How to convert GPS coordinates to decimal in Lua?</a>\nHowever, I cannot work out how to trap to include the decimal value, as in 52°52'16.9&quot;N 0°46'43.5&quot;W.</p>\n"^^ . . . . . . . "0"^^ . . . "Yeah, it is a mistake - it should be "abe". About binary counter - Livio already gave a perfect answer - it is a partitioning of a set from mathematical point of view."^^ . "0"^^ . . . "0"^^ . "2"^^ . . "0"^^ . . . . . "Attempt to index nil with 'humanoid'"^^ . . . . . "The error tries to tell you that `map` is a number."^^ . "0"^^ . "2"^^ . . "cross-platform"^^ . . . "powershell"^^ . . "luafilesystem"^^ . . . "Also, the question can be simplified to how to get from `"fun() world"` to `"hello world"` by replacing `"fun()"` with `"hello"`. So no horizontal scrollbar is needed to display the complete content of the code box."^^ . . . . "0"^^ . . . . . "Converting from one script to another"^^ . "<p>I'm writing a Lua filter for Pandoc to deduce the HTML <code>pagetitle</code> from the first <code>h1</code> heading of the input document. Other than the <code>print()</code> function, <code>io.stderr.write</code> does not append a newline. I found in <a href="https://stackoverflow.com/a/52403720">the answer</a> to <a href="https://stackoverflow.com/q/52400428">NewLine(\\n) alternative in Lua?</a> that <code>[[</code> and <code>]]</code> can be used to create multi-line string literals, but surprisingly this does not work with strings that contain nothing but a line break.</p>\n<pre class="lang-lua prettyprint-override"><code>local pagetitle\n\nfunction Header(header)\n if not pagetitle and header.level == 1 then\n pagetitle = pandoc.utils.stringify(header)\n end\nend\n\n-- capture current line break:\nlocal EOL = [[\n]]\n\nfunction Meta(meta)\n if not meta.pagetitle then\n if pagetitle then\n meta.pagetitle = pagetitle\n else\n io.stderr:write(\n 'WARNING: h1 missing, defaulting HTML pagetitle to input filename.', EOL)\n meta.pagetitle = PANDOC_STATE.input_files[1]\n end\n return meta\n end\nend\n</code></pre>\n<p>Maybe that's just a Lua bug. On the other hand, it didn't look right from the start, although the idea seemed quite clever at first.</p>\n<p>What would you suggest instead?</p>\n"^^ . "0"^^ . . . . . . . . "1"^^ . "<p>look at my nvim config!! <a href="https://github.com/souravsspace/config/tree/main/nvim" rel="nofollow noreferrer">https://github.com/souravsspace/config/tree/main/nvim</a></p>\n<p>i have copied this(<a href="https://github.com/nikolovlazar/dotfiles/tree/main/.config/nvim" rel="nofollow noreferrer">https://github.com/nikolovlazar/dotfiles/tree/main/.config/nvim</a>) and update some... let me know which dir or code i have duplicated and there is an issue:</p>\n<p>when ever I’m in a nextjs/react/vite/tanstack-start/remix project it should auto suggest when ever i typed any html tag ex: (div, h3, h1, p) but it doesn’t (but in astro it does) can you tell my how can I fix it?? Or you can fix it if you don’t mind it will be a great help!</p>\n"^^ . . "0"^^ . . . "0"^^ . "@RichardChambers - I think any `goto`s and labels inside the `...` would behave the same in both cases"^^ . . "<p>Since this is a LocalScript, you can use <code>game.Players.LocalPlayer.Character.HumanoidRootPart.Position</code> to get the Vector3 of the player's character. If you want to get the CFrame of the player's character, use <code>game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame</code>. Example:</p>\n\n<pre class="lang-lua prettyprint-override"><code>print(game.Players.LocalPlayer.Character.HumanoidRootPart.Position) --&gt; 0, 5, 0 (example value)\n\n-- To get rotation:\n\nprint(game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.Rotation) --&gt; 0, 0, 0 (example value)\n</code></pre>\n"^^ . . . . "So there's no error then? If you can't reproduce the error and neither can we, then it seems all is well. (I suspect you may not be understanding my request--I need code i can run to see the error you're showing here... but most of the code isn't provided here. "Reproduce" just means "code I can run that causes the error")"^^ . . "<p>I am trying to improve the Lua <code>io.popen</code> function to use the Win32 <code>CreateProcess</code> api. By default, it uses the libc <code>popen</code> function, which unfortunately spawns a terminal window on Windows even when running in a Desktop application.</p>\n<p>My approach is currently to copy <a href="https://github.com/lua/lua/blob/master/liolib.c" rel="nofollow noreferrer">https://github.com/lua/lua/blob/master/liolib.c</a>, put it in it's own Lua library file and then change some methods. It mostly seems to work, but weirdly reading from the subprocess blocks after 2048 bytes. My assumption is that the pipe buffer is full and is not emptied, but not sure how to configure it.</p>\n<p>So, originally the Lua file does this:</p>\n<pre class="lang-c prettyprint-override"><code>#define l_popen(L,c,m) (_popen(c,m))\n#define l_pclose(L,file) (_pclose(file))\n</code></pre>\n<p>I have replaced this by this code:</p>\n<pre class="lang-c prettyprint-override"><code>static FILE* l_popen(lua_State *L, const char* filename, const char *mode, PROCESS_INFORMATION* pi) {\n ZeroMemory(pi, sizeof(PROCESS_INFORMATION));\n\n HANDLE g_hChildStd_IN_Rd = NULL;\n HANDLE g_hChildStd_IN_Wr = NULL;\n HANDLE g_hChildStd_OUT_Rd = NULL;\n HANDLE g_hChildStd_OUT_Wr = NULL;\n\n SECURITY_ATTRIBUTES saAttr;\n ZeroMemory(&amp;saAttr, sizeof(SECURITY_ATTRIBUTES));\n saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);\n saAttr.bInheritHandle = TRUE;\n saAttr.lpSecurityDescriptor = NULL;\n\n // Pipe for child process' STDOUT\n if (!CreatePipe(&amp;g_hChildStd_OUT_Rd, &amp;g_hChildStd_OUT_Wr, &amp;saAttr, 0)) {\n printf(&quot;Error creating pipe\\n&quot;);\n return NULL;\n }\n\n if ( ! SetHandleInformation(g_hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT, 0) ) {\n printf(&quot;SOmething weird\\n&quot;);\n return NULL;\n }\n\n // Pipe for child process' STDIN\n if (!CreatePipe(&amp;g_hChildStd_IN_Rd, &amp;g_hChildStd_IN_Wr, &amp;saAttr, 0)) {\n printf(&quot;Error creating pipe\\n&quot;);\n return NULL;\n }\n\n if ( ! SetHandleInformation(g_hChildStd_IN_Wr, HANDLE_FLAG_INHERIT, 0) ) {\n printf(&quot;SOmething weird\\n&quot;);\n return NULL;\n }\n\n STARTUPINFO si;\n ZeroMemory(&amp;si, sizeof(si));\n si.cb = sizeof(si);\n si.hStdError = g_hChildStd_OUT_Wr;\n si.hStdOutput = g_hChildStd_OUT_Wr;\n si.hStdInput = g_hChildStd_IN_Rd;\n si.dwFlags |= STARTF_USESTDHANDLES;\n\n if (!CreateProcess( \n NULL,\n filename, //TODO: check unicode?\n NULL,\n NULL,\n TRUE,\n 0,\n NULL,\n NULL,\n &amp;si,\n pi)\n ) {\n printf(&quot;Could not create process\\n&quot;);\n return NULL;\n }\n\n int fd;\n if (strcmp(mode, &quot;r&quot;) == 0) {\n fd = _open_osfhandle((intptr_t) g_hChildStd_OUT_Rd, 0);\n } else if (strcmp(mode, &quot;w&quot;) == 0) {\n fd = _open_osfhandle((intptr_t) g_hChildStd_IN_Wr, 0);\n }\n\n if (fd == -1) {\n printf(&quot;Could not open file descriptor&quot;);\n }\n\n printf(&quot;Got file descriptor:%d\\n&quot;, fd);\n\n FILE* f = _fdopen(fd, mode);\n return f;\n}\n</code></pre>\n<p>which is mostly inspired by the MSDN documentation <a href="https://learn.microsoft.com/en-us/windows/win32/procthread/creating-a-child-process-with-redirected-input-and-output" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/windows/win32/procthread/creating-a-child-process-with-redirected-input-and-output</a>.</p>\n<p>As the original file uses the libc functions like getc or fread, I converted the handle to a <code>FILE*</code> so that it will be easier to maintain (That way, i don't have to change <em>everything</em> to ReadFile. Instead in the future, I can just diff the original source file, add my few changes and done).</p>\n<p>The problem is now here:</p>\n<pre class="lang-c prettyprint-override"><code>static void read_all (lua_State *L, FILE *f) {\n size_t nr;\n luaL_Buffer b;\n luaL_buffinit(L, &amp;b);\n do { /* read file in chunks of LUAL_BUFFERSIZE bytes */\n printf(&quot;Preparing buffer\\n&quot;);\n char *p = luaL_prepbuffer(&amp;b);\n nr = fread(p, sizeof(char), LUAL_BUFFERSIZE, f);\n printf(&quot;Read %zd bytes\\n&quot;, nr);\n //printf(&quot;Content: %s\\n&quot;, p);\n luaL_addsize(&amp;b, nr);\n } while (nr == LUAL_BUFFERSIZE);\n printf(&quot;Read all\\n&quot;);\n luaL_pushresult(&amp;b); /* close buffer */\n}\n</code></pre>\n<p>If I load the library to a Lua interpreter, and execute the following file, I get this:</p>\n<pre class="lang-lua prettyprint-override"><code>local phandle = mylib.popen(&quot;git&quot;)\nprint(phandle:read(&quot;a&quot;))\n</code></pre>\n<pre><code>Got file descriptor:3\nPreparing buffer\nRead 1024 bytes\nPreparing buffer\nRead 1024 bytes\nPreparing buffer\n</code></pre>\n<p>And then it hangs. On the other hand, if I do</p>\n<pre class="lang-lua prettyprint-override"><code>local phandle = mylib.popen(&quot;git&quot;)\nfor i=1,50 do\n print(phandle:read(&quot;l&quot;))\nend\n</code></pre>\n<p>it will print the entire output of <code>git</code>, but also block at the last line (So it seems that it does not properly return a EOF).</p>\n<p>Not sure where the problem is though...</p>\n"^^ . "running roblox script only once"^^ . . "redis-cluster"^^ . . "curve"^^ . . . . . "1"^^ . "sqlite"^^ . . . . . . "I updated the question and added the final coding I came up with. I'm confused as to how I can do it with less space and without using tables."^^ . . . . . "Just to note: judging from the code you are using 1-based arrays for creating the grid as is the LUA standard. I tried that myself for a regular 2D game and I had one-off issues everywhere. Even the Love2D example code uses 0-based arrays for level data. It just makes more sense since the on-screen coordinates also originate at 0,0; you need less of those "-1" conversions in your code to translate from a 1-based position in the grid to a 0-based position on the screen."^^ . "3"^^ . "1"^^ . . . "1"^^ . . "1"^^ . "<p>I’m developing a futuristic racing game in Roblox Studio and need help implementing a dynamic speed boost system for vehicles.</p>\n<p><strong>What I Want to Achieve:</strong></p>\n<ul>\n<li>Players should be able to activate speed boosts (like nitro or magnetic acceleration) using a key press.</li>\n<li>The boost should increase the vehicle’s speed temporarily and then gradually return to normal.</li>\n<li>Boost effects should be smooth and not cause sudden jumps in movement.</li>\n</ul>\n<p><strong>What I’ve Tried So Far:</strong></p>\n<p>I’m using a VehicleSeat for vehicle control and attempted to modify the VehicleSeat. Throttle and VehicleSeat. Torque values. Here’s a basic script I wrote:</p>\n<pre><code>local vehicle = script.Parent\nlocal seat = vehicle:FindFirstChild(&quot;VehicleSeat&quot;)\nlocal boostForce = 5000 -- Example force value\nlocal boostDuration = 3 -- Boost lasts for 3 seconds\n\nlocal function activateBoost()\n if seat and seat.Occupant then\n seat.Torque = seat.Torque + boostForce\n wait(boostDuration)\n seat.Torque = seat.Torque - boostForce\n end\nend\n\nseat.ChildAdded:Connect(function(child)\n if child:IsA(&quot;Humanoid&quot;) then\n activateBoost()\n end\nend)\n</code></pre>\n<p><strong>Issues I’m Facing:</strong></p>\n<ol>\n<li>The boost doesn’t feel smooth—it applies and removes speed too suddenly.</li>\n<li>I’m unsure if modifying Torque is the best approach. Should I use VectorForce, BodyVelocity, or another method?</li>\n<li>How can I make the speed boost work only when a player presses a key (e.g., “Shift”) instead of automatically triggering when they enter the seat?</li>\n</ol>\n<p><strong>What Would Help Me:</strong></p>\n<ul>\n<li>A more gradual speed boost that smoothly increases and decreases.</li>\n<li>A proper way to bind the boost activation to a key press while the player is driving.</li>\n<li>Advice on whether Torque, BodyVelocity, or another method is best suited for this.</li>\n</ul>\n<p>Thanks in advance for any guidance! </p>\n"^^ . . . "<p>Here was the solution: <a href="https://gis.stackexchange.com/questions/195370/determining-curvature-of-polylines">Determining curvature of polylines</a></p>\n<pre class="lang-lua prettyprint-override"><code>-- function to calculate the curvature of a polyline segment using three points\nlocal function calculatePolylineCurvature(p1x, p1y, p2x, p2y, p3x, p3y)\n-- https://gis.stackexchange.com/questions/195370/determining-curvature-of-polylines\n -- compute the determinant (signed area of the triangle)\n local numerator = 2 * ((p2x - p1x) * (p3y - p2y) - (p2y - p1y) * (p3x - p2x))\n\n -- compute the product of the three segment lengths\n local len1 = (p2x - p1x)^2 + (p2y - p1y)^2\n local len2 = (p3x - p2x)^2 + (p3y - p2y)^2\n local len3 = (p1x - p3x)^2 + (p1y - p3y)^2\n\n local denominator = math.sqrt(len1 * len2 * len3)\n\n -- prevent division by zero\n if denominator == 0 then\n return nil\n end\n return -8.1*numerator / denominator -- just to set the same scale as Bezier curvature\nend\n</code></pre>\n<pre class="lang-lua prettyprint-override"><code>-- function to calculate the normal vector to the polyline segment\nlocal function calculatePolylineNormal(p1x, p1y, p2x, p2y, p3x, p3y)\n return p1y - p3y, p3x - p1x\nend\n</code></pre>\n<p>The main function:</p>\n<pre class="lang-lua prettyprint-override"><code> polyline = {100,300,160,257,220,242,280,250,340,271,400,300,460,329,520,350,580,358,640,343,700,300}\n\n local length = 20\n polylineCurvatureLines = {}\n polylineCurvatureHeightLine = {}\n\n table.insert (polylineCurvatureHeightLine, polyline[1])\n table.insert (polylineCurvatureHeightLine, polyline[2])\n\n for i = 3, #polyline - 3, 2 do\n local p1x, p1y = polyline[i-2], polyline[i-1]\n local p2x, p2y = polyline[i], polyline[i+1]\n local p3x, p3y = polyline[i+2], polyline[i+3]\n\n local k = calculatePolylineCurvature(p1x, p1y, p2x, p2y, p3x, p3y)\n local nx, ny = calculatePolylineNormal (p1x, p1y, p2x, p2y, p3x, p3y)\n\n nx = nx * k * length\n ny = ny * k * length\n\n table.insert (polylineCurvatureLines, {p2x, p2y, p2x + nx, p2y + ny})\n table.insert (polylineCurvatureHeightLine, p2x + nx)\n table.insert (polylineCurvatureHeightLine, p2y + ny)\n end\n\n table.insert (polylineCurvatureHeightLine, polyline[#polyline-1])\n table.insert (polylineCurvatureHeightLine, polyline[#polyline])\n</code></pre>\n<p>The result:</p>\n<p><a href="https://i.sstatic.net/JptYbmF2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JptYbmF2.png" alt="good polyline curvature" /></a></p>\n<p><strong>Update:</strong></p>\n<p>It has a mistake! The curvature will be lower for more curve divisions!</p>\n<ul>\n<li><p>factor = 20 for 40 crossings</p>\n<p>factor = 40 for 80 crossings</p>\n</li>\n</ul>\n"^^ . "0"^^ . . . "@gsck: Newlines in Lua are almost always equivalent to other whitespace characters. If OP just wants to split a statement into multiple lines, they shouldn't need extra parentheses at all."^^ . . "1"^^ . . . "<p>I am making a game in roblox and a part of what I am trying to do is find a player who pressed a keybind localy and find the players position(I only need help with finding the players position not the keybind)</p>\n<p>I tried to search online but i didnt find a solution to my problem</p>\n<pre><code>local UserInputService = game:GetService(&quot;UserInputService&quot;)\n\nUserInputService.InputBegan:Connect(function(input, gameProcessed)\n if input.KeyCode == Enum.KeyCode.G then\n _G.MalevolentShire = true\n \n \n end\nend)\n</code></pre>\n"^^ . . "0"^^ . . . "0"^^ . "0"^^ . . . "1"^^ . . . "-1"^^ . . . . . "Why do parentheses affect multiple-argument unpacking?"^^ . "0"^^ . . . . "If you are concerned about `continue` then should you be concerned about `goto` (http://lua-users.org/wiki/GotoStatement ) as well?"^^ . "0"^^ . . "<blockquote>\n<p>how does it work? Why does it give true_value if the condition is true?</p>\n</blockquote>\n<p>Lua has a few concepts that are necessary to understand to give a complete answer here.</p>\n<h3>Logical operators</h3>\n<p>It's first important to understand how <code>and</code> and <code>or</code> work - which may seem obvious but for completeness, from <a href="https://www.lua.org/pil/3.3.html#:%7E:text=The%20operator%20and%20returns%20its%20first%20argument%20if%20it%20is%20false%3B%20otherwise%2C%20it%20returns%20its%20second%20argument" rel="nofollow noreferrer">the official docs</a>:</p>\n<blockquote>\n<p>The operator <code>and</code> returns its first argument if it is false; otherwise, it returns its second argument</p>\n</blockquote>\n<p>And also:</p>\n<blockquote>\n<p>The operator <code>or</code> returns its first argument if it is not false; otherwise, it returns its second argument</p>\n</blockquote>\n<h3>Operator precedence</h3>\n<p>Also from the docs, <a href="https://www.lua.org/pil/3.3.html#:%7E:text=Another%20useful%20idiom%20is%20(a%20and%20b)%20or%20c%20(or%20simply%20a%20and%20b%20or%20c%2C%20because%20and%20has%20a%20higher%20precedence%20than%20or)" rel="nofollow noreferrer">operator precedence</a>:</p>\n<blockquote>\n<p><code>and</code> has a higher precedence than <code>or</code></p>\n</blockquote>\n<p>That means that this code from the question:</p>\n<pre><code>local result = condition and true_value or false_value\n</code></pre>\n<p>Can be read as:</p>\n<pre><code>local result = (condition and true_value) or false_value\n</code></pre>\n<p><em>These two code examples are functionally identical.</em></p>\n<h3>Booleans and truthiness</h3>\n<p>If you're new to lua, <a href="https://www.lua.org/pil/2.2.html#:%7E:text=false%20and%20nil%20as%20false%20and%20anything%20else%20as%20true" rel="nofollow noreferrer">booleans</a> can be surprising.</p>\n<blockquote>\n<p>false and nil as false and <strong>anything else as true</strong></p>\n</blockquote>\n<p>Why do I point this out? because the concept of truthiness is quite different in lua, all of these evaluate to <strong>true</strong>:</p>\n<ul>\n<li>0</li>\n<li>&quot;&quot;</li>\n<li><code>{}</code></li>\n</ul>\n<h2>Scenarios</h2>\n<p>Let's look at a few scenarios to drill things home.</p>\n<h2><code>condition</code> is True</h2>\n<pre><code>&gt; condition=true\n&gt; true_value=&quot;true value&quot;\n&gt; false_value=&quot;false value&quot;\n\n&gt; result = (condition and true_value) or false_value\n&gt; result\ntrue value\n</code></pre>\n<p>In this case:</p>\n<ul>\n<li>The first argument to <code>and</code> is not <code>false</code> or <code>nil</code></li>\n<li>The second argument to <code>and</code> is evaluated\n<ul>\n<li>it is not <code>false</code> or <code>nil</code>, so it is returned</li>\n</ul>\n</li>\n<li>The first argument to <code>or</code> is not <code>false</code> or <code>nil</code>\n<ul>\n<li>so <code>false_value</code> is not evaluated</li>\n<li>The first argument is returned</li>\n</ul>\n</li>\n</ul>\n<h2><code>condition</code> is False</h2>\n<pre><code>&gt; condition=false\n&gt; true_value=&quot;true value&quot;\n&gt; false_value=&quot;false value&quot;\n\n&gt; result = (condition and true_value) or false_value\n&gt; result\nfalse value\n</code></pre>\n<p>In this case:</p>\n<ul>\n<li>The first argument to <code>and</code> is <code>false</code></li>\n<li>The second argument to <code>and</code> is not evaluated</li>\n<li>The first argument to <code>or</code> is <code>false</code>\n<ul>\n<li>so <code>false_value</code> is evaluated and returned</li>\n</ul>\n</li>\n</ul>\n<h2>Gotcha scenarios</h2>\n<p>There are many scenarios that can trip folks up unfamiliar with lua.</p>\n<h3><code>condition</code> is truthy</h3>\n<p>If condition is not a boolean, it's going to be cast to a boolean to evaluate the <code>and</code>. so e.g.:</p>\n<pre><code>&gt; condition=0\n&gt; true_value=&quot;true value&quot;\n&gt; false_value=&quot;false value&quot;\n\n&gt; result = (condition and true_value) or false_value\n&gt; result\ntrue value\n</code></pre>\n<p>In this case:</p>\n<ul>\n<li>The first argument to <code>and</code> is not <code>false</code> or <code>nil</code>\n<ul>\n<li>So it evaluates to <code>true</code></li>\n</ul>\n</li>\n<li>The second argument to <code>and</code> is evaluated\n<ul>\n<li>it is not <code>false</code> or <code>nil</code>, so it is returned</li>\n</ul>\n</li>\n<li>The first argument to <code>or</code> is not <code>false</code> or <code>nil</code>\n<ul>\n<li>so <code>false_value</code> is not evaluated</li>\n<li>The first argument is returned</li>\n</ul>\n</li>\n</ul>\n<p>In many other languages you may expect to get <code>false_value</code> here, but not with Lua.</p>\n<h3><code>true_value</code> is false</h3>\n<p>If <code>true_value</code> is <code>false</code> or <code>nil</code> this is the typical scenario that trips folks up:</p>\n<pre><code>&gt; condition=true\n&gt; true_value=false\n&gt; false_value=&quot;false value&quot;\n\n&gt; result = (condition and true_value) or false_value\n&gt; result\nfalse value\n</code></pre>\n<p>In this case:</p>\n<ul>\n<li>The first argument to <code>and</code> is not <code>false</code> or <code>nil</code></li>\n<li>The second argument to <code>and</code> is evaluated\n<ul>\n<li>it is <code>false</code></li>\n<li>The result of <code>(condition and true_value)</code> is therefore <code>false</code></li>\n</ul>\n</li>\n<li>The first argument to <code>or</code> is <code>false</code>\n<ul>\n<li>so <code>false_value</code> is evaluated and returned</li>\n</ul>\n</li>\n</ul>\n<p>This can be particularly confusing if there are functions in use, here's a fabricated example:</p>\n<pre><code>&gt; user_provided_valid_input=true\n&gt; result = (user_provided_valid_input and doThing()) or tell_user_their_input_was_bad()\n</code></pre>\n<p>If <code>doThing</code> returns <code>nil</code> (e.g. doesn't have a return value) or <code>false</code> (e.g. encounters an error) then <code>tell_user_their_input_was_bad()</code> will be called.</p>\n<h2>Summary</h2>\n<p>The code in the question is equivalent to:</p>\n<pre><code>intermediate = condition and true_value\nresult = intermediate or false_value\n</code></pre>\n<ul>\n<li>It doesn't <em>really</em> mimic a ternary operator</li>\n<li>Don't use <code>a and b or c</code> unless you fully understand the possible pitfalls</li>\n<li>Even then, colleagues or future-you may thank you to avoid this idiom :)</li>\n</ul>\n"^^ . . . "1"^^ . . . "1"^^ . . . . "<p>Based on your use of the word &quot;unpacking,&quot; it seems like you might be coming from Python? Python has tuples, and unpacking looks something like this:</p>\n<pre class="lang-py prettyprint-override"><code>multiple_values = (1, 2)\na, b = multiple_values\n</code></pre>\n<p>Here, <code>multiple_values</code> is <em>one</em> variable that <em>contains</em> multiple values. This behavior is the basis of multiple-return unpacking. Functions that return multiple values don't actually return multiple values. They return one <em>tuple</em> that contains multiple things, and you &quot;unpack&quot; the tuple by assigning each of its items to a different variable.</p>\n<pre class="lang-py prettyprint-override"><code>def find(needle: str, haystack:str) -&gt; tuple[int, int]:\n start = 1\n end = 2\n return start, end\n\na, b = find(&quot;hi&quot;, &quot;this&quot;) # a = &quot;hi&quot;; b = &quot;this&quot;\n</code></pre>\n<p>Crucially, this means that all return values are preserved even if you don't unpack.</p>\n<pre><code>a = find(&quot;hi&quot;, &quot;this&quot;) # a = (&quot;hi&quot;, &quot;this&quot;)\n</code></pre>\n<p>Lua doesn't have tuples. Instead of handling multiple-return through tuples, it does so by directly changing the number of returned values based on context. In fact, it's not exactly right to call this &quot;unpacking&quot; at all because there's no tuple to unpack.</p>\n<pre class="lang-lua prettyprint-override"><code>text:find('pollo') --find returns no values\na = text:find('pollo') --find only returns one value - the other gets discarded\na, b = text:find('pollo') --find returns two values\na, b, c = text:find('pollo') --find returns two values and a &quot;padding&quot; nil\n</code></pre>\n<p>Importantly, this is entirely context-dependent. If you change the way your function is called, it returns a different number of arguments.</p>\n<p>The last thing to understand is what <a href="/a/79439772">shingo explained</a>: in both languages, parentheses can only ever contain one value. The difference is that in Lua, one value means one value, but in Python, one value can mean &quot;two values that are actually one value because they're a tuple.&quot;</p>\n<p>So let's look at two code samples: your code and the equivalent in Python.</p>\n<div class="s-table-container"><table class="s-table">\n<thead>\n<tr>\n<th>Lua</th>\n<th>Python</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>a, b = (text:find('pollo'))</code></td>\n<td><code>a, b = (find('pollo', text))</code></td>\n</tr>\n</tbody>\n</table></div>\n<p>In Python, this works fine. The <code>find</code> call returns a tuple containing two values. The parentheses can only contain one value, but that's fine because those two values are in a single tuple. And the <code>a, b</code> unpacks the tuple into two variables.</p>\n<p>But in Lua, the parentheses must contain precisely one value; there's no &quot;cheating&quot; with tuples like in Python. So instead of choosing the two-value return style like it does without parentheses, Lua is forced to choose the one-value return style to make the function fit its context. That makes the line equivalent to <code>a, b = 6</code>, which sets <code>a = 6</code> and <code>b = nil</code>.</p>\n"^^ . . . . "<p>I was recently trying to write event callback handlers for my UI system, and I've been having trouble accessing higher-scope variables from a procedurally generated global function.</p>\n<p>Here's some sample code to re-create the problem:</p>\n<pre><code>gameInstance = {}\ngameInstance.State = {}\ngameInstance.State.GetPlayerCountry = function()\n local country = {}\n country.GetInterestGroups = function()\n local iglist = {}\n iglist[1] = &quot;ig1&quot;;\n iglist[2] = &quot;ig2&quot;;\n iglist[3] = &quot;ig3&quot;;\n return iglist;\n end;\n return country;\nend;\n\n\ngameState = gameInstance.State;\nplayerCountry = gameState.GetPlayerCountry();\ninterestGroups = playerCountry.GetInterestGroups();\nfor i in ipairs(interestGroups) do\n local elementID = 'Slider' .. i;\n local onClickCallbackID = elementID .. 'Callback';\n print(onClickCallbackID);\n --layout.CreateElementFromTemplate('slider_template', parentElementID);\n --layout.SetOnClickCallback(elementID, onClickCallbackID);\n _G[onClickCallbackID] = function()\n --local layout = layoutController.xmlLayoutProxy;\n print('Testing a dynamic callback ' .. elementID);\n end;\n Slider1Callback();\nend;\n</code></pre>\n<p>This produces the following output (quite unexpectedly):</p>\n<p><a href="https://i.sstatic.net/KPF5bNtG.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/KPF5bNtG.jpg" alt="enter image description here" /></a></p>\n<p>As you can see, my elementID variable isn't being correctly read by my procedural callbacks. This is a problem because my UI framework heavily relies on ids, and the callback system isn't designed to give a callback function the id of the element it is serving as a callback for (it's expected that the function/coder who writes the function knows or has a way of looking it up), and a re-design would be painful, as I'd have to dig into old unmaintained messy C# Unity code written by somebody else that heavily uses reflection, - I'd basically have to re-write the entire event handling portion of the UI library I am using, altering dozenz of classes.</p>\n<p>Why is this happening? Is there any way to fix this.</p>\n"^^ . . "isometric"^^ . "0"^^ . . . . . "1"^^ . . . . . . . . "oop"^^ . "0"^^ . "It seems a more unambiguously descriptive keyword for this problem would be ***"partitions"***, not "permutations". (Helpful to search for related questions and tutorials and documentations)"^^ . "0"^^ . "5"^^ . . . "I now know ChatGPT if frowned on in here; however, I did by braking down my requirements into segments and asking how to lua code the segments. It provided readable code using substing! for the two halves of the dms string. Thank you for the alphabet soup ;) that as a longtime ex coder I find very difficult."^^ . "<p>The <code>end</code> keyword needs to be on the line above <code>theme</code> and then you're missing a closing brace + parenthesis <code>})</code> below <code>background</code>. Tables need to be closed <code>{}</code> as do function calls <code>()</code>, so maybe make it a habit to go through and count the open vs closing characters to make sure they are equal.</p>\n<p>I would also consider using an editor with some language server protocol support for lua that can highlight syntax errors. The denizens here think these types of questions aren't great.</p>\n"^^ . . . "lua-5.4"^^ . "5"^^ . "1"^^ . "0"^^ . . . . . "0"^^ . . "1"^^ . . "Does your code relies on `loadstring()` to execute user's code, and does that user `require()` your code, so that you are afraid that, before `require()` the user will redefine `loadstring()`?"^^ . . . . . . . "<p>I was beating my head around the following problem. VB.net programs dumbly converted from C# samples do not work for me. VB samples I could find are outdated... I would like to read all FFT peaks of a wavefile. (Not in real time).</p>\n<p>To my understanding I have to cycle though chunks of a wavefile, read peaks... How can I do in in VB? (NAudio or Bass.net... or anything else)</p>\n<p>Thanks.\n(Alternatively if you know how to do it in Lua, I would be grateful for the solution, too.)</p>\n"^^ . . "0"^^ . "1"^^ . . . . "<pre><code> part = script.Parent\n part.Touched:Connect(function(hit)\n local plr = game.Players:GetPlayerFromCharacter(hit.Parent)\n plr.PlayerGui.upd.Enabled = true\n end)\n</code></pre>\n<p>that script run only once, but must run any time player touching part. Why?</p>\n"^^ . . . . . "1"^^ . . "redis"^^ . . . . . . "@shingo Saw others doing it, thought I would need it, and it does work in some of the cmd.exe calls…"^^ . "You could try to reinstall Lua 5.1."^^ . "0"^^ . . . "0"^^ . "What other information is posted when you run `LspInfo`? It might be useful to post all the output for the active LSP configurations (or lack thereof)."^^ . "0"^^ . "openresty"^^ . "0"^^ . "0"^^ . . . . "collision"^^ . "1"^^ . . "<p>I want to make nginx handle large request by dumping them into a file and instead set a header so my backend app can read the file instead. However, whatever I try, the file is gone before I can do anything with it:</p>\n<pre><code> location ~ ^/upload $ {\n client_body_in_file_only on;\n\n content_by_lua_block {\n ngx.req.read_body()\n local body_file = ngx.req.get_body_file()\n ngx.req.set_header(&quot;X-File-Path&quot;, body_file)\n ngx.req.set_body_data(&quot;&quot;)\n return ngx.exec(&quot;@proxy_target&quot;)\n }\n }\n location @proxy_target {\n proxy_pass http://127.0.0.1:8000$request_uri;\n }\n</code></pre>\n<p>The code is pretty straight forward and body_file is defined. However, the file itself doesnt exist. When I dont read the file via <code>read_body</code> it does exist but then I cant get the name of the file because it returns nil. If i DO read the file, I can get its name but its gone. Grrr</p>\n<p>I first tried using nginx without lua. However, it is impossible to remove the request body without getting malformed request errors in my backend app.\nIf someone knows a solution via nginx alone that obviously would be much preferred</p>\n<p>Any pointers are welcome!</p>\n<p>// EDIT: Opened a bug report since this seems inconsistent behavior: <a href="https://github.com/openresty/lua-nginx-module/issues/2405" rel="nofollow noreferrer">https://github.com/openresty/lua-nginx-module/issues/2405</a></p>\n"^^ . "0"^^ . "0"^^ . "1"^^ . . "0"^^ . . . . . "0"^^ . . . . . . "0"^^ . . "0"^^ . . . . . . "0"^^ . "I need to block the function from being changed, or if it doesn't search for the original function without any modification"^^ . . . . "0"^^ . "1"^^ . . . . . "dependency-injection"^^ . . "1"^^ . . . "<p>Path in <code>postbuildcommands</code> should be made relative to project;\nto inform premake that such string contains paths, you have to enclosed them by <code>%[..]</code>, i.e</p>\n<pre class="lang-lua prettyprint-override"><code>postbuildcommands {\n &quot;{COPYFILE} %[vendor/SDL3/lib/SDL3.dll] %[bin/Debug-windows-x86_64]&quot;\n}\n</code></pre>\n<p>For this kind of <code>postbuildcommands</code>, a good alternative is</p>\n<pre class="lang-lua prettyprint-override"><code>files &quot;vendor/SDL3/lib/SDL3.dll&quot;\n\nfilters &quot;files:**.dll&quot;\n buildaction &quot;Copy&quot;\nfilters {}\n</code></pre>\n<p>Which would copy the file only when missing or outdated</p>\n"^^ . "0"^^ . . . "-1"^^ . . . . . . "2"^^ . . . "<p>Below is a table of RGB color codes.</p>\n<p>When I use this table in a form with lua code, I create a 13*9 color tone panel.\nIs it possible to create a code that creates the same algorithm (color codes) without using the table (or based on the first row of 13 colors)?</p>\n<p><code>local clrtbl = { 0x000033,0x001933,0x003333,0x003319,0x003300,0x193300,0x333300,0x331900,0x330000,0x330019,0x330033,0x190033,0x000000, 0x000066,0x003366,0x006666,0x006633,0x006600,0x336600,0x666600,0x663300,0x660000,0x660033,0x660066,0x330066,0x202020, 0x000099,0x004C99,0x009999,0x00994C,0x009900,0x4C9900,0x999900,0x994C00,0x990000,0x99004C,0x990099,0x4C0099,0x404040, 0x0000CC,0x0066CC,0x00CCCC,0x00CC66,0x00CC00,0x66CC00,0xCCCC00,0xCC6600,0xCC0000,0xCC0066,0xCC00CC,0x6600CC,0x606060, 0x0000FF,0x0080FF,0x00FFFF,0x00FF80,0x00FF00,0x80FF00,0xFFFF00,0xFF8000,0xFF0000,0xFF007F,0xFF00FF,0x7F00FF,0x808080, 0x3333FF,0x3399FF,0x33FFFF,0x33FF99,0x33FF33,0x99FF33,0xFFFF33,0xFF9933,0xFF3333,0xFF3399,0xFF33FF,0x9933FF,0xA0A0A0, 0x6666FF,0x66B2FF,0x66FFFF,0x66FFB2,0x66FF66,0xB2FF66,0xFFFF66,0xFFB266,0xFF6666,0xFF66B2,0xFF66FF,0xB266FF,0xC0C0C0, 0x9999FF,0x99CCFF,0x99FFFF,0x99FFCC,0x99FF99,0xCCFF99,0xFFFF99,0xFFCC99,0xFF9999,0xFF99CC,0xFF99FF,0xCC99FF,0xE0E0E0, 0xCCCCFF,0xCCE5FF,0xCCFFFF,0xCCFFE5,0xCCFFCC,0xE5FFCC,0xFFFFCC,0xFFE5CC,0xFFCCCC,0xFFCCE5,0xFFCCFF,0xE5CCFF,0xFFFFFF}</code></p>\n<p><a href="https://i.sstatic.net/v04pj8o7.png" rel="nofollow noreferrer">The color palette that the table creates.</a></p>\n<p>This algorithm table creates 13 colors from left to right, 9 tones from top to bottom. When considered in this context, it appears to be arranged with a certain symmetry.\nThe final output is clear in the picture.\nHow can we solve this?<br />\nI have added a calculation code below. But it doesn't even come close to my table list. My goal is to make a function that generates the same algorithm (RGB hex codes that generate color tones) with lua code, without using the table.</p>\n<p>EDIT:\nI think the closest I could get to the result by taking 2 rows (26 color tones) from the table is as follows:</p>\n<pre><code>local base_colors = {0x000033, 0x001933, 0x003333, 0x003319, 0x003300, 0x193300, 0x333300, 0x331900, 0x330000, 0x330019, 0x330033, 0x190033, 0x000000}\n\nlocal special_colors = {0x0000FF, 0x0080FF, 0x00FFFF, 0x00FF80, 0x00FF00, 0x80FF00, 0xFFFF00, 0xFF8000, 0xFF0000, 0xFF007F, 0xFF00FF, 0x7F00FF, 0xFFFFFF}\n\nlocal function calculate_shades(base_color)\n local shades = {}\n local step = 0x22\n\n for i = 0, 7 do\n local red = ((base_color // 0x10000) &amp; 0xFF)\n local green = ((base_color // 0x100) &amp; 0xFF)\n local blue = (base_color &amp; 0xFF)\n\n red = math.min(255, red + i * step)\n green = math.min(255, green + i * step)\n blue = math.min(255, blue + i * step)\n\n local shade = (red &lt;&lt; 16) + (green &lt;&lt; 8) + blue\n shades[#shades + 1] = shade\n end\n\n table.insert(shades, base_color)\n return shades\nend\n\nlocal function generate_color_table(base_colors, special_colors)\n local color_table = {}\n local special_index = 1\n for base_index, base_color in ipairs(base_colors) do\n local shades = calculate_shades(base_color)\n for shade_index, shade in ipairs(shades) do\n if (base_index - 1) * 9 + shade_index == special_index * 9 then\n table.insert(color_table, special_colors[special_index])\n special_index = special_index + 1\n else\n table.insert(color_table, shade)\n end\n end\n end\n return color_table\nend\n\nlocal result = &quot;newClrTbl = {&quot;\n\nlocal color_table = generate_color_table(base_colors, special_colors)\nfor i = 1, #color_table do\n if i == #color_table then\n result = result .. (string.format(&quot;0x%06X&quot;, color_table[i]))\n else\n result = result .. (string.format(&quot;0x%06X,&quot;, color_table[i]))\n end\nend\n\nprint(result..&quot;}&quot;)\n</code></pre>\n<p><a href="https://i.sstatic.net/YFTNJWx7.png" rel="nofollow noreferrer">Panel with the last edited code output</a></p>\n<p>There still seems to be a lot of code waste.\nIs there a code that can do this algorithm without using a table and based on the color tones in the main table?</p>\n"^^ . "How do I draw a EQ Curve based on 8 bandpoints?"^^ . . "0"^^ . . . "0"^^ . . . "<p>Both <code>.*(%d+)</code> and <code>.*(%d)+</code> result in the same output because <code>.*</code> matches any zero or more chars as many as possible, and then <code>(%d+)</code> captures just one last digit into Group 1, and <code>(%d)+</code> captures the last digit, too (techincally, these are different patterns, but due to <code>.*</code> there is only one digit both <code>(%d+)</code> and <code>(%d)+</code> can match). The <code>string.match</code> only returns the captured substring if there is a capturing group in the regex, and your regex contains that one capturing group.</p>\n<p>You need</p>\n<pre class="lang-lua prettyprint-override"><code>local p1 = &quot;^.*%d&quot;\n</code></pre>\n<p>Here,</p>\n<ul>\n<li><code>^</code> - start of string</li>\n<li><code>.*</code> - any zero or more chars as many as possible</li>\n<li><code>%d</code> - a digit character.</li>\n</ul>\n<p>See the <a href="https://ideone.com/jyXJlV" rel="nofollow noreferrer">Lua demo</a>.</p>\n<p>Note the <code>^</code>, start of string anchor, is not necessary here if you go on using <code>string.match</code>. It just explicitly says to start matching from the start of the string. In case you ever want to get consistent results with <code>string.gmatch</code>, you will find it helpful.</p>\n"^^ . "latex"^^ . "1"^^ . . . "1"^^ . "0"^^ . . . . . . "0"^^ . . . . "Custom Auto Clicker in LG Ghub not working, unknown syntax error plus async coding?"^^ . . . "0"^^ . . . . "0"^^ . . . . . "1"^^ . . . . . "Thanks for your reply, Dmitry. Wow! I didn't do a great job at reproducing that simple example. Good catch. Thanks for that. I could see the results that you anticipated. I'll try expand this to see if I can connect with the backend server and get a response."^^ . . . "Add `/MACHINE:X64`"^^ . "osrm"^^ . . . . "that'll do! took me a second to figure it out, but that will do what i'm looking for!"^^ . "1"^^ . "3"^^ . . . "0"^^ . "3"^^ . . "0"^^ . . . . "line-breaks"^^ . . "1"^^ . "@lhf There must be something happening that I don't understand then. How I'd expect it to execute is: loop iteration begins -> elementID is assigned the value of Slider1, Slider2, etc. -> my callback is created and added to the global table -> it receives the value of elementID at the current iteration (Slider1, Slider2, Slider3, etc). Instead, the copy of elementID being given to all of the callbacks is "Slider1"."^^ . . . . . . "<p>The description of <a href="https://openresty-reference.readthedocs.io/en/latest/Lua_Nginx_API/#ngxreqset_body_data" rel="nofollow noreferrer">ngx.req.set_body_data</a> in the reference says:</p>\n<blockquote>\n<p>When the current request's request body has been read into memory or buffered into a disk file, then the old request body's memory will be freed <strong>or the disk file will be cleaned up immediately</strong>, respectively.</p>\n</blockquote>\n<p>I think this is the reason why the body file is gone.</p>\n"^^ . . "@Aer, you have `{ "aeb", "d", "c"};` in your example, but it is supposed to be incorrect, is it?"^^ . "<p>This statement mimics a ternary operator in the Lua programing language:</p>\n<pre><code>local result = condition and true_value or false_value\n</code></pre>\n<p>But how does it work? Why does it give <code>true_value</code> if the condition is true?</p>\n"^^ . . "Not really an "answer", but an exploratory method might be to just plug different permutations into a bytecode visualizer (like https://www.luac.nl/). The instructions are definitely not 1-1 identical."^^ . . . "1"^^ . "<p>Because Lua's syntax defines that expressions in parentheses can only be a single expression:</p>\n<blockquote>\n<p>exp ::= nil | false | true | Numeral | LiteralString | ‘...’ | functiondef | <strong>prefixexp</strong> | tableconstructor | exp binop exp | unop exp</p>\n</blockquote>\n<blockquote>\n<p>prefixexp ::= var | functioncall | <strong>‘(’ exp ‘)’</strong></p>\n</blockquote>\n<p>This is also mentioned in the manual:</p>\n<blockquote>\n<p><a href="https://www.lua.org/manual/5.1/manual.html#2.5" rel="noreferrer">Lua 5.1-5.3</a> Any expression enclosed in parentheses always results in only one value.</p>\n</blockquote>\n<blockquote>\n<p><a href="https://www.lua.org/manual/5.4/manual.html#3.4.12" rel="noreferrer">Lua 5.4</a> As a particular case, the syntax expects a single expression inside a parenthesized expression; therefore, adding parentheses around a multires expression forces it to produce exactly one result.</p>\n</blockquote>\n"^^ . . "`Engine.__call = Engine.run` is an assignment, not a binding, its value won't be automatically updated."^^ . . . . . . . "1"^^ . . "0"^^ . "<p>The <a href="https://www.lua.org/pil/20.1.html" rel="nofollow noreferrer"><code>string:find</code></a> method in Lua can return multiple values: the start of the match and the end. I can then use unpacking to assign the start and the end to separate variables.</p>\n<pre><code>&gt; text = 'ciao pollo mario'\n\n&gt; a, b = text:find('pollo') -- without parentheses\n&gt; a, b\n6 10\n</code></pre>\n<p>But for some reason, putting parentheses around the <code>find</code> call messes up the unpacking:</p>\n<pre><code>&gt; a, b = ( text:find('pollo') ) -- with parentheses\n&gt; a, b\n6 nil\n</code></pre>\n<p>This is very sad since I use parentheses for code readability, like this:</p>\n<pre><code>&gt; a, b = (\n text:find('pollo')\n)\n</code></pre>\n<p>Why is this happening? I would expect that parentheses don't have any effect on the result!</p>\n"^^ . "<p>I'm working on extracting routes for OSRM routing. The goal is to use this data for matching GPS data to routes.</p>\n<p>As the profiles.lua are not well documented and hard to debug, I took the approach to first filter the osm.pbf and then generate the routing via osrm-extract.</p>\n<p>The goal would be to weight the routing by a tag like gtfs:id.\nIs this possible to weight the route by this tag?</p>\n<p>Any source for a detailed explanation of the profiles.lua settings would be highly welcome.</p>\n"^^ . . "0"^^ . "@WalterMitty, as there's no apparent reference to lua in that is it relevant ?"^^ . . "This is all I could find on documentation for the profile usage: https://github.com/Project-OSRM/osrm-backend/blob/master/docs/profiles.md"^^ . . "<p>Why is my OSM map rendering squished in Love2D?</p>\n<p>I'm trying to render an OpenStreetMap (.osm) file in Love2D without using external libraries. The issue is that the displayed map appears vertically squished instead of maintaining its correct proportions.</p>\n<p>Here is how I process the .osm file:</p>\n<ol>\n<li>parse the XML to extract nodes and ways.</li>\n<li>convert latitude and longitude directly to (x, y) coordinates.</li>\n<li>compute a scale factor based on the bounding box of the map and the screen dimensions (same for X and Y axis)</li>\n<li>draw the map using love.graphics.line() as precalculated line.</li>\n</ol>\n<p>Problem:\nThe map appears compressed vertically instead of maintaining the correct aspect ratio.</p>\n<p>The code:</p>\n<pre class="lang-lua prettyprint-override"><code>local filenames = {\n 'map-55.osm', -- https://osm.org/go/evapcHOU -- 54.92349, -2.96367\n 'map-0.osm', -- https://osm.org/go/lX8ggeT68 -- -0.697995, 10.243917\n}\n\n-- osm\nlocal osm = {}\n\nfunction osm.parseOSM(xml)\n local nodes = {}\n local nodesHash = {}\n\n local nodeIndex = 0\n local ways = {}\n for wayStr in xml:gmatch('&lt;way.-&gt;.-&lt;/way&gt;') do\n local nodeIndices = {}\n for id in wayStr:gmatch('&lt;nd ref=&quot;(.-)&quot;') do -- id or nd\n if nodesHash[id] then\n table.insert (nodeIndices, nodesHash[id])\n else\n nodeIndex = nodeIndex + 1\n nodesHash[id] = nodeIndex\n table.insert (nodeIndices, nodeIndex)\n end\n end\n-- print ('#nodeIndices', #nodeIndices)\n local way = {nodeIndices = nodeIndices, line = {}}\n table.insert (ways, way)\n end\n\n for nodeStr in xml:gmatch('&lt;node.-/&gt;') do\n local id = nodeStr:match('id=&quot;(.-)&quot;')\n local x = tonumber(nodeStr:match('lon=&quot;(.-)&quot;')) -- X\n local y = tonumber(nodeStr:match('lat=&quot;(.-)&quot;')) -- Y\n if nodesHash[id] then\n nodes[nodesHash[id]] = {x=x, y=-y}\n else\n\n end\n end\n\n local minLat, minLon, maxLat, maxLon = xml:match('&lt;bounds minlat=&quot;(.-)&quot; minlon=&quot;(.-)&quot; maxlat=&quot;(.-)&quot; maxlon=&quot;(.-)&quot;/&gt;')\n\n local minX = tonumber(minLon) -- x\n local maxX = tonumber(maxLon) -- x\n local minY = tonumber(minLat) -- y\n local maxY = tonumber(maxLat) -- y\n\n local dx = maxX-minX\n local dy = maxY-minY\n\n local bounds = {\n minX=minX, \n maxX=maxX, \n dx=dx,\n midX=minX + dx/2, \n minY=minY, \n maxY=maxY, \n dy=dy,\n midY=minY + dy/2, \n }\n\n return {nodes = nodes, ways = ways, bounds = bounds}\nend\n\nfunction osm.updateScale(mapData)\n local bounds = mapData.bounds\n local screenWidth, screenHeight = love.graphics.getDimensions ()\n mapData.scale = math.min(screenWidth / bounds.dx, screenHeight / bounds.dy)\n print ('mapData.scale', mapData.scale)\n\n local ways = mapData.ways\n local nodes = mapData.nodes\n for i, way in ipairs (ways) do\n way.line = {}\n for j, nodeIndex in ipairs (way.nodeIndices) do\n local node = nodes[nodeIndex]\n local x = node.x * mapData.scale\n local y = node.y * mapData.scale\n print ('x: '..x, 'y: '..y)\n table.insert (way.line, x)\n table.insert (way.line, y)\n end\n end\nend\n\nlocal mapDataSet = {}\n\nfunction love.load()\n for i, filename in ipairs (filenames) do\n local file = love.filesystem.read(filename)\n if file then\n local mapData = osm.parseOSM(file)\n osm.updateScale(mapData)\n mapDataSet[i] = mapData\n end\n end\n mapData = mapDataSet[1]\nend\n\nfunction love.draw()\n local tx = mapData.bounds.midX*mapData.scale - 400\n local ty = mapData.bounds.midY*mapData.scale + 300\n love.graphics.translate (-tx, ty)\n for _, way in pairs(mapData.ways) do\n love.graphics.line(way.line)\n end\nend\n</code></pre>\n<p>At higher latitudes (lat 55°), the geometry looks compressed vertically, as if the map is being flattened:</p>\n<p><a href="https://i.sstatic.net/LorN1ndr.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/LorN1ndr.png" alt="OSM Lua Love2D" /></a></p>\n<p>Near the equator (lat ≈ 0°), the shapes appear correct:</p>\n<p><a href="https://i.sstatic.net/65dpU5uB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/65dpU5uB.png" alt="OSM Lua equator" /></a></p>\n<p>How can I correctly transform latitude values to maintain the correct proportions across the whole map?</p>\n<p>Edited:\nI've used the Mercator projection:</p>\n<pre class="lang-lua prettyprint-override"><code>local function mercatorY(lat)\n local radLat = math.rad(lat)\n local merY = math.deg(math.atan(math.sinh(radLat)))\n return merY\nend\n</code></pre>\n<p>but it was not enough, I need extra curved factor with magic value to make the 55° round again:</p>\n<pre class="lang-lua prettyprint-override"><code>local function mercatorY(lat)\n local radLat = math.rad(lat)\n local merY = math.deg(math.atan(math.sinh(radLat)))\n local stretchY = 1 + (1 - math.cos(radLat)) * 1.1\n return merY * stretchY\nend\n</code></pre>\n<p>Than I've tried to make check the other lat (lat = 40°) and it was ellipse too, but too high:</p>\n<pre class="lang-lua prettyprint-override"><code> 'map-40.osm', -- https://osm.org/go/xehPtqIcg -- 39.875064, 20.027293\n</code></pre>\n<p><a href="https://i.sstatic.net/vIvIiho7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vIvIiho7.png" alt="not round roundabout" /></a></p>\n<p>Edit:</p>\n<p>Found the solution there: <a href="https://stackoverflow.com/questions/25614911/osm-data-slightly-distorted-flat-projection/">OSM data slightly distorted (flat projection)</a></p>\n"^^ . "0"^^ . "<p>It was necessary to run external CMD (batch) script from my Lua program. I am on Windows 10 and Lua script is running from one of the trading terminals (Quik). Meaning I am restricted from using some custom built Lua modules.</p>\n<p>Here is the way I managed to run the script and it is working perfectly:</p>\n<pre><code>local command = [[&quot;&quot;csv2xls.cmd&quot; -fs D:\\proj\\qlua100\\app\\data\\source\\orders_cancelled.csv -fd D:\\proj\\qlua100\\app\\data\\source\\orders_cancelled.xlsx --zoom 90&quot;]]\nos.execute(command)\n</code></pre>\n<p>but I do not understand this way of merger between Lua and Windows CMD features in a way of running this code.</p>\n<p>What double square brackets mean at the beginning and at the end of the code?</p>\n<p>What is the meaning of quotes?</p>\n<p>I would like to replace those long file names with variables. But the sequence after the equal sign is not the string.</p>\n<p>How this line works from Lua stand point?\nCould someone explain it please or point me to the article(s) which does.</p>\n"^^ . "1"^^ . . "lazyvim"^^ . . . "0"^^ . . . "1"^^ . "1"^^ . . . . . . "How to block functions from being overwritten?"^^ . "1"^^ . "2"^^ . . "<p>I am getting this error while trying to use Semantic MediaWiki.</p>\n<p>MediaWiki 1.41.4<br>\nPHP 8.2.27 (litespeed)<br>\nICU 76.1<br>\nMySQL 8.0.33-cll-lve<br>\nLua 5.1.5<br>\nSemantic MediaWiki 4.2.0<br>\nSemantic Scribunto 2.3.2</p>\n<p>I have followed the [instructions here]<a href="https://www.mediawiki.org/wiki/Extension:Scribunto#Bundled_binaries" rel="nofollow noreferrer">1</a> that say 'Scribunto should work for you out of the box if'. And I have:</p>\n<ul>\n<li>Linux x86-64</li>\n<li>PHP's proc_open function is not restricted.</li>\n<li>proc_terminate and shell_exec are not disabled in PHP.</li>\n<li>lua5_1_5_linux_64_generic/lua is set to 755</li>\n<li>SELinux is not running on my server.</li>\n</ul>\n<p>LocalSettings.php includes<br>\n<code>$wgScribuntoDefaultEngine = 'luastandalone';\n$wgScribuntoEngineConf['luastandalone']['errorFile'] = &quot;$IP/images/temp/lua-error.log&quot;;</code></p>\n<p>I attempted to verify that lua is running.</p>\n<p><code>[home@az1-ss108 lua5_1_5_linux_64_generic]$ file lua\nlua: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, stripped</code></p>\n<p>So it seems to be running.</p>\n<p>It is not working out of the box.</p>\n<p>lua-error.log contains: (edited. original post contained contents of wrong error file)</p>\n<pre><code>/mediawiki-1.41.4/extensions/Scribunto/includes/Engines/LuaStandalone/lua_ulimit.sh: line 6: /mediawiki-1.41.4/extensions/Scribunto/includes/Engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic: Is a directory\n/mediawiki-1.41.4/extensions/Scribunto/includes/Engines/LuaStandalone/lua_ulimit.sh: line 6: exec: /mediawiki-1.41.4/extensions/Scribunto/includes/Engines/LuaStandalone/binaries/lua5_1_5_linux_64_generic: cannot execute: Is a directory\n</code></pre>\n<p>I tried using <code>$wgScribuntoEngineConf['luastandalone']['luaPath'] = '/usr/bin/lua</code>, but the version running on my server is 5.2, so this is not a workaround.</p>\n"^^ . . . . . "0"^^ . . "<p>I'm currently working on a small 2D game using the LÖVE2D engine. I created a background with Tiled and exported it as a <code>.lua</code> file. However, I'm facing two issues with this background:</p>\n<p><strong>Problem number one:</strong> I want different layers to move at different speeds to create a parallax effect. Unfortunately, the solution I came up with doesn't work. Here are the relevant fragments of my code:</p>\n<pre><code>-- variables for moving background\nlocal layerOffsets = {}\nlocal layerSpeeds = {\n sky = 100,\n ground = 150,\n clouds = 50,\n}\n\nfunction love.load()\n -- loading libraries\n sti = require 'libraries/sti'\n \n -- loading the background\n map = sti('maps/robot_run_ext.lua')\n\n -- Initialize offsets for each layer\n for layer, _ in pairs(layerSpeeds) do\n layerOffsets[layer] = 0\n end\nend\n\nfunction love.update(dt)\n -- Get the with of the map in pixels\n local mapWidth = map.width * map.tilewidth\n\n -- Update each layer separately\n for layer, speed in pairs(layerSpeeds) do\n layerOffsets[layer] = layerOffsets[layer] - speed * dt\n -- Wrap around when the layer moves off-screen\n if layerOffsets[layer] &lt;= -mapWidth then\n layerOffsets[layer] = 0\n end\n end\nend\n\nfunction love.draw()\n local mapWidth = map.width * map.tilewidth\n\n love.graphics.clear() -- Clear the screen \n\n for layer, offset in pairs(layerOffsets) do\n if map.layers[layer] then\n map.layers[layer]:draw(offset, 0)\n map.layers[layer]:draw(offset + mapWidth, 0)\n end\n end\nend\n</code></pre>\n<p>When I launch the game, <strong>nothing</strong> moves, and I have no idea why. Previously, I tried moving the entire background as a single entity (without separating layers), and everything worked smoothly.</p>\n<p><strong>Problem number two:</strong> The rendering of certain layers appears to be inconsistent and somewhat random. When I first launch the game, everything displays correctly (ground, sky, and clouds are all visible). However, if I close the game and restart it—without changing anything in the code—sometimes the clouds disappear, or parts of the ground aren't visible. Since those ground elements overlap with the sky, I suspect the sky is somehow being drawn on top of them.</p>\n<p>The issue seems to be random: I can run the game five times in a row with everything displaying fine, and then on the next run, some elements suddenly disappear. Again, I <strong>don't</strong> change anything in the code between these launches.</p>\n<p>I've checked that all my libraries are up to date, and everything appears to be in order. I expect the game to render layers consistently and allow them to move at different speeds as intended.</p>\n"^^ . "Why is my string.gsub not working ? (Lua)"^^ . . . . . . "1"^^ . . . . . "code-generation"^^ . "<p><code>sol::state::load</code> returns a result, this result contains a function (and it gladly implicitly converts to a function). calling this function only executes the script that was loaded.</p>\n<pre><code>std::string script = &quot;print('hello')&quot;;\n\nsol::function f = _interpreter.load(script);\nf(); // prints hello\n</code></pre>\n<p>if the script declares a function, then executing this script will simply declare the function, you still need to get it from the interpreter state then call it.</p>\n<pre><code>std::string script = R&quot;(\n function check_condition(price_update)\n print(price_update)\n print(&quot;best bid = &quot;, price_update.best_bid)\n return true\n end\n )&quot;;\n\nauto load_result = _interpreter.load(script);\nif (!load_result.valid()) { /* throw something? */ }\nsol::function f = load_result.get&lt;sol::function&gt;();\nf(); // executes the script which declares a function\n\n// get declared function\nsol::function check_condition = _interpreter[&quot;check_condition&quot;];\n\nPriceData pd(106.0, 107.0);\nbool call_return = check_condition(pd); // calls function\nassert(call_return);\n</code></pre>\n<pre><code>sol.PriceData*: 000001F00AC72F98\nbest bid = 106.0\n</code></pre>\n<p>your code for adding the usertype works.</p>\n<pre><code>_interpreter.new_usertype&lt;PriceData&gt;\n (\n &quot;PriceData&quot;,\n &quot;best_bid&quot;, &amp;PriceData::best_bid,\n &quot;best_ask&quot;, &amp;PriceData::best_ask\n );\n</code></pre>\n"^^ . "0"^^ . "It should be able to access `Engine.run`, but `Engine.__call` IS STILL NIL."^^ . "<p>I am using Envoy's JWT authentication HTTP filter, and it works fine when no Lua filters are placed before it. However, if I place a Lua filter before the JWT auth filter, I get the following error:</p>\n<pre><code>&quot;response&quot;: {\n &quot;upstream-service-time&quot;: null,\n &quot;flags&quot;: &quot;-&quot;,\n &quot;code&quot;: 401,\n &quot;details&quot;: &quot;jwt_authn_access_denied{Jwt_issuer_is_not_configured}&quot;,\n &quot;duration&quot;: 7\n}\n</code></pre>\n<pre><code>- name: envoy.filters.http.lua\n typed_config:\n &quot;@type&quot;: type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua\n inline_code: |\n function envoy_on_request(handle)\n -- Log Authorization Headers\n local auth_header = handle:headers():get(&quot;Authorization&quot;)\n if auth_header then\n handle:logInfo(&quot;Authorization Header: &quot; .. auth_header)\n else\n handle:logInfo(&quot;Authorization Header: MISSING&quot;)\n end\n end\n - name: envoy.filters.http.jwt_authn\n typed_config:\n &quot;@type&quot;: type.googleapis.com/envoy.extensions.filters.http.jwt_authn.v3.JwtAuthentication\n providers:\n aws-cognito-jwt:\n clear_route_cache: true\n</code></pre>\n"^^ . . "<p><code>engine.lua</code> and <code>car.lua</code> are two modules. <code>car</code> accesses <code>engine</code> and provides access of it's state to <code>engine</code> using dependency injection. <code>engine.lua</code> on <code>require</code> statements uses different metatable than when later called with <code>new()</code>.</p>\n<p>engine.lua</p>\n<pre><code>-- engine.lua:\n\nlocal Engine = {}\nEngine.__index = Engine\nEngine.__call = Engine.run\n\nEngine.new = function(car)\n -- for dependency injection\n Engine.car = car\n local self = setmetatable({}, Engine)\n return self\nend\n\nEngine.run = function(self, opts) \n print(self.car.name)\nend\n\nreturn setmetatable(Engine, { __call = Engine.new })\n</code></pre>\n<p>car.lua:</p>\n<pre><code>-- car.lua\n\nlocal Car = {name = &quot;ferrari&quot;}\nlocal Engine = require('engine') \n-- since in metatable __call = Engine.new\n\nCar.run = Engine(Car)\n\n-- now Engine is metatable for new object\n-- so __call = Engine.run\nlocal opts = {}\nCar.run(opts)\n</code></pre>\n<p>when I run <code>car.lua</code>, I get: <code>attempt to call field 'run' (a table value)</code>. On printing metatable of <code>Car.run</code> I see there is no <code>__call</code> method in metatable. Shouldn't it be there, since it is a key of <code>Engine</code>? why am I not able to call it?</p>\n"^^ . . "1"^^ . "1"^^ . "0"^^ . . . "0"^^ . . . . . "lua-table"^^ . "0"^^ . . . "1"^^ . . . "Issue with Screen Transition Animation Not Playing Before Screen Change in Crank Storyboard"^^ . "0"^^ . . "0"^^ . "How to detect is a model is on top of another object in Tabletop simulator"^^ . "1"^^ . . "How can I pass variables to a procedurally generated global function in Lua?"^^ . . . "How to have an invisible Latex section that is kept when converted to markdown? (Pandoc)"^^ . "0"^^ . "envoyproxy"^^ . . . "logitech-gaming-software"^^ . "Account for damping while modeling projectile motion"^^ . "As can be read in the Lua documentation, [Some characters, called magic characters, have special meanings when used in a pattern. The magic characters are ( ) . % + - * ? \\[ ^ $](https://www.lua.org/pil/20.2.html "Programming in Lua : 20.2")"^^ . "redisson"^^ . . . . . "0"^^ . "As you've already discovered most of the code examples on the internet for _.NET / .NET Framework_ are in C#, which means that if one wants to be able to use one of those code samples in _VB.NET_, then one needs to understand _C#_. Which means that if one doesn't already know C#, then one must learn C#."^^ . . "<pre><code>filter &quot;system:windows&quot;\n cppdialect &quot;C++17&quot;\n staticruntime &quot;On&quot;\n systemversion &quot;latest&quot;\n\n defines \n {}\n\n postbuildcommands {\n &quot;{COPYFILE} vendor/SDL3/lib/SDL3.dll bin/Debug-windows-x86_64&quot;\n }\n</code></pre>\n<p>I'm trying to learn premake and having troubles copying over a dll file with a post build command.</p>\n<p>Above is the post build command im using (you can see it at the bottom of the code snippet). However, when trying to run the application after running the premake file and generating the solution, it says 'The system cannot find the path specified.'. Seems like it either cant find the SDL3.dll or the exe itself.</p>\n<p>What could be happening here and what im doing wrong?</p>\n"^^ . . "@WalterMitty -- that has nothing to do with this question. As I addressed in my answer, OP code has a syntax mistake which led to the error they reported, and a misplaced table definition which would lead to incorrect behavior if the syntax mistake were corrected. These are programming issues, particular to Lua, and not related to Python or reading CSV files in general."^^ . "1"^^ . . . "comb"^^ . "0"^^ . "0"^^ . . "Are they in global and available in _G[tableName] ?"^^ . "lua-patterns"^^ . "Why "bac" is not valid? Please be more specific about what you intend with "first unique". Another question: why all combinations start with "a", e.g. why "eabcd" is not a valid combination while "bde" is in your example?"^^ . "Your question is asking how do you fix this script, but the error is where you are using the script. What code is calling `mob.spawn`? Did you mistakenly call it with `mob:spawn`?"^^ . "1"^^ . . "0"^^ . . . . "use Lua 5.2 not 5.4 with visual studio code so I am sure code will work on 5.2 systems"^^ . "<p>I'm using EgoMoose's Trajectory module with some modifications to predict the path of a ball in Roblox. However, I've encountered a challenge related to damping. The ball's rolling speed is reduced using the following method:</p>\n<pre class="lang-lua prettyprint-override"><code>local assemblyLinearVelocity = ball.AssemblyLinearVelocity\n\nball.AssemblyLinearVelocity = assemblyLinearVelocity - assemblyLinearVelocity.Unit * assemblyLinearVelocity.Magnitude ^ 0.755 * heartbeatDeltaTime\n</code></pre>\n<p>Since the trajectory module operates with a fixed <code>TimeStep</code> of 0.1, I need to properly account for the <code>heartbeatDeltaTime</code> when applying this damping. How can I effectively integrate this into the trajectory calculations?</p>\n<pre class="lang-lua prettyprint-override"><code>local TERRAIN = game.Workspace.Terrain\n\nlocal BEAM = Instance.new(&quot;Beam&quot;)\nBEAM.Color = ColorSequence.new(Color3.new(1, 0, 0))\nBEAM.Transparency = NumberSequence.new(0)\nBEAM.FaceCamera = true\nBEAM.Segments = 20\nBEAM.Width0 = 0.1\nBEAM.Width1 = 0.1\n\n-- Class\n\nlocal Trajectory = {}\nTrajectory.__index = Trajectory\n\n-- Private Functions\n\nlocal function reflect(v, n)\n return -2*v:Dot(n)*n + v\nend\n\nlocal function drawBeamProjectile(g, v0, x0, t)\n local c = 0.5*0.5*0.5\n local p3 = 0.5*g*t*t + v0*t + x0\n local p2 = p3 - (g*t*t + v0*t)/3\n local p1 = (c*g*t*t + 0.5*v0*t + x0 - c*(x0+p3))/(3*c) - p2\n\n local curve0 = (p1 - x0).Magnitude\n local curve1 = (p2 - p3).Magnitude\n\n local b = (x0 - p3).unit\n local r1 = (p1 - x0).unit\n local u1 = r1:Cross(b).unit\n local r2 = (p2 - p3).unit\n local u2 = r2:Cross(b).unit\n b = u1:Cross(r1).unit\n\n local cfA = CFrame.fromMatrix(x0, r1, u1, b)\n local cfB = CFrame.fromMatrix(p3, r2, u2, b)\n\n local A0 = Instance.new(&quot;Attachment&quot;)\n local A1 = Instance.new(&quot;Attachment&quot;)\n local Beam = BEAM:Clone()\n\n A0.CFrame = cfA\n A0.Parent = TERRAIN\n A1.CFrame = cfB\n A1.Parent = TERRAIN\n\n Beam.Attachment0 = A0\n Beam.Attachment1 = A1\n Beam.CurveSize0 = curve0\n Beam.CurveSize1 = -curve1\n Beam.Parent = TERRAIN\nend\n\n-- Public Constructors\n \nfunction Trajectory.new(gravity)\n local self = setmetatable({}, Trajectory)\n\n self.Gravity = gravity\n self.TimeStep = 0.1\n self.MaxTime = 5\n self.MinSpeed = 15\n self.MaxBounce = 5\n\n return self\nend\n\n-- Public Methods\n\nfunction Trajectory:Velocity(v0, t)\n -- g*t + v0\n return self.Gravity*t + v0\nend\n\nfunction Trajectory:Position(x0, v0, t)\n -- 0.5*g*t^2 + v0*t + x0\n return 0.5*self.Gravity*t*t + v0*t + x0\nend\n\nfunction Trajectory:PlaneQuadraticIntersection(x0, v0, p, n)\n local a = (0.5*self.Gravity):Dot(n)\n local b = v0:Dot(n)\n local c = (x0 - p):Dot(n)\n\n if (a ~= 0) then\n local d = math.sqrt(b*b - 4*a*c)\n return (-b - d)/(2*a)\n else\n return -c / b\n end\nend\n\nfunction Trajectory:CalculateSingle(x0, v0, ignoreList)\n local t = 0\n local hit, pos, normal, material\n\n repeat\n local p0 = self:Position(x0, v0, t)\n local p1 = self:Position(x0, v0, t + self.TimeStep)\n t = t + self.TimeStep\n\n local raycastParams = RaycastParams.new()\n raycastParams.FilterType = Enum.RaycastFilterType.Exclude\n raycastParams.FilterDescendantsInstances = ignoreList\n raycastParams.CollisionGroup = &quot;Football&quot;\n\n local direction = p1 - p0\n local result = workspace:Raycast(p0, direction, raycastParams)\n\n if result then\n hit = result.Instance\n pos = result.Position\n normal = result.Normal\n material = result.Material\n else\n hit, pos, normal, material = nil, nil, nil, nil\n end\n until (hit or t &gt;= self.MaxTime)\n\n if (hit) then\n local t = self:PlaneQuadraticIntersection(x0, v0, pos, normal)\n local x1 = self:Position(x0, v0, t)\n return t, normal, hit.CurrentPhysicalProperties\n end\nend\n\nfunction Trajectory:Cast(x0, v0, object, ignoreList)\n local bounce = 0\n local t, x1, normal, pB\n local speed2 = self.MinSpeed*self.MinSpeed\n local pA = object.CurrentPhysicalProperties\n local path = {}\n\n while (v0:Dot(v0) &gt;= speed2 and bounce &lt;= self.MaxBounce) do\n t, normal, pB = self:CalculateSingle(x0, v0, ignoreList)\n if (t) then\n table.insert(path, {x0, v0, t})\n\n local elast = (pA.Elasticity*pA.ElasticityWeight + pB.Elasticity*pB.ElasticityWeight)/(pA.ElasticityWeight+pB.ElasticityWeight)\n local frict = (pA.Friction*pA.FrictionWeight + pB.Friction*pB.FrictionWeight)/(pA.FrictionWeight+pB.FrictionWeight)\n local dot = 1 - math.abs(v0.Unit:Dot(normal))\n\n if frict ~= frict then\n frict = 1\n end\n\n x0 = self:Position(x0, v0, t)\n v0 = reflect(self:Velocity(v0, t), normal) * elast + v0 * frict * dot\n bounce = bounce + 1\n else\n bounce = self.MaxBounce + 1\n end\n end\n\n return path\nend\n\nfunction Trajectory:Draw(path)\n for i = 1, #path do\n local x0, v0, t = unpack(path[i])\n drawBeamProjectile(self.Gravity, v0, x0, t)\n end\nend\n\nreturn Trajectory\n</code></pre>\n"^^ . "nixos"^^ . . "conditional-operator"^^ . "0"^^ . . . . "What happens if you replace `Slider1Callback()` with `_G[onClickCallbackID]()`? Also, in Lua, semicolons are usually not used."^^ . . "Is it possible to identify a table from a string variable?"^^ . "0"^^ . . "You forgot to include the function in your question."^^ . "0"^^ . . . "0"^^ . . "<p>Every player has an invisible part located by their torso called HumanoidRootPart, that can be used as an inner hitbox or to track the player's position. To access it on a LocalScript, one can use <code>Game.Players.LocalPlayer.Character.HumanoidRootPart</code> then just get the position like on a normal part.</p>\n"^^ . . . . . . . "0"^^ . . "As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer)."^^ . . . . . "3"^^ . . "roblox"^^ . "crank"^^ . "0"^^ . "0"^^ . . . . . "brackets"^^ . "To be honest, I have no idea how to do that. But also just curious if Scribunto should work with Lua 5.3 or if it still requires 5.1."^^ . . "0"^^ . . "0"^^ . "Try setting `$wgScribuntoEngineConf['luastandalone']['luaPath']` to `(whatever)/lua5_1_5_linux_64_generic/lua`."^^ . . "vlc"^^ . . "audio"^^ . . . . "E5107: Error loading lua [string ":source (no file)"]:24: '}' expected near '='"^^ . . "functional-programming"^^ . . "Try to name the lib with `/OUT:lua54.lib`"^^ . . "0"^^ . "-1"^^ . . "4"^^ . "winapi"^^ . . . . . . . "1"^^ . . . . "<p>I have a polyline (white) with coordinates {x1, y1, x2, y2, x3, y3 ...}</p>\n<pre class="lang-lua prettyprint-override"><code>polyline = {100,300,160,257,220,242,280,250,340,271,400,300,460,329,520,350,580,358,640,343,700,300}\n</code></pre>\n<p>How can I get the curvature of it? The result must be same as the curvature of Bezier (red curve on the calculated heights):</p>\n<p><a href="https://i.sstatic.net/0kxf8zgC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0kxf8zgC.png" alt="curve and bezier curvature" /></a></p>\n<p>I can understand, that the ends of polyline must have the zero curvature.</p>\n<p>The result must be something like:</p>\n<p><a href="https://i.sstatic.net/xxxjvIiI.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/xxxjvIiI.png" alt="curve and bezier curvature and polyline curvature" /></a></p>\n"^^ . . . . "Attempt to index number with 'Spawner'"^^ . "<p>I program in LUA and I need some help:</p>\n<p>I have file1.lua and file2.lua</p>\n<p>In file1.lua:</p>\n<pre class="lang-lua prettyprint-override"><code>loadstring('print(&quot;Hello World!&quot;)')\n</code></pre>\n<p>in file2.lua:</p>\n<pre class="lang-lua prettyprint-override"><code>_loadstring = loadstring\n\nfunction loadstring(code)\n iprint(&quot;The code is:&quot;, code)\n return _loadstring(code)()\nend\n</code></pre>\n<p>Basically, file2.lua allows me to see the code that is being passed inside the loadstring. Would it be possible for me to COMPLETELY BLOCK modification of the loadstring function? So that it cannot be accessed/intercepted in other places?</p>\n<p>I want to ensure security when executing client-side code, but if I cannot block this interception it will be difficult because I intend to encrypt the code, decrypt it and put a loadstring for it to work.</p>\n<p>EDIT:</p>\n<p>I'm still looking for alternatives and I thought of something:</p>\n<p>It's like my code starts like this:</p>\n<pre class="lang-lua prettyprint-override"><code>_loadstring = loadstring\n\nfunction loadstring(code)\niprint(&quot;The code is:&quot;, code)\nreturn _loadstring(code)()\nend\n\nloadstring('print(&quot;Hello World!&quot;)')\n</code></pre>\n<p>Can't I guarantee that the second loadstring called is the LUA loadstring? Force it to use the exact lua loadstring instead of any other?</p>\n"^^ . "<p>It's a consequence of the way Lua handles <a href="https://www.lua.org/pil/3.3.html" rel="nofollow noreferrer">logical operators</a>. In Lua, <code>a and b</code> is evaluated according to the following logic:</p>\n<ul>\n<li>If <code>a</code> is <code>false</code> or <code>nil</code> (&quot;falsy&quot;), then <code>a</code></li>\n<li>If <code>a</code> is &quot;truthy&quot; (neither of the above), then <code>b</code></li>\n</ul>\n<p><code>a or b</code> is handled similarly - <code>b</code> if <code>a</code> is falsy, <code>a</code> if <code>a</code> is truthy.</p>\n<p>Since <code>and</code> has <a href="https://www.lua.org/pil/3.5.html" rel="nofollow noreferrer">precedence</a> over <code>or</code>, the &quot;ternary&quot; expression is equivalent to <code>(condition and true_value) or false_value</code>. From there, it's probably best to explain its behavior in terms of cases. If <code>condition</code> is <code>true</code>, the and-expression evaluates to <code>true_value</code>, and the or-expression does the same because <code>true_value</code> is truthy. If <code>condition</code> is <code>false</code>, the and-expression evaluates to <code>false</code>, and the or-expression evaluates to <code>false_value</code>. Here's a table for reference:</p>\n<div class="s-table-container"><table class="s-table">\n<thead>\n<tr>\n<th>condition</th>\n<th>condition and true_value</th>\n<th>(condition and true_value) or false_value</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>true</td>\n<td>true_value</td>\n<td>true_value</td>\n</tr>\n<tr>\n<td>false</td>\n<td>false</td>\n<td>false_value</td>\n</tr>\n</tbody>\n</table></div>\n<p>An edge case to watch out for is a falsy (<code>false</code> or <code>nil</code>) <code>true_value</code>. In that case, even if <code>condition</code> is true, <code>condition and true_value</code> evaluates to something falsy, so the or-expression evaluates to <code>false_value</code> instead of <code>true_value</code>. Whether this is a problem depends on your use case. If it's impossible, you're fine. If <code>true_value</code> can be falsy but not <code>false_value</code>, just switch the two and invert the condition. If either can be falsy, you might just want to use an if statement instead.</p>\n"^^ . . . . "<p>The lua-language-server not started while opening a .lua file from startup using <code>nvim a.lua</code>. <code>:LspInfo</code> showing <code>0 client(s) attached to this buffer</code>.</p>\n<p>But it works when switching to another .lua file: <code>:e b.lua</code>.</p>\n<p>Only lua_ls with this problem. Other lsp servers (gopls, jsonls, bashls, pylsp) works well.</p>\n<p>I use <code>lazy.nvim</code> and <code>mason</code>. Here's my lsp config. I can't figure it out. Anyone have any idea?</p>\n<p><strong>lua/plugins/lsp.lua:</strong></p>\n<pre class="lang-lua prettyprint-override"><code>return {\n {\n 'neovim/nvim-lspconfig',\n dependencies = {\n &quot;williamboman/mason.nvim&quot;,\n &quot;williamboman/mason-lspconfig.nvim&quot;,\n 'hrsh7th/cmp-nvim-lsp',\n },\n priority = 900,\n config = function()\n require(&quot;mason&quot;).setup()\n require(&quot;mason-lspconfig&quot;).setup({\n ensure_installed = {\n &quot;gopls&quot;,\n &quot;lua_ls&quot;,\n &quot;html&quot;,\n &quot;jsonls&quot;,\n &quot;yamlls&quot;,\n &quot;pylsp&quot;,\n &quot;bashls&quot;,\n &quot;clangd&quot;,\n &quot;ts_ls&quot;,\n &quot;volar&quot;,\n }\n })\n\n -- Set up lspconfig.\n -- Enable each lsp servers.\n local capabilities = require('cmp_nvim_lsp').default_capabilities()\n -- go\n require('lspconfig')['gopls'].setup({\n capabilities = capabilities\n })\n -- lua\n require('lspconfig')['lua_ls'].setup({\n capabilities = capabilities\n })\n -- html\n require('lspconfig')['html'].setup({\n capabilities = capabilities\n })\n -- json\n require('lspconfig')['jsonls'].setup({\n capabilities = capabilities\n })\n -- yaml\n require('lspconfig')['yamlls'].setup({\n capabilities = capabilities\n })\n -- python\n require('lspconfig')['pylsp'].setup({\n capabilities = capabilities,\n settings = {\n pylsp = {\n plugins = {\n pycodestyle = {\n ignore = { 'E501' },\n }\n }\n }\n }\n })\n -- bash\n require('lspconfig')['bashls'].setup({\n capabilities = capabilities\n })\n -- clang\n require('lspconfig')['clangd'].setup({\n capabilities = capabilities,\n filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' },\n })\n -- typescript\n require('lspconfig')['ts_ls'].setup({\n capabilities = capabilities,\n init_options = {\n plugins = {\n {\n name = &quot;@vue/typescript-plugin&quot;,\n location = &quot;/opt/homebrew/lib/node_modules/@vue/typescript-plugin&quot;,\n languages = { &quot;javascript&quot;, &quot;typescript&quot;, &quot;vue&quot; },\n },\n },\n },\n filetypes = {\n &quot;javascript&quot;,\n &quot;typescript&quot;,\n &quot;vue&quot;,\n },\n })\n -- volar (for vue)\n require('lspconfig')['volar'].setup({\n capabilities = capabilities\n })\n\n -- Keymap for lsp\n local vim = vim\n local keyset = vim.keymap.set\n keyset(&quot;n&quot;, &quot;&lt;leader&gt;rn&quot;, &quot;&lt;cmd&gt;lua vim.lsp.buf.rename()&lt;CR&gt;&quot;, { silent = true })\n keyset(&quot;n&quot;, &quot;&lt;leader&gt;f&quot;, &quot;&lt;cmd&gt;lua vim.lsp.buf.format()&lt;CR&gt;&quot;, { silent = true })\n\n -- Auto format for golang.\n vim.api.nvim_create_autocmd('BufWritePre', {\n pattern = '*.go',\n callback = function()\n vim.api.nvim_command('lua vim.lsp.buf.format()')\n end,\n desc = 'format on save for Go files',\n })\n end\n }\n}\n</code></pre>\n<p><code>:LspInfo</code> output:</p>\n<pre><code>lspconfig: require(&quot;lspconfig.health&quot;).check()\n\nLSP configs active in this session (globally) ~\n- Configured servers: clangd, bashls, volar, yamlls, jsonls, lua_ls, gopls, pylsp, html, ts_ls\n- OK Deprecated servers: (none)\n\nLSP configs active in this buffer (bufnr: 1) ~\n- Language client log: ~/.local/state/nvim/lsp.log\n- Detected filetype: `lua`\n- 0 client(s) attached to this buffer\n- Other clients that match the &quot;lua&quot; filetype:\n- Config: lua_ls\n filetypes: lua\n cmd: ~/.local/share/nvim/mason/bin/lua-language-server\n version: `3.13.6`\n executable: true\n autostart: true\n root directory: ~/.config/nvim/\n</code></pre>\n"^^ . . . "0"^^ . "The output is as expected: you're calling Slider1Callback every time, with a fixed 1."^^ . . "2"^^ . . . . . . . . . . . "0"^^ . . . . . "color-scheme"^^ . "lua-5.1"^^ . "2"^^ . . . "neovim"^^ . "1"^^ . "Powershell escape in LUA script"^^ . . . . "0"^^ . . "nix"^^ . "<p><strong>I found the solution. I created a remote event that sent a request switch GUI to the client</strong></p>\n"^^ . . "Loop exceeds its limit"^^ . "@AlexanderMashin I feel stupid. Also, the semicolons are basically just a habit thing. I've mostly written code in C-like languages, and that muscle memory goes pretty deep."^^ . . . . . . "0"^^ . "storyboard"^^ . . . "@KyleF.Hartzenberg OK and posted."^^ . . . . . "Are you sure it is only running once? If you put `print("Touched")` inside the function, does it only print once? I think your issue might not be in this code specifically. To better help you out, could you tell us what you are trying to do, and what you are seeing happen?"^^ . "0"^^ . . . . . . . . . "0"^^ . . . "<p>The solution was to close the pipe handles after creating the process.</p>\n<p>So</p>\n<pre class="lang-c prettyprint-override"><code> if (!CreateProcess( \n NULL,\n filename, //TODO: check unicode?\n NULL,\n NULL,\n TRUE,\n 0,\n NULL,\n NULL,\n &amp;si,\n pi)\n ) {\n printf(&quot;Could not create process\\n&quot;);\n return NULL;\n }\nCloseHandle(g_hChildStd_OUT_Wr); \nCloseHandle(g_hChildStd_IN_Rd);\n</code></pre>\n<p>I guess because then only the child holds a handle to the resources, not the parent.</p>\n"^^ .